@clawos-dev/clawd 0.2.675 → 0.2.677
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-builder-plugin/mcp-server.cjs +116 -3
- package/dist/cli.cjs +257 -14
- package/dist/cloud-persona-conversations.html +74 -74
- package/dist/cloud-persona-metrics.html +1 -1
- package/dist/dispatch/mcp-server.cjs +116 -3
- package/dist/persona-defaults/persona-app-builder/mcp/clawd-app-builder/mcp-server.cjs +116 -3
- package/dist/persona-defaults/persona-dataclaw-builder/mcp/clawd-app-builder/mcp-server.cjs +116 -3
- package/dist/share-md-viewer-error.html +1 -1
- package/dist/share-md-viewer.html +1 -1
- package/dist/share-ui/assets/guest-CtZL9p9v.css +32 -0
- package/dist/share-ui/assets/guest-DuT_1Mqo.js +628 -0
- package/dist/share-ui/guest.html +2 -2
- package/package.json +1 -1
- package/dist/share-ui/assets/guest-CZG8PmZ5.css +0 -32
- package/dist/share-ui/assets/guest-D40ma1Yh.js +0 -602
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
var Cj=Object.defineProperty;var jb=e=>{throw TypeError(e)};var Ej=(e,t,n)=>t in e?Cj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Lb=(e,t,n)=>Ej(e,typeof t!="symbol"?t+"":t,n),Db=(e,t,n)=>t.has(e)||jb("Cannot "+n);var Jl=(e,t,n)=>(Db(e,t,"read from private field"),n?n.call(e):t.get(e)),Ob=(e,t,n)=>t.has(e)?jb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Bb=(e,t,n,r)=>(Db(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function Ij(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var Yh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Du(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var OE={exports:{}},pp={},BE={exports:{}},Ye={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Ou=Symbol.for("react.element"),Nj=Symbol.for("react.portal"),Tj=Symbol.for("react.fragment"),Pj=Symbol.for("react.strict_mode"),Rj=Symbol.for("react.profiler"),Aj=Symbol.for("react.provider"),Mj=Symbol.for("react.context"),jj=Symbol.for("react.forward_ref"),Lj=Symbol.for("react.suspense"),Dj=Symbol.for("react.memo"),Oj=Symbol.for("react.lazy"),$b=Symbol.iterator;function Bj(e){return e===null||typeof e!="object"?null:(e=$b&&e[$b]||e["@@iterator"],typeof e=="function"?e:null)}var $E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},zE=Object.assign,FE={};function Tl(e,t,n){this.props=e,this.context=t,this.refs=FE,this.updater=n||$E}Tl.prototype.isReactComponent={};Tl.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Tl.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function HE(){}HE.prototype=Tl.prototype;function N1(e,t,n){this.props=e,this.context=t,this.refs=FE,this.updater=n||$E}var T1=N1.prototype=new HE;T1.constructor=N1;zE(T1,Tl.prototype);T1.isPureReactComponent=!0;var zb=Array.isArray,UE=Object.prototype.hasOwnProperty,P1={current:null},WE={key:!0,ref:!0,__self:!0,__source:!0};function qE(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)UE.call(t,r)&&!WE.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];i.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)i[r]===void 0&&(i[r]=a[r]);return{$$typeof:Ou,type:e,key:s,ref:o,props:i,_owner:P1.current}}function $j(e,t){return{$$typeof:Ou,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function R1(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ou}function zj(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Fb=/\/+/g;function Om(e,t){return typeof e=="object"&&e!==null&&e.key!=null?zj(""+e.key):t.toString(36)}function vh(e,t,n,r,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Ou:case Nj:o=!0}}if(o)return o=e,i=i(o),e=r===""?"."+Om(o,0):r,zb(i)?(n="",e!=null&&(n=e.replace(Fb,"$&/")+"/"),vh(i,t,n,"",function(c){return c})):i!=null&&(R1(i)&&(i=$j(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(Fb,"$&/")+"/")+e)),t.push(i)),1;if(o=0,r=r===""?".":r+":",zb(e))for(var a=0;a<e.length;a++){s=e[a];var l=r+Om(s,a);o+=vh(s,t,n,l,i)}else if(l=Bj(e),typeof l=="function")for(e=l.call(e),a=0;!(s=e.next()).done;)s=s.value,l=r+Om(s,a++),o+=vh(s,t,n,l,i);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function gd(e,t,n){if(e==null)return e;var r=[],i=0;return vh(e,r,"","",function(s){return t.call(n,s,i++)}),r}function Fj(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var $n={current:null},xh={transition:null},Hj={ReactCurrentDispatcher:$n,ReactCurrentBatchConfig:xh,ReactCurrentOwner:P1};function VE(){throw Error("act(...) is not supported in production builds of React.")}Ye.Children={map:gd,forEach:function(e,t,n){gd(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return gd(e,function(){t++}),t},toArray:function(e){return gd(e,function(t){return t})||[]},only:function(e){if(!R1(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ye.Component=Tl;Ye.Fragment=Tj;Ye.Profiler=Rj;Ye.PureComponent=N1;Ye.StrictMode=Pj;Ye.Suspense=Lj;Ye.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Hj;Ye.act=VE;Ye.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=zE({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=P1.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)UE.call(t,l)&&!WE.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:Ou,type:e.type,key:i,ref:s,props:r,_owner:o}};Ye.createContext=function(e){return e={$$typeof:Mj,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Aj,_context:e},e.Consumer=e};Ye.createElement=qE;Ye.createFactory=function(e){var t=qE.bind(null,e);return t.type=e,t};Ye.createRef=function(){return{current:null}};Ye.forwardRef=function(e){return{$$typeof:jj,render:e}};Ye.isValidElement=R1;Ye.lazy=function(e){return{$$typeof:Oj,_payload:{_status:-1,_result:e},_init:Fj}};Ye.memo=function(e,t){return{$$typeof:Dj,type:e,compare:t===void 0?null:t}};Ye.startTransition=function(e){var t=xh.transition;xh.transition={};try{e()}finally{xh.transition=t}};Ye.unstable_act=VE;Ye.useCallback=function(e,t){return $n.current.useCallback(e,t)};Ye.useContext=function(e){return $n.current.useContext(e)};Ye.useDebugValue=function(){};Ye.useDeferredValue=function(e){return $n.current.useDeferredValue(e)};Ye.useEffect=function(e,t){return $n.current.useEffect(e,t)};Ye.useId=function(){return $n.current.useId()};Ye.useImperativeHandle=function(e,t,n){return $n.current.useImperativeHandle(e,t,n)};Ye.useInsertionEffect=function(e,t){return $n.current.useInsertionEffect(e,t)};Ye.useLayoutEffect=function(e,t){return $n.current.useLayoutEffect(e,t)};Ye.useMemo=function(e,t){return $n.current.useMemo(e,t)};Ye.useReducer=function(e,t,n){return $n.current.useReducer(e,t,n)};Ye.useRef=function(e){return $n.current.useRef(e)};Ye.useState=function(e){return $n.current.useState(e)};Ye.useSyncExternalStore=function(e,t,n){return $n.current.useSyncExternalStore(e,t,n)};Ye.useTransition=function(){return $n.current.useTransition()};Ye.version="18.3.1";BE.exports=Ye;var g=BE.exports;const Qe=Du(g),Pl=Ij({__proto__:null,default:Qe},[g]);/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Uj=g,Wj=Symbol.for("react.element"),qj=Symbol.for("react.fragment"),Vj=Object.prototype.hasOwnProperty,Kj=Uj.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Gj={key:!0,ref:!0,__self:!0,__source:!0};function KE(e,t,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)Vj.call(t,r)&&!Gj.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:Wj,type:e,key:s,ref:o,props:i,_owner:Kj.current}}pp.Fragment=qj;pp.jsx=KE;pp.jsxs=KE;OE.exports=pp;var h=OE.exports,k0={},GE={exports:{}},fr={},YE={exports:{}},XE={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/(function(e){function t($,B){var I=$.length;$.push(B);e:for(;0<I;){var U=I-1>>>1,V=$[U];if(0<i(V,B))$[U]=B,$[I]=V,I=U;else break e}}function n($){return $.length===0?null:$[0]}function r($){if($.length===0)return null;var B=$[0],I=$.pop();if(I!==B){$[0]=I;e:for(var U=0,V=$.length,O=V>>>1;U<O;){var ne=2*(U+1)-1,ae=$[ne],Y=ne+1,ye=$[Y];if(0>i(ae,I))Y<V&&0>i(ye,ae)?($[U]=ye,$[Y]=I,U=Y):($[U]=ae,$[ne]=I,U=ne);else if(Y<V&&0>i(ye,I))$[U]=ye,$[Y]=I,U=Y;else break e}}return B}function i($,B){var I=$.sortIndex-B.sortIndex;return I!==0?I:$.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,d=null,f=3,p=!1,m=!1,x=!1,w=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b($){for(var B=n(c);B!==null;){if(B.callback===null)r(c);else if(B.startTime<=$)r(c),B.sortIndex=B.expirationTime,t(l,B);else break;B=n(c)}}function S($){if(x=!1,b($),!m)if(n(l)!==null)m=!0,z(C);else{var B=n(c);B!==null&&F(S,B.startTime-$)}}function C($,B){m=!1,x&&(x=!1,v(E),E=-1),p=!0;var I=f;try{for(b(B),d=n(l);d!==null&&(!(d.expirationTime>B)||$&&!D());){var U=d.callback;if(typeof U=="function"){d.callback=null,f=d.priorityLevel;var V=U(d.expirationTime<=B);B=e.unstable_now(),typeof V=="function"?d.callback=V:d===n(l)&&r(l),b(B)}else r(l);d=n(l)}if(d!==null)var O=!0;else{var ne=n(c);ne!==null&&F(S,ne.startTime-B),O=!1}return O}finally{d=null,f=I,p=!1}}var k=!1,N=null,E=-1,L=5,P=-1;function D(){return!(e.unstable_now()-P<L)}function R(){if(N!==null){var $=e.unstable_now();P=$;var B=!0;try{B=N(!0,$)}finally{B?A():(k=!1,N=null)}}else k=!1}var A;if(typeof _=="function")A=function(){_(R)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,j=M.port2;M.port1.onmessage=R,A=function(){j.postMessage(null)}}else A=function(){w(R,0)};function z($){N=$,k||(k=!0,A())}function F($,B){E=w(function(){$(e.unstable_now())},B)}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($){$.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,z(C))},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function($){switch(f){case 1:case 2:case 3:var B=3;break;default:B=f}var I=f;f=B;try{return $()}finally{f=I}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,B){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var I=f;f=$;try{return B()}finally{f=I}},e.unstable_scheduleCallback=function($,B,I){var U=e.unstable_now();switch(typeof I=="object"&&I!==null?(I=I.delay,I=typeof I=="number"&&0<I?U+I:U):I=U,$){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=I+V,$={id:u++,callback:B,priorityLevel:$,startTime:I,expirationTime:V,sortIndex:-1},I>U?($.sortIndex=I,t(c,$),n(l)===null&&$===n(c)&&(x?(v(E),E=-1):x=!0,F(S,I-U))):($.sortIndex=V,t(l,$),m||p||(m=!0,z(C))),$},e.unstable_shouldYield=D,e.unstable_wrapCallback=function($){var B=f;return function(){var I=f;f=B;try{return $.apply(this,arguments)}finally{f=I}}}})(XE);YE.exports=XE;var Yj=YE.exports;/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var Xj=g,hr=Yj;function Q(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;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."}var ZE=new Set,Zc={};function Yo(e,t){tl(e,t),tl(e+"Capture",t)}function tl(e,t){for(Zc[e]=t,e=0;e<t.length;e++)ZE.add(t[e])}var Yi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),C0=Object.prototype.hasOwnProperty,Zj=/^[: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]*$/,Hb={},Ub={};function Qj(e){return C0.call(Ub,e)?!0:C0.call(Hb,e)?!1:Zj.test(e)?Ub[e]=!0:(Hb[e]=!0,!1)}function Jj(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function eL(e,t,n,r){if(t===null||typeof t>"u"||Jj(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function zn(e,t,n,r,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var _n={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){_n[e]=new zn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];_n[t]=new zn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){_n[e]=new zn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){_n[e]=new zn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){_n[e]=new zn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){_n[e]=new zn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){_n[e]=new zn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){_n[e]=new zn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){_n[e]=new zn(e,5,!1,e.toLowerCase(),null,!1,!1)});var A1=/[\-:]([a-z])/g;function M1(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(A1,M1);_n[t]=new zn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(A1,M1);_n[t]=new zn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(A1,M1);_n[t]=new zn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){_n[e]=new zn(e,1,!1,e.toLowerCase(),null,!1,!1)});_n.xlinkHref=new zn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){_n[e]=new zn(e,1,!1,e.toLowerCase(),null,!0,!0)});function j1(e,t,n,r){var i=_n.hasOwnProperty(t)?_n[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(eL(t,n,i,r)&&(n=null),r||i===null?Qj(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var ss=Xj.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,vd=Symbol.for("react.element"),ka=Symbol.for("react.portal"),Ca=Symbol.for("react.fragment"),L1=Symbol.for("react.strict_mode"),E0=Symbol.for("react.profiler"),QE=Symbol.for("react.provider"),JE=Symbol.for("react.context"),D1=Symbol.for("react.forward_ref"),I0=Symbol.for("react.suspense"),N0=Symbol.for("react.suspense_list"),O1=Symbol.for("react.memo"),Ss=Symbol.for("react.lazy"),eI=Symbol.for("react.offscreen"),Wb=Symbol.iterator;function ec(e){return e===null||typeof e!="object"?null:(e=Wb&&e[Wb]||e["@@iterator"],typeof e=="function"?e:null)}var Nt=Object.assign,Bm;function _c(e){if(Bm===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Bm=t&&t[1]||""}return`
|
|
34
|
+
`+Bm+e}var $m=!1;function zm(e,t){if(!e||$m)return"";$m=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var i=c.stack.split(`
|
|
35
|
+
`),s=r.stack.split(`
|
|
36
|
+
`),o=i.length-1,a=s.length-1;1<=o&&0<=a&&i[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(i[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||i[o]!==s[a]){var l=`
|
|
37
|
+
`+i[o].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{$m=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?_c(e):""}function tL(e){switch(e.tag){case 5:return _c(e.type);case 16:return _c("Lazy");case 13:return _c("Suspense");case 19:return _c("SuspenseList");case 0:case 2:case 15:return e=zm(e.type,!1),e;case 11:return e=zm(e.type.render,!1),e;case 1:return e=zm(e.type,!0),e;default:return""}}function T0(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ca:return"Fragment";case ka:return"Portal";case E0:return"Profiler";case L1:return"StrictMode";case I0:return"Suspense";case N0:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case JE:return(e.displayName||"Context")+".Consumer";case QE:return(e._context.displayName||"Context")+".Provider";case D1:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case O1:return t=e.displayName||null,t!==null?t:T0(e.type)||"Memo";case Ss:t=e._payload,e=e._init;try{return T0(e(t))}catch{}}return null}function nL(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return T0(t);case 8:return t===L1?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function qs(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function tI(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function rL(e){var t=tI(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function xd(e){e._valueTracker||(e._valueTracker=rL(e))}function nI(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=tI(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Xh(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function P0(e,t){var n=t.checked;return Nt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function qb(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=qs(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function rI(e,t){t=t.checked,t!=null&&j1(e,"checked",t,!1)}function R0(e,t){rI(e,t);var n=qs(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?A0(e,t.type,n):t.hasOwnProperty("defaultValue")&&A0(e,t.type,qs(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Vb(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function A0(e,t,n){(t!=="number"||Xh(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var bc=Array.isArray;function Fa(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=""+qs(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 M0(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Q(91));return Nt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Kb(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Q(92));if(bc(n)){if(1<n.length)throw Error(Q(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:qs(n)}}function iI(e,t){var n=qs(t.value),r=qs(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Gb(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function sI(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function j0(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?sI(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var yd,oI=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(yd=yd||document.createElement("div"),yd.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=yd.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Qc(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Mc={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},iL=["Webkit","ms","Moz","O"];Object.keys(Mc).forEach(function(e){iL.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Mc[t]=Mc[e]})});function aI(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Mc.hasOwnProperty(e)&&Mc[e]?(""+t).trim():t+"px"}function lI(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=aI(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var sL=Nt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function L0(e,t){if(t){if(sL[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Q(62))}}function D0(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var O0=null;function B1(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var B0=null,Ha=null,Ua=null;function Yb(e){if(e=zu(e)){if(typeof B0!="function")throw Error(Q(280));var t=e.stateNode;t&&(t=yp(t),B0(e.stateNode,e.type,t))}}function cI(e){Ha?Ua?Ua.push(e):Ua=[e]:Ha=e}function uI(){if(Ha){var e=Ha,t=Ua;if(Ua=Ha=null,Yb(e),t)for(e=0;e<t.length;e++)Yb(t[e])}}function dI(e,t){return e(t)}function hI(){}var Fm=!1;function fI(e,t,n){if(Fm)return e(t,n);Fm=!0;try{return dI(e,t,n)}finally{Fm=!1,(Ha!==null||Ua!==null)&&(hI(),uI())}}function Jc(e,t){var n=e.stateNode;if(n===null)return null;var r=yp(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(Q(231,t,typeof n));return n}var $0=!1;if(Yi)try{var tc={};Object.defineProperty(tc,"passive",{get:function(){$0=!0}}),window.addEventListener("test",tc,tc),window.removeEventListener("test",tc,tc)}catch{$0=!1}function oL(e,t,n,r,i,s,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(u){this.onError(u)}}var jc=!1,Zh=null,Qh=!1,z0=null,aL={onError:function(e){jc=!0,Zh=e}};function lL(e,t,n,r,i,s,o,a,l){jc=!1,Zh=null,oL.apply(aL,arguments)}function cL(e,t,n,r,i,s,o,a,l){if(lL.apply(this,arguments),jc){if(jc){var c=Zh;jc=!1,Zh=null}else throw Error(Q(198));Qh||(Qh=!0,z0=c)}}function Xo(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 pI(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 Xb(e){if(Xo(e)!==e)throw Error(Q(188))}function uL(e){var t=e.alternate;if(!t){if(t=Xo(e),t===null)throw Error(Q(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return Xb(i),e;if(s===r)return Xb(i),t;s=s.sibling}throw Error(Q(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o)throw Error(Q(189))}}if(n.alternate!==r)throw Error(Q(190))}if(n.tag!==3)throw Error(Q(188));return n.stateNode.current===n?e:t}function mI(e){return e=uL(e),e!==null?gI(e):null}function gI(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=gI(e);if(t!==null)return t;e=e.sibling}return null}var vI=hr.unstable_scheduleCallback,Zb=hr.unstable_cancelCallback,dL=hr.unstable_shouldYield,hL=hr.unstable_requestPaint,Dt=hr.unstable_now,fL=hr.unstable_getCurrentPriorityLevel,$1=hr.unstable_ImmediatePriority,xI=hr.unstable_UserBlockingPriority,Jh=hr.unstable_NormalPriority,pL=hr.unstable_LowPriority,yI=hr.unstable_IdlePriority,mp=null,yi=null;function mL(e){if(yi&&typeof yi.onCommitFiberRoot=="function")try{yi.onCommitFiberRoot(mp,e,void 0,(e.current.flags&128)===128)}catch{}}var Vr=Math.clz32?Math.clz32:xL,gL=Math.log,vL=Math.LN2;function xL(e){return e>>>=0,e===0?32:31-(gL(e)/vL|0)|0}var _d=64,bd=4194304;function wc(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ef(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=wc(a):(s&=o,s!==0&&(r=wc(s)))}else o=n&~i,o!==0?r=wc(o):s!==0&&(r=wc(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Vr(t),i=1<<n,r|=e[n],t&=~i;return r}function yL(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function _L(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-Vr(s),a=1<<o,l=i[o];l===-1?(!(a&n)||a&r)&&(i[o]=yL(a,t)):l<=t&&(e.expiredLanes|=a),s&=~a}}function F0(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function _I(){var e=_d;return _d<<=1,!(_d&4194240)&&(_d=64),e}function Hm(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Bu(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Vr(t),e[t]=n}function bL(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-Vr(n),s=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~s}}function z1(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Vr(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var ot=0;function bI(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var wI,F1,SI,kI,CI,H0=!1,wd=[],Ls=null,Ds=null,Os=null,eu=new Map,tu=new Map,Is=[],wL="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Qb(e,t){switch(e){case"focusin":case"focusout":Ls=null;break;case"dragenter":case"dragleave":Ds=null;break;case"mouseover":case"mouseout":Os=null;break;case"pointerover":case"pointerout":eu.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":tu.delete(t.pointerId)}}function nc(e,t,n,r,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},t!==null&&(t=zu(t),t!==null&&F1(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function SL(e,t,n,r,i){switch(t){case"focusin":return Ls=nc(Ls,e,t,n,r,i),!0;case"dragenter":return Ds=nc(Ds,e,t,n,r,i),!0;case"mouseover":return Os=nc(Os,e,t,n,r,i),!0;case"pointerover":var s=i.pointerId;return eu.set(s,nc(eu.get(s)||null,e,t,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,tu.set(s,nc(tu.get(s)||null,e,t,n,r,i)),!0}return!1}function EI(e){var t=So(e.target);if(t!==null){var n=Xo(t);if(n!==null){if(t=n.tag,t===13){if(t=pI(n),t!==null){e.blockedOn=t,CI(e.priority,function(){SI(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 yh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=U0(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);O0=r,n.target.dispatchEvent(r),O0=null}else return t=zu(n),t!==null&&F1(t),e.blockedOn=n,!1;t.shift()}return!0}function Jb(e,t,n){yh(e)&&n.delete(t)}function kL(){H0=!1,Ls!==null&&yh(Ls)&&(Ls=null),Ds!==null&&yh(Ds)&&(Ds=null),Os!==null&&yh(Os)&&(Os=null),eu.forEach(Jb),tu.forEach(Jb)}function rc(e,t){e.blockedOn===t&&(e.blockedOn=null,H0||(H0=!0,hr.unstable_scheduleCallback(hr.unstable_NormalPriority,kL)))}function nu(e){function t(i){return rc(i,e)}if(0<wd.length){rc(wd[0],e);for(var n=1;n<wd.length;n++){var r=wd[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Ls!==null&&rc(Ls,e),Ds!==null&&rc(Ds,e),Os!==null&&rc(Os,e),eu.forEach(t),tu.forEach(t),n=0;n<Is.length;n++)r=Is[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Is.length&&(n=Is[0],n.blockedOn===null);)EI(n),n.blockedOn===null&&Is.shift()}var Wa=ss.ReactCurrentBatchConfig,tf=!0;function CL(e,t,n,r){var i=ot,s=Wa.transition;Wa.transition=null;try{ot=1,H1(e,t,n,r)}finally{ot=i,Wa.transition=s}}function EL(e,t,n,r){var i=ot,s=Wa.transition;Wa.transition=null;try{ot=4,H1(e,t,n,r)}finally{ot=i,Wa.transition=s}}function H1(e,t,n,r){if(tf){var i=U0(e,t,n,r);if(i===null)Qm(e,t,r,nf,n),Qb(e,r);else if(SL(i,e,t,n,r))r.stopPropagation();else if(Qb(e,r),t&4&&-1<wL.indexOf(e)){for(;i!==null;){var s=zu(i);if(s!==null&&wI(s),s=U0(e,t,n,r),s===null&&Qm(e,t,r,nf,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else Qm(e,t,r,null,n)}}var nf=null;function U0(e,t,n,r){if(nf=null,e=B1(r),e=So(e),e!==null)if(t=Xo(e),t===null)e=null;else if(n=t.tag,n===13){if(e=pI(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 nf=e,null}function II(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(fL()){case $1:return 1;case xI:return 4;case Jh:case pL:return 16;case yI:return 536870912;default:return 16}default:return 16}}var Ps=null,U1=null,_h=null;function NI(){if(_h)return _h;var e,t=U1,n=t.length,r,i="value"in Ps?Ps.value:Ps.textContent,s=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[s-r];r++);return _h=i.slice(e,1<r?1-r:void 0)}function bh(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 Sd(){return!0}function ew(){return!1}function pr(e){function t(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Sd:ew,this.isPropagationStopped=ew,this}return Nt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Sd)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Sd)},persist:function(){},isPersistent:Sd}),t}var Rl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},W1=pr(Rl),$u=Nt({},Rl,{view:0,detail:0}),IL=pr($u),Um,Wm,ic,gp=Nt({},$u,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:q1,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!==ic&&(ic&&e.type==="mousemove"?(Um=e.screenX-ic.screenX,Wm=e.screenY-ic.screenY):Wm=Um=0,ic=e),Um)},movementY:function(e){return"movementY"in e?e.movementY:Wm}}),tw=pr(gp),NL=Nt({},gp,{dataTransfer:0}),TL=pr(NL),PL=Nt({},$u,{relatedTarget:0}),qm=pr(PL),RL=Nt({},Rl,{animationName:0,elapsedTime:0,pseudoElement:0}),AL=pr(RL),ML=Nt({},Rl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),jL=pr(ML),LL=Nt({},Rl,{data:0}),nw=pr(LL),DL={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},OL={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"},BL={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $L(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=BL[e])?!!t[e]:!1}function q1(){return $L}var zL=Nt({},$u,{key:function(e){if(e.key){var t=DL[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=bh(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?OL[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:q1,charCode:function(e){return e.type==="keypress"?bh(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?bh(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),FL=pr(zL),HL=Nt({},gp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),rw=pr(HL),UL=Nt({},$u,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:q1}),WL=pr(UL),qL=Nt({},Rl,{propertyName:0,elapsedTime:0,pseudoElement:0}),VL=pr(qL),KL=Nt({},gp,{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}),GL=pr(KL),YL=[9,13,27,32],V1=Yi&&"CompositionEvent"in window,Lc=null;Yi&&"documentMode"in document&&(Lc=document.documentMode);var XL=Yi&&"TextEvent"in window&&!Lc,TI=Yi&&(!V1||Lc&&8<Lc&&11>=Lc),iw=" ",sw=!1;function PI(e,t){switch(e){case"keyup":return YL.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function RI(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ea=!1;function ZL(e,t){switch(e){case"compositionend":return RI(t);case"keypress":return t.which!==32?null:(sw=!0,iw);case"textInput":return e=t.data,e===iw&&sw?null:e;default:return null}}function QL(e,t){if(Ea)return e==="compositionend"||!V1&&PI(e,t)?(e=NI(),_h=U1=Ps=null,Ea=!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 TI&&t.locale!=="ko"?null:t.data;default:return null}}var JL={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 ow(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!JL[e.type]:t==="textarea"}function AI(e,t,n,r){cI(r),t=rf(t,"onChange"),0<t.length&&(n=new W1("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Dc=null,ru=null;function eD(e){UI(e,0)}function vp(e){var t=Ta(e);if(nI(t))return e}function tD(e,t){if(e==="change")return t}var MI=!1;if(Yi){var Vm;if(Yi){var Km="oninput"in document;if(!Km){var aw=document.createElement("div");aw.setAttribute("oninput","return;"),Km=typeof aw.oninput=="function"}Vm=Km}else Vm=!1;MI=Vm&&(!document.documentMode||9<document.documentMode)}function lw(){Dc&&(Dc.detachEvent("onpropertychange",jI),ru=Dc=null)}function jI(e){if(e.propertyName==="value"&&vp(ru)){var t=[];AI(t,ru,e,B1(e)),fI(eD,t)}}function nD(e,t,n){e==="focusin"?(lw(),Dc=t,ru=n,Dc.attachEvent("onpropertychange",jI)):e==="focusout"&&lw()}function rD(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return vp(ru)}function iD(e,t){if(e==="click")return vp(t)}function sD(e,t){if(e==="input"||e==="change")return vp(t)}function oD(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Xr=typeof Object.is=="function"?Object.is:oD;function iu(e,t){if(Xr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!C0.call(t,i)||!Xr(e[i],t[i]))return!1}return!0}function cw(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function uw(e,t){var n=cw(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=cw(n)}}function LI(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?LI(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function DI(){for(var e=window,t=Xh();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Xh(e.document)}return t}function K1(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function aD(e){var t=DI(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&LI(n.ownerDocument.documentElement,n)){if(r!==null&&K1(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=uw(n,s);var o=uw(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var lD=Yi&&"documentMode"in document&&11>=document.documentMode,Ia=null,W0=null,Oc=null,q0=!1;function dw(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;q0||Ia==null||Ia!==Xh(r)||(r=Ia,"selectionStart"in r&&K1(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}),Oc&&iu(Oc,r)||(Oc=r,r=rf(W0,"onSelect"),0<r.length&&(t=new W1("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Ia)))}function kd(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Na={animationend:kd("Animation","AnimationEnd"),animationiteration:kd("Animation","AnimationIteration"),animationstart:kd("Animation","AnimationStart"),transitionend:kd("Transition","TransitionEnd")},Gm={},OI={};Yi&&(OI=document.createElement("div").style,"AnimationEvent"in window||(delete Na.animationend.animation,delete Na.animationiteration.animation,delete Na.animationstart.animation),"TransitionEvent"in window||delete Na.transitionend.transition);function xp(e){if(Gm[e])return Gm[e];if(!Na[e])return e;var t=Na[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in OI)return Gm[e]=t[n];return e}var BI=xp("animationend"),$I=xp("animationiteration"),zI=xp("animationstart"),FI=xp("transitionend"),HI=new Map,hw="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Js(e,t){HI.set(e,t),Yo(t,[e])}for(var Ym=0;Ym<hw.length;Ym++){var Xm=hw[Ym],cD=Xm.toLowerCase(),uD=Xm[0].toUpperCase()+Xm.slice(1);Js(cD,"on"+uD)}Js(BI,"onAnimationEnd");Js($I,"onAnimationIteration");Js(zI,"onAnimationStart");Js("dblclick","onDoubleClick");Js("focusin","onFocus");Js("focusout","onBlur");Js(FI,"onTransitionEnd");tl("onMouseEnter",["mouseout","mouseover"]);tl("onMouseLeave",["mouseout","mouseover"]);tl("onPointerEnter",["pointerout","pointerover"]);tl("onPointerLeave",["pointerout","pointerover"]);Yo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Yo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Yo("onBeforeInput",["compositionend","keypress","textInput","paste"]);Yo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Yo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Yo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Sc="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(" "),dD=new Set("cancel close invalid load scroll toggle".split(" ").concat(Sc));function fw(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,cL(r,t,void 0,e),e.currentTarget=null}function UI(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var s=void 0;if(t)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==s&&i.isPropagationStopped())break e;fw(i,a,c),s=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==s&&i.isPropagationStopped())break e;fw(i,a,c),s=l}}}if(Qh)throw e=z0,Qh=!1,z0=null,e}function gt(e,t){var n=t[X0];n===void 0&&(n=t[X0]=new Set);var r=e+"__bubble";n.has(r)||(WI(t,e,2,!1),n.add(r))}function Zm(e,t,n){var r=0;t&&(r|=4),WI(n,e,r,t)}var Cd="_reactListening"+Math.random().toString(36).slice(2);function su(e){if(!e[Cd]){e[Cd]=!0,ZE.forEach(function(n){n!=="selectionchange"&&(dD.has(n)||Zm(n,!1,e),Zm(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Cd]||(t[Cd]=!0,Zm("selectionchange",!1,t))}}function WI(e,t,n,r){switch(II(t)){case 1:var i=CL;break;case 4:i=EL;break;default:i=H1}n=i.bind(null,t,n,e),i=void 0,!$0||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Qm(e,t,n,r,i){var s=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===i||a.nodeType===8&&a.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;o=o.return}for(;a!==null;){if(o=So(a),o===null)return;if(l=o.tag,l===5||l===6){r=s=o;continue e}a=a.parentNode}}r=r.return}fI(function(){var c=s,u=B1(n),d=[];e:{var f=HI.get(e);if(f!==void 0){var p=W1,m=e;switch(e){case"keypress":if(bh(n)===0)break e;case"keydown":case"keyup":p=FL;break;case"focusin":m="focus",p=qm;break;case"focusout":m="blur",p=qm;break;case"beforeblur":case"afterblur":p=qm;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=tw;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=TL;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=WL;break;case BI:case $I:case zI:p=AL;break;case FI:p=VL;break;case"scroll":p=IL;break;case"wheel":p=GL;break;case"copy":case"cut":case"paste":p=jL;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=rw}var x=(t&4)!==0,w=!x&&e==="scroll",v=x?f!==null?f+"Capture":null:f;x=[];for(var _=c,b;_!==null;){b=_;var S=b.stateNode;if(b.tag===5&&S!==null&&(b=S,v!==null&&(S=Jc(_,v),S!=null&&x.push(ou(_,S,b)))),w)break;_=_.return}0<x.length&&(f=new p(f,m,null,n,u),d.push({event:f,listeners:x}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&n!==O0&&(m=n.relatedTarget||n.fromElement)&&(So(m)||m[Xi]))break e;if((p||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,p?(m=n.relatedTarget||n.toElement,p=c,m=m?So(m):null,m!==null&&(w=Xo(m),m!==w||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=c),p!==m)){if(x=tw,S="onMouseLeave",v="onMouseEnter",_="mouse",(e==="pointerout"||e==="pointerover")&&(x=rw,S="onPointerLeave",v="onPointerEnter",_="pointer"),w=p==null?f:Ta(p),b=m==null?f:Ta(m),f=new x(S,_+"leave",p,n,u),f.target=w,f.relatedTarget=b,S=null,So(u)===c&&(x=new x(v,_+"enter",m,n,u),x.target=b,x.relatedTarget=w,S=x),w=S,p&&m)t:{for(x=p,v=m,_=0,b=x;b;b=ua(b))_++;for(b=0,S=v;S;S=ua(S))b++;for(;0<_-b;)x=ua(x),_--;for(;0<b-_;)v=ua(v),b--;for(;_--;){if(x===v||v!==null&&x===v.alternate)break t;x=ua(x),v=ua(v)}x=null}else x=null;p!==null&&pw(d,f,p,x,!1),m!==null&&w!==null&&pw(d,w,m,x,!0)}}e:{if(f=c?Ta(c):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var C=tD;else if(ow(f))if(MI)C=sD;else{C=rD;var k=nD}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(C=iD);if(C&&(C=C(e,c))){AI(d,C,n,u);break e}k&&k(e,f,c),e==="focusout"&&(k=f._wrapperState)&&k.controlled&&f.type==="number"&&A0(f,"number",f.value)}switch(k=c?Ta(c):window,e){case"focusin":(ow(k)||k.contentEditable==="true")&&(Ia=k,W0=c,Oc=null);break;case"focusout":Oc=W0=Ia=null;break;case"mousedown":q0=!0;break;case"contextmenu":case"mouseup":case"dragend":q0=!1,dw(d,n,u);break;case"selectionchange":if(lD)break;case"keydown":case"keyup":dw(d,n,u)}var N;if(V1)e:{switch(e){case"compositionstart":var E="onCompositionStart";break e;case"compositionend":E="onCompositionEnd";break e;case"compositionupdate":E="onCompositionUpdate";break e}E=void 0}else Ea?PI(e,n)&&(E="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(E="onCompositionStart");E&&(TI&&n.locale!=="ko"&&(Ea||E!=="onCompositionStart"?E==="onCompositionEnd"&&Ea&&(N=NI()):(Ps=u,U1="value"in Ps?Ps.value:Ps.textContent,Ea=!0)),k=rf(c,E),0<k.length&&(E=new nw(E,e,null,n,u),d.push({event:E,listeners:k}),N?E.data=N:(N=RI(n),N!==null&&(E.data=N)))),(N=XL?ZL(e,n):QL(e,n))&&(c=rf(c,"onBeforeInput"),0<c.length&&(u=new nw("onBeforeInput","beforeinput",null,n,u),d.push({event:u,listeners:c}),u.data=N))}UI(d,t)})}function ou(e,t,n){return{instance:e,listener:t,currentTarget:n}}function rf(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=Jc(e,n),s!=null&&r.unshift(ou(e,s,i)),s=Jc(e,t),s!=null&&r.push(ou(e,s,i))),e=e.return}return r}function ua(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function pw(e,t,n,r,i){for(var s=t._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,i?(l=Jc(n,s),l!=null&&o.unshift(ou(n,l,a))):i||(l=Jc(n,s),l!=null&&o.push(ou(n,l,a)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var hD=/\r\n?/g,fD=/\u0000|\uFFFD/g;function mw(e){return(typeof e=="string"?e:""+e).replace(hD,`
|
|
38
|
+
`).replace(fD,"")}function Ed(e,t,n){if(t=mw(t),mw(e)!==t&&n)throw Error(Q(425))}function sf(){}var V0=null,K0=null;function G0(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Y0=typeof setTimeout=="function"?setTimeout:void 0,pD=typeof clearTimeout=="function"?clearTimeout:void 0,gw=typeof Promise=="function"?Promise:void 0,mD=typeof queueMicrotask=="function"?queueMicrotask:typeof gw<"u"?function(e){return gw.resolve(null).then(e).catch(gD)}:Y0;function gD(e){setTimeout(function(){throw e})}function Jm(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),nu(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);nu(t)}function Bs(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function vw(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Al=Math.random().toString(36).slice(2),pi="__reactFiber$"+Al,au="__reactProps$"+Al,Xi="__reactContainer$"+Al,X0="__reactEvents$"+Al,vD="__reactListeners$"+Al,xD="__reactHandles$"+Al;function So(e){var t=e[pi];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Xi]||n[pi]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=vw(e);e!==null;){if(n=e[pi])return n;e=vw(e)}return t}e=n,n=e.parentNode}return null}function zu(e){return e=e[pi]||e[Xi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ta(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Q(33))}function yp(e){return e[au]||null}var Z0=[],Pa=-1;function eo(e){return{current:e}}function xt(e){0>Pa||(e.current=Z0[Pa],Z0[Pa]=null,Pa--)}function pt(e,t){Pa++,Z0[Pa]=e.current,e.current=t}var Vs={},Nn=eo(Vs),Xn=eo(!1),Ao=Vs;function nl(e,t){var n=e.type.contextTypes;if(!n)return Vs;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Zn(e){return e=e.childContextTypes,e!=null}function of(){xt(Xn),xt(Nn)}function xw(e,t,n){if(Nn.current!==Vs)throw Error(Q(168));pt(Nn,t),pt(Xn,n)}function qI(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(Q(108,nL(e)||"Unknown",i));return Nt({},n,r)}function af(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Vs,Ao=Nn.current,pt(Nn,e),pt(Xn,Xn.current),!0}function yw(e,t,n){var r=e.stateNode;if(!r)throw Error(Q(169));n?(e=qI(e,t,Ao),r.__reactInternalMemoizedMergedChildContext=e,xt(Xn),xt(Nn),pt(Nn,e)):xt(Xn),pt(Xn,n)}var $i=null,_p=!1,eg=!1;function VI(e){$i===null?$i=[e]:$i.push(e)}function yD(e){_p=!0,VI(e)}function to(){if(!eg&&$i!==null){eg=!0;var e=0,t=ot;try{var n=$i;for(ot=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}$i=null,_p=!1}catch(i){throw $i!==null&&($i=$i.slice(e+1)),vI($1,to),i}finally{ot=t,eg=!1}}return null}var Ra=[],Aa=0,lf=null,cf=0,Cr=[],Er=0,Mo=null,zi=1,Fi="";function vo(e,t){Ra[Aa++]=cf,Ra[Aa++]=lf,lf=e,cf=t}function KI(e,t,n){Cr[Er++]=zi,Cr[Er++]=Fi,Cr[Er++]=Mo,Mo=e;var r=zi;e=Fi;var i=32-Vr(r)-1;r&=~(1<<i),n+=1;var s=32-Vr(t)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,zi=1<<32-Vr(t)+i|n<<i|r,Fi=s+e}else zi=1<<s|n<<i|r,Fi=e}function G1(e){e.return!==null&&(vo(e,1),KI(e,1,0))}function Y1(e){for(;e===lf;)lf=Ra[--Aa],Ra[Aa]=null,cf=Ra[--Aa],Ra[Aa]=null;for(;e===Mo;)Mo=Cr[--Er],Cr[Er]=null,Fi=Cr[--Er],Cr[Er]=null,zi=Cr[--Er],Cr[Er]=null}var cr=null,lr=null,_t=!1,Ur=null;function GI(e,t){var n=Ir(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function _w(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,cr=e,lr=Bs(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,cr=e,lr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Mo!==null?{id:zi,overflow:Fi}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ir(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,cr=e,lr=null,!0):!1;default:return!1}}function Q0(e){return(e.mode&1)!==0&&(e.flags&128)===0}function J0(e){if(_t){var t=lr;if(t){var n=t;if(!_w(e,t)){if(Q0(e))throw Error(Q(418));t=Bs(n.nextSibling);var r=cr;t&&_w(e,t)?GI(r,n):(e.flags=e.flags&-4097|2,_t=!1,cr=e)}}else{if(Q0(e))throw Error(Q(418));e.flags=e.flags&-4097|2,_t=!1,cr=e}}}function bw(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;cr=e}function Id(e){if(e!==cr)return!1;if(!_t)return bw(e),_t=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!G0(e.type,e.memoizedProps)),t&&(t=lr)){if(Q0(e))throw YI(),Error(Q(418));for(;t;)GI(e,t),t=Bs(t.nextSibling)}if(bw(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){lr=Bs(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}lr=null}}else lr=cr?Bs(e.stateNode.nextSibling):null;return!0}function YI(){for(var e=lr;e;)e=Bs(e.nextSibling)}function rl(){lr=cr=null,_t=!1}function X1(e){Ur===null?Ur=[e]:Ur.push(e)}var _D=ss.ReactCurrentBatchConfig;function sc(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(Q(309));var r=n.stateNode}if(!r)throw Error(Q(147,e));var i=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var a=i.refs;o===null?delete a[s]:a[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(Q(284));if(!n._owner)throw Error(Q(290,e))}return e}function Nd(e,t){throw e=Object.prototype.toString.call(t),Error(Q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ww(e){var t=e._init;return t(e._payload)}function XI(e){function t(v,_){if(e){var b=v.deletions;b===null?(v.deletions=[_],v.flags|=16):b.push(_)}}function n(v,_){if(!e)return null;for(;_!==null;)t(v,_),_=_.sibling;return null}function r(v,_){for(v=new Map;_!==null;)_.key!==null?v.set(_.key,_):v.set(_.index,_),_=_.sibling;return v}function i(v,_){return v=Hs(v,_),v.index=0,v.sibling=null,v}function s(v,_,b){return v.index=b,e?(b=v.alternate,b!==null?(b=b.index,b<_?(v.flags|=2,_):b):(v.flags|=2,_)):(v.flags|=1048576,_)}function o(v){return e&&v.alternate===null&&(v.flags|=2),v}function a(v,_,b,S){return _===null||_.tag!==6?(_=ag(b,v.mode,S),_.return=v,_):(_=i(_,b),_.return=v,_)}function l(v,_,b,S){var C=b.type;return C===Ca?u(v,_,b.props.children,S,b.key):_!==null&&(_.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Ss&&ww(C)===_.type)?(S=i(_,b.props),S.ref=sc(v,_,b),S.return=v,S):(S=Nh(b.type,b.key,b.props,null,v.mode,S),S.ref=sc(v,_,b),S.return=v,S)}function c(v,_,b,S){return _===null||_.tag!==4||_.stateNode.containerInfo!==b.containerInfo||_.stateNode.implementation!==b.implementation?(_=lg(b,v.mode,S),_.return=v,_):(_=i(_,b.children||[]),_.return=v,_)}function u(v,_,b,S,C){return _===null||_.tag!==7?(_=To(b,v.mode,S,C),_.return=v,_):(_=i(_,b),_.return=v,_)}function d(v,_,b){if(typeof _=="string"&&_!==""||typeof _=="number")return _=ag(""+_,v.mode,b),_.return=v,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case vd:return b=Nh(_.type,_.key,_.props,null,v.mode,b),b.ref=sc(v,null,_),b.return=v,b;case ka:return _=lg(_,v.mode,b),_.return=v,_;case Ss:var S=_._init;return d(v,S(_._payload),b)}if(bc(_)||ec(_))return _=To(_,v.mode,b,null),_.return=v,_;Nd(v,_)}return null}function f(v,_,b,S){var C=_!==null?_.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return C!==null?null:a(v,_,""+b,S);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case vd:return b.key===C?l(v,_,b,S):null;case ka:return b.key===C?c(v,_,b,S):null;case Ss:return C=b._init,f(v,_,C(b._payload),S)}if(bc(b)||ec(b))return C!==null?null:u(v,_,b,S,null);Nd(v,b)}return null}function p(v,_,b,S,C){if(typeof S=="string"&&S!==""||typeof S=="number")return v=v.get(b)||null,a(_,v,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case vd:return v=v.get(S.key===null?b:S.key)||null,l(_,v,S,C);case ka:return v=v.get(S.key===null?b:S.key)||null,c(_,v,S,C);case Ss:var k=S._init;return p(v,_,b,k(S._payload),C)}if(bc(S)||ec(S))return v=v.get(b)||null,u(_,v,S,C,null);Nd(_,S)}return null}function m(v,_,b,S){for(var C=null,k=null,N=_,E=_=0,L=null;N!==null&&E<b.length;E++){N.index>E?(L=N,N=null):L=N.sibling;var P=f(v,N,b[E],S);if(P===null){N===null&&(N=L);break}e&&N&&P.alternate===null&&t(v,N),_=s(P,_,E),k===null?C=P:k.sibling=P,k=P,N=L}if(E===b.length)return n(v,N),_t&&vo(v,E),C;if(N===null){for(;E<b.length;E++)N=d(v,b[E],S),N!==null&&(_=s(N,_,E),k===null?C=N:k.sibling=N,k=N);return _t&&vo(v,E),C}for(N=r(v,N);E<b.length;E++)L=p(N,v,E,b[E],S),L!==null&&(e&&L.alternate!==null&&N.delete(L.key===null?E:L.key),_=s(L,_,E),k===null?C=L:k.sibling=L,k=L);return e&&N.forEach(function(D){return t(v,D)}),_t&&vo(v,E),C}function x(v,_,b,S){var C=ec(b);if(typeof C!="function")throw Error(Q(150));if(b=C.call(b),b==null)throw Error(Q(151));for(var k=C=null,N=_,E=_=0,L=null,P=b.next();N!==null&&!P.done;E++,P=b.next()){N.index>E?(L=N,N=null):L=N.sibling;var D=f(v,N,P.value,S);if(D===null){N===null&&(N=L);break}e&&N&&D.alternate===null&&t(v,N),_=s(D,_,E),k===null?C=D:k.sibling=D,k=D,N=L}if(P.done)return n(v,N),_t&&vo(v,E),C;if(N===null){for(;!P.done;E++,P=b.next())P=d(v,P.value,S),P!==null&&(_=s(P,_,E),k===null?C=P:k.sibling=P,k=P);return _t&&vo(v,E),C}for(N=r(v,N);!P.done;E++,P=b.next())P=p(N,v,E,P.value,S),P!==null&&(e&&P.alternate!==null&&N.delete(P.key===null?E:P.key),_=s(P,_,E),k===null?C=P:k.sibling=P,k=P);return e&&N.forEach(function(R){return t(v,R)}),_t&&vo(v,E),C}function w(v,_,b,S){if(typeof b=="object"&&b!==null&&b.type===Ca&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case vd:e:{for(var C=b.key,k=_;k!==null;){if(k.key===C){if(C=b.type,C===Ca){if(k.tag===7){n(v,k.sibling),_=i(k,b.props.children),_.return=v,v=_;break e}}else if(k.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Ss&&ww(C)===k.type){n(v,k.sibling),_=i(k,b.props),_.ref=sc(v,k,b),_.return=v,v=_;break e}n(v,k);break}else t(v,k);k=k.sibling}b.type===Ca?(_=To(b.props.children,v.mode,S,b.key),_.return=v,v=_):(S=Nh(b.type,b.key,b.props,null,v.mode,S),S.ref=sc(v,_,b),S.return=v,v=S)}return o(v);case ka:e:{for(k=b.key;_!==null;){if(_.key===k)if(_.tag===4&&_.stateNode.containerInfo===b.containerInfo&&_.stateNode.implementation===b.implementation){n(v,_.sibling),_=i(_,b.children||[]),_.return=v,v=_;break e}else{n(v,_);break}else t(v,_);_=_.sibling}_=lg(b,v.mode,S),_.return=v,v=_}return o(v);case Ss:return k=b._init,w(v,_,k(b._payload),S)}if(bc(b))return m(v,_,b,S);if(ec(b))return x(v,_,b,S);Nd(v,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,_!==null&&_.tag===6?(n(v,_.sibling),_=i(_,b),_.return=v,v=_):(n(v,_),_=ag(b,v.mode,S),_.return=v,v=_),o(v)):n(v,_)}return w}var il=XI(!0),ZI=XI(!1),uf=eo(null),df=null,Ma=null,Z1=null;function Q1(){Z1=Ma=df=null}function J1(e){var t=uf.current;xt(uf),e._currentValue=t}function ev(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function qa(e,t){df=e,Z1=Ma=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Yn=!0),e.firstContext=null)}function Rr(e){var t=e._currentValue;if(Z1!==e)if(e={context:e,memoizedValue:t,next:null},Ma===null){if(df===null)throw Error(Q(308));Ma=e,df.dependencies={lanes:0,firstContext:e}}else Ma=Ma.next=e;return t}var ko=null;function ey(e){ko===null?ko=[e]:ko.push(e)}function QI(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,ey(t)):(n.next=i.next,i.next=n),t.interleaved=n,Zi(e,r)}function Zi(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ks=!1;function ty(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function JI(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function qi(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function $s(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,tt&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Zi(e,n)}return i=r.interleaved,i===null?(t.next=t,ey(r)):(t.next=i.next,i.next=t),r.interleaved=t,Zi(e,n)}function wh(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,z1(e,n)}}function Sw(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function hf(e,t,n,r){var i=e.updateQueue;ks=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var u=e.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(s!==null){var d=i.baseState;o=0,u=c=l=null,a=s;do{var f=a.lane,p=a.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=e,x=a;switch(f=t,p=n,x.tag){case 1:if(m=x.payload,typeof m=="function"){d=m.call(p,d,f);break e}d=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=x.payload,f=typeof m=="function"?m.call(p,d,f):m,f==null)break e;d=Nt({},d,f);break e;case 2:ks=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else p={eventTime:p,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=p,l=d):u=u.next=p,o|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(u===null&&(l=d),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);Lo|=o,e.lanes=o,e.memoizedState=d}}function kw(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(Q(191,i));i.call(r)}}}var Fu={},_i=eo(Fu),lu=eo(Fu),cu=eo(Fu);function Co(e){if(e===Fu)throw Error(Q(174));return e}function ny(e,t){switch(pt(cu,t),pt(lu,e),pt(_i,Fu),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:j0(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=j0(t,e)}xt(_i),pt(_i,t)}function sl(){xt(_i),xt(lu),xt(cu)}function eN(e){Co(cu.current);var t=Co(_i.current),n=j0(t,e.type);t!==n&&(pt(lu,e),pt(_i,n))}function ry(e){lu.current===e&&(xt(_i),xt(lu))}var Ct=eo(0);function ff(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var tg=[];function iy(){for(var e=0;e<tg.length;e++)tg[e]._workInProgressVersionPrimary=null;tg.length=0}var Sh=ss.ReactCurrentDispatcher,ng=ss.ReactCurrentBatchConfig,jo=0,It=null,Qt=null,on=null,pf=!1,Bc=!1,uu=0,bD=0;function wn(){throw Error(Q(321))}function sy(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Xr(e[n],t[n]))return!1;return!0}function oy(e,t,n,r,i,s){if(jo=s,It=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Sh.current=e===null||e.memoizedState===null?CD:ED,e=n(r,i),Bc){s=0;do{if(Bc=!1,uu=0,25<=s)throw Error(Q(301));s+=1,on=Qt=null,t.updateQueue=null,Sh.current=ID,e=n(r,i)}while(Bc)}if(Sh.current=mf,t=Qt!==null&&Qt.next!==null,jo=0,on=Qt=It=null,pf=!1,t)throw Error(Q(300));return e}function ay(){var e=uu!==0;return uu=0,e}function ci(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return on===null?It.memoizedState=on=e:on=on.next=e,on}function Ar(){if(Qt===null){var e=It.alternate;e=e!==null?e.memoizedState:null}else e=Qt.next;var t=on===null?It.memoizedState:on.next;if(t!==null)on=t,Qt=e;else{if(e===null)throw Error(Q(310));Qt=e,e={memoizedState:Qt.memoizedState,baseState:Qt.baseState,baseQueue:Qt.baseQueue,queue:Qt.queue,next:null},on===null?It.memoizedState=on=e:on=on.next=e}return on}function du(e,t){return typeof t=="function"?t(e):t}function rg(e){var t=Ar(),n=t.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=e;var r=Qt,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var a=o=null,l=null,c=s;do{var u=c.lane;if((jo&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=d,o=r):l=l.next=d,It.lanes|=u,Lo|=u}c=c.next}while(c!==null&&c!==s);l===null?o=r:l.next=a,Xr(r,t.memoizedState)||(Yn=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do s=i.lane,It.lanes|=s,Lo|=s,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function ig(e){var t=Ar(),n=t.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,s=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);Xr(s,t.memoizedState)||(Yn=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function tN(){}function nN(e,t){var n=It,r=Ar(),i=t(),s=!Xr(r.memoizedState,i);if(s&&(r.memoizedState=i,Yn=!0),r=r.queue,ly(sN.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||on!==null&&on.memoizedState.tag&1){if(n.flags|=2048,hu(9,iN.bind(null,n,r,i,t),void 0,null),un===null)throw Error(Q(349));jo&30||rN(n,t,i)}return i}function rN(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=It.updateQueue,t===null?(t={lastEffect:null,stores:null},It.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function iN(e,t,n,r){t.value=n,t.getSnapshot=r,oN(t)&&aN(e)}function sN(e,t,n){return n(function(){oN(t)&&aN(e)})}function oN(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Xr(e,n)}catch{return!0}}function aN(e){var t=Zi(e,1);t!==null&&Kr(t,e,1,-1)}function Cw(e){var t=ci();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:du,lastRenderedState:e},t.queue=e,e=e.dispatch=kD.bind(null,It,e),[t.memoizedState,e]}function hu(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=It.updateQueue,t===null?(t={lastEffect:null,stores:null},It.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function lN(){return Ar().memoizedState}function kh(e,t,n,r){var i=ci();It.flags|=e,i.memoizedState=hu(1|t,n,void 0,r===void 0?null:r)}function bp(e,t,n,r){var i=Ar();r=r===void 0?null:r;var s=void 0;if(Qt!==null){var o=Qt.memoizedState;if(s=o.destroy,r!==null&&sy(r,o.deps)){i.memoizedState=hu(t,n,s,r);return}}It.flags|=e,i.memoizedState=hu(1|t,n,s,r)}function Ew(e,t){return kh(8390656,8,e,t)}function ly(e,t){return bp(2048,8,e,t)}function cN(e,t){return bp(4,2,e,t)}function uN(e,t){return bp(4,4,e,t)}function dN(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function hN(e,t,n){return n=n!=null?n.concat([e]):null,bp(4,4,dN.bind(null,t,e),n)}function cy(){}function fN(e,t){var n=Ar();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&sy(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function pN(e,t){var n=Ar();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&sy(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function mN(e,t,n){return jo&21?(Xr(n,t)||(n=_I(),It.lanes|=n,Lo|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Yn=!0),e.memoizedState=n)}function wD(e,t){var n=ot;ot=n!==0&&4>n?n:4,e(!0);var r=ng.transition;ng.transition={};try{e(!1),t()}finally{ot=n,ng.transition=r}}function gN(){return Ar().memoizedState}function SD(e,t,n){var r=Fs(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},vN(e))xN(t,n);else if(n=QI(e,t,n,r),n!==null){var i=On();Kr(n,e,r,i),yN(n,t,r)}}function kD(e,t,n){var r=Fs(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(vN(e))xN(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,Xr(a,o)){var l=t.interleaved;l===null?(i.next=i,ey(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=QI(e,t,i,r),n!==null&&(i=On(),Kr(n,e,r,i),yN(n,t,r))}}function vN(e){var t=e.alternate;return e===It||t!==null&&t===It}function xN(e,t){Bc=pf=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function yN(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,z1(e,n)}}var mf={readContext:Rr,useCallback:wn,useContext:wn,useEffect:wn,useImperativeHandle:wn,useInsertionEffect:wn,useLayoutEffect:wn,useMemo:wn,useReducer:wn,useRef:wn,useState:wn,useDebugValue:wn,useDeferredValue:wn,useTransition:wn,useMutableSource:wn,useSyncExternalStore:wn,useId:wn,unstable_isNewReconciler:!1},CD={readContext:Rr,useCallback:function(e,t){return ci().memoizedState=[e,t===void 0?null:t],e},useContext:Rr,useEffect:Ew,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,kh(4194308,4,dN.bind(null,t,e),n)},useLayoutEffect:function(e,t){return kh(4194308,4,e,t)},useInsertionEffect:function(e,t){return kh(4,2,e,t)},useMemo:function(e,t){var n=ci();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ci();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=SD.bind(null,It,e),[r.memoizedState,e]},useRef:function(e){var t=ci();return e={current:e},t.memoizedState=e},useState:Cw,useDebugValue:cy,useDeferredValue:function(e){return ci().memoizedState=e},useTransition:function(){var e=Cw(!1),t=e[0];return e=wD.bind(null,e[1]),ci().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=It,i=ci();if(_t){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=t(),un===null)throw Error(Q(349));jo&30||rN(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,Ew(sN.bind(null,r,s,e),[e]),r.flags|=2048,hu(9,iN.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=ci(),t=un.identifierPrefix;if(_t){var n=Fi,r=zi;n=(r&~(1<<32-Vr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=uu++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=bD++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ED={readContext:Rr,useCallback:fN,useContext:Rr,useEffect:ly,useImperativeHandle:hN,useInsertionEffect:cN,useLayoutEffect:uN,useMemo:pN,useReducer:rg,useRef:lN,useState:function(){return rg(du)},useDebugValue:cy,useDeferredValue:function(e){var t=Ar();return mN(t,Qt.memoizedState,e)},useTransition:function(){var e=rg(du)[0],t=Ar().memoizedState;return[e,t]},useMutableSource:tN,useSyncExternalStore:nN,useId:gN,unstable_isNewReconciler:!1},ID={readContext:Rr,useCallback:fN,useContext:Rr,useEffect:ly,useImperativeHandle:hN,useInsertionEffect:cN,useLayoutEffect:uN,useMemo:pN,useReducer:ig,useRef:lN,useState:function(){return ig(du)},useDebugValue:cy,useDeferredValue:function(e){var t=Ar();return Qt===null?t.memoizedState=e:mN(t,Qt.memoizedState,e)},useTransition:function(){var e=ig(du)[0],t=Ar().memoizedState;return[e,t]},useMutableSource:tN,useSyncExternalStore:nN,useId:gN,unstable_isNewReconciler:!1};function zr(e,t){if(e&&e.defaultProps){t=Nt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function tv(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Nt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var wp={isMounted:function(e){return(e=e._reactInternals)?Xo(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=On(),i=Fs(e),s=qi(r,i);s.payload=t,n!=null&&(s.callback=n),t=$s(e,s,i),t!==null&&(Kr(t,e,i,r),wh(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=On(),i=Fs(e),s=qi(r,i);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=$s(e,s,i),t!==null&&(Kr(t,e,i,r),wh(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=On(),r=Fs(e),i=qi(n,r);i.tag=2,t!=null&&(i.callback=t),t=$s(e,i,r),t!==null&&(Kr(t,e,r,n),wh(t,e,r))}};function Iw(e,t,n,r,i,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,o):t.prototype&&t.prototype.isPureReactComponent?!iu(n,r)||!iu(i,s):!0}function _N(e,t,n){var r=!1,i=Vs,s=t.contextType;return typeof s=="object"&&s!==null?s=Rr(s):(i=Zn(t)?Ao:Nn.current,r=t.contextTypes,s=(r=r!=null)?nl(e,i):Vs),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=wp,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function Nw(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&&wp.enqueueReplaceState(t,t.state,null)}function nv(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},ty(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=Rr(s):(s=Zn(t)?Ao:Nn.current,i.context=nl(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(tv(e,t,s,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&wp.enqueueReplaceState(i,i.state,null),hf(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function ol(e,t){try{var n="",r=t;do n+=tL(r),r=r.return;while(r);var i=n}catch(s){i=`
|
|
39
|
+
Error generating stack: `+s.message+`
|
|
40
|
+
`+s.stack}return{value:e,source:t,stack:i,digest:null}}function sg(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function rv(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var ND=typeof WeakMap=="function"?WeakMap:Map;function bN(e,t,n){n=qi(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){vf||(vf=!0,fv=r),rv(e,t)},n}function wN(e,t,n){n=qi(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){rv(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){rv(e,t),typeof r!="function"&&(zs===null?zs=new Set([this]):zs.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function Tw(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new ND;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=HD.bind(null,e,t,n),t.then(e,e))}function Pw(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Rw(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=qi(-1,1),t.tag=2,$s(n,t,1))),n.lanes|=1),e)}var TD=ss.ReactCurrentOwner,Yn=!1;function jn(e,t,n,r){t.child=e===null?ZI(t,null,n,r):il(t,e.child,n,r)}function Aw(e,t,n,r,i){n=n.render;var s=t.ref;return qa(t,i),r=oy(e,t,n,r,s,i),n=ay(),e!==null&&!Yn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Qi(e,t,i)):(_t&&n&&G1(t),t.flags|=1,jn(e,t,r,i),t.child)}function Mw(e,t,n,r,i){if(e===null){var s=n.type;return typeof s=="function"&&!vy(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,SN(e,t,s,r,i)):(e=Nh(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:iu,n(o,r)&&e.ref===t.ref)return Qi(e,t,i)}return t.flags|=1,e=Hs(s,r),e.ref=t.ref,e.return=t,t.child=e}function SN(e,t,n,r,i){if(e!==null){var s=e.memoizedProps;if(iu(s,r)&&e.ref===t.ref)if(Yn=!1,t.pendingProps=r=s,(e.lanes&i)!==0)e.flags&131072&&(Yn=!0);else return t.lanes=e.lanes,Qi(e,t,i)}return iv(e,t,n,r,i)}function kN(e,t,n){var r=t.pendingProps,i=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},pt(La,or),or|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,pt(La,or),or|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,pt(La,or),or|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,pt(La,or),or|=r;return jn(e,t,i,n),t.child}function CN(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function iv(e,t,n,r,i){var s=Zn(n)?Ao:Nn.current;return s=nl(t,s),qa(t,i),n=oy(e,t,n,r,s,i),r=ay(),e!==null&&!Yn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Qi(e,t,i)):(_t&&r&&G1(t),t.flags|=1,jn(e,t,n,i),t.child)}function jw(e,t,n,r,i){if(Zn(n)){var s=!0;af(t)}else s=!1;if(qa(t,i),t.stateNode===null)Ch(e,t),_N(t,n,r),nv(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,c=n.contextType;typeof c=="object"&&c!==null?c=Rr(c):(c=Zn(n)?Ao:Nn.current,c=nl(t,c));var u=n.getDerivedStateFromProps,d=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==c)&&Nw(t,o,r,c),ks=!1;var f=t.memoizedState;o.state=f,hf(t,r,o,i),l=t.memoizedState,a!==r||f!==l||Xn.current||ks?(typeof u=="function"&&(tv(t,n,u,r),l=t.memoizedState),(a=ks||Iw(t,n,a,r,f,l,c))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),o.props=r,o.state=l,o.context=c,r=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,JI(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:zr(t.type,a),o.props=c,d=t.pendingProps,f=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=Rr(l):(l=Zn(n)?Ao:Nn.current,l=nl(t,l));var p=n.getDerivedStateFromProps;(u=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==d||f!==l)&&Nw(t,o,r,l),ks=!1,f=t.memoizedState,o.state=f,hf(t,r,o,i);var m=t.memoizedState;a!==d||f!==m||Xn.current||ks?(typeof p=="function"&&(tv(t,n,p,r),m=t.memoizedState),(c=ks||Iw(t,n,c,r,f,m,l)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,m,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,m,l)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=l,r=c):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return sv(e,t,n,r,s,i)}function sv(e,t,n,r,i,s){CN(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return i&&yw(t,n,!1),Qi(e,t,s);r=t.stateNode,TD.current=t;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=il(t,e.child,null,s),t.child=il(t,null,a,s)):jn(e,t,a,s),t.memoizedState=r.state,i&&yw(t,n,!0),t.child}function EN(e){var t=e.stateNode;t.pendingContext?xw(e,t.pendingContext,t.pendingContext!==t.context):t.context&&xw(e,t.context,!1),ny(e,t.containerInfo)}function Lw(e,t,n,r,i){return rl(),X1(i),t.flags|=256,jn(e,t,n,r),t.child}var ov={dehydrated:null,treeContext:null,retryLane:0};function av(e){return{baseLanes:e,cachePool:null,transitions:null}}function IN(e,t,n){var r=t.pendingProps,i=Ct.current,s=!1,o=(t.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(i&2)!==0),a?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),pt(Ct,i&1),e===null)return J0(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,s?(r=t.mode,s=t.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=Cp(o,r,0,null),e=To(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=av(n),t.memoizedState=ov,e):uy(t,o));if(i=e.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return PD(e,t,o,r,a,i,n);if(s){s=r.fallback,o=t.mode,i=e.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=Hs(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=Hs(a,s):(s=To(s,o,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,o=e.child.memoizedState,o=o===null?av(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~n,t.memoizedState=ov,r}return s=e.child,e=s.sibling,r=Hs(s,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function uy(e,t){return t=Cp({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Td(e,t,n,r){return r!==null&&X1(r),il(t,e.child,null,n),e=uy(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function PD(e,t,n,r,i,s,o){if(n)return t.flags&256?(t.flags&=-257,r=sg(Error(Q(422))),Td(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,i=t.mode,r=Cp({mode:"visible",children:r.children},i,0,null),s=To(s,i,o,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&il(t,e.child,null,o),t.child.memoizedState=av(o),t.memoizedState=ov,s);if(!(t.mode&1))return Td(e,t,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(Q(419)),r=sg(s,r,void 0),Td(e,t,o,r)}if(a=(o&e.childLanes)!==0,Yn||a){if(r=un,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Zi(e,i),Kr(r,e,i,-1))}return gy(),r=sg(Error(Q(421))),Td(e,t,o,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=UD.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,lr=Bs(i.nextSibling),cr=t,_t=!0,Ur=null,e!==null&&(Cr[Er++]=zi,Cr[Er++]=Fi,Cr[Er++]=Mo,zi=e.id,Fi=e.overflow,Mo=t),t=uy(t,r.children),t.flags|=4096,t)}function Dw(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ev(e.return,t,n)}function og(e,t,n,r,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function NN(e,t,n){var r=t.pendingProps,i=r.revealOrder,s=r.tail;if(jn(e,t,r.children,n),r=Ct.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Dw(e,n,t);else if(e.tag===19)Dw(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(pt(Ct,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&ff(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),og(t,!1,i,n,s);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ff(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}og(t,!0,n,null,s);break;case"together":og(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ch(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Qi(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Lo|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Q(153));if(t.child!==null){for(e=t.child,n=Hs(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Hs(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function RD(e,t,n){switch(t.tag){case 3:EN(t),rl();break;case 5:eN(t);break;case 1:Zn(t.type)&&af(t);break;case 4:ny(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;pt(uf,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(pt(Ct,Ct.current&1),t.flags|=128,null):n&t.child.childLanes?IN(e,t,n):(pt(Ct,Ct.current&1),e=Qi(e,t,n),e!==null?e.sibling:null);pt(Ct,Ct.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return NN(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),pt(Ct,Ct.current),r)break;return null;case 22:case 23:return t.lanes=0,kN(e,t,n)}return Qi(e,t,n)}var TN,lv,PN,RN;TN=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};lv=function(){};PN=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,Co(_i.current);var s=null;switch(n){case"input":i=P0(e,i),r=P0(e,r),s=[];break;case"select":i=Nt({},i,{value:void 0}),r=Nt({},r,{value:void 0}),s=[];break;case"textarea":i=M0(e,i),r=M0(e,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=sf)}L0(n,r);var o;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var a=i[c];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Zc.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in r){var l=r[c];if(a=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(s||(s=[]),s.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Zc.hasOwnProperty(c)?(l!=null&&c==="onScroll"&>("scroll",e),s||a===l||(s=[])):(s=s||[]).push(c,l))}n&&(s=s||[]).push("style",n);var c=s;(t.updateQueue=c)&&(t.flags|=4)}};RN=function(e,t,n,r){n!==r&&(t.flags|=4)};function oc(e,t){if(!_t)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 Sn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function AD(e,t,n){var r=t.pendingProps;switch(Y1(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Sn(t),null;case 1:return Zn(t.type)&&of(),Sn(t),null;case 3:return r=t.stateNode,sl(),xt(Xn),xt(Nn),iy(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Id(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ur!==null&&(gv(Ur),Ur=null))),lv(e,t),Sn(t),null;case 5:ry(t);var i=Co(cu.current);if(n=t.type,e!==null&&t.stateNode!=null)PN(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Q(166));return Sn(t),null}if(e=Co(_i.current),Id(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[pi]=t,r[au]=s,e=(t.mode&1)!==0,n){case"dialog":gt("cancel",r),gt("close",r);break;case"iframe":case"object":case"embed":gt("load",r);break;case"video":case"audio":for(i=0;i<Sc.length;i++)gt(Sc[i],r);break;case"source":gt("error",r);break;case"img":case"image":case"link":gt("error",r),gt("load",r);break;case"details":gt("toggle",r);break;case"input":qb(r,s),gt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},gt("invalid",r);break;case"textarea":Kb(r,s),gt("invalid",r)}L0(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?r.textContent!==a&&(s.suppressHydrationWarning!==!0&&Ed(r.textContent,a,e),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Ed(r.textContent,a,e),i=["children",""+a]):Zc.hasOwnProperty(o)&&a!=null&&o==="onScroll"&>("scroll",r)}switch(n){case"input":xd(r),Vb(r,s,!0);break;case"textarea":xd(r),Gb(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=sf)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=sI(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[pi]=t,e[au]=r,TN(e,t,!1,!1),t.stateNode=e;e:{switch(o=D0(n,r),n){case"dialog":gt("cancel",e),gt("close",e),i=r;break;case"iframe":case"object":case"embed":gt("load",e),i=r;break;case"video":case"audio":for(i=0;i<Sc.length;i++)gt(Sc[i],e);i=r;break;case"source":gt("error",e),i=r;break;case"img":case"image":case"link":gt("error",e),gt("load",e),i=r;break;case"details":gt("toggle",e),i=r;break;case"input":qb(e,r),i=P0(e,r),gt("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=Nt({},r,{value:void 0}),gt("invalid",e);break;case"textarea":Kb(e,r),i=M0(e,r),gt("invalid",e);break;default:i=r}L0(n,i),a=i;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?lI(e,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&oI(e,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Qc(e,l):typeof l=="number"&&Qc(e,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Zc.hasOwnProperty(s)?l!=null&&s==="onScroll"&>("scroll",e):l!=null&&j1(e,s,l,o))}switch(n){case"input":xd(e),Vb(e,r,!1);break;case"textarea":xd(e),Gb(e);break;case"option":r.value!=null&&e.setAttribute("value",""+qs(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?Fa(e,!!r.multiple,s,!1):r.defaultValue!=null&&Fa(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=sf)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Sn(t),null;case 6:if(e&&t.stateNode!=null)RN(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Q(166));if(n=Co(cu.current),Co(_i.current),Id(t)){if(r=t.stateNode,n=t.memoizedProps,r[pi]=t,(s=r.nodeValue!==n)&&(e=cr,e!==null))switch(e.tag){case 3:Ed(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ed(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[pi]=t,t.stateNode=r}return Sn(t),null;case 13:if(xt(Ct),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(_t&&lr!==null&&t.mode&1&&!(t.flags&128))YI(),rl(),t.flags|=98560,s=!1;else if(s=Id(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(Q(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(Q(317));s[pi]=t}else rl(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Sn(t),s=!1}else Ur!==null&&(gv(Ur),Ur=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Ct.current&1?Jt===0&&(Jt=3):gy())),t.updateQueue!==null&&(t.flags|=4),Sn(t),null);case 4:return sl(),lv(e,t),e===null&&su(t.stateNode.containerInfo),Sn(t),null;case 10:return J1(t.type._context),Sn(t),null;case 17:return Zn(t.type)&&of(),Sn(t),null;case 19:if(xt(Ct),s=t.memoizedState,s===null)return Sn(t),null;if(r=(t.flags&128)!==0,o=s.rendering,o===null)if(r)oc(s,!1);else{if(Jt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ff(e),o!==null){for(t.flags|=128,oc(s,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return pt(Ct,Ct.current&1|2),t.child}e=e.sibling}s.tail!==null&&Dt()>al&&(t.flags|=128,r=!0,oc(s,!1),t.lanes=4194304)}else{if(!r)if(e=ff(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),oc(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!_t)return Sn(t),null}else 2*Dt()-s.renderingStartTime>al&&n!==1073741824&&(t.flags|=128,r=!0,oc(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Dt(),t.sibling=null,n=Ct.current,pt(Ct,r?n&1|2:n&1),t):(Sn(t),null);case 22:case 23:return my(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?or&1073741824&&(Sn(t),t.subtreeFlags&6&&(t.flags|=8192)):Sn(t),null;case 24:return null;case 25:return null}throw Error(Q(156,t.tag))}function MD(e,t){switch(Y1(t),t.tag){case 1:return Zn(t.type)&&of(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return sl(),xt(Xn),xt(Nn),iy(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ry(t),null;case 13:if(xt(Ct),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return xt(Ct),null;case 4:return sl(),null;case 10:return J1(t.type._context),null;case 22:case 23:return my(),null;case 24:return null;default:return null}}var Pd=!1,En=!1,jD=typeof WeakSet=="function"?WeakSet:Set,fe=null;function ja(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Pt(e,t,r)}else n.current=null}function cv(e,t,n){try{n()}catch(r){Pt(e,t,r)}}var Ow=!1;function LD(e,t){if(V0=tf,e=DI(),K1(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,u=0,d=e,f=null;t:for(;;){for(var p;d!==n||i!==0&&d.nodeType!==3||(a=o+i),d!==s||r!==0&&d.nodeType!==3||(l=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===e)break t;if(f===n&&++c===i&&(a=o),f===s&&++u===r&&(l=o),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(K0={focusedElem:e,selectionRange:n},tf=!1,fe=t;fe!==null;)if(t=fe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,fe=e;else for(;fe!==null;){t=fe;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var x=m.memoizedProps,w=m.memoizedState,v=t.stateNode,_=v.getSnapshotBeforeUpdate(t.elementType===t.type?x:zr(t.type,x),w);v.__reactInternalSnapshotBeforeUpdate=_}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(S){Pt(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,fe=e;break}fe=t.return}return m=Ow,Ow=!1,m}function $c(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&cv(t,n,s)}i=i.next}while(i!==r)}}function Sp(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function uv(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function AN(e){var t=e.alternate;t!==null&&(e.alternate=null,AN(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[pi],delete t[au],delete t[X0],delete t[vD],delete t[xD])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function MN(e){return e.tag===5||e.tag===3||e.tag===4}function Bw(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||MN(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function dv(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=sf));else if(r!==4&&(e=e.child,e!==null))for(dv(e,t,n),e=e.sibling;e!==null;)dv(e,t,n),e=e.sibling}function hv(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(hv(e,t,n),e=e.sibling;e!==null;)hv(e,t,n),e=e.sibling}var pn=null,Fr=!1;function ps(e,t,n){for(n=n.child;n!==null;)jN(e,t,n),n=n.sibling}function jN(e,t,n){if(yi&&typeof yi.onCommitFiberUnmount=="function")try{yi.onCommitFiberUnmount(mp,n)}catch{}switch(n.tag){case 5:En||ja(n,t);case 6:var r=pn,i=Fr;pn=null,ps(e,t,n),pn=r,Fr=i,pn!==null&&(Fr?(e=pn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):pn.removeChild(n.stateNode));break;case 18:pn!==null&&(Fr?(e=pn,n=n.stateNode,e.nodeType===8?Jm(e.parentNode,n):e.nodeType===1&&Jm(e,n),nu(e)):Jm(pn,n.stateNode));break;case 4:r=pn,i=Fr,pn=n.stateNode.containerInfo,Fr=!0,ps(e,t,n),pn=r,Fr=i;break;case 0:case 11:case 14:case 15:if(!En&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&cv(n,t,o),i=i.next}while(i!==r)}ps(e,t,n);break;case 1:if(!En&&(ja(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Pt(n,t,a)}ps(e,t,n);break;case 21:ps(e,t,n);break;case 22:n.mode&1?(En=(r=En)||n.memoizedState!==null,ps(e,t,n),En=r):ps(e,t,n);break;default:ps(e,t,n)}}function $w(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new jD),t.forEach(function(r){var i=WD.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Br(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 5:pn=a.stateNode,Fr=!1;break e;case 3:pn=a.stateNode.containerInfo,Fr=!0;break e;case 4:pn=a.stateNode.containerInfo,Fr=!0;break e}a=a.return}if(pn===null)throw Error(Q(160));jN(s,o,i),pn=null,Fr=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){Pt(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)LN(t,e),t=t.sibling}function LN(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Br(t,e),ii(e),r&4){try{$c(3,e,e.return),Sp(3,e)}catch(x){Pt(e,e.return,x)}try{$c(5,e,e.return)}catch(x){Pt(e,e.return,x)}}break;case 1:Br(t,e),ii(e),r&512&&n!==null&&ja(n,n.return);break;case 5:if(Br(t,e),ii(e),r&512&&n!==null&&ja(n,n.return),e.flags&32){var i=e.stateNode;try{Qc(i,"")}catch(x){Pt(e,e.return,x)}}if(r&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=n!==null?n.memoizedProps:s,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&rI(i,s),D0(a,o);var c=D0(a,s);for(o=0;o<l.length;o+=2){var u=l[o],d=l[o+1];u==="style"?lI(i,d):u==="dangerouslySetInnerHTML"?oI(i,d):u==="children"?Qc(i,d):j1(i,u,d,c)}switch(a){case"input":R0(i,s);break;case"textarea":iI(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var p=s.value;p!=null?Fa(i,!!s.multiple,p,!1):f!==!!s.multiple&&(s.defaultValue!=null?Fa(i,!!s.multiple,s.defaultValue,!0):Fa(i,!!s.multiple,s.multiple?[]:"",!1))}i[au]=s}catch(x){Pt(e,e.return,x)}}break;case 6:if(Br(t,e),ii(e),r&4){if(e.stateNode===null)throw Error(Q(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(x){Pt(e,e.return,x)}}break;case 3:if(Br(t,e),ii(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{nu(t.containerInfo)}catch(x){Pt(e,e.return,x)}break;case 4:Br(t,e),ii(e);break;case 13:Br(t,e),ii(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(fy=Dt())),r&4&&$w(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(En=(c=En)||u,Br(t,e),En=c):Br(t,e),ii(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!u&&e.mode&1)for(fe=e,u=e.child;u!==null;){for(d=fe=u;fe!==null;){switch(f=fe,p=f.child,f.tag){case 0:case 11:case 14:case 15:$c(4,f,f.return);break;case 1:ja(f,f.return);var m=f.stateNode;if(typeof m.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(x){Pt(r,n,x)}}break;case 5:ja(f,f.return);break;case 22:if(f.memoizedState!==null){Fw(d);continue}}p!==null?(p.return=f,fe=p):Fw(d)}u=u.sibling}e:for(u=null,d=e;;){if(d.tag===5){if(u===null){u=d;try{i=d.stateNode,c?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=d.stateNode,l=d.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=aI("display",o))}catch(x){Pt(e,e.return,x)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(x){Pt(e,e.return,x)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Br(t,e),ii(e),r&4&&$w(e);break;case 21:break;default:Br(t,e),ii(e)}}function ii(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(MN(n)){var r=n;break e}n=n.return}throw Error(Q(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Qc(i,""),r.flags&=-33);var s=Bw(e);hv(e,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,a=Bw(e);dv(e,a,o);break;default:throw Error(Q(161))}}catch(l){Pt(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function DD(e,t,n){fe=e,DN(e)}function DN(e,t,n){for(var r=(e.mode&1)!==0;fe!==null;){var i=fe,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||Pd;if(!o){var a=i.alternate,l=a!==null&&a.memoizedState!==null||En;a=Pd;var c=En;if(Pd=o,(En=l)&&!c)for(fe=i;fe!==null;)o=fe,l=o.child,o.tag===22&&o.memoizedState!==null?Hw(i):l!==null?(l.return=o,fe=l):Hw(i);for(;s!==null;)fe=s,DN(s),s=s.sibling;fe=i,Pd=a,En=c}zw(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,fe=s):zw(e)}}function zw(e){for(;fe!==null;){var t=fe;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:En||Sp(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!En)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:zr(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&kw(t,s,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}kw(t,o,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var d=u.dehydrated;d!==null&&nu(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Q(163))}En||t.flags&512&&uv(t)}catch(f){Pt(t,t.return,f)}}if(t===e){fe=null;break}if(n=t.sibling,n!==null){n.return=t.return,fe=n;break}fe=t.return}}function Fw(e){for(;fe!==null;){var t=fe;if(t===e){fe=null;break}var n=t.sibling;if(n!==null){n.return=t.return,fe=n;break}fe=t.return}}function Hw(e){for(;fe!==null;){var t=fe;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Sp(4,t)}catch(l){Pt(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(l){Pt(t,i,l)}}var s=t.return;try{uv(t)}catch(l){Pt(t,s,l)}break;case 5:var o=t.return;try{uv(t)}catch(l){Pt(t,o,l)}}}catch(l){Pt(t,t.return,l)}if(t===e){fe=null;break}var a=t.sibling;if(a!==null){a.return=t.return,fe=a;break}fe=t.return}}var OD=Math.ceil,gf=ss.ReactCurrentDispatcher,dy=ss.ReactCurrentOwner,Nr=ss.ReactCurrentBatchConfig,tt=0,un=null,qt=null,xn=0,or=0,La=eo(0),Jt=0,fu=null,Lo=0,kp=0,hy=0,zc=null,Gn=null,fy=0,al=1/0,Bi=null,vf=!1,fv=null,zs=null,Rd=!1,Rs=null,xf=0,Fc=0,pv=null,Eh=-1,Ih=0;function On(){return tt&6?Dt():Eh!==-1?Eh:Eh=Dt()}function Fs(e){return e.mode&1?tt&2&&xn!==0?xn&-xn:_D.transition!==null?(Ih===0&&(Ih=_I()),Ih):(e=ot,e!==0||(e=window.event,e=e===void 0?16:II(e.type)),e):1}function Kr(e,t,n,r){if(50<Fc)throw Fc=0,pv=null,Error(Q(185));Bu(e,n,r),(!(tt&2)||e!==un)&&(e===un&&(!(tt&2)&&(kp|=n),Jt===4&&Ns(e,xn)),Qn(e,r),n===1&&tt===0&&!(t.mode&1)&&(al=Dt()+500,_p&&to()))}function Qn(e,t){var n=e.callbackNode;_L(e,t);var r=ef(e,e===un?xn:0);if(r===0)n!==null&&Zb(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Zb(n),t===1)e.tag===0?yD(Uw.bind(null,e)):VI(Uw.bind(null,e)),mD(function(){!(tt&6)&&to()}),n=null;else{switch(bI(r)){case 1:n=$1;break;case 4:n=xI;break;case 16:n=Jh;break;case 536870912:n=yI;break;default:n=Jh}n=WN(n,ON.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function ON(e,t){if(Eh=-1,Ih=0,tt&6)throw Error(Q(327));var n=e.callbackNode;if(Va()&&e.callbackNode!==n)return null;var r=ef(e,e===un?xn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=yf(e,r);else{t=r;var i=tt;tt|=2;var s=$N();(un!==e||xn!==t)&&(Bi=null,al=Dt()+500,No(e,t));do try{zD();break}catch(a){BN(e,a)}while(!0);Q1(),gf.current=s,tt=i,qt!==null?t=0:(un=null,xn=0,t=Jt)}if(t!==0){if(t===2&&(i=F0(e),i!==0&&(r=i,t=mv(e,i))),t===1)throw n=fu,No(e,0),Ns(e,r),Qn(e,Dt()),n;if(t===6)Ns(e,r);else{if(i=e.current.alternate,!(r&30)&&!BD(i)&&(t=yf(e,r),t===2&&(s=F0(e),s!==0&&(r=s,t=mv(e,s))),t===1))throw n=fu,No(e,0),Ns(e,r),Qn(e,Dt()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(Q(345));case 2:xo(e,Gn,Bi);break;case 3:if(Ns(e,r),(r&130023424)===r&&(t=fy+500-Dt(),10<t)){if(ef(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){On(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Y0(xo.bind(null,e,Gn,Bi),t);break}xo(e,Gn,Bi);break;case 4:if(Ns(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var o=31-Vr(r);s=1<<o,o=t[o],o>i&&(i=o),r&=~s}if(r=i,r=Dt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*OD(r/1960))-r,10<r){e.timeoutHandle=Y0(xo.bind(null,e,Gn,Bi),r);break}xo(e,Gn,Bi);break;case 5:xo(e,Gn,Bi);break;default:throw Error(Q(329))}}}return Qn(e,Dt()),e.callbackNode===n?ON.bind(null,e):null}function mv(e,t){var n=zc;return e.current.memoizedState.isDehydrated&&(No(e,t).flags|=256),e=yf(e,t),e!==2&&(t=Gn,Gn=n,t!==null&&gv(t)),e}function gv(e){Gn===null?Gn=e:Gn.push.apply(Gn,e)}function BD(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!Xr(s(),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 Ns(e,t){for(t&=~hy,t&=~kp,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Vr(t),r=1<<n;e[n]=-1,t&=~r}}function Uw(e){if(tt&6)throw Error(Q(327));Va();var t=ef(e,0);if(!(t&1))return Qn(e,Dt()),null;var n=yf(e,t);if(e.tag!==0&&n===2){var r=F0(e);r!==0&&(t=r,n=mv(e,r))}if(n===1)throw n=fu,No(e,0),Ns(e,t),Qn(e,Dt()),n;if(n===6)throw Error(Q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,xo(e,Gn,Bi),Qn(e,Dt()),null}function py(e,t){var n=tt;tt|=1;try{return e(t)}finally{tt=n,tt===0&&(al=Dt()+500,_p&&to())}}function Do(e){Rs!==null&&Rs.tag===0&&!(tt&6)&&Va();var t=tt;tt|=1;var n=Nr.transition,r=ot;try{if(Nr.transition=null,ot=1,e)return e()}finally{ot=r,Nr.transition=n,tt=t,!(tt&6)&&to()}}function my(){or=La.current,xt(La)}function No(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,pD(n)),qt!==null)for(n=qt.return;n!==null;){var r=n;switch(Y1(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&of();break;case 3:sl(),xt(Xn),xt(Nn),iy();break;case 5:ry(r);break;case 4:sl();break;case 13:xt(Ct);break;case 19:xt(Ct);break;case 10:J1(r.type._context);break;case 22:case 23:my()}n=n.return}if(un=e,qt=e=Hs(e.current,null),xn=or=t,Jt=0,fu=null,hy=kp=Lo=0,Gn=zc=null,ko!==null){for(t=0;t<ko.length;t++)if(n=ko[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}ko=null}return e}function BN(e,t){do{var n=qt;try{if(Q1(),Sh.current=mf,pf){for(var r=It.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}pf=!1}if(jo=0,on=Qt=It=null,Bc=!1,uu=0,dy.current=null,n===null||n.return===null){Jt=1,fu=t,qt=null;break}e:{var s=e,o=n.return,a=n,l=t;if(t=xn,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,d=u.tag;if(!(u.mode&1)&&(d===0||d===11||d===15)){var f=u.alternate;f?(u.updateQueue=f.updateQueue,u.memoizedState=f.memoizedState,u.lanes=f.lanes):(u.updateQueue=null,u.memoizedState=null)}var p=Pw(o);if(p!==null){p.flags&=-257,Rw(p,o,a,s,t),p.mode&1&&Tw(s,c,t),t=p,l=c;var m=t.updateQueue;if(m===null){var x=new Set;x.add(l),t.updateQueue=x}else m.add(l);break e}else{if(!(t&1)){Tw(s,c,t),gy();break e}l=Error(Q(426))}}else if(_t&&a.mode&1){var w=Pw(o);if(w!==null){!(w.flags&65536)&&(w.flags|=256),Rw(w,o,a,s,t),X1(ol(l,a));break e}}s=l=ol(l,a),Jt!==4&&(Jt=2),zc===null?zc=[s]:zc.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var v=bN(s,l,t);Sw(s,v);break e;case 1:a=l;var _=s.type,b=s.stateNode;if(!(s.flags&128)&&(typeof _.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(zs===null||!zs.has(b)))){s.flags|=65536,t&=-t,s.lanes|=t;var S=wN(s,a,t);Sw(s,S);break e}}s=s.return}while(s!==null)}FN(n)}catch(C){t=C,qt===n&&n!==null&&(qt=n=n.return);continue}break}while(!0)}function $N(){var e=gf.current;return gf.current=mf,e===null?mf:e}function gy(){(Jt===0||Jt===3||Jt===2)&&(Jt=4),un===null||!(Lo&268435455)&&!(kp&268435455)||Ns(un,xn)}function yf(e,t){var n=tt;tt|=2;var r=$N();(un!==e||xn!==t)&&(Bi=null,No(e,t));do try{$D();break}catch(i){BN(e,i)}while(!0);if(Q1(),tt=n,gf.current=r,qt!==null)throw Error(Q(261));return un=null,xn=0,Jt}function $D(){for(;qt!==null;)zN(qt)}function zD(){for(;qt!==null&&!dL();)zN(qt)}function zN(e){var t=UN(e.alternate,e,or);e.memoizedProps=e.pendingProps,t===null?FN(e):qt=t,dy.current=null}function FN(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=MD(n,t),n!==null){n.flags&=32767,qt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Jt=6,qt=null;return}}else if(n=AD(n,t,or),n!==null){qt=n;return}if(t=t.sibling,t!==null){qt=t;return}qt=t=e}while(t!==null);Jt===0&&(Jt=5)}function xo(e,t,n){var r=ot,i=Nr.transition;try{Nr.transition=null,ot=1,FD(e,t,n,r)}finally{Nr.transition=i,ot=r}return null}function FD(e,t,n,r){do Va();while(Rs!==null);if(tt&6)throw Error(Q(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(Q(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(bL(e,s),e===un&&(qt=un=null,xn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Rd||(Rd=!0,WN(Jh,function(){return Va(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=Nr.transition,Nr.transition=null;var o=ot;ot=1;var a=tt;tt|=4,dy.current=null,LD(e,n),LN(n,e),aD(K0),tf=!!V0,K0=V0=null,e.current=n,DD(n),hL(),tt=a,ot=o,Nr.transition=s}else e.current=n;if(Rd&&(Rd=!1,Rs=e,xf=i),s=e.pendingLanes,s===0&&(zs=null),mL(n.stateNode),Qn(e,Dt()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(vf)throw vf=!1,e=fv,fv=null,e;return xf&1&&e.tag!==0&&Va(),s=e.pendingLanes,s&1?e===pv?Fc++:(Fc=0,pv=e):Fc=0,to(),null}function Va(){if(Rs!==null){var e=bI(xf),t=Nr.transition,n=ot;try{if(Nr.transition=null,ot=16>e?16:e,Rs===null)var r=!1;else{if(e=Rs,Rs=null,xf=0,tt&6)throw Error(Q(331));var i=tt;for(tt|=4,fe=e.current;fe!==null;){var s=fe,o=s.child;if(fe.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(fe=c;fe!==null;){var u=fe;switch(u.tag){case 0:case 11:case 15:$c(8,u,s)}var d=u.child;if(d!==null)d.return=u,fe=d;else for(;fe!==null;){u=fe;var f=u.sibling,p=u.return;if(AN(u),u===c){fe=null;break}if(f!==null){f.return=p,fe=f;break}fe=p}}}var m=s.alternate;if(m!==null){var x=m.child;if(x!==null){m.child=null;do{var w=x.sibling;x.sibling=null,x=w}while(x!==null)}}fe=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,fe=o;else e:for(;fe!==null;){if(s=fe,s.flags&2048)switch(s.tag){case 0:case 11:case 15:$c(9,s,s.return)}var v=s.sibling;if(v!==null){v.return=s.return,fe=v;break e}fe=s.return}}var _=e.current;for(fe=_;fe!==null;){o=fe;var b=o.child;if(o.subtreeFlags&2064&&b!==null)b.return=o,fe=b;else e:for(o=_;fe!==null;){if(a=fe,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Sp(9,a)}}catch(C){Pt(a,a.return,C)}if(a===o){fe=null;break e}var S=a.sibling;if(S!==null){S.return=a.return,fe=S;break e}fe=a.return}}if(tt=i,to(),yi&&typeof yi.onPostCommitFiberRoot=="function")try{yi.onPostCommitFiberRoot(mp,e)}catch{}r=!0}return r}finally{ot=n,Nr.transition=t}}return!1}function Ww(e,t,n){t=ol(n,t),t=bN(e,t,1),e=$s(e,t,1),t=On(),e!==null&&(Bu(e,1,t),Qn(e,t))}function Pt(e,t,n){if(e.tag===3)Ww(e,e,n);else for(;t!==null;){if(t.tag===3){Ww(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(zs===null||!zs.has(r))){e=ol(n,e),e=wN(t,e,1),t=$s(t,e,1),e=On(),t!==null&&(Bu(t,1,e),Qn(t,e));break}}t=t.return}}function HD(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=On(),e.pingedLanes|=e.suspendedLanes&n,un===e&&(xn&n)===n&&(Jt===4||Jt===3&&(xn&130023424)===xn&&500>Dt()-fy?No(e,0):hy|=n),Qn(e,t)}function HN(e,t){t===0&&(e.mode&1?(t=bd,bd<<=1,!(bd&130023424)&&(bd=4194304)):t=1);var n=On();e=Zi(e,t),e!==null&&(Bu(e,t,n),Qn(e,n))}function UD(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),HN(e,n)}function WD(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Q(314))}r!==null&&r.delete(t),HN(e,n)}var UN;UN=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Xn.current)Yn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Yn=!1,RD(e,t,n);Yn=!!(e.flags&131072)}else Yn=!1,_t&&t.flags&1048576&&KI(t,cf,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ch(e,t),e=t.pendingProps;var i=nl(t,Nn.current);qa(t,n),i=oy(null,t,r,e,i,n);var s=ay();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Zn(r)?(s=!0,af(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,ty(t),i.updater=wp,t.stateNode=i,i._reactInternals=t,nv(t,r,e,n),t=sv(null,t,r,!0,s,n)):(t.tag=0,_t&&s&&G1(t),jn(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ch(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=VD(r),e=zr(r,e),i){case 0:t=iv(null,t,r,e,n);break e;case 1:t=jw(null,t,r,e,n);break e;case 11:t=Aw(null,t,r,e,n);break e;case 14:t=Mw(null,t,r,zr(r.type,e),n);break e}throw Error(Q(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:zr(r,i),iv(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:zr(r,i),jw(e,t,r,i,n);case 3:e:{if(EN(t),e===null)throw Error(Q(387));r=t.pendingProps,s=t.memoizedState,i=s.element,JI(e,t),hf(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=ol(Error(Q(423)),t),t=Lw(e,t,r,n,i);break e}else if(r!==i){i=ol(Error(Q(424)),t),t=Lw(e,t,r,n,i);break e}else for(lr=Bs(t.stateNode.containerInfo.firstChild),cr=t,_t=!0,Ur=null,n=ZI(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(rl(),r===i){t=Qi(e,t,n);break e}jn(e,t,r,n)}t=t.child}return t;case 5:return eN(t),e===null&&J0(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,G0(r,i)?o=null:s!==null&&G0(r,s)&&(t.flags|=32),CN(e,t),jn(e,t,o,n),t.child;case 6:return e===null&&J0(t),null;case 13:return IN(e,t,n);case 4:return ny(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=il(t,null,r,n):jn(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:zr(r,i),Aw(e,t,r,i,n);case 7:return jn(e,t,t.pendingProps,n),t.child;case 8:return jn(e,t,t.pendingProps.children,n),t.child;case 12:return jn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,pt(uf,r._currentValue),r._currentValue=o,s!==null)if(Xr(s.value,o)){if(s.children===i.children&&!Xn.current){t=Qi(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=qi(-1,n&-n),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),ev(s.return,n,t),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Q(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),ev(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}jn(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,qa(t,n),i=Rr(i),r=r(i),t.flags|=1,jn(e,t,r,n),t.child;case 14:return r=t.type,i=zr(r,t.pendingProps),i=zr(r.type,i),Mw(e,t,r,i,n);case 15:return SN(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:zr(r,i),Ch(e,t),t.tag=1,Zn(r)?(e=!0,af(t)):e=!1,qa(t,n),_N(t,r,i),nv(t,r,i,n),sv(null,t,r,!0,e,n);case 19:return NN(e,t,n);case 22:return kN(e,t,n)}throw Error(Q(156,t.tag))};function WN(e,t){return vI(e,t)}function qD(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ir(e,t,n,r){return new qD(e,t,n,r)}function vy(e){return e=e.prototype,!(!e||!e.isReactComponent)}function VD(e){if(typeof e=="function")return vy(e)?1:0;if(e!=null){if(e=e.$$typeof,e===D1)return 11;if(e===O1)return 14}return 2}function Hs(e,t){var n=e.alternate;return n===null?(n=Ir(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Nh(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")vy(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Ca:return To(n.children,i,s,t);case L1:o=8,i|=8;break;case E0:return e=Ir(12,n,t,i|2),e.elementType=E0,e.lanes=s,e;case I0:return e=Ir(13,n,t,i),e.elementType=I0,e.lanes=s,e;case N0:return e=Ir(19,n,t,i),e.elementType=N0,e.lanes=s,e;case eI:return Cp(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case QE:o=10;break e;case JE:o=9;break e;case D1:o=11;break e;case O1:o=14;break e;case Ss:o=16,r=null;break e}throw Error(Q(130,e==null?e:typeof e,""))}return t=Ir(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function To(e,t,n,r){return e=Ir(7,e,r,t),e.lanes=n,e}function Cp(e,t,n,r){return e=Ir(22,e,r,t),e.elementType=eI,e.lanes=n,e.stateNode={isHidden:!1},e}function ag(e,t,n){return e=Ir(6,e,null,t),e.lanes=n,e}function lg(e,t,n){return t=Ir(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function KD(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Hm(0),this.expirationTimes=Hm(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hm(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function xy(e,t,n,r,i,s,o,a,l){return e=new KD(e,t,n,a,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Ir(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ty(s),e}function GD(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ka,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function qN(e){if(!e)return Vs;e=e._reactInternals;e:{if(Xo(e)!==e||e.tag!==1)throw Error(Q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Zn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Q(171))}if(e.tag===1){var n=e.type;if(Zn(n))return qI(e,n,t)}return t}function VN(e,t,n,r,i,s,o,a,l){return e=xy(n,r,!0,e,i,s,o,a,l),e.context=qN(null),n=e.current,r=On(),i=Fs(n),s=qi(r,i),s.callback=t??null,$s(n,s,i),e.current.lanes=i,Bu(e,i,r),Qn(e,r),e}function Ep(e,t,n,r){var i=t.current,s=On(),o=Fs(i);return n=qN(n),t.context===null?t.context=n:t.pendingContext=n,t=qi(s,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=$s(i,t,o),e!==null&&(Kr(e,i,o,s),wh(e,i,o)),o}function _f(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function qw(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function yy(e,t){qw(e,t),(e=e.alternate)&&qw(e,t)}function YD(){return null}var KN=typeof reportError=="function"?reportError:function(e){console.error(e)};function _y(e){this._internalRoot=e}Ip.prototype.render=_y.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Q(409));Ep(e,t,null,null)};Ip.prototype.unmount=_y.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Do(function(){Ep(null,e,null,null)}),t[Xi]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=kI();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Is.length&&t!==0&&t<Is[n].priority;n++);Is.splice(n,0,e),n===0&&EI(e)}};function by(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Np(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Vw(){}function XD(e,t,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var c=_f(o);s.call(c)}}var o=VN(t,r,e,0,null,!1,!1,"",Vw);return e._reactRootContainer=o,e[Xi]=o.current,su(e.nodeType===8?e.parentNode:e),Do(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var c=_f(l);a.call(c)}}var l=xy(e,0,!1,null,null,!1,!1,"",Vw);return e._reactRootContainer=l,e[Xi]=l.current,su(e.nodeType===8?e.parentNode:e),Do(function(){Ep(t,l,n,r)}),l}function Tp(e,t,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var a=i;i=function(){var l=_f(o);a.call(l)}}Ep(t,o,e,i)}else o=XD(n,t,e,i,r);return _f(o)}wI=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=wc(t.pendingLanes);n!==0&&(z1(t,n|1),Qn(t,Dt()),!(tt&6)&&(al=Dt()+500,to()))}break;case 13:Do(function(){var r=Zi(e,1);if(r!==null){var i=On();Kr(r,e,1,i)}}),yy(e,1)}};F1=function(e){if(e.tag===13){var t=Zi(e,134217728);if(t!==null){var n=On();Kr(t,e,134217728,n)}yy(e,134217728)}};SI=function(e){if(e.tag===13){var t=Fs(e),n=Zi(e,t);if(n!==null){var r=On();Kr(n,e,t,r)}yy(e,t)}};kI=function(){return ot};CI=function(e,t){var n=ot;try{return ot=e,t()}finally{ot=n}};B0=function(e,t,n){switch(t){case"input":if(R0(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=yp(r);if(!i)throw Error(Q(90));nI(r),R0(r,i)}}}break;case"textarea":iI(e,n);break;case"select":t=n.value,t!=null&&Fa(e,!!n.multiple,t,!1)}};dI=py;hI=Do;var ZD={usingClientEntryPoint:!1,Events:[zu,Ta,yp,cI,uI,py]},ac={findFiberByHostInstance:So,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},QD={bundleType:ac.bundleType,version:ac.version,rendererPackageName:ac.rendererPackageName,rendererConfig:ac.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ss.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=mI(e),e===null?null:e.stateNode},findFiberByHostInstance:ac.findFiberByHostInstance||YD,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ad=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ad.isDisabled&&Ad.supportsFiber)try{mp=Ad.inject(QD),yi=Ad}catch{}}fr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ZD;fr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!by(t))throw Error(Q(200));return GD(e,t,null,n)};fr.createRoot=function(e,t){if(!by(e))throw Error(Q(299));var n=!1,r="",i=KN;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=xy(e,1,!1,null,null,n,!1,r,i),e[Xi]=t.current,su(e.nodeType===8?e.parentNode:e),new _y(t)};fr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Q(188)):(e=Object.keys(e).join(","),Error(Q(268,e)));return e=mI(t),e=e===null?null:e.stateNode,e};fr.flushSync=function(e){return Do(e)};fr.hydrate=function(e,t,n){if(!Np(t))throw Error(Q(200));return Tp(null,e,t,!0,n)};fr.hydrateRoot=function(e,t,n){if(!by(e))throw Error(Q(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=KN;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=VN(t,null,e,1,n??null,i,!1,s,o),e[Xi]=t.current,su(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new Ip(t)};fr.render=function(e,t,n){if(!Np(t))throw Error(Q(200));return Tp(null,e,t,!1,n)};fr.unmountComponentAtNode=function(e){if(!Np(e))throw Error(Q(40));return e._reactRootContainer?(Do(function(){Tp(null,null,e,!1,function(){e._reactRootContainer=null,e[Xi]=null})}),!0):!1};fr.unstable_batchedUpdates=py;fr.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Np(n))throw Error(Q(200));if(e==null||e._reactInternals===void 0)throw Error(Q(38));return Tp(e,t,n,!1,r)};fr.version="18.3.1-next-f1338f8080-20240426";function GN(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(GN)}catch(e){console.error(e)}}GN(),GE.exports=fr;var Oo=GE.exports;const vv=Du(Oo);var Kw=Oo;k0.createRoot=Kw.createRoot,k0.hydrateRoot=Kw.hydrateRoot;const YN="(prefers-color-scheme: dark)",JD=["light","dark","system"],XN="clawd-standalone:theme-source",eO="light",tO={colorPrimary:"#1677ff",colorBgContainer:"#fff",colorText:"#000",colorBorder:"#d9d9d9"};function nO(){try{const e=localStorage.getItem(XN);if(e!==null&&JD.includes(e))return e}catch{}return eO}function rO(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(YN).matches}function Gw(e){return{mode:e==="dark"||e==="system"&&rO()?"dark":"light",...tO}}function iO(e){let t=nO();const n=new Set,r=()=>{const s=Gw(t);for(const o of n)o(s)};typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(YN).addEventListener("change",()=>{t==="system"&&r()});const i={gateway:{call:()=>Promise.reject(new Error("standalone-host: gateway.call not supported"))},self:{call:()=>Promise.reject(new Error("standalone-host: self.call removed; use useDaemonClient()"))},kv:{get:async s=>{const o=localStorage.getItem(`clawd-standalone:kv:${s}`);if(o==null)return null;try{return JSON.parse(o)}catch{return null}},set:async(s,o)=>{localStorage.setItem(`clawd-standalone:kv:${s}`,JSON.stringify(o))}},logger:{info:(s,o)=>{var a;console.info("[ext]",s,o??""),(a=e.logClient)==null||a.push({level:"info",msg:String(s),meta:o})},warn:(s,o)=>{var a;console.warn("[ext]",s,o??""),(a=e.logClient)==null||a.push({level:"warn",msg:String(s),meta:o})},error:(s,o)=>{var a;console.error("[ext]",s,o??""),(a=e.logClient)==null||a.push({level:"error",msg:String(s),meta:o})}},get theme(){return Gw(t)},on(){return()=>{}},onThemeChange(s){return n.add(s),()=>{n.delete(s)}}};return i.getThemeSource=()=>t,i.setThemeSource=s=>{t=s;try{localStorage.setItem(XN,s)}catch{}r()},e.notifier&&(i.notifier=e.notifier),i}const ZN=g.createContext(null);function Yw({host:e,children:t}){return h.jsx(ZN.Provider,{value:e,children:t})}function wy(){const e=g.useContext(ZN);if(!e)throw new Error("HostProvider missing");return e}var QN={exports:{}};/*!
|
|
41
|
+
Copyright (c) 2018 Jed Watson.
|
|
42
|
+
Licensed under the MIT License (MIT), see
|
|
43
|
+
http://jedwatson.github.io/classnames
|
|
44
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var s="",o=0;o<arguments.length;o++){var a=arguments[o];a&&(s=i(s,r(a)))}return s}function r(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return n.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var o="";for(var a in s)t.call(s,a)&&s[a]&&(o=i(o,a));return o}function i(s,o){return o?s?s+" "+o:s+o:s}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(QN);var sO=QN.exports;const oO=Du(sO);function bf(){return bf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bf.apply(null,arguments)}function Rt(e){"@babel/helpers - typeof";return Rt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rt(e)}var aO=Symbol.for("react.element"),lO=Symbol.for("react.transitional.element"),cO=Symbol.for("react.fragment");function uO(e){return e&&Rt(e)==="object"&&(e.$$typeof===aO||e.$$typeof===lO)&&e.type===cO}var xv={},dO=function(t){};function hO(e,t){}function fO(e,t){}function pO(){xv={}}function JN(e,t,n){!t&&!xv[n]&&(e(!1,n),xv[n]=!0)}function Pp(e,t){JN(hO,e,t)}function mO(e,t){JN(fO,e,t)}Pp.preMessage=dO;Pp.resetWarned=pO;Pp.noteOnce=mO;function gO(e,t){if(Rt(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Rt(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function e5(e){var t=gO(e,"string");return Rt(t)=="symbol"?t:t+""}function Ne(e,t,n){return(t=e5(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ve(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xw(Object(n),!0).forEach(function(r){Ne(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xw(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Zw(e){return e instanceof HTMLElement||e instanceof SVGElement}function vO(e){return e&&Rt(e)==="object"&&Zw(e.nativeElement)?e.nativeElement:Zw(e)?e:null}function xO(e){var t=vO(e);if(t)return t;if(e instanceof Qe.Component){var n;return(n=vv.findDOMNode)===null||n===void 0?void 0:n.call(vv,e)}return null}var t5={exports:{}},at={};/**
|
|
45
|
+
* @license React
|
|
46
|
+
* react-is.production.min.js
|
|
47
|
+
*
|
|
48
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
49
|
+
*
|
|
50
|
+
* This source code is licensed under the MIT license found in the
|
|
51
|
+
* LICENSE file in the root directory of this source tree.
|
|
52
|
+
*/var Sy=Symbol.for("react.element"),ky=Symbol.for("react.portal"),Rp=Symbol.for("react.fragment"),Ap=Symbol.for("react.strict_mode"),Mp=Symbol.for("react.profiler"),jp=Symbol.for("react.provider"),Lp=Symbol.for("react.context"),yO=Symbol.for("react.server_context"),Dp=Symbol.for("react.forward_ref"),Op=Symbol.for("react.suspense"),Bp=Symbol.for("react.suspense_list"),$p=Symbol.for("react.memo"),zp=Symbol.for("react.lazy"),_O=Symbol.for("react.offscreen"),n5;n5=Symbol.for("react.module.reference");function jr(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Sy:switch(e=e.type,e){case Rp:case Mp:case Ap:case Op:case Bp:return e;default:switch(e=e&&e.$$typeof,e){case yO:case Lp:case Dp:case zp:case $p:case jp:return e;default:return t}}case ky:return t}}}at.ContextConsumer=Lp;at.ContextProvider=jp;at.Element=Sy;at.ForwardRef=Dp;at.Fragment=Rp;at.Lazy=zp;at.Memo=$p;at.Portal=ky;at.Profiler=Mp;at.StrictMode=Ap;at.Suspense=Op;at.SuspenseList=Bp;at.isAsyncMode=function(){return!1};at.isConcurrentMode=function(){return!1};at.isContextConsumer=function(e){return jr(e)===Lp};at.isContextProvider=function(e){return jr(e)===jp};at.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Sy};at.isForwardRef=function(e){return jr(e)===Dp};at.isFragment=function(e){return jr(e)===Rp};at.isLazy=function(e){return jr(e)===zp};at.isMemo=function(e){return jr(e)===$p};at.isPortal=function(e){return jr(e)===ky};at.isProfiler=function(e){return jr(e)===Mp};at.isStrictMode=function(e){return jr(e)===Ap};at.isSuspense=function(e){return jr(e)===Op};at.isSuspenseList=function(e){return jr(e)===Bp};at.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===Rp||e===Mp||e===Ap||e===Op||e===Bp||e===_O||typeof e=="object"&&e!==null&&(e.$$typeof===zp||e.$$typeof===$p||e.$$typeof===jp||e.$$typeof===Lp||e.$$typeof===Dp||e.$$typeof===n5||e.getModuleId!==void 0)};at.typeOf=jr;t5.exports=at;var cg=t5.exports;function r5(e,t,n){var r=g.useRef({});return(!("value"in r.current)||n(r.current.condition,t))&&(r.current.value=e(),r.current.condition=t),r.current.value}var bO=Number(g.version.split(".")[0]),wO=function(t,n){typeof t=="function"?t(n):Rt(t)==="object"&&t&&"current"in t&&(t.current=n)},SO=function(t){var n,r;if(!t)return!1;if(i5(t)&&bO>=19)return!0;var i=cg.isMemo(t)?t.type.type:t.type;return!(typeof i=="function"&&!((n=i.prototype)!==null&&n!==void 0&&n.render)&&i.$$typeof!==cg.ForwardRef||typeof t=="function"&&!((r=t.prototype)!==null&&r!==void 0&&r.render)&&t.$$typeof!==cg.ForwardRef)};function i5(e){return g.isValidElement(e)&&!uO(e)}var kO=function(t){if(t&&i5(t)){var n=t;return n.props.propertyIsEnumerable("ref")?n.props.ref:n.ref}return null};function Ml(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qw(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,e5(r.key),r)}}function jl(e,t,n){return t&&Qw(e.prototype,t),n&&Qw(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function yv(e,t){return yv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},yv(e,t)}function s5(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&yv(e,t)}function wf(e){return wf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wf(e)}function o5(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(o5=function(){return!!e})()}function _v(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function CO(e,t){if(t&&(Rt(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _v(e)}function a5(e){var t=o5();return function(){var n,r=wf(e);if(t){var i=wf(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return CO(this,n)}}function bv(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function EO(e){if(Array.isArray(e))return bv(e)}function l5(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Cy(e,t){if(e){if(typeof e=="string")return bv(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bv(e,t):void 0}}function IO(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
53
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zo(e){return EO(e)||l5(e)||Cy(e)||IO()}var c5=function(t){return+setTimeout(t,16)},u5=function(t){return clearTimeout(t)};typeof window<"u"&&"requestAnimationFrame"in window&&(c5=function(t){return window.requestAnimationFrame(t)},u5=function(t){return window.cancelAnimationFrame(t)});var Jw=0,Ey=new Map;function d5(e){Ey.delete(e)}var wv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;Jw+=1;var r=Jw;function i(s){if(s===0)d5(r),t();else{var o=c5(function(){i(s-1)});Ey.set(r,o)}}return i(n),r};wv.cancel=function(e){var t=Ey.get(e);return d5(e),u5(t)};function h5(e){if(Array.isArray(e))return e}function NO(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(u){c=!0,i=u}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function f5(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
54
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function st(e,t){return h5(e)||NO(e,t)||Cy(e,t)||f5()}function pu(e){for(var t=0,n,r=0,i=e.length;i>=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}function os(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function TO(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}var eS="data-rc-order",tS="data-rc-priority",PO="rc-util-key",Sv=new Map;function p5(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.mark;return t?t.startsWith("data-")?t:"data-".concat(t):PO}function Fp(e){if(e.attachTo)return e.attachTo;var t=document.querySelector("head");return t||document.body}function RO(e){return e==="queue"?"prependQueue":e?"prepend":"append"}function Iy(e){return Array.from((Sv.get(e)||e).children).filter(function(t){return t.tagName==="STYLE"})}function m5(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!os())return null;var n=t.csp,r=t.prepend,i=t.priority,s=i===void 0?0:i,o=RO(r),a=o==="prependQueue",l=document.createElement("style");l.setAttribute(eS,o),a&&s&&l.setAttribute(tS,"".concat(s)),n!=null&&n.nonce&&(l.nonce=n==null?void 0:n.nonce),l.innerHTML=e;var c=Fp(t),u=c.firstChild;if(r){if(a){var d=(t.styles||Iy(c)).filter(function(f){if(!["prepend","prependQueue"].includes(f.getAttribute(eS)))return!1;var p=Number(f.getAttribute(tS)||0);return s>=p});if(d.length)return c.insertBefore(l,d[d.length-1].nextSibling),l}c.insertBefore(l,u)}else c.appendChild(l);return l}function g5(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=Fp(t);return(t.styles||Iy(n)).find(function(r){return r.getAttribute(p5(t))===e})}function AO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=g5(e,t);if(n){var r=Fp(t);r.removeChild(n)}}function MO(e,t){var n=Sv.get(e);if(!n||!TO(document,n)){var r=m5("",t),i=r.parentNode;Sv.set(e,i),e.removeChild(r)}}function Hc(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=Fp(n),i=Iy(r),s=Ve(Ve({},n),{},{styles:i});MO(r,s);var o=g5(t,s);if(o){var a,l;if((a=s.csp)!==null&&a!==void 0&&a.nonce&&o.nonce!==((l=s.csp)===null||l===void 0?void 0:l.nonce)){var c;o.nonce=(c=s.csp)===null||c===void 0?void 0:c.nonce}return o.innerHTML!==e&&(o.innerHTML=e),o}var u=m5(e,s);return u.setAttribute(p5(s),t),u}function jO(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function kv(e,t){if(e==null)return{};var n,r,i=jO(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function LO(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=new Set;function i(s,o){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,l=r.has(s);if(Pp(!l,"Warning: There may be circular references"),l)return!1;if(s===o)return!0;if(n&&a>1)return!1;r.add(s);var c=a+1;if(Array.isArray(s)){if(!Array.isArray(o)||s.length!==o.length)return!1;for(var u=0;u<s.length;u++)if(!i(s[u],o[u],c))return!1;return!0}if(s&&o&&Rt(s)==="object"&&Rt(o)==="object"){var d=Object.keys(s);return d.length!==Object.keys(o).length?!1:d.every(function(f){return i(s[f],o[f],c)})}return!1}return i(e,t)}var DO="%";function Cv(e){return e.join(DO)}var OO=function(){function e(t){Ml(this,e),Ne(this,"instanceId",void 0),Ne(this,"cache",new Map),Ne(this,"extracted",new Set),this.instanceId=t}return jl(e,[{key:"get",value:function(n){return this.opGet(Cv(n))}},{key:"opGet",value:function(n){return this.cache.get(n)||null}},{key:"update",value:function(n,r){return this.opUpdate(Cv(n),r)}},{key:"opUpdate",value:function(n,r){var i=this.cache.get(n),s=r(i);s===null?this.cache.delete(n):this.cache.set(n,s)}}]),e}(),mu="data-token-hash",Vi="data-css-hash",Eo="__cssinjs_instance__";function BO(){var e=Math.random().toString(12).slice(2);if(typeof document<"u"&&document.head&&document.body){var t=document.body.querySelectorAll("style[".concat(Vi,"]"))||[],n=document.head.firstChild;Array.from(t).forEach(function(i){i[Eo]=i[Eo]||e,i[Eo]===e&&document.head.insertBefore(i,n)});var r={};Array.from(document.querySelectorAll("style[".concat(Vi,"]"))).forEach(function(i){var s=i.getAttribute(Vi);if(r[s]){if(i[Eo]===e){var o;(o=i.parentNode)===null||o===void 0||o.removeChild(i)}}else r[s]=!0})}return new OO(e)}var Hp=g.createContext({hashPriority:"low",cache:BO(),defaultCache:!0});function $O(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var Ny=function(){function e(){Ml(this,e),Ne(this,"cache",void 0),Ne(this,"keys",void 0),Ne(this,"cacheCallTimes",void 0),this.cache=new Map,this.keys=[],this.cacheCallTimes=0}return jl(e,[{key:"size",value:function(){return this.keys.length}},{key:"internalGet",value:function(n){var r,i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o={map:this.cache};return n.forEach(function(a){if(!o)o=void 0;else{var l;o=(l=o)===null||l===void 0||(l=l.map)===null||l===void 0?void 0:l.get(a)}}),(r=o)!==null&&r!==void 0&&r.value&&s&&(o.value[1]=this.cacheCallTimes++),(i=o)===null||i===void 0?void 0:i.value}},{key:"get",value:function(n){var r;return(r=this.internalGet(n,!0))===null||r===void 0?void 0:r[0]}},{key:"has",value:function(n){return!!this.internalGet(n)}},{key:"set",value:function(n,r){var i=this;if(!this.has(n)){if(this.size()+1>e.MAX_CACHE_SIZE+e.MAX_CACHE_OFFSET){var s=this.keys.reduce(function(c,u){var d=st(c,2),f=d[1];return i.internalGet(u)[1]<f?[u,i.internalGet(u)[1]]:c},[this.keys[0],this.cacheCallTimes]),o=st(s,1),a=o[0];this.delete(a)}this.keys.push(n)}var l=this.cache;n.forEach(function(c,u){if(u===n.length-1)l.set(c,{value:[r,i.cacheCallTimes++]});else{var d=l.get(c);d?d.map||(d.map=new Map):l.set(c,{map:new Map}),l=l.get(c).map}})}},{key:"deleteByPath",value:function(n,r){var i=n.get(r[0]);if(r.length===1){var s;return i.map?n.set(r[0],{map:i.map}):n.delete(r[0]),(s=i.value)===null||s===void 0?void 0:s[0]}var o=this.deleteByPath(i.map,r.slice(1));return(!i.map||i.map.size===0)&&!i.value&&n.delete(r[0]),o}},{key:"delete",value:function(n){if(this.has(n))return this.keys=this.keys.filter(function(r){return!$O(r,n)}),this.deleteByPath(this.cache,n)}}]),e}();Ne(Ny,"MAX_CACHE_SIZE",20);Ne(Ny,"MAX_CACHE_OFFSET",5);var nS=0,v5=function(){function e(t){Ml(this,e),Ne(this,"derivatives",void 0),Ne(this,"id",void 0),this.derivatives=Array.isArray(t)?t:[t],this.id=nS,t.length===0&&(t.length>0,void 0),nS+=1}return jl(e,[{key:"getDerivativeToken",value:function(n){return this.derivatives.reduce(function(r,i){return i(n,r)},void 0)}}]),e}(),ug=new Ny;function Ev(e){var t=Array.isArray(e)?e:[e];return ug.has(t)||ug.set(t,new v5(t)),ug.get(t)}var zO=new WeakMap,dg={};function FO(e,t){for(var n=zO,r=0;r<t.length;r+=1){var i=t[r];n.has(i)||n.set(i,new WeakMap),n=n.get(i)}return n.has(dg)||n.set(dg,e()),n.get(dg)}var rS=new WeakMap;function Uc(e){var t=rS.get(e)||"";return t||(Object.keys(e).forEach(function(n){var r=e[n];t+=n,r instanceof v5?t+=r.id:r&&Rt(r)==="object"?t+=Uc(r):t+=r}),t=pu(t),rS.set(e,t)),t}function iS(e,t){return pu("".concat(t,"_").concat(Uc(e)))}var sS=os();function Sf(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(i)return e;var s=Ve(Ve({},r),{},Ne(Ne({},mu,t),Vi,n)),o=Object.keys(s).map(function(a){var l=s[a];return l?"".concat(a,'="').concat(l,'"'):null}).filter(function(a){return a}).join(" ");return"<style ".concat(o,">").concat(e,"</style>")}var HO=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return"--".concat(n?"".concat(n,"-"):"").concat(t).replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z0-9]+)/g,"$1-$2").replace(/([a-z])([A-Z0-9])/g,"$1-$2").toLowerCase()},UO=function(t,n,r){return Object.keys(t).length?".".concat(n).concat(r!=null&&r.scope?".".concat(r.scope):"","{").concat(Object.entries(t).map(function(i){var s=st(i,2),o=s[0],a=s[1];return"".concat(o,":").concat(a,";")}).join(""),"}"):""},WO=function(t,n,r){var i={},s={};return Object.entries(t).forEach(function(o){var a,l,c=st(o,2),u=c[0],d=c[1];if(r!=null&&(a=r.preserve)!==null&&a!==void 0&&a[u])s[u]=d;else if((typeof d=="string"||typeof d=="number")&&!(r!=null&&(l=r.ignore)!==null&&l!==void 0&&l[u])){var f,p=HO(u,r==null?void 0:r.prefix);i[p]=typeof d=="number"&&!(r!=null&&(f=r.unitless)!==null&&f!==void 0&&f[u])?"".concat(d,"px"):String(d),s[u]="var(".concat(p,")")}}),[s,UO(i,n,{scope:r==null?void 0:r.scope})]},oS=os()?g.useLayoutEffect:g.useEffect,qO=function(t,n){var r=g.useRef(!0);oS(function(){return t(r.current)},n),oS(function(){return r.current=!1,function(){r.current=!0}},[])},VO=Ve({},Pl),aS=VO.useInsertionEffect,KO=function(t,n,r){g.useMemo(t,r),qO(function(){return n(!0)},r)},GO=aS?function(e,t,n){return aS(function(){return e(),t()},n)}:KO,YO=Ve({},Pl),XO=YO.useInsertionEffect,ZO=function(t){var n=[],r=!1;function i(s){r||n.push(s)}return g.useEffect(function(){return r=!1,function(){r=!0,n.length&&n.forEach(function(s){return s()})}},t),i},QO=function(){return function(t){t()}},JO=typeof XO<"u"?ZO:QO;function x5(e,t,n,r,i){var s=g.useContext(Hp),o=s.cache,a=[e].concat(Zo(t)),l=Cv(a),c=JO([l]),u=function(m){o.opUpdate(l,function(x){var w=x||[void 0,void 0],v=st(w,2),_=v[0],b=_===void 0?0:_,S=v[1],C=S,k=C||n(),N=[b,k];return m?m(N):N})};g.useMemo(function(){u()},[l]);var d=o.opGet(l),f=d[1];return GO(function(){i==null||i(f)},function(p){return u(function(m){var x=st(m,2),w=x[0],v=x[1];return p&&w===0&&(i==null||i(f)),[w+1,v]}),function(){o.opUpdate(l,function(m){var x=m||[],w=st(x,2),v=w[0],_=v===void 0?0:v,b=w[1],S=_-1;return S===0?(c(function(){(p||!o.opGet(l))&&(r==null||r(b,!1))}),null):[_-1,b]})}},[l]),f}var e6={},t6="css",bo=new Map;function n6(e){bo.set(e,(bo.get(e)||0)+1)}function r6(e,t){if(typeof document<"u"){var n=document.querySelectorAll("style[".concat(mu,'="').concat(e,'"]'));n.forEach(function(r){if(r[Eo]===t){var i;(i=r.parentNode)===null||i===void 0||i.removeChild(r)}})}}var i6=0;function s6(e,t){bo.set(e,(bo.get(e)||0)-1);var n=new Set;bo.forEach(function(r,i){r<=0&&n.add(i)}),bo.size-n.size>i6&&n.forEach(function(r){r6(r,t),bo.delete(r)})}var o6=function(t,n,r,i){var s=r.getDerivativeToken(t),o=Ve(Ve({},s),n);return i&&(o=i(o)),o},y5="token";function a6(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=g.useContext(Hp),i=r.cache.instanceId,s=r.container,o=n.salt,a=o===void 0?"":o,l=n.override,c=l===void 0?e6:l,u=n.formatToken,d=n.getComputedToken,f=n.cssVar,p=FO(function(){return Object.assign.apply(Object,[{}].concat(Zo(t)))},t),m=Uc(p),x=Uc(c),w=f?Uc(f):"",v=x5(y5,[a,e.id,m,x,w],function(){var _,b=d?d(p,c,e):o6(p,c,e,u),S=Ve({},b),C="";if(f){var k=WO(b,f.key,{prefix:f.prefix,ignore:f.ignore,unitless:f.unitless,preserve:f.preserve}),N=st(k,2);b=N[0],C=N[1]}var E=iS(b,a);b._tokenKey=E,S._tokenKey=iS(S,a);var L=(_=f==null?void 0:f.key)!==null&&_!==void 0?_:E;b._themeKey=L,n6(L);var P="".concat(t6,"-").concat(pu(E));return b._hashId=P,[b,P,S,C,(f==null?void 0:f.key)||""]},function(_){s6(_[0]._themeKey,i)},function(_){var b=st(_,4),S=b[0],C=b[3];if(f&&C){var k=Hc(C,pu("css-variables-".concat(S._themeKey)),{mark:Vi,prepend:"queue",attachTo:s,priority:-999});k[Eo]=i,k.setAttribute(mu,S._themeKey)}});return v}var l6=function(t,n,r){var i=st(t,5),s=i[2],o=i[3],a=i[4],l=r||{},c=l.plain;if(!o)return null;var u=s._tokenKey,d=-999,f={"data-rc-order":"prependQueue","data-rc-priority":"".concat(d)},p=Sf(o,a,u,f,c);return[d,u,p]},c6={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},_5="comm",b5="rule",w5="decl",u6="@import",d6="@namespace",h6="@keyframes",f6="@layer",p6=Math.abs,Wc=String.fromCharCode;function S5(e){return e.trim()}function Iv(e,t,n){return e.replace(t,n)}function Ka(e,t){return e.charCodeAt(t)|0}function ll(e,t,n){return e.slice(t,n)}function hi(e){return e.length}function m6(e){return e.length}function Md(e,t){return t.push(e),e}var Up=1,cl=1,k5=0,Mr=0,Ut=0,Ll="";function Ty(e,t,n,r,i,s,o,a){return{value:e,root:t,parent:n,type:r,props:i,children:s,line:Up,column:cl,length:o,return:"",siblings:a}}function g6(){return Ut}function v6(){return Ut=Mr>0?Ka(Ll,--Mr):0,cl--,Ut===10&&(cl=1,Up--),Ut}function Gr(){return Ut=Mr<k5?Ka(Ll,Mr++):0,cl++,Ut===10&&(cl=1,Up++),Ut}function As(){return Ka(Ll,Mr)}function Th(){return Mr}function Wp(e,t){return ll(Ll,e,t)}function gu(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function x6(e){return Up=cl=1,k5=hi(Ll=e),Mr=0,[]}function y6(e){return Ll="",e}function hg(e){return S5(Wp(Mr-1,Nv(e===91?e+2:e===40?e+1:e)))}function _6(e){for(;(Ut=As())&&Ut<33;)Gr();return gu(e)>2||gu(Ut)>3?"":" "}function b6(e,t){for(;--t&&Gr()&&!(Ut<48||Ut>102||Ut>57&&Ut<65||Ut>70&&Ut<97););return Wp(e,Th()+(t<6&&As()==32&&Gr()==32))}function Nv(e){for(;Gr();)switch(Ut){case e:return Mr;case 34:case 39:e!==34&&e!==39&&Nv(Ut);break;case 40:e===41&&Nv(e);break;case 92:Gr();break}return Mr}function w6(e,t){for(;Gr()&&e+Ut!==57;)if(e+Ut===84&&As()===47)break;return"/*"+Wp(t,Mr-1)+"*"+Wc(e===47?e:Gr())}function S6(e){for(;!gu(As());)Gr();return Wp(e,Mr)}function k6(e){return y6(Ph("",null,null,null,[""],e=x6(e),0,[0],e))}function Ph(e,t,n,r,i,s,o,a,l){for(var c=0,u=0,d=o,f=0,p=0,m=0,x=1,w=1,v=1,_=0,b=0,S="",C=i,k=s,N=r,E=S;w;)switch(m=b,b=Gr()){case 40:m!=108&&Ka(E,d-1)==58?(_++,E+="("):E+=hg(b);break;case 41:_--,E+=")";break;case 34:case 39:case 91:E+=hg(b);break;case 9:case 10:case 13:case 32:if(_>0){E+=Wc(b);break}E+=_6(m);break;case 92:E+=b6(Th()-1,7);continue;case 47:switch(As()){case 42:case 47:Md(C6(w6(Gr(),Th()),t,n,l),l),(gu(m||1)==5||gu(As()||1)==5)&&hi(E)&&ll(E,-1,void 0)!==" "&&(E+=" ");break;default:E+="/"}break;case 123*x:a[c++]=hi(E)*v;case 125*x:case 59:case 0:if(_>0&&b){E+=Wc(b);break}switch(b){case 0:case 125:w=0;case 59+u:v==-1&&(E=Iv(E,/\f/g,"")),p>0&&(hi(E)-d||x===0)&&Md(p>32?cS(E+";",r,n,d-1,l):cS(Iv(E," ","")+";",r,n,d-2,l),l);break;case 59:E+=";";default:if(Md(N=lS(E,t,n,c,u,i,a,S,C=[],k=[],d,s),s),b===123)if(u===0)Ph(E,t,N,N,C,s,d,a,k);else{switch(f){case 99:if(Ka(E,3)===110)break;case 108:if(Ka(E,2)===97)break;default:u=0;case 100:case 109:case 115:}u?Ph(e,N,N,r&&Md(lS(e,N,N,0,0,i,a,S,i,C=[],d,k),k),i,k,d,a,r?C:k):Ph(E,N,N,N,[""],k,0,a,k)}}c=u=p=0,x=v=1,S=E="",d=o;break;case 58:d=1+hi(E),p=m;default:if(x<1){if(b==123)--x;else if(b==125&&x++==0&&v6()==125)continue}switch(E+=Wc(b),b*x){case 38:v=u>0?1:(E+="\f",-1);break;case 44:if(_>0)break;a[c++]=(hi(E)-1)*v,v=1;break;case 64:As()===45&&(E+=hg(Gr())),f=As(),u=d=hi(S=E+=S6(Th())),b++;break;case 45:m===45&&hi(E)==2&&(x=0)}}return s}function lS(e,t,n,r,i,s,o,a,l,c,u,d){for(var f=i-1,p=i===0?s:[""],m=m6(p),x=0,w=0,v=0;x<r;++x)for(var _=0,b=ll(e,f+1,f=p6(w=o[x])),S=e;_<m;++_)(S=S5(w>0?p[_]+" "+b:Iv(b,/&\f/g,p[_])))&&(l[v++]=S);return Ty(e,t,n,i===0?b5:a,l,c,u,d)}function C6(e,t,n,r){return Ty(e,t,n,_5,Wc(g6()),ll(e,2,-2),0,r)}function cS(e,t,n,r,i){return Ty(e,t,n,w5,ll(e,0,r),ll(e,r+1,-1),r,i)}function Tv(e,t){for(var n="",r=0;r<e.length;r++)n+=t(e[r],r,e,t)||"";return n}function E6(e,t,n,r){switch(e.type){case f6:if(e.children.length)break;case u6:case d6:case w5:return e.return=e.return||e.value;case _5:return"";case h6:return e.return=e.value+"{"+Tv(e.children,r)+"}";case b5:if(!hi(e.value=e.props.join(",")))return""}return hi(n=Tv(e.children,r))?e.return=e.value+"{"+n+"}":""}var uS="data-ant-cssinjs-cache-path",C5="_FILE_STYLE__",Po,E5=!0;function I6(){if(!Po&&(Po={},os())){var e=document.createElement("div");e.className=uS,e.style.position="fixed",e.style.visibility="hidden",e.style.top="-9999px",document.body.appendChild(e);var t=getComputedStyle(e).content||"";t=t.replace(/^"/,"").replace(/"$/,""),t.split(";").forEach(function(i){var s=i.split(":"),o=st(s,2),a=o[0],l=o[1];Po[a]=l});var n=document.querySelector("style[".concat(uS,"]"));if(n){var r;E5=!1,(r=n.parentNode)===null||r===void 0||r.removeChild(n)}document.body.removeChild(e)}}function N6(e){return I6(),!!Po[e]}function T6(e){var t=Po[e],n=null;if(t&&os())if(E5)n=C5;else{var r=document.querySelector("style[".concat(Vi,'="').concat(Po[e],'"]'));r?n=r.innerHTML:delete Po[e]}return[n,t]}var P6="_skip_check_",I5="_multi_value_";function Rh(e){var t=Tv(k6(e),E6);return t.replace(/\{%%%\:[^;];}/g,";")}function R6(e){return Rt(e)==="object"&&e&&(P6 in e||I5 in e)}function dS(e,t,n){if(!t)return e;var r=".".concat(t),i=n==="low"?":where(".concat(r,")"):r,s=e.split(",").map(function(o){var a,l=o.trim().split(/\s+/),c=l[0]||"",u=((a=c.match(/^\w+/))===null||a===void 0?void 0:a[0])||"";return c="".concat(u).concat(i).concat(c.slice(u.length)),[c].concat(Zo(l.slice(1))).join(" ")});return s.join(",")}var A6=function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{root:!0,parentSelectors:[]},i=r.root,s=r.injectHash,o=r.parentSelectors,a=n.hashId,l=n.layer;n.path;var c=n.hashPriority,u=n.transformers,d=u===void 0?[]:u;n.linters;var f="",p={};function m(v){var _=v.getName(a);if(!p[_]){var b=e(v.style,n,{root:!1,parentSelectors:o}),S=st(b,1),C=S[0];p[_]="@keyframes ".concat(v.getName(a)).concat(C)}}function x(v){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return v.forEach(function(b){Array.isArray(b)?x(b,_):b&&_.push(b)}),_}var w=x(Array.isArray(t)?t:[t]);return w.forEach(function(v){var _=typeof v=="string"&&!i?{}:v;if(typeof _=="string")f+="".concat(_,`
|
|
55
|
+
`);else if(_._keyframe)m(_);else{var b=d.reduce(function(S,C){var k;return(C==null||(k=C.visit)===null||k===void 0?void 0:k.call(C,S))||S},_);Object.keys(b).forEach(function(S){var C=b[S];if(Rt(C)==="object"&&C&&(S!=="animationName"||!C._keyframe)&&!R6(C)){var k=!1,N=S.trim(),E=!1;(i||s)&&a?N.startsWith("@")?k=!0:N==="&"?N=dS("",a,c):N=dS(S,a,c):i&&!a&&(N==="&"||N==="")&&(N="",E=!0);var L=e(C,n,{root:E,injectHash:k,parentSelectors:[].concat(Zo(o),[N])}),P=st(L,2),D=P[0],R=P[1];p=Ve(Ve({},p),R),f+="".concat(N).concat(D)}else{let j=function(z,F){var $=z.replace(/[A-Z]/g,function(I){return"-".concat(I.toLowerCase())}),B=F;!c6[z]&&typeof B=="number"&&B!==0&&(B="".concat(B,"px")),z==="animationName"&&F!==null&&F!==void 0&&F._keyframe&&(m(F),B=F.getName(a)),f+="".concat($,":").concat(B,";")};var A,M=(A=C==null?void 0:C.value)!==null&&A!==void 0?A:C;Rt(C)==="object"&&C!==null&&C!==void 0&&C[I5]&&Array.isArray(M)?M.forEach(function(z){j(S,z)}):j(S,M)}})}}),i?l&&(f&&(f="@layer ".concat(l.name," {").concat(f,"}")),l.dependencies&&(p["@layer ".concat(l.name)]=l.dependencies.map(function(v){return"@layer ".concat(v,", ").concat(l.name,";")}).join(`
|
|
56
|
+
`))):f="{".concat(f,"}"),[f,p]};function M6(e,t){return pu("".concat(e.join("%")).concat(t))}function j6(){return null}var N5="style";function L6(e,t){var n=e.token,r=e.path,i=e.hashId,s=e.layer,o=e.nonce,a=e.clientOnly,l=e.order,c=l===void 0?0:l,u=g.useContext(Hp),d=u.autoClear;u.mock;var f=u.defaultCache,p=u.hashPriority,m=u.container,x=u.ssrInline,w=u.transformers,v=u.linters,_=u.cache,b=u.layer,S=n._tokenKey,C=[S];b&&C.push("layer"),C.push.apply(C,Zo(r));var k=sS,N=x5(N5,C,function(){var R=C.join("|");if(N6(R)){var A=T6(R),M=st(A,2),j=M[0],z=M[1];if(j)return[j,S,z,{},a,c]}var F=t(),$=A6(F,{hashId:i,hashPriority:p,layer:b?s:void 0,path:r.join("-"),transformers:w,linters:v}),B=st($,2),I=B[0],U=B[1],V=Rh(I),O=M6(C,V);return[V,S,O,U,a,c]},function(R,A){var M=st(R,3),j=M[2];(A||d)&&sS&&AO(j,{mark:Vi,attachTo:m})},function(R){var A=st(R,4),M=A[0];A[1];var j=A[2],z=A[3];if(k&&M!==C5){var F={mark:Vi,prepend:b?!1:"queue",attachTo:m,priority:c},$=typeof o=="function"?o():o;$&&(F.csp={nonce:$});var B=[],I=[];Object.keys(z).forEach(function(V){V.startsWith("@layer")?B.push(V):I.push(V)}),B.forEach(function(V){Hc(Rh(z[V]),"_layer-".concat(V),Ve(Ve({},F),{},{prepend:!0}))});var U=Hc(M,j,F);U[Eo]=_.instanceId,U.setAttribute(mu,S),I.forEach(function(V){Hc(Rh(z[V]),"_effect-".concat(V),F)})}}),E=st(N,3),L=E[0],P=E[1],D=E[2];return function(R){var A;return!x||k||!f?A=g.createElement(j6,null):A=g.createElement("style",bf({},Ne(Ne({},mu,P),Vi,D),{dangerouslySetInnerHTML:{__html:L}})),g.createElement(g.Fragment,null,A,R)}}var D6=function(t,n,r){var i=st(t,6),s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],u=i[5],d=r||{},f=d.plain;if(c)return null;var p=s,m={"data-rc-order":"prependQueue","data-rc-priority":"".concat(u)};return p=Sf(s,o,a,m,f),l&&Object.keys(l).forEach(function(x){if(!n[x]){n[x]=!0;var w=Rh(l[x]),v=Sf(w,o,"_effect-".concat(x),m,f);x.startsWith("@layer")?p=v+p:p+=v}}),[u,a,p]},O6="cssVar",B6=function(t,n,r){var i=st(t,4),s=i[1],o=i[2],a=i[3],l=r||{},c=l.plain;if(!s)return null;var u=-999,d={"data-rc-order":"prependQueue","data-rc-priority":"".concat(u)},f=Sf(s,a,o,d,c);return[u,o,f]};Ne(Ne(Ne({},N5,D6),y5,l6),O6,B6);function da(e){return e.notSplit=!0,e}da(["borderTop","borderBottom"]),da(["borderTop"]),da(["borderBottom"]),da(["borderLeft","borderRight"]),da(["borderLeft"]),da(["borderRight"]);var $6=g.createContext({});function z6(e){return h5(e)||l5(e)||Cy(e)||f5()}function Pv(e,t){for(var n=e,r=0;r<t.length;r+=1){if(n==null)return;n=n[t[r]]}return n}function T5(e,t,n,r){if(!t.length)return n;var i=z6(t),s=i[0],o=i.slice(1),a;return!e&&typeof s=="number"?a=[]:Array.isArray(e)?a=Zo(e):a=Ve({},e),r&&n===void 0&&o.length===1?delete a[s][o[0]]:a[s]=T5(a[s],o,n,r),a}function fg(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return t.length&&r&&n===void 0&&!Pv(e,t.slice(0,-1))?e:T5(e,t,n,r)}function F6(e){return Rt(e)==="object"&&e!==null&&Object.getPrototypeOf(e)===Object.prototype}function hS(e){return Array.isArray(e)?[]:{}}var H6=typeof Reflect>"u"?Object.keys:Reflect.ownKeys;function U6(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=hS(t[0]);return t.forEach(function(i){function s(o,a){var l=new Set(a),c=Pv(i,o),u=Array.isArray(c);if(u||F6(c)){if(!l.has(c)){l.add(c);var d=Pv(r,o);u?r=fg(r,o,[]):(!d||Rt(d)!=="object")&&(r=fg(r,o,hS(c))),H6(c).forEach(function(f){s([].concat(Zo(o),[f]),l)})}}else r=fg(r,o,c)}s([])}),r}const W6=g.createContext({}),q6=g.createContext(void 0),nr="${label} is not a valid ${type}",qp={Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:nr,method:nr,array:nr,object:nr,number:nr,date:nr,boolean:nr,integer:nr,float:nr,regexp:nr,email:nr,url:nr,hex:nr},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}}};Object.assign({},qp.Modal);let Ah=[];const fS=()=>Ah.reduce((e,t)=>Object.assign(Object.assign({},e),t),qp.Modal);function V6(e){if(e){const t=Object.assign({},e);return Ah.push(t),fS(),()=>{Ah=Ah.filter(n=>n!==t),fS()}}Object.assign({},qp.Modal)}const P5=g.createContext(void 0),K6="internalMark",G6=e=>{const{locale:t={},children:n,_ANT_MARK__:r}=e;g.useEffect(()=>V6(t==null?void 0:t.Modal),[t]);const i=g.useMemo(()=>Object.assign(Object.assign({},t),{exist:!0}),[t]);return g.createElement(P5.Provider,{value:i},n)},Py={blue:"#1677FF",purple:"#722ED1",cyan:"#13C2C2",green:"#52C41A",magenta:"#EB2F96",pink:"#EB2F96",red:"#F5222D",orange:"#FA8C16",yellow:"#FADB14",volcano:"#FA541C",geekblue:"#2F54EB",gold:"#FAAD14",lime:"#A0D911"},vu=Object.assign(Object.assign({},Py),{colorPrimary:"#1677ff",colorSuccess:"#52c41a",colorWarning:"#faad14",colorError:"#ff4d4f",colorInfo:"#1677ff",colorLink:"",colorTextBase:"",colorBgBase:"",fontFamily:`-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
57
|
+
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
58
|
+
'Noto Color Emoji'`,fontFamilyCode:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0}),rn=Math.round;function pg(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(i=>parseFloat(i));for(let i=0;i<3;i+=1)r[i]=t(r[i]||0,n[i]||"",i);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const pS=(e,t,n)=>n===0?e:e/100;function lc(e,t){const n=t||255;return e>n?n:e<0?0:e}class Et{constructor(t){Ne(this,"isValid",!0),Ne(this,"r",0),Ne(this,"g",0),Ne(this,"b",0),Ne(this,"a",1),Ne(this,"_h",void 0),Ne(this,"_s",void 0),Ne(this,"_l",void 0),Ne(this,"_v",void 0),Ne(this,"_max",void 0),Ne(this,"_min",void 0),Ne(this,"_brightness",void 0);function n(i){return i[0]in t&&i[1]in t&&i[2]in t}if(t)if(typeof t=="string"){let s=function(o){return i.startsWith(o)};var r=s;const i=t.trim();/^#?[A-F\d]{3,8}$/i.test(i)?this.fromHexString(i):s("rgb")?this.fromRgbString(i):s("hsl")?this.fromHslString(i):(s("hsv")||s("hsb"))&&this.fromHsvString(i)}else if(t instanceof Et)this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this._h=t._h,this._s=t._s,this._l=t._l,this._v=t._v;else if(n("rgb"))this.r=lc(t.r),this.g=lc(t.g),this.b=lc(t.b),this.a=typeof t.a=="number"?lc(t.a,1):1;else if(n("hsl"))this.fromHsl(t);else if(n("hsv"))this.fromHsv(t);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(t))}setR(t){return this._sc("r",t)}setG(t){return this._sc("g",t)}setB(t){return this._sc("b",t)}setA(t){return this._sc("a",t,1)}setHue(t){const n=this.toHsv();return n.h=t,this._c(n)}getLuminance(){function t(s){const o=s/255;return o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4)}const n=t(this.r),r=t(this.g),i=t(this.b);return .2126*n+.7152*r+.0722*i}getHue(){if(typeof this._h>"u"){const t=this.getMax()-this.getMin();t===0?this._h=0:this._h=rn(60*(this.r===this.getMax()?(this.g-this.b)/t+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/t+2:(this.r-this.g)/t+4))}return this._h}getSaturation(){if(typeof this._s>"u"){const t=this.getMax()-this.getMin();t===0?this._s=0:this._s=t/this.getMax()}return this._s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(t=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()-t/100;return i<0&&(i=0),this._c({h:n,s:r,l:i,a:this.a})}lighten(t=10){const n=this.getHue(),r=this.getSaturation();let i=this.getLightness()+t/100;return i>1&&(i=1),this._c({h:n,s:r,l:i,a:this.a})}mix(t,n=50){const r=this._c(t),i=n/100,s=a=>(r[a]-this[a])*i+this[a],o={r:rn(s("r")),g:rn(s("g")),b:rn(s("b")),a:rn(s("a")*100)/100};return this._c(o)}tint(t=10){return this.mix({r:255,g:255,b:255,a:1},t)}shade(t=10){return this.mix({r:0,g:0,b:0,a:1},t)}onBackground(t){const n=this._c(t),r=this.a+n.a*(1-this.a),i=s=>rn((this[s]*this.a+n[s]*n.a*(1-this.a))/r);return this._c({r:i("r"),g:i("g"),b:i("b"),a:r})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}clone(){return this._c(this)}toHexString(){let t="#";const n=(this.r||0).toString(16);t+=n.length===2?n:"0"+n;const r=(this.g||0).toString(16);t+=r.length===2?r:"0"+r;const i=(this.b||0).toString(16);if(t+=i.length===2?i:"0"+i,typeof this.a=="number"&&this.a>=0&&this.a<1){const s=rn(this.a*255).toString(16);t+=s.length===2?s:"0"+s}return t}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const t=this.getHue(),n=rn(this.getSaturation()*100),r=rn(this.getLightness()*100);return this.a!==1?`hsla(${t},${n}%,${r}%,${this.a})`:`hsl(${t},${n}%,${r}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(t,n,r){const i=this.clone();return i[t]=lc(n,r),i}_c(t){return new this.constructor(t)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(t){const n=t.replace("#","");function r(i,s){return parseInt(n[i]+n[s||i],16)}n.length<6?(this.r=r(0),this.g=r(1),this.b=r(2),this.a=n[3]?r(3)/255:1):(this.r=r(0,1),this.g=r(2,3),this.b=r(4,5),this.a=n[6]?r(6,7)/255:1)}fromHsl({h:t,s:n,l:r,a:i}){if(this._h=t%360,this._s=n,this._l=r,this.a=typeof i=="number"?i:1,n<=0){const f=rn(r*255);this.r=f,this.g=f,this.b=f}let s=0,o=0,a=0;const l=t/60,c=(1-Math.abs(2*r-1))*n,u=c*(1-Math.abs(l%2-1));l>=0&&l<1?(s=c,o=u):l>=1&&l<2?(s=u,o=c):l>=2&&l<3?(o=c,a=u):l>=3&&l<4?(o=u,a=c):l>=4&&l<5?(s=u,a=c):l>=5&&l<6&&(s=c,a=u);const d=r-c/2;this.r=rn((s+d)*255),this.g=rn((o+d)*255),this.b=rn((a+d)*255)}fromHsv({h:t,s:n,v:r,a:i}){this._h=t%360,this._s=n,this._v=r,this.a=typeof i=="number"?i:1;const s=rn(r*255);if(this.r=s,this.g=s,this.b=s,n<=0)return;const o=t/60,a=Math.floor(o),l=o-a,c=rn(r*(1-n)*255),u=rn(r*(1-n*l)*255),d=rn(r*(1-n*(1-l))*255);switch(a){case 0:this.g=d,this.b=c;break;case 1:this.r=u,this.b=c;break;case 2:this.r=c,this.b=d;break;case 3:this.r=c,this.g=u;break;case 4:this.r=d,this.g=c;break;case 5:default:this.g=c,this.b=u;break}}fromHsvString(t){const n=pg(t,pS);this.fromHsv({h:n[0],s:n[1],v:n[2],a:n[3]})}fromHslString(t){const n=pg(t,pS);this.fromHsl({h:n[0],s:n[1],l:n[2],a:n[3]})}fromRgbString(t){const n=pg(t,(r,i)=>i.includes("%")?rn(r/100*255):r);this.r=n[0],this.g=n[1],this.b=n[2],this.a=n[3]}}var jd=2,mS=.16,Y6=.05,X6=.05,Z6=.15,R5=5,A5=4,Q6=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function gS(e,t,n){var r;return Math.round(e.h)>=60&&Math.round(e.h)<=240?r=n?Math.round(e.h)-jd*t:Math.round(e.h)+jd*t:r=n?Math.round(e.h)+jd*t:Math.round(e.h)-jd*t,r<0?r+=360:r>=360&&(r-=360),r}function vS(e,t,n){if(e.h===0&&e.s===0)return e.s;var r;return n?r=e.s-mS*t:t===A5?r=e.s+mS:r=e.s+Y6*t,r>1&&(r=1),n&&t===R5&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(r*100)/100}function xS(e,t,n){var r;return n?r=e.v+X6*t:r=e.v-Z6*t,r=Math.max(0,Math.min(1,r)),Math.round(r*100)/100}function ul(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[],r=new Et(e),i=r.toHsv(),s=R5;s>0;s-=1){var o=new Et({h:gS(i,s,!0),s:vS(i,s,!0),v:xS(i,s,!0)});n.push(o)}n.push(r);for(var a=1;a<=A5;a+=1){var l=new Et({h:gS(i,a),s:vS(i,a),v:xS(i,a)});n.push(l)}return t.theme==="dark"?Q6.map(function(c){var u=c.index,d=c.amount;return new Et(t.backgroundColor||"#141414").mix(n[u],d).toHexString()}):n.map(function(c){return c.toHexString()})}var mg={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1677FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},Rv=["#fff1f0","#ffccc7","#ffa39e","#ff7875","#ff4d4f","#f5222d","#cf1322","#a8071a","#820014","#5c0011"];Rv.primary=Rv[5];var Av=["#fff2e8","#ffd8bf","#ffbb96","#ff9c6e","#ff7a45","#fa541c","#d4380d","#ad2102","#871400","#610b00"];Av.primary=Av[5];var Mv=["#fff7e6","#ffe7ba","#ffd591","#ffc069","#ffa940","#fa8c16","#d46b08","#ad4e00","#873800","#612500"];Mv.primary=Mv[5];var jv=["#fffbe6","#fff1b8","#ffe58f","#ffd666","#ffc53d","#faad14","#d48806","#ad6800","#874d00","#613400"];jv.primary=jv[5];var Lv=["#feffe6","#ffffb8","#fffb8f","#fff566","#ffec3d","#fadb14","#d4b106","#ad8b00","#876800","#614700"];Lv.primary=Lv[5];var Dv=["#fcffe6","#f4ffb8","#eaff8f","#d3f261","#bae637","#a0d911","#7cb305","#5b8c00","#3f6600","#254000"];Dv.primary=Dv[5];var Ov=["#f6ffed","#d9f7be","#b7eb8f","#95de64","#73d13d","#52c41a","#389e0d","#237804","#135200","#092b00"];Ov.primary=Ov[5];var Bv=["#e6fffb","#b5f5ec","#87e8de","#5cdbd3","#36cfc9","#13c2c2","#08979c","#006d75","#00474f","#002329"];Bv.primary=Bv[5];var $v=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];$v.primary=$v[5];var zv=["#f0f5ff","#d6e4ff","#adc6ff","#85a5ff","#597ef7","#2f54eb","#1d39c4","#10239e","#061178","#030852"];zv.primary=zv[5];var Fv=["#f9f0ff","#efdbff","#d3adf7","#b37feb","#9254de","#722ed1","#531dab","#391085","#22075e","#120338"];Fv.primary=Fv[5];var Hv=["#fff0f6","#ffd6e7","#ffadd2","#ff85c0","#f759ab","#eb2f96","#c41d7f","#9e1068","#780650","#520339"];Hv.primary=Hv[5];var Uv=["#a6a6a6","#999999","#8c8c8c","#808080","#737373","#666666","#404040","#1a1a1a","#000000","#000000"];Uv.primary=Uv[5];var gg={red:Rv,volcano:Av,orange:Mv,gold:jv,yellow:Lv,lime:Dv,green:Ov,cyan:Bv,blue:$v,geekblue:zv,purple:Fv,magenta:Hv,grey:Uv};function M5(e,{generateColorPalettes:t,generateNeutralColorPalettes:n}){const{colorSuccess:r,colorWarning:i,colorError:s,colorInfo:o,colorPrimary:a,colorBgBase:l,colorTextBase:c}=e,u=t(a),d=t(r),f=t(i),p=t(s),m=t(o),x=n(l,c),w=e.colorLink||e.colorInfo,v=t(w),_=new Et(p[1]).mix(new Et(p[3]),50).toHexString();return Object.assign(Object.assign({},x),{colorPrimaryBg:u[1],colorPrimaryBgHover:u[2],colorPrimaryBorder:u[3],colorPrimaryBorderHover:u[4],colorPrimaryHover:u[5],colorPrimary:u[6],colorPrimaryActive:u[7],colorPrimaryTextHover:u[8],colorPrimaryText:u[9],colorPrimaryTextActive:u[10],colorSuccessBg:d[1],colorSuccessBgHover:d[2],colorSuccessBorder:d[3],colorSuccessBorderHover:d[4],colorSuccessHover:d[4],colorSuccess:d[6],colorSuccessActive:d[7],colorSuccessTextHover:d[8],colorSuccessText:d[9],colorSuccessTextActive:d[10],colorErrorBg:p[1],colorErrorBgHover:p[2],colorErrorBgFilledHover:_,colorErrorBgActive:p[3],colorErrorBorder:p[3],colorErrorBorderHover:p[4],colorErrorHover:p[5],colorError:p[6],colorErrorActive:p[7],colorErrorTextHover:p[8],colorErrorText:p[9],colorErrorTextActive:p[10],colorWarningBg:f[1],colorWarningBgHover:f[2],colorWarningBorder:f[3],colorWarningBorderHover:f[4],colorWarningHover:f[4],colorWarning:f[6],colorWarningActive:f[7],colorWarningTextHover:f[8],colorWarningText:f[9],colorWarningTextActive:f[10],colorInfoBg:m[1],colorInfoBgHover:m[2],colorInfoBorder:m[3],colorInfoBorderHover:m[4],colorInfoHover:m[4],colorInfo:m[6],colorInfoActive:m[7],colorInfoTextHover:m[8],colorInfoText:m[9],colorInfoTextActive:m[10],colorLinkHover:v[4],colorLink:v[6],colorLinkActive:v[7],colorBgMask:new Et("#000").setA(.45).toRgbString(),colorWhite:"#fff"})}const J6=e=>{let t=e,n=e,r=e,i=e;return e<6&&e>=5?t=e+1:e<16&&e>=6?t=e+2:e>=16&&(t=16),e<7&&e>=5?n=4:e<8&&e>=7?n=5:e<14&&e>=8?n=6:e<16&&e>=14?n=7:e>=16&&(n=8),e<6&&e>=2?r=1:e>=6&&(r=2),e>4&&e<8?i=4:e>=8&&(i=6),{borderRadius:e,borderRadiusXS:r,borderRadiusSM:n,borderRadiusLG:t,borderRadiusOuter:i}};function e8(e){const{motionUnit:t,motionBase:n,borderRadius:r,lineWidth:i}=e;return Object.assign({motionDurationFast:`${(n+t).toFixed(1)}s`,motionDurationMid:`${(n+t*2).toFixed(1)}s`,motionDurationSlow:`${(n+t*3).toFixed(1)}s`,lineWidthBold:i+1},J6(r))}const t8=e=>{const{controlHeight:t}=e;return{controlHeightSM:t*.75,controlHeightXS:t*.5,controlHeightLG:t*1.25}};function n8(e){return(e+8)/e}function r8(e){const t=Array.from({length:10}).map((n,r)=>{const i=r-1,s=e*Math.pow(Math.E,i/5),o=r>1?Math.floor(s):Math.ceil(s);return Math.floor(o/2)*2});return t[1]=e,t.map(n=>({size:n,lineHeight:n8(n)}))}const i8=e=>{const t=r8(e),n=t.map(u=>u.size),r=t.map(u=>u.lineHeight),i=n[1],s=n[0],o=n[2],a=r[1],l=r[0],c=r[2];return{fontSizeSM:s,fontSize:i,fontSizeLG:o,fontSizeXL:n[3],fontSizeHeading1:n[6],fontSizeHeading2:n[5],fontSizeHeading3:n[4],fontSizeHeading4:n[3],fontSizeHeading5:n[2],lineHeight:a,lineHeightLG:c,lineHeightSM:l,fontHeight:Math.round(a*i),fontHeightLG:Math.round(c*o),fontHeightSM:Math.round(l*s),lineHeightHeading1:r[6],lineHeightHeading2:r[5],lineHeightHeading3:r[4],lineHeightHeading4:r[3],lineHeightHeading5:r[2]}};function s8(e){const{sizeUnit:t,sizeStep:n}=e;return{sizeXXL:t*(n+8),sizeXL:t*(n+4),sizeLG:t*(n+2),sizeMD:t*(n+1),sizeMS:t*n,size:t*n,sizeSM:t*(n-1),sizeXS:t*(n-2),sizeXXS:t*(n-3)}}const yr=(e,t)=>new Et(e).setA(t).toRgbString(),cc=(e,t)=>new Et(e).darken(t).toHexString(),o8=e=>{const t=ul(e);return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[4],6:t[5],7:t[6],8:t[4],9:t[5],10:t[6]}},a8=(e,t)=>{const n=e||"#fff",r=t||"#000";return{colorBgBase:n,colorTextBase:r,colorText:yr(r,.88),colorTextSecondary:yr(r,.65),colorTextTertiary:yr(r,.45),colorTextQuaternary:yr(r,.25),colorFill:yr(r,.15),colorFillSecondary:yr(r,.06),colorFillTertiary:yr(r,.04),colorFillQuaternary:yr(r,.02),colorBgSolid:yr(r,1),colorBgSolidHover:yr(r,.75),colorBgSolidActive:yr(r,.95),colorBgLayout:cc(n,4),colorBgContainer:cc(n,0),colorBgElevated:cc(n,0),colorBgSpotlight:yr(r,.85),colorBgBlur:"transparent",colorBorder:cc(n,15),colorBorderSecondary:cc(n,6)}};function Ry(e){mg.pink=mg.magenta,gg.pink=gg.magenta;const t=Object.keys(Py).map(n=>{const r=e[n]===mg[n]?gg[n]:ul(e[n]);return Array.from({length:10},()=>1).reduce((i,s,o)=>(i[`${n}-${o+1}`]=r[o],i[`${n}${o+1}`]=r[o],i),{})}).reduce((n,r)=>(n=Object.assign(Object.assign({},n),r),n),{});return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e),t),M5(e,{generateColorPalettes:o8,generateNeutralColorPalettes:a8})),i8(e.fontSize)),s8(e)),t8(e)),e8(e))}const j5=Ev(Ry),kf={token:vu,override:{override:vu},hashed:!0},L5=Qe.createContext(kf),Wv="ant",D5="anticon",l8=(e,t)=>t||(e?`${Wv}-${e}`:Wv),Vp=g.createContext({getPrefixCls:l8,iconPrefixCls:D5}),{Consumer:Ede}=Vp,c8=`-ant-${Date.now()}-${Math.random()}`;function u8(e,t){const n={},r=(o,a)=>{let l=o.clone();return l=(a==null?void 0:a(l))||l,l.toRgbString()},i=(o,a)=>{const l=new Et(o),c=ul(l.toRgbString());n[`${a}-color`]=r(l),n[`${a}-color-disabled`]=c[1],n[`${a}-color-hover`]=c[4],n[`${a}-color-active`]=c[6],n[`${a}-color-outline`]=l.clone().setA(.2).toRgbString(),n[`${a}-color-deprecated-bg`]=c[0],n[`${a}-color-deprecated-border`]=c[2]};if(t.primaryColor){i(t.primaryColor,"primary");const o=new Et(t.primaryColor),a=ul(o.toRgbString());a.forEach((c,u)=>{n[`primary-${u+1}`]=c}),n["primary-color-deprecated-l-35"]=r(o,c=>c.lighten(35)),n["primary-color-deprecated-l-20"]=r(o,c=>c.lighten(20)),n["primary-color-deprecated-t-20"]=r(o,c=>c.tint(20)),n["primary-color-deprecated-t-50"]=r(o,c=>c.tint(50)),n["primary-color-deprecated-f-12"]=r(o,c=>c.setA(c.a*.12));const l=new Et(a[0]);n["primary-color-active-deprecated-f-30"]=r(l,c=>c.setA(c.a*.3)),n["primary-color-active-deprecated-d-02"]=r(l,c=>c.darken(2))}return t.successColor&&i(t.successColor,"success"),t.warningColor&&i(t.warningColor,"warning"),t.errorColor&&i(t.errorColor,"error"),t.infoColor&&i(t.infoColor,"info"),`
|
|
59
|
+
:root {
|
|
60
|
+
${Object.keys(n).map(o=>`--${e}-${o}: ${n[o]};`).join(`
|
|
61
|
+
`)}
|
|
62
|
+
}
|
|
63
|
+
`.trim()}function d8(e,t){const n=u8(e,t);os()&&Hc(n,`${c8}-dynamic-theme`)}const qv=g.createContext(!1),h8=({children:e,disabled:t})=>{const n=g.useContext(qv);return g.createElement(qv.Provider,{value:t??n},e)},xu=g.createContext(void 0),f8=({children:e,size:t})=>{const n=g.useContext(xu);return g.createElement(xu.Provider,{value:t||n},e)};function p8(){const e=g.useContext(qv),t=g.useContext(xu);return{componentDisabled:e,componentSize:t}}function Vv(e){var t=g.useRef();t.current=e;var n=g.useCallback(function(){for(var r,i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];return(r=t.current)===null||r===void 0?void 0:r.call.apply(r,[t].concat(s))},[]);return n}function Kv(e){var t=g.useRef(!1),n=g.useState(e),r=st(n,2),i=r[0],s=r[1];g.useEffect(function(){return t.current=!1,function(){t.current=!0}},[]);function o(a,l){l&&t.current||s(a)}return[i,o]}var m8=1e3*60*10,g8=function(){function e(){Ml(this,e),Ne(this,"map",new Map),Ne(this,"objectIDMap",new WeakMap),Ne(this,"nextID",0),Ne(this,"lastAccessBeat",new Map),Ne(this,"accessBeat",0)}return jl(e,[{key:"set",value:function(n,r){this.clear();var i=this.getCompositeKey(n);this.map.set(i,r),this.lastAccessBeat.set(i,Date.now())}},{key:"get",value:function(n){var r=this.getCompositeKey(n),i=this.map.get(r);return this.lastAccessBeat.set(r,Date.now()),this.accessBeat+=1,i}},{key:"getCompositeKey",value:function(n){var r=this,i=n.map(function(s){return s&&Rt(s)==="object"?"obj_".concat(r.getObjectID(s)):"".concat(Rt(s),"_").concat(s)});return i.join("|")}},{key:"getObjectID",value:function(n){if(this.objectIDMap.has(n))return this.objectIDMap.get(n);var r=this.nextID;return this.objectIDMap.set(n,r),this.nextID+=1,r}},{key:"clear",value:function(){var n=this;if(this.accessBeat>1e4){var r=Date.now();this.lastAccessBeat.forEach(function(i,s){r-i>m8&&(n.map.delete(s),n.lastAccessBeat.delete(s))}),this.accessBeat=0}}}]),e}();new g8;const v8="5.29.3";function vg(e){return e>=0&&e<=255}function Ld(e,t){const{r:n,g:r,b:i,a:s}=new Et(e).toRgb();if(s<1)return e;const{r:o,g:a,b:l}=new Et(t).toRgb();for(let c=.01;c<=1;c+=.01){const u=Math.round((n-o*(1-c))/c),d=Math.round((r-a*(1-c))/c),f=Math.round((i-l*(1-c))/c);if(vg(u)&&vg(d)&&vg(f))return new Et({r:u,g:d,b:f,a:Math.round(c*100)/100}).toRgbString()}return new Et({r:n,g:r,b:i,a:1}).toRgbString()}var x8=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};function O5(e){const{override:t}=e,n=x8(e,["override"]),r=Object.assign({},t);Object.keys(vu).forEach(f=>{delete r[f]});const i=Object.assign(Object.assign({},n),r),s=480,o=576,a=768,l=992,c=1200,u=1600;if(i.motion===!1){const f="0s";i.motionDurationFast=f,i.motionDurationMid=f,i.motionDurationSlow=f}return Object.assign(Object.assign(Object.assign({},i),{colorFillContent:i.colorFillSecondary,colorFillContentHover:i.colorFill,colorFillAlter:i.colorFillQuaternary,colorBgContainerDisabled:i.colorFillTertiary,colorBorderBg:i.colorBgContainer,colorSplit:Ld(i.colorBorderSecondary,i.colorBgContainer),colorTextPlaceholder:i.colorTextQuaternary,colorTextDisabled:i.colorTextQuaternary,colorTextHeading:i.colorText,colorTextLabel:i.colorTextSecondary,colorTextDescription:i.colorTextTertiary,colorTextLightSolid:i.colorWhite,colorHighlight:i.colorError,colorBgTextHover:i.colorFillSecondary,colorBgTextActive:i.colorFill,colorIcon:i.colorTextTertiary,colorIconHover:i.colorText,colorErrorOutline:Ld(i.colorErrorBg,i.colorBgContainer),colorWarningOutline:Ld(i.colorWarningBg,i.colorBgContainer),fontSizeIcon:i.fontSizeSM,lineWidthFocus:i.lineWidth*3,lineWidth:i.lineWidth,controlOutlineWidth:i.lineWidth*2,controlInteractiveSize:i.controlHeight/2,controlItemBgHover:i.colorFillTertiary,controlItemBgActive:i.colorPrimaryBg,controlItemBgActiveHover:i.colorPrimaryBgHover,controlItemBgActiveDisabled:i.colorFill,controlTmpOutline:i.colorFillQuaternary,controlOutline:Ld(i.colorPrimaryBg,i.colorBgContainer),lineType:i.lineType,borderRadius:i.borderRadius,borderRadiusXS:i.borderRadiusXS,borderRadiusSM:i.borderRadiusSM,borderRadiusLG:i.borderRadiusLG,fontWeightStrong:600,opacityLoading:.65,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",controlPaddingHorizontal:12,controlPaddingHorizontalSM:8,paddingXXS:i.sizeXXS,paddingXS:i.sizeXS,paddingSM:i.sizeSM,padding:i.size,paddingMD:i.sizeMD,paddingLG:i.sizeLG,paddingXL:i.sizeXL,paddingContentHorizontalLG:i.sizeLG,paddingContentVerticalLG:i.sizeMS,paddingContentHorizontal:i.sizeMS,paddingContentVertical:i.sizeSM,paddingContentHorizontalSM:i.size,paddingContentVerticalSM:i.sizeXS,marginXXS:i.sizeXXS,marginXS:i.sizeXS,marginSM:i.sizeSM,margin:i.size,marginMD:i.sizeMD,marginLG:i.sizeLG,marginXL:i.sizeXL,marginXXL:i.sizeXXL,boxShadow:`
|
|
64
|
+
0 6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
65
|
+
0 3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
66
|
+
0 9px 28px 8px rgba(0, 0, 0, 0.05)
|
|
67
|
+
`,boxShadowSecondary:`
|
|
68
|
+
0 6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
69
|
+
0 3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
70
|
+
0 9px 28px 8px rgba(0, 0, 0, 0.05)
|
|
71
|
+
`,boxShadowTertiary:`
|
|
72
|
+
0 1px 2px 0 rgba(0, 0, 0, 0.03),
|
|
73
|
+
0 1px 6px -1px rgba(0, 0, 0, 0.02),
|
|
74
|
+
0 2px 4px 0 rgba(0, 0, 0, 0.02)
|
|
75
|
+
`,screenXS:s,screenXSMin:s,screenXSMax:o-1,screenSM:o,screenSMMin:o,screenSMMax:a-1,screenMD:a,screenMDMin:a,screenMDMax:l-1,screenLG:l,screenLGMin:l,screenLGMax:c-1,screenXL:c,screenXLMin:c,screenXLMax:u-1,screenXXL:u,screenXXLMin:u,boxShadowPopoverArrow:"2px 2px 5px rgba(0, 0, 0, 0.05)",boxShadowCard:`
|
|
76
|
+
0 1px 2px -2px ${new Et("rgba(0, 0, 0, 0.16)").toRgbString()},
|
|
77
|
+
0 3px 6px 0 ${new Et("rgba(0, 0, 0, 0.12)").toRgbString()},
|
|
78
|
+
0 5px 12px 4px ${new Et("rgba(0, 0, 0, 0.09)").toRgbString()}
|
|
79
|
+
`,boxShadowDrawerRight:`
|
|
80
|
+
-6px 0 16px 0 rgba(0, 0, 0, 0.08),
|
|
81
|
+
-3px 0 6px -4px rgba(0, 0, 0, 0.12),
|
|
82
|
+
-9px 0 28px 8px rgba(0, 0, 0, 0.05)
|
|
83
|
+
`,boxShadowDrawerLeft:`
|
|
84
|
+
6px 0 16px 0 rgba(0, 0, 0, 0.08),
|
|
85
|
+
3px 0 6px -4px rgba(0, 0, 0, 0.12),
|
|
86
|
+
9px 0 28px 8px rgba(0, 0, 0, 0.05)
|
|
87
|
+
`,boxShadowDrawerUp:`
|
|
88
|
+
0 6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
89
|
+
0 3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
90
|
+
0 9px 28px 8px rgba(0, 0, 0, 0.05)
|
|
91
|
+
`,boxShadowDrawerDown:`
|
|
92
|
+
0 -6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
93
|
+
0 -3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
94
|
+
0 -9px 28px 8px rgba(0, 0, 0, 0.05)
|
|
95
|
+
`,boxShadowTabsOverflowLeft:"inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowRight:"inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowTop:"inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowBottom:"inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"}),r)}var yS=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const y8={lineHeight:!0,lineHeightSM:!0,lineHeightLG:!0,lineHeightHeading1:!0,lineHeightHeading2:!0,lineHeightHeading3:!0,lineHeightHeading4:!0,lineHeightHeading5:!0,opacityLoading:!0,fontWeightStrong:!0,zIndexPopupBase:!0,zIndexBase:!0,opacityImage:!0},_8={motionBase:!0,motionUnit:!0},b8={screenXS:!0,screenXSMin:!0,screenXSMax:!0,screenSM:!0,screenSMMin:!0,screenSMMax:!0,screenMD:!0,screenMDMin:!0,screenMDMax:!0,screenLG:!0,screenLGMin:!0,screenLGMax:!0,screenXL:!0,screenXLMin:!0,screenXLMax:!0,screenXXL:!0,screenXXLMin:!0},B5=(e,t,n)=>{const r=n.getDerivativeToken(e),{override:i}=t,s=yS(t,["override"]);let o=Object.assign(Object.assign({},r),{override:i});return o=O5(o),s&&Object.entries(s).forEach(([a,l])=>{const{theme:c}=l,u=yS(l,["theme"]);let d=u;c&&(d=B5(Object.assign(Object.assign({},o),u),{override:u},c)),o[a]=d}),o};function $5(){const{token:e,hashed:t,theme:n,override:r,cssVar:i}=Qe.useContext(L5),s=`${v8}-${t||""}`,o=n||j5,[a,l,c]=a6(o,[vu,e],{salt:s,override:r,getComputedToken:B5,formatToken:O5,cssVar:i&&{prefix:i.prefix,key:i.key,unitless:y8,ignore:_8,preserve:b8}});return[o,c,t?l:"",a,i]}const w8=()=>({display:"inline-flex",alignItems:"center",color:"inherit",fontStyle:"normal",lineHeight:0,textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizeLegibility","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale","> *":{lineHeight:1},svg:{display:"inline-block"}}),S8=e=>({[`.${e}`]:Object.assign(Object.assign({},w8()),{[`.${e} .${e}-icon`]:{display:"block"}})}),k8=(e,t)=>{const[n,r]=$5();return L6({token:r,hashId:"",path:["ant-design-icons",e],nonce:()=>t==null?void 0:t.nonce,layer:{name:"antd"}},()=>S8(e))},C8=Object.assign({},Pl),{useId:_S}=C8,E8=()=>"",I8=typeof _S>"u"?E8:_S;function N8(e,t,n){var r;const i=e||{},s=i.inherit===!1||!t?Object.assign(Object.assign({},kf),{hashed:(r=t==null?void 0:t.hashed)!==null&&r!==void 0?r:kf.hashed,cssVar:t==null?void 0:t.cssVar}):t,o=I8();return r5(()=>{var a,l;if(!e)return t;const c=Object.assign({},s.components);Object.keys(e.components||{}).forEach(f=>{c[f]=Object.assign(Object.assign({},c[f]),e.components[f])});const u=`css-var-${o.replace(/:/g,"")}`,d=((a=i.cssVar)!==null&&a!==void 0?a:s.cssVar)&&Object.assign(Object.assign(Object.assign({prefix:n==null?void 0:n.prefixCls},typeof s.cssVar=="object"?s.cssVar:{}),typeof i.cssVar=="object"?i.cssVar:{}),{key:typeof i.cssVar=="object"&&((l=i.cssVar)===null||l===void 0?void 0:l.key)||u});return Object.assign(Object.assign(Object.assign({},s),i),{token:Object.assign(Object.assign({},s.token),i.token),components:c,cssVar:d})},[i,s],(a,l)=>a.some((c,u)=>{const d=l[u];return!LO(c,d,!0)}))}var T8=["children"],z5=g.createContext({});function P8(e){var t=e.children,n=kv(e,T8);return g.createElement(z5.Provider,{value:n},t)}var R8=function(e){s5(n,e);var t=a5(n);function n(){return Ml(this,n),t.apply(this,arguments)}return jl(n,[{key:"render",value:function(){return this.props.children}}]),n}(g.Component);function A8(e){var t=g.useReducer(function(a){return a+1},0),n=st(t,2),r=n[1],i=g.useRef(e),s=Vv(function(){return i.current}),o=Vv(function(a){i.current=typeof a=="function"?a(i.current):a,r()});return[s,o]}var bs="none",Dd="appear",Od="enter",Bd="leave",bS="none",Hr="prepare",Da="start",Oa="active",Ay="end",F5="prepared";function wS(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}function M8(e,t){var n={animationend:wS("Animation","AnimationEnd"),transitionend:wS("Transition","TransitionEnd")};return e&&("AnimationEvent"in t||delete n.animationend.animation,"TransitionEvent"in t||delete n.transitionend.transition),n}var j8=M8(os(),typeof window<"u"?window:{}),H5={};if(os()){var L8=document.createElement("div");H5=L8.style}var $d={};function U5(e){if($d[e])return $d[e];var t=j8[e];if(t)for(var n=Object.keys(t),r=n.length,i=0;i<r;i+=1){var s=n[i];if(Object.prototype.hasOwnProperty.call(t,s)&&s in H5)return $d[e]=t[s],$d[e]}return""}var W5=U5("animationend"),q5=U5("transitionend"),V5=!!(W5&&q5),SS=W5||"animationend",kS=q5||"transitionend";function CS(e,t){if(!e)return null;if(Rt(e)==="object"){var n=t.replace(/-\w/g,function(r){return r[1].toUpperCase()});return e[n]}return"".concat(e,"-").concat(t)}const D8=function(e){var t=g.useRef();function n(i){i&&(i.removeEventListener(kS,e),i.removeEventListener(SS,e))}function r(i){t.current&&t.current!==i&&n(t.current),i&&i!==t.current&&(i.addEventListener(kS,e),i.addEventListener(SS,e),t.current=i)}return g.useEffect(function(){return function(){n(t.current)}},[]),[r,n]};var K5=os()?g.useLayoutEffect:g.useEffect;const O8=function(){var e=g.useRef(null);function t(){wv.cancel(e.current)}function n(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;t();var s=wv(function(){i<=1?r({isCanceled:function(){return s!==e.current}}):n(r,i-1)});e.current=s}return g.useEffect(function(){return function(){t()}},[]),[n,t]};var B8=[Hr,Da,Oa,Ay],$8=[Hr,F5],G5=!1,z8=!0;function Y5(e){return e===Oa||e===Ay}const F8=function(e,t,n){var r=Kv(bS),i=st(r,2),s=i[0],o=i[1],a=O8(),l=st(a,2),c=l[0],u=l[1];function d(){o(Hr,!0)}var f=t?$8:B8;return K5(function(){if(s!==bS&&s!==Ay){var p=f.indexOf(s),m=f[p+1],x=n(s);x===G5?o(m,!0):m&&c(function(w){function v(){w.isCanceled()||o(m,!0)}x===!0?v():Promise.resolve(x).then(v)})}},[e,s]),g.useEffect(function(){return function(){u()}},[]),[d,s]};function H8(e,t,n,r){var i=r.motionEnter,s=i===void 0?!0:i,o=r.motionAppear,a=o===void 0?!0:o,l=r.motionLeave,c=l===void 0?!0:l,u=r.motionDeadline,d=r.motionLeaveImmediately,f=r.onAppearPrepare,p=r.onEnterPrepare,m=r.onLeavePrepare,x=r.onAppearStart,w=r.onEnterStart,v=r.onLeaveStart,_=r.onAppearActive,b=r.onEnterActive,S=r.onLeaveActive,C=r.onAppearEnd,k=r.onEnterEnd,N=r.onLeaveEnd,E=r.onVisibleChanged,L=Kv(),P=st(L,2),D=P[0],R=P[1],A=A8(bs),M=st(A,2),j=M[0],z=M[1],F=Kv(null),$=st(F,2),B=$[0],I=$[1],U=j(),V=g.useRef(!1),O=g.useRef(null);function ne(){return n()}var ae=g.useRef(!1);function Y(){z(bs),I(null,!0)}var ye=Vv(function(ke){var Fe=j();if(Fe!==bs){var yt=ne();if(!(ke&&!ke.deadline&&ke.target!==yt)){var tn=ae.current,hn;Fe===Dd&&tn?hn=C==null?void 0:C(yt,ke):Fe===Od&&tn?hn=k==null?void 0:k(yt,ke):Fe===Bd&&tn&&(hn=N==null?void 0:N(yt,ke)),tn&&hn!==!1&&Y()}}}),Ce=D8(ye),oe=st(Ce,1),je=oe[0],Ae=function(Fe){switch(Fe){case Dd:return Ne(Ne(Ne({},Hr,f),Da,x),Oa,_);case Od:return Ne(Ne(Ne({},Hr,p),Da,w),Oa,b);case Bd:return Ne(Ne(Ne({},Hr,m),Da,v),Oa,S);default:return{}}},De=g.useMemo(function(){return Ae(U)},[U]),xe=F8(U,!e,function(ke){if(ke===Hr){var Fe=De[Hr];return Fe?Fe(ne()):G5}if(Ze in De){var yt;I(((yt=De[Ze])===null||yt===void 0?void 0:yt.call(De,ne(),null))||null)}return Ze===Oa&&U!==bs&&(je(ne()),u>0&&(clearTimeout(O.current),O.current=setTimeout(function(){ye({deadline:!0})},u))),Ze===F5&&Y(),z8}),Ke=st(xe,2),rt=Ke[0],Ze=Ke[1],ht=Y5(Ze);ae.current=ht;var Kt=g.useRef(null);K5(function(){if(!(V.current&&Kt.current===t)){R(t);var ke=V.current;V.current=!0;var Fe;!ke&&t&&a&&(Fe=Dd),ke&&t&&s&&(Fe=Od),(ke&&!t&&c||!ke&&d&&!t&&c)&&(Fe=Bd);var yt=Ae(Fe);Fe&&(e||yt[Hr])?(z(Fe),rt()):z(bs),Kt.current=t}},[t]),g.useEffect(function(){(U===Dd&&!a||U===Od&&!s||U===Bd&&!c)&&z(bs)},[a,s,c]),g.useEffect(function(){return function(){V.current=!1,clearTimeout(O.current)}},[]);var de=g.useRef(!1);g.useEffect(function(){D&&(de.current=!0),D!==void 0&&U===bs&&((de.current||D)&&(E==null||E(D)),de.current=!0)},[D,U]);var ze=B;return De[Hr]&&Ze===Da&&(ze=Ve({transition:"none"},ze)),[U,Ze,ze,D??t]}function U8(e){var t=e;Rt(e)==="object"&&(t=e.transitionSupport);function n(i,s){return!!(i.motionName&&t&&s!==!1)}var r=g.forwardRef(function(i,s){var o=i.visible,a=o===void 0?!0:o,l=i.removeOnLeave,c=l===void 0?!0:l,u=i.forceRender,d=i.children,f=i.motionName,p=i.leavedClassName,m=i.eventProps,x=g.useContext(z5),w=x.motion,v=n(i,w),_=g.useRef(),b=g.useRef();function S(){try{return _.current instanceof HTMLElement?_.current:xO(b.current)}catch{return null}}var C=H8(v,a,S,i),k=st(C,4),N=k[0],E=k[1],L=k[2],P=k[3],D=g.useRef(P);P&&(D.current=!0);var R=g.useCallback(function($){_.current=$,wO(s,$)},[s]),A,M=Ve(Ve({},m),{},{visible:a});if(!d)A=null;else if(N===bs)P?A=d(Ve({},M),R):!c&&D.current&&p?A=d(Ve(Ve({},M),{},{className:p}),R):u||!c&&!p?A=d(Ve(Ve({},M),{},{style:{display:"none"}}),R):A=null;else{var j;E===Hr?j="prepare":Y5(E)?j="active":E===Da&&(j="start");var z=CS(f,"".concat(N,"-").concat(j));A=d(Ve(Ve({},M),{},{className:oO(CS(f,N),Ne(Ne({},z,z&&j),f,typeof f=="string")),style:L}),R)}if(g.isValidElement(A)&&SO(A)){var F=kO(A);F||(A=g.cloneElement(A,{ref:R}))}return g.createElement(R8,{ref:b},A)});return r.displayName="CSSMotion",r}const W8=U8(V5);var Gv="add",Yv="keep",Xv="remove",xg="removed";function q8(e){var t;return e&&Rt(e)==="object"&&"key"in e?t=e:t={key:e},Ve(Ve({},t),{},{key:String(t.key)})}function Zv(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return e.map(q8)}function V8(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],r=0,i=t.length,s=Zv(e),o=Zv(t);s.forEach(function(c){for(var u=!1,d=r;d<i;d+=1){var f=o[d];if(f.key===c.key){r<d&&(n=n.concat(o.slice(r,d).map(function(p){return Ve(Ve({},p),{},{status:Gv})})),r=d),n.push(Ve(Ve({},f),{},{status:Yv})),r+=1,u=!0;break}}u||n.push(Ve(Ve({},c),{},{status:Xv}))}),r<i&&(n=n.concat(o.slice(r).map(function(c){return Ve(Ve({},c),{},{status:Gv})})));var a={};n.forEach(function(c){var u=c.key;a[u]=(a[u]||0)+1});var l=Object.keys(a).filter(function(c){return a[c]>1});return l.forEach(function(c){n=n.filter(function(u){var d=u.key,f=u.status;return d!==c||f!==Xv}),n.forEach(function(u){u.key===c&&(u.status=Yv)})}),n}var K8=["component","children","onVisibleChanged","onAllRemoved"],G8=["status"],Y8=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function X8(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:W8,n=function(r){s5(s,r);var i=a5(s);function s(){var o;Ml(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=i.call.apply(i,[this].concat(l)),Ne(_v(o),"state",{keyEntities:[]}),Ne(_v(o),"removeKey",function(u){o.setState(function(d){var f=d.keyEntities.map(function(p){return p.key!==u?p:Ve(Ve({},p),{},{status:xg})});return{keyEntities:f}},function(){var d=o.state.keyEntities,f=d.filter(function(p){var m=p.status;return m!==xg}).length;f===0&&o.props.onAllRemoved&&o.props.onAllRemoved()})}),o}return jl(s,[{key:"render",value:function(){var a=this,l=this.state.keyEntities,c=this.props,u=c.component,d=c.children,f=c.onVisibleChanged;c.onAllRemoved;var p=kv(c,K8),m=u||g.Fragment,x={};return Y8.forEach(function(w){x[w]=p[w],delete p[w]}),delete p.keys,g.createElement(m,p,l.map(function(w,v){var _=w.status,b=kv(w,G8),S=_===Gv||_===Yv;return g.createElement(t,bf({},x,{key:b.key,visible:S,eventProps:b,onVisibleChanged:function(k){f==null||f(k,{key:b.key}),k||a.removeKey(b.key)}}),function(C,k){return d(Ve(Ve({},C),{},{index:v}),k)})}))}}],[{key:"getDerivedStateFromProps",value:function(a,l){var c=a.keys,u=l.keyEntities,d=Zv(c),f=V8(u,d);return{keyEntities:f.filter(function(p){var m=u.find(function(x){var w=x.key;return p.key===w});return!(m&&m.status===xg&&p.status===Xv)})}}}]),s}(g.Component);return Ne(n,"defaultProps",{component:"div"}),n}X8(V5);const ES=g.createContext(!0);function Z8(e){const t=g.useContext(ES),{children:n}=e,[,r]=$5(),{motion:i}=r,s=g.useRef(!1);return s.current||(s.current=t!==i),s.current?g.createElement(ES.Provider,{value:i},g.createElement(P8,{motion:i},n)):n}const Q8=()=>null;var J8=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const eB=["getTargetContainer","getPopupContainer","renderEmpty","input","pagination","form","select","button"];let X5;function tB(){return X5||Wv}function nB(e){return Object.keys(e).some(t=>t.endsWith("Color"))}const rB=e=>{const{prefixCls:t,iconPrefixCls:n,theme:r,holderRender:i}=e;t!==void 0&&(X5=t),r&&nB(r)&&d8(tB(),r)},iB=e=>{const{children:t,csp:n,autoInsertSpaceInButton:r,alert:i,anchor:s,form:o,locale:a,componentSize:l,direction:c,space:u,splitter:d,virtual:f,dropdownMatchSelectWidth:p,popupMatchSelectWidth:m,popupOverflow:x,legacyLocale:w,parentContext:v,iconPrefixCls:_,theme:b,componentDisabled:S,segmented:C,statistic:k,spin:N,calendar:E,carousel:L,cascader:P,collapse:D,typography:R,checkbox:A,descriptions:M,divider:j,drawer:z,skeleton:F,steps:$,image:B,layout:I,list:U,mentions:V,modal:O,progress:ne,result:ae,slider:Y,breadcrumb:ye,menu:Ce,pagination:oe,input:je,textArea:Ae,empty:De,badge:xe,radio:Ke,rate:rt,switch:Ze,transfer:ht,avatar:Kt,message:de,tag:ze,table:ke,card:Fe,tabs:yt,timeline:tn,timePicker:hn,upload:W,notification:ee,tree:be,colorPicker:Le,datePicker:He,rangePicker:Mt,flex:bn,wave:nn,dropdown:fn,warning:le,tour:Se,tooltip:it,popover:mt,popconfirm:gr,floatButton:se,floatButtonGroup:nt,variant:Bt,inputNumber:ni,treeSelect:oa}=e,aa=g.useCallback((jt,$t)=>{const{prefixCls:Wn}=e;if($t)return $t;const vr=Wn||v.getPrefixCls("");return jt?`${vr}-${jt}`:vr},[v.getPrefixCls,e.prefixCls]),hs=_||v.iconPrefixCls||D5,la=n||v.csp;k8(hs,la);const Xl=N8(b,v.theme,{prefixCls:aa("")}),Zl={csp:la,autoInsertSpaceInButton:r,alert:i,anchor:s,locale:a||w,direction:c,space:u,splitter:d,virtual:f,popupMatchSelectWidth:m??p,popupOverflow:x,getPrefixCls:aa,iconPrefixCls:hs,theme:Xl,segmented:C,statistic:k,spin:N,calendar:E,carousel:L,cascader:P,collapse:D,typography:R,checkbox:A,descriptions:M,divider:j,drawer:z,skeleton:F,steps:$,image:B,input:je,textArea:Ae,layout:I,list:U,mentions:V,modal:O,progress:ne,result:ae,slider:Y,breadcrumb:ye,menu:Ce,pagination:oe,empty:De,badge:xe,radio:Ke,rate:rt,switch:Ze,transfer:ht,avatar:Kt,message:de,tag:ze,table:ke,card:Fe,tabs:yt,timeline:tn,timePicker:hn,upload:W,notification:ee,tree:be,colorPicker:Le,datePicker:He,rangePicker:Mt,flex:bn,wave:nn,dropdown:fn,warning:le,tour:Se,tooltip:it,popover:mt,popconfirm:gr,floatButton:se,floatButtonGroup:nt,variant:Bt,inputNumber:ni,treeSelect:oa},fs=Object.assign({},v);Object.keys(Zl).forEach(jt=>{Zl[jt]!==void 0&&(fs[jt]=Zl[jt])}),eB.forEach(jt=>{const $t=e[jt];$t&&(fs[jt]=$t)}),typeof r<"u"&&(fs.button=Object.assign({autoInsertSpace:r},fs.button));const ri=r5(()=>fs,fs,(jt,$t)=>{const Wn=Object.keys(jt),vr=Object.keys($t);return Wn.length!==vr.length||Wn.some(Mi=>jt[Mi]!==$t[Mi])}),{layer:hd}=g.useContext(Hp),ca=g.useMemo(()=>({prefixCls:hs,csp:la,layer:hd?"antd":void 0}),[hs,la,hd]);let Gt=g.createElement(g.Fragment,null,g.createElement(Q8,{dropdownMatchSelectWidth:p}),t);const Ql=g.useMemo(()=>{var jt,$t,Wn,vr;return U6(((jt=qp.Form)===null||jt===void 0?void 0:jt.defaultValidateMessages)||{},((Wn=($t=ri.locale)===null||$t===void 0?void 0:$t.Form)===null||Wn===void 0?void 0:Wn.defaultValidateMessages)||{},((vr=ri.form)===null||vr===void 0?void 0:vr.validateMessages)||{},(o==null?void 0:o.validateMessages)||{})},[ri,o==null?void 0:o.validateMessages]);Object.keys(Ql).length>0&&(Gt=g.createElement(q6.Provider,{value:Ql},Gt)),a&&(Gt=g.createElement(G6,{locale:a,_ANT_MARK__:K6},Gt)),Gt=g.createElement($6.Provider,{value:ca},Gt),l&&(Gt=g.createElement(f8,{size:l},Gt)),Gt=g.createElement(Z8,null,Gt);const fd=g.useMemo(()=>{const jt=Xl||{},{algorithm:$t,token:Wn,components:vr,cssVar:Mi}=jt,Lm=J8(jt,["algorithm","token","components","cssVar"]),pd=$t&&(!Array.isArray($t)||$t.length>0)?Ev($t):j5,lo={};Object.entries(vr||{}).forEach(([Dm,md])=>{const xr=Object.assign({},md);"algorithm"in xr&&(xr.algorithm===!0?xr.theme=pd:(Array.isArray(xr.algorithm)||typeof xr.algorithm=="function")&&(xr.theme=Ev(xr.algorithm)),delete xr.algorithm),lo[Dm]=xr});const co=Object.assign(Object.assign({},vu),Wn);return Object.assign(Object.assign({},Lm),{theme:pd,token:co,components:lo,override:Object.assign({override:co},lo),cssVar:Mi})},[Xl]);return b&&(Gt=g.createElement(L5.Provider,{value:fd},Gt)),ri.warning&&(Gt=g.createElement(W6.Provider,{value:ri.warning},Gt)),S!==void 0&&(Gt=g.createElement(h8,{disabled:S},Gt)),g.createElement(Vp.Provider,{value:ri},Gt)},Dl=e=>{const t=g.useContext(Vp),n=g.useContext(P5);return g.createElement(iB,Object.assign({parentContext:t,legacyLocale:n},e))};Dl.ConfigContext=Vp;Dl.SizeContext=xu;Dl.config=rB;Dl.useConfig=p8;Object.defineProperty(Dl,"SizeContext",{get:()=>xu});const _r=(e,t)=>new Et(e).setA(t).toRgbString(),ha=(e,t)=>new Et(e).lighten(t).toHexString(),sB=e=>{const t=ul(e,{theme:"dark"});return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[6],6:t[5],7:t[4],8:t[6],9:t[5],10:t[4]}},oB=(e,t)=>{const n=e||"#000",r=t||"#fff";return{colorBgBase:n,colorTextBase:r,colorText:_r(r,.85),colorTextSecondary:_r(r,.65),colorTextTertiary:_r(r,.45),colorTextQuaternary:_r(r,.25),colorFill:_r(r,.18),colorFillSecondary:_r(r,.12),colorFillTertiary:_r(r,.08),colorFillQuaternary:_r(r,.04),colorBgSolid:_r(r,.95),colorBgSolidHover:_r(r,1),colorBgSolidActive:_r(r,.9),colorBgElevated:ha(n,12),colorBgContainer:ha(n,8),colorBgLayout:ha(n,0),colorBgSpotlight:ha(n,26),colorBgBlur:_r(r,.04),colorBorder:ha(n,26),colorBorderSecondary:ha(n,19)}},aB=(e,t)=>{const n=Object.keys(Py).map(s=>{const o=ul(e[s],{theme:"dark"});return Array.from({length:10},()=>1).reduce((a,l,c)=>(a[`${s}-${c+1}`]=o[c],a[`${s}${c+1}`]=o[c],a),{})}).reduce((s,o)=>(s=Object.assign(Object.assign({},s),o),s),{}),r=t??Ry(e),i=M5(e,{generateColorPalettes:sB,generateNeutralColorPalettes:oB});return Object.assign(Object.assign(Object.assign(Object.assign({},r),n),i),{colorPrimaryBg:i.colorPrimaryBorder,colorPrimaryBgHover:i.colorPrimaryBorderHover})},IS={defaultSeed:kf.token,defaultAlgorithm:Ry,darkAlgorithm:aB};function NS({children:e}){const t=wy(),[n,r]=g.useState(t.theme);return g.useEffect(()=>t.onThemeChange(r),[t]),h.jsx(Dl,{theme:{algorithm:n.mode==="dark"?IS.darkAlgorithm:IS.defaultAlgorithm,token:{colorPrimary:n.colorPrimary,colorBgContainer:n.colorBgContainer,colorText:n.colorText,colorBorder:n.colorBorder}},children:e})}var et;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},e.getValidEnumValues=i=>{const s=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(const a of s)o[a]=i[a];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},e.find=(i,s)=>{for(const o of i)if(s(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(et||(et={}));var TS;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(TS||(TS={}));const pe=et.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Cs=e=>{switch(typeof e){case"undefined":return pe.undefined;case"string":return pe.string;case"number":return Number.isNaN(e)?pe.nan:pe.number;case"boolean":return pe.boolean;case"function":return pe.function;case"bigint":return pe.bigint;case"symbol":return pe.symbol;case"object":return Array.isArray(e)?pe.array:e===null?pe.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?pe.promise:typeof Map<"u"&&e instanceof Map?pe.map:typeof Set<"u"&&e instanceof Set?pe.set:typeof Date<"u"&&e instanceof Date?pe.date:pe.object;default:return pe.unknown}},X=et.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ji extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),r}static assert(t){if(!(t instanceof Ji))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,et.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ji.create=e=>new Ji(e);const Qv=(e,t)=>{let n;switch(e.code){case X.invalid_type:e.received===pe.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case X.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,et.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:n=`Unrecognized key(s) in object: ${et.joinValues(e.keys,", ")}`;break;case X.invalid_union:n="Invalid input";break;case X.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${et.joinValues(e.options)}`;break;case X.invalid_enum_value:n=`Invalid enum value. Expected ${et.joinValues(e.options)}, received '${e.received}'`;break;case X.invalid_arguments:n="Invalid function arguments";break;case X.invalid_return_type:n="Invalid function return type";break;case X.invalid_date:n="Invalid date";break;case X.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:et.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case X.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case X.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case X.custom:n="Invalid input";break;case X.invalid_intersection_types:n="Intersection results could not be merged";break;case X.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case X.not_finite:n="Number must be finite";break;default:n=t.defaultError,et.assertNever(e)}return{message:n}};let lB=Qv;function cB(){return lB}const uB=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:t,defaultError:a}).message;return{...i,path:s,message:a}};function ce(e,t){const n=cB(),r=uB({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Qv?void 0:Qv].filter(i=>!!i)});e.common.issues.push(r)}class Bn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return Pe;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return Bn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Pe;s.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:t.value,value:r}}}const Pe=Object.freeze({status:"aborted"}),kc=e=>({status:"dirty",value:e}),Lr=e=>({status:"valid",value:e}),PS=e=>e.status==="aborted",RS=e=>e.status==="dirty",dl=e=>e.status==="valid",Cf=e=>typeof Promise<"u"&&e instanceof Promise;var _e;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(_e||(_e={}));class Ci{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const AS=(e,t)=>{if(dl(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ji(e.common.issues);return this._error=n,this._error}}};function $e(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,a)=>{const{message:l}=e;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:i}}class Xe{get description(){return this._def.description}_getType(t){return Cs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Cs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Bn,ctx:{common:t.parent.common,data:t.data,parsedType:Cs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Cf(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cs(t)},i=this._parseSync({data:t,path:r.path,parent:r});return AS(r,i)}"~validate"(t){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cs(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return dl(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(i=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>dl(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Cs(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(Cf(i)?i:Promise.resolve(i));return AS(r,s)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=t(i),a=()=>s.addIssue({code:X.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new Gs({schema:this,typeName:Re.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Ki.create(this,this._def)}nullable(){return zo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return bi.create(this)}promise(){return Rf.create(this,this._def)}or(t){return If.create([this,t],this._def)}and(t){return Nf.create(this,t,this._def)}transform(t){return new Gs({...$e(this._def),schema:this,typeName:Re.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Af({...$e(this._def),innerType:this,defaultValue:n,typeName:Re.ZodDefault})}brand(){return new eT({typeName:Re.ZodBranded,type:this,...$e(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Mf({...$e(this._def),innerType:this,catchValue:n,typeName:Re.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return jy.create(this,t)}readonly(){return jf.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const dB=/^c[^\s-]{8,}$/i,hB=/^[0-9a-z]+$/,fB=/^[0-9A-HJKMNP-TV-Z]{26}$/i,pB=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,mB=/^[a-z0-9_-]{21}$/i,gB=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,vB=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,xB=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yB="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let yg;const _B=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,bB=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,wB=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,SB=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,kB=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,CB=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Z5="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",EB=new RegExp(`^${Z5}$`);function Q5(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function IB(e){return new RegExp(`^${Q5(e)}$`)}function NB(e){let t=`${Z5}T${Q5(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function TB(e,t){return!!((t==="v4"||!t)&&_B.test(e)||(t==="v6"||!t)&&wB.test(e))}function PB(e,t){if(!gB.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function RB(e,t){return!!((t==="v4"||!t)&&bB.test(e)||(t==="v6"||!t)&&SB.test(e))}class Hi extends Xe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==pe.string){const s=this._getOrReturnCtx(t);return ce(s,{code:X.invalid_type,expected:pe.string,received:s.parsedType}),Pe}const r=new Bn;let i;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),ce(i,{code:X.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),ce(i,{code:X.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=t.data.length>s.value,a=t.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(t,i),o?ce(i,{code:X.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&ce(i,{code:X.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")xB.test(t.data)||(i=this._getOrReturnCtx(t,i),ce(i,{validation:"email",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")yg||(yg=new RegExp(yB,"u")),yg.test(t.data)||(i=this._getOrReturnCtx(t,i),ce(i,{validation:"emoji",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")pB.test(t.data)||(i=this._getOrReturnCtx(t,i),ce(i,{validation:"uuid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")mB.test(t.data)||(i=this._getOrReturnCtx(t,i),ce(i,{validation:"nanoid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")dB.test(t.data)||(i=this._getOrReturnCtx(t,i),ce(i,{validation:"cuid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")hB.test(t.data)||(i=this._getOrReturnCtx(t,i),ce(i,{validation:"cuid2",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")fB.test(t.data)||(i=this._getOrReturnCtx(t,i),ce(i,{validation:"ulid",code:X.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),ce(i,{validation:"url",code:X.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),ce(i,{validation:"regex",code:X.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),ce(i,{code:X.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),ce(i,{code:X.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),ce(i,{code:X.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?NB(s).test(t.data)||(i=this._getOrReturnCtx(t,i),ce(i,{code:X.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?EB.test(t.data)||(i=this._getOrReturnCtx(t,i),ce(i,{code:X.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?IB(s).test(t.data)||(i=this._getOrReturnCtx(t,i),ce(i,{code:X.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?vB.test(t.data)||(i=this._getOrReturnCtx(t,i),ce(i,{validation:"duration",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?TB(t.data,s.version)||(i=this._getOrReturnCtx(t,i),ce(i,{validation:"ip",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?PB(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),ce(i,{validation:"jwt",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?RB(t.data,s.version)||(i=this._getOrReturnCtx(t,i),ce(i,{validation:"cidr",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?kB.test(t.data)||(i=this._getOrReturnCtx(t,i),ce(i,{validation:"base64",code:X.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?CB.test(t.data)||(i=this._getOrReturnCtx(t,i),ce(i,{validation:"base64url",code:X.invalid_string,message:s.message}),r.dirty()):et.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:X.invalid_string,..._e.errToObj(r)})}_addCheck(t){return new Hi({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",..._e.errToObj(t)})}url(t){return this._addCheck({kind:"url",..._e.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",..._e.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",..._e.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",..._e.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",..._e.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",..._e.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",..._e.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",..._e.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",..._e.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",..._e.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",..._e.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",..._e.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,..._e.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,..._e.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",..._e.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,..._e.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,..._e.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,..._e.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,..._e.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,..._e.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,..._e.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,..._e.errToObj(n)})}nonempty(t){return this.min(1,_e.errToObj(t))}trim(){return new Hi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Hi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Hi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Hi.create=e=>new Hi({checks:[],typeName:Re.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...$e(e)});function AB(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}class hl extends Xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==pe.number){const s=this._getOrReturnCtx(t);return ce(s,{code:X.invalid_type,expected:pe.number,received:s.parsedType}),Pe}let r;const i=new Bn;for(const s of this._def.checks)s.kind==="int"?et.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ce(r,{code:X.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:X.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:X.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?AB(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),ce(r,{code:X.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ce(r,{code:X.not_finite,message:s.message}),i.dirty()):et.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,_e.toString(n))}gt(t,n){return this.setLimit("min",t,!1,_e.toString(n))}lte(t,n){return this.setLimit("max",t,!0,_e.toString(n))}lt(t,n){return this.setLimit("max",t,!1,_e.toString(n))}setLimit(t,n,r,i){return new hl({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:_e.toString(i)}]})}_addCheck(t){return new hl({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:_e.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_e.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_e.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_e.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_e.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:_e.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:_e.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_e.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_e.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&et.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}hl.create=e=>new hl({checks:[],typeName:Re.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...$e(e)});class yu extends Xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==pe.bigint)return this._getInvalidInput(t);let r;const i=new Bn;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:X.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:X.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ce(r,{code:X.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):et.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return ce(n,{code:X.invalid_type,expected:pe.bigint,received:n.parsedType}),Pe}gte(t,n){return this.setLimit("min",t,!0,_e.toString(n))}gt(t,n){return this.setLimit("min",t,!1,_e.toString(n))}lte(t,n){return this.setLimit("max",t,!0,_e.toString(n))}lt(t,n){return this.setLimit("max",t,!1,_e.toString(n))}setLimit(t,n,r,i){return new yu({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:_e.toString(i)}]})}_addCheck(t){return new yu({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_e.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_e.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_e.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_e.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:_e.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}yu.create=e=>new yu({checks:[],typeName:Re.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...$e(e)});class Jv extends Xe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==pe.boolean){const r=this._getOrReturnCtx(t);return ce(r,{code:X.invalid_type,expected:pe.boolean,received:r.parsedType}),Pe}return Lr(t.data)}}Jv.create=e=>new Jv({typeName:Re.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...$e(e)});class Ef extends Xe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==pe.date){const s=this._getOrReturnCtx(t);return ce(s,{code:X.invalid_type,expected:pe.date,received:s.parsedType}),Pe}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return ce(s,{code:X.invalid_date}),Pe}const r=new Bn;let i;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),ce(i,{code:X.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),ce(i,{code:X.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):et.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Ef({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:_e.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:_e.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Ef.create=e=>new Ef({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Re.ZodDate,...$e(e)});class MS extends Xe{_parse(t){if(this._getType(t)!==pe.symbol){const r=this._getOrReturnCtx(t);return ce(r,{code:X.invalid_type,expected:pe.symbol,received:r.parsedType}),Pe}return Lr(t.data)}}MS.create=e=>new MS({typeName:Re.ZodSymbol,...$e(e)});class ex extends Xe{_parse(t){if(this._getType(t)!==pe.undefined){const r=this._getOrReturnCtx(t);return ce(r,{code:X.invalid_type,expected:pe.undefined,received:r.parsedType}),Pe}return Lr(t.data)}}ex.create=e=>new ex({typeName:Re.ZodUndefined,...$e(e)});class tx extends Xe{_parse(t){if(this._getType(t)!==pe.null){const r=this._getOrReturnCtx(t);return ce(r,{code:X.invalid_type,expected:pe.null,received:r.parsedType}),Pe}return Lr(t.data)}}tx.create=e=>new tx({typeName:Re.ZodNull,...$e(e)});class jS extends Xe{constructor(){super(...arguments),this._any=!0}_parse(t){return Lr(t.data)}}jS.create=e=>new jS({typeName:Re.ZodAny,...$e(e)});class nx extends Xe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Lr(t.data)}}nx.create=e=>new nx({typeName:Re.ZodUnknown,...$e(e)});class Ks extends Xe{_parse(t){const n=this._getOrReturnCtx(t);return ce(n,{code:X.invalid_type,expected:pe.never,received:n.parsedType}),Pe}}Ks.create=e=>new Ks({typeName:Re.ZodNever,...$e(e)});class LS extends Xe{_parse(t){if(this._getType(t)!==pe.undefined){const r=this._getOrReturnCtx(t);return ce(r,{code:X.invalid_type,expected:pe.void,received:r.parsedType}),Pe}return Lr(t.data)}}LS.create=e=>new LS({typeName:Re.ZodVoid,...$e(e)});class bi extends Xe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==pe.array)return ce(n,{code:X.invalid_type,expected:pe.array,received:n.parsedType}),Pe;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&(ce(n,{code:o?X.too_big:X.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(ce(n,{code:X.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(ce(n,{code:X.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>i.type._parseAsync(new Ci(n,o,n.path,a)))).then(o=>Bn.mergeArray(r,o));const s=[...n.data].map((o,a)=>i.type._parseSync(new Ci(n,o,n.path,a)));return Bn.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new bi({...this._def,minLength:{value:t,message:_e.toString(n)}})}max(t,n){return new bi({...this._def,maxLength:{value:t,message:_e.toString(n)}})}length(t,n){return new bi({...this._def,exactLength:{value:t,message:_e.toString(n)}})}nonempty(t){return this.min(1,t)}}bi.create=(e,t)=>new bi({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Re.ZodArray,...$e(t)});function ba(e){if(e instanceof Ht){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Ki.create(ba(r))}return new Ht({...e._def,shape:()=>t})}else return e instanceof bi?new bi({...e._def,type:ba(e.element)}):e instanceof Ki?Ki.create(ba(e.unwrap())):e instanceof zo?zo.create(ba(e.unwrap())):e instanceof Bo?Bo.create(e.items.map(t=>ba(t))):e}class Ht extends Xe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=et.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==pe.object){const c=this._getOrReturnCtx(t);return ce(c,{code:X.invalid_type,expected:pe.object,received:c.parsedType}),Pe}const{status:r,ctx:i}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ks&&this._def.unknownKeys==="strip"))for(const c in i.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=s[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Ci(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Ks){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(ce(i,{code:X.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Ci(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>Bn.mergeObjectSync(r,c)):Bn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return _e.errToObj,new Ht({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,o;const i=((o=(s=this._def).errorMap)==null?void 0:o.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:_e.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new Ht({...this._def,unknownKeys:"strip"})}passthrough(){return new Ht({...this._def,unknownKeys:"passthrough"})}extend(t){return new Ht({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Ht({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Re.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Ht({...this._def,catchall:t})}pick(t){const n={};for(const r of et.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Ht({...this._def,shape:()=>n})}omit(t){const n={};for(const r of et.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new Ht({...this._def,shape:()=>n})}deepPartial(){return ba(this)}partial(t){const n={};for(const r of et.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new Ht({...this._def,shape:()=>n})}required(t){const n={};for(const r of et.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Ki;)s=s._def.innerType;n[r]=s}return new Ht({...this._def,shape:()=>n})}keyof(){return J5(et.objectKeys(this.shape))}}Ht.create=(e,t)=>new Ht({shape:()=>e,unknownKeys:"strip",catchall:Ks.create(),typeName:Re.ZodObject,...$e(t)});Ht.strictCreate=(e,t)=>new Ht({shape:()=>e,unknownKeys:"strict",catchall:Ks.create(),typeName:Re.ZodObject,...$e(t)});Ht.lazycreate=(e,t)=>new Ht({shape:e,unknownKeys:"strip",catchall:Ks.create(),typeName:Re.ZodObject,...$e(t)});class If extends Xe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new Ji(a.ctx.common.issues));return ce(n,{code:X.invalid_union,unionErrors:o}),Pe}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(l=>new Ji(l));return ce(n,{code:X.invalid_union,unionErrors:a}),Pe}}get options(){return this._def.options}}If.create=(e,t)=>new If({options:e,typeName:Re.ZodUnion,...$e(t)});const Oi=e=>e instanceof ix?Oi(e.schema):e instanceof Gs?Oi(e.innerType()):e instanceof Pf?[e.value]:e instanceof $o?e.options:e instanceof sx?et.objectValues(e.enum):e instanceof Af?Oi(e._def.innerType):e instanceof ex?[void 0]:e instanceof tx?[null]:e instanceof Ki?[void 0,...Oi(e.unwrap())]:e instanceof zo?[null,...Oi(e.unwrap())]:e instanceof eT||e instanceof jf?Oi(e.unwrap()):e instanceof Mf?Oi(e._def.innerType):[];class My extends Xe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==pe.object)return ce(n,{code:X.invalid_type,expected:pe.object,received:n.parsedType}),Pe;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(ce(n,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const s of n){const o=Oi(s.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of o){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,s)}}return new My({typeName:Re.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...$e(r)})}}function rx(e,t){const n=Cs(e),r=Cs(t);if(e===t)return{valid:!0,data:e};if(n===pe.object&&r===pe.object){const i=et.objectKeys(t),s=et.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(const a of s){const l=rx(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===pe.array&&r===pe.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let s=0;s<e.length;s++){const o=e[s],a=t[s],l=rx(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===pe.date&&r===pe.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Nf extends Xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(s,o)=>{if(PS(s)||PS(o))return Pe;const a=rx(s.value,o.value);return a.valid?((RS(s)||RS(o))&&n.dirty(),{status:n.value,value:a.data}):(ce(r,{code:X.invalid_intersection_types}),Pe)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Nf.create=(e,t,n)=>new Nf({left:e,right:t,typeName:Re.ZodIntersection,...$e(n)});class Bo extends Xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==pe.array)return ce(r,{code:X.invalid_type,expected:pe.array,received:r.parsedType}),Pe;if(r.data.length<this._def.items.length)return ce(r,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Pe;!this._def.rest&&r.data.length>this._def.items.length&&(ce(r,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Ci(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>Bn.mergeArray(n,o)):Bn.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new Bo({...this._def,rest:t})}}Bo.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Bo({items:e,typeName:Re.ZodTuple,rest:null,...$e(t)})};class Tf extends Xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==pe.object)return ce(r,{code:X.invalid_type,expected:pe.object,received:r.parsedType}),Pe;const i=[],s=this._def.keyType,o=this._def.valueType;for(const a in r.data)i.push({key:s._parse(new Ci(r,a,r.path,a)),value:o._parse(new Ci(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Bn.mergeObjectAsync(n,i):Bn.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Xe?new Tf({keyType:t,valueType:n,typeName:Re.ZodRecord,...$e(r)}):new Tf({keyType:Hi.create(),valueType:t,typeName:Re.ZodRecord,...$e(n)})}}class DS extends Xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==pe.map)return ce(r,{code:X.invalid_type,expected:pe.map,received:r.parsedType}),Pe;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new Ci(r,a,r.path,[c,"key"])),value:s._parse(new Ci(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Pe;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Pe;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}DS.create=(e,t,n)=>new DS({valueType:t,keyType:e,typeName:Re.ZodMap,...$e(n)});class _u extends Xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==pe.set)return ce(r,{code:X.invalid_type,expected:pe.set,received:r.parsedType}),Pe;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(ce(r,{code:X.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(ce(r,{code:X.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Pe;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>s._parse(new Ci(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new _u({...this._def,minSize:{value:t,message:_e.toString(n)}})}max(t,n){return new _u({...this._def,maxSize:{value:t,message:_e.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}_u.create=(e,t)=>new _u({valueType:e,minSize:null,maxSize:null,typeName:Re.ZodSet,...$e(t)});class ix extends Xe{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}ix.create=(e,t)=>new ix({getter:e,typeName:Re.ZodLazy,...$e(t)});class Pf extends Xe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ce(n,{received:n.data,code:X.invalid_literal,expected:this._def.value}),Pe}return{status:"valid",value:t.data}}get value(){return this._def.value}}Pf.create=(e,t)=>new Pf({value:e,typeName:Re.ZodLiteral,...$e(t)});function J5(e,t){return new $o({values:e,typeName:Re.ZodEnum,...$e(t)})}class $o extends Xe{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ce(n,{expected:et.joinValues(r),received:n.parsedType,code:X.invalid_type}),Pe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return ce(n,{received:n.data,code:X.invalid_enum_value,options:r}),Pe}return Lr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return $o.create(t,{...this._def,...n})}exclude(t,n=this._def){return $o.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}$o.create=J5;class sx extends Xe{_parse(t){const n=et.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==pe.string&&r.parsedType!==pe.number){const i=et.objectValues(n);return ce(r,{expected:et.joinValues(i),received:r.parsedType,code:X.invalid_type}),Pe}if(this._cache||(this._cache=new Set(et.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=et.objectValues(n);return ce(r,{received:r.data,code:X.invalid_enum_value,options:i}),Pe}return Lr(t.data)}get enum(){return this._def.values}}sx.create=(e,t)=>new sx({values:e,typeName:Re.ZodNativeEnum,...$e(t)});class Rf extends Xe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==pe.promise&&n.common.async===!1)return ce(n,{code:X.invalid_type,expected:pe.promise,received:n.parsedType}),Pe;const r=n.parsedType===pe.promise?n.data:Promise.resolve(n.data);return Lr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Rf.create=(e,t)=>new Rf({type:e,typeName:Re.ZodPromise,...$e(t)});class Gs extends Xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:o=>{ce(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return Pe;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Pe:l.status==="dirty"||n.value==="dirty"?kc(l.value):l});{if(n.value==="aborted")return Pe;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?Pe:a.status==="dirty"||n.value==="dirty"?kc(a.value):a}}if(i.type==="refinement"){const o=a=>{const l=i.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Pe:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Pe:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!dl(o))return Pe;const a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>dl(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:n.value,value:a})):Pe);et.assertNever(i)}}Gs.create=(e,t,n)=>new Gs({schema:e,typeName:Re.ZodEffects,effect:t,...$e(n)});Gs.createWithPreprocess=(e,t,n)=>new Gs({schema:t,effect:{type:"preprocess",transform:e},typeName:Re.ZodEffects,...$e(n)});class Ki extends Xe{_parse(t){return this._getType(t)===pe.undefined?Lr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ki.create=(e,t)=>new Ki({innerType:e,typeName:Re.ZodOptional,...$e(t)});class zo extends Xe{_parse(t){return this._getType(t)===pe.null?Lr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}zo.create=(e,t)=>new zo({innerType:e,typeName:Re.ZodNullable,...$e(t)});class Af extends Xe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===pe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Af.create=(e,t)=>new Af({innerType:e,typeName:Re.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...$e(t)});class Mf extends Xe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Cf(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ji(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ji(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Mf.create=(e,t)=>new Mf({innerType:e,typeName:Re.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...$e(t)});class OS extends Xe{_parse(t){if(this._getType(t)!==pe.nan){const r=this._getOrReturnCtx(t);return ce(r,{code:X.invalid_type,expected:pe.nan,received:r.parsedType}),Pe}return{status:"valid",value:t.data}}}OS.create=e=>new OS({typeName:Re.ZodNaN,...$e(e)});class eT extends Xe{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class jy extends Xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Pe:s.status==="dirty"?(n.dirty(),kc(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Pe:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new jy({in:t,out:n,typeName:Re.ZodPipeline})}}class jf extends Xe{_parse(t){const n=this._def.innerType._parse(t),r=i=>(dl(i)&&(i.value=Object.freeze(i.value)),i);return Cf(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}jf.create=(e,t)=>new jf({innerType:e,typeName:Re.ZodReadonly,...$e(t)});var Re;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Re||(Re={}));const y=Hi.create,H=hl.create,ie=Jv.create,Gi=nx.create;Ks.create;const G=bi.create,T=Ht.create;If.create;const Jn=My.create;Nf.create;Bo.create;const Dr=Tf.create,q=Pf.create,ge=$o.create;Rf.create;Ki.create;zo.create;const MB=Gs.createWithPreprocess,jB=["head","index"],Kp=y().regex(/^[A-Za-z0-9][A-Za-z0-9-]{0,127}$/),Lf=y().regex(/^[1-9][0-9]*$/),Df=y().regex(/^[A-Za-z0-9_.-]+$/),Of=y().min(1).max(255).refine(e=>!e.startsWith("-")&&e!=="HEAD"&&!e.startsWith("/")&&!e.endsWith("/")&&!e.endsWith(".")&&!/[\s~^:?*\[\\\x00-\x1f\x7f]/.test(e)&&!e.includes("..")&&!e.includes("@{")&&!e.includes("//")&&e.split("/").every(t=>!t.startsWith(".")&&!t.endsWith(".lock")),"Invalid Git branch"),Ly=y().min(1).max(4096).refine(e=>!e.startsWith("/")&&!e.includes("\0")&&!e.split(/[\\/]/).includes("..")),Dy=T({workspaceId:Kp,repoId:Lf,owner:Df,name:Df,sourceBranch:Of,defaultBranch:Of}).strict(),LB=T({repoId:Lf,owner:Df,name:Df,defaultBranch:y(),private:ie(),description:y().nullable()}),tT=T({number:H().int().positive(),url:y().url().refine(e=>new URL(e).origin==="https://github.com"),base:y(),head:y()}),DB=Dy.extend({initialCommit:y(),head:y(),actualBranch:y().nullable(),branches:G(y()).optional(),files:G(T({path:Ly,previousPath:y().optional(),comparison:ge(jB).optional(),status:y(),added:H().nonnegative(),removed:H().nonnegative(),binary:ie(),untracked:ie().optional()})),totalFiles:H().int().nonnegative().optional(),filesTruncated:ie().optional(),added:H().nonnegative(),removed:H().nonnegative(),dirty:ie(),conflicted:ie(),version:y(),measuredAt:H(),pendingPublication:T({operationId:Kp,expectedVersion:y(),stage:y()}).optional(),pr:tT.nullable().optional(),savedAt:H().nullable().optional()}),uo=T({sessionId:Kp});Jn("action",[uo.extend({action:q("repositories"),page:H().int().min(1).max(1e3).optional(),search:y().max(100).optional()}).strict(),uo.extend({action:q("branches"),repoId:Lf,page:H().int().min(1).max(1e3).optional()}).strict(),uo.extend({action:q("bind"),repoId:Lf,branch:Of}).strict(),uo.extend({action:q("status")}).strict(),uo.extend({action:q("switch"),branch:Of,create:ie().optional()}).strict(),uo.extend({action:q("diff"),filePath:Ly}).strict(),uo.extend({action:q("publish"),operationId:Kp,expectedVersion:y().min(1).max(128)}).strict()]);T({binding:Dy.nullable().optional(),workspace:DB.nullable().optional(),repositories:G(LB).optional(),branches:G(y()).optional(),hasMore:ie().optional(),diff:T({path:Ly,patch:y(),binary:ie(),truncated:ie()}).optional(),pr:tT.optional()});new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");T({id:y().min(1),name:y().min(1),baseUrl:y().min(1),apiKey:y().min(1),remark:y().optional(),createdAt:H(),updatedAt:H()}).strict();const OB=T({id:y().min(1),name:y().min(1),baseUrl:y().min(1),remark:y().optional(),keyMasked:y(),hasKey:ie(),createdAt:H(),updatedAt:H()}).strict();T({activeChannelId:y().nullable(),channels:G(OB)}).strict();T({}).strict();T({id:y().min(1).optional(),name:y().min(1),baseUrl:y().min(1),apiKey:y().optional(),remark:y().optional()}).strict();T({id:y().min(1)}).strict();T({id:y().min(1).nullable()}).strict();T({channelId:y().min(1).optional(),updatedAt:H().optional()}).strict().refine(e=>e.updatedAt===void 0||e.channelId!==void 0,{message:"updatedAt requires channelId"});T({channelId:y().nullable(),models:G(T({id:y().min(1),ownedBy:y().optional()}).strict())}).strict();const BB=["owner"],$B=["agent","owner","user-upload"],nT=T({id:y().min(1),relPath:y().min(1),from:ge($B),label:y().optional(),size:H().int().nonnegative(),mime:y().min(1),addedAt:H().int().nonnegative(),lastEditedAt:H().int().nonnegative().optional(),stale:ie().optional()});T({sessionId:y().min(1),relPath:y().min(1),ttlSeconds:H().int().positive().nullable().optional(),view:ge(["raw","md-rendered"]).optional()});T({url:y().min(1),expiresAt:H().int().nonnegative().nullable()});T({sessionId:y().min(1),relPath:y().min(1),label:y().optional(),origin:q("agent").optional()});T({entry:nT});T({sessionId:y().min(1),relPath:y().min(1)});T({removed:q(!0)});T({sessionId:y().min(1)});T({entries:G(nT)});T({attachmentId:y().min(1),url:y().min(1),relPath:y().min(1),sizeBytes:H().int().nonnegative(),mimeType:y().min(1)});const zB=Jn("type",[T({type:q("persona"),id:y().min(1)}).strict(),T({type:q("chat"),id:y().min(1)}).strict(),T({type:q("*")}).strict()]),FB=ge(["read","send","admin"]),Oy=T({resource:zB,actions:G(FB).min(1)}).strict(),HB=T({id:y().min(1),secretHash:y().regex(/^[a-f0-9]{64}$/),displayName:y(),grants:G(Oy),issuedAt:H().int().nonnegative(),expiresAt:H().int().positive().optional(),maxUses:H().int().positive().optional(),usedCount:H().int().nonnegative(),peerOwnerId:y().min(1).optional(),firstUsedByPeerAt:H().int().positive().optional(),peerDisplayName:y().optional()}).strict(),UB=HB.omit({secretHash:!0});T({type:q("whoami:ok"),owner:T({id:y(),kind:ge(["owner","guest"]),displayName:y(),ownerId:y(),provider:y()}).strict(),capability:UB,grantedPersonas:G(T({id:y().min(1),displayName:y()}).strict())}).strict();T({selfUrl:y().min(1)});T({type:q("contact:handshake:ok"),owner:T({id:y(),ownerId:y(),provider:y(),displayName:y()}),grants:G(Oy)});const WB=Jn("status",[T({status:q("authorized"),login:y().min(1),source:ge(["git","file"])}).strict(),T({status:q("missing")}).strict(),T({status:q("invalid"),message:y().min(1)}).strict(),T({status:q("pending"),authUrl:y().url()}).strict()]);T({token:y().min(1)}).strict();T({returnTo:y().url().optional()}).strict();const qB=T({url:y().url(),bin:y(),sha256:y().regex(/^[0-9a-f]{64}$/),size:H().int().positive()}),VB=T({name:y().min(1),from:y().optional(),version:y().optional(),min:y().optional(),library:ie().optional(),localVersion:y().optional(),artifact:qB.optional(),aptMissing:q(!0).optional(),aptVersion:y().optional()}),KB=T({name:y().min(1),env:G(y().min(1)).min(1)}),By=y().regex(/^[a-z0-9-]+$/,"连接器名只能是小写字母、数字和短横线"),rT=["proxy","env"],iT=["mcp","cli"],GB=["bearer","lark-sidecar"],YB=["none","shared","personal"],sT=["oauth","fields"],$y=y().regex(/^[A-Z][A-Z0-9_]*$/,"要填的变量名只能是大写字母、数字和下划线,且以字母开头"),oT=T({name:By,kind:ge(rT),runner:ge(iT),protocol:ge(GB).optional(),id:y().min(1),credentialSource:ge(YB).optional(),auth:ge(sT).optional(),publisherUnionId:y().regex(/^on_[A-Za-z0-9_-]+$/).optional(),fields:G($y).default([]),http:T({url:y().min(1),headers:Dr(y(),y())}).optional()}),XB=e=>{if(!e||typeof e!="object")return e;let t=e;if("clis"in t&&Array.isArray(t.clis)){const{clis:n,...r}=t;t="packages"in r?r:{...r,packages:n}}if("assets"in t&&Array.isArray(t.assets)&&t.assets.length===0){const{assets:n,...r}=t;t=r}return t},aT=T({version:q(1),entry:y().max(240).regex(/^[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)*\.mjs$/).refine(e=>!e.split("/").some(t=>[".",".."].includes(t))),timeoutSeconds:H().int().min(1).max(600),checks:G(y().regex(/^[a-z0-9][a-z0-9-]{0,63}$/)).min(1).max(64).refine(e=>new Set(e).size===e.length)}).strict(),lT={test:aT.optional(),packages:G(VB),secrets:G(KB),connectors:G(oT).default([])};T(lT);const zy=MB(XB,T({version:q(1),...lT}).strict()),ZB=T({target:y().min(1),reason:y().min(1),file:y().min(1),quote:y().min(1)}),QB=["integration","production"],er=ge(QB),es=y().regex(/^[a-z0-9.-]+(?::[0-9]+)?\/[a-z0-9._/-]+@sha256:[a-f0-9]{64}$/),ox=y().regex(/^[a-f0-9]{40}$/),JB=y().refine(e=>{try{const t=new URL(e);return t.protocol==="https:"&&!t.username&&!t.password&&!t.search&&!t.hash&&t.pathname==="/"&&/(^|[.-])int([.-]|$)/.test(t.hostname)}catch{return!1}},"测试验证地址必须明确指向 int HTTPS 环境"),e9=T({version:q(1),runId:y().regex(/^[A-Za-z0-9_-]{1,128}$/),status:q("passed"),exitCode:q(0),result:T({version:q(1),runId:y().regex(/^[A-Za-z0-9_-]{1,128}$/),checks:G(T({name:y().regex(/^[a-z0-9][a-z0-9-]{0,63}$/),status:q("passed"),reason:y().max(1024).optional()}).strict()).min(1).max(64)}).strict(),execution:T({image:es,imageID:y().min(1).max(512),engine:ge(["codex","pi"]),podUid:y().min(1).max(512),jobUid:y().min(1).max(512)}).strict()}).strict(),cT=T({status:q("passed"),fingerprint:y().regex(/^[a-f0-9]{64}$/),checks:G(y().regex(/^[a-z0-9-]+$/)),endpoint:JB,verifiedAt:y().refine(e=>Number.isFinite(Date.parse(e))),test:e9.optional()}).strict(),uT=T({engine:y().min(1),model:y(),effort:y(),size:y().min(1),cpu:H().positive(),taskConcurrency:H().int().positive()}).strict(),dT=T({version:q(1),environment:q("integration"),component:q("persona"),image:es,commit:ox,baseImage:es,pipelineCommit:ox,repository:y().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/),config:uT.optional(),verification:cT.refine(e=>e.checks.includes("persona-smoke")),test:aT.optional()}).strict().refine(e=>{if(!e.test)return e.verification.test===void 0;const t=e.verification.test;return["persona-dialogue","persona-task","persona-custom-test"].every(n=>e.verification.checks.includes(n))&&t!==void 0&&t.execution.image===e.image&&t.runId===t.result.runId&&t.result.checks.length===e.test.checks.length&&new Set(t.result.checks.map(n=>n.name)).size===e.test.checks.length&&t.result.checks.every(n=>e.test.checks.includes(n.name))},"Declared publisher acceptance requires complete candidate runtime evidence");T({version:q(1),environment:q("integration"),component:q("base"),image:es,commit:ox,verification:cT.refine(e=>e.checks.includes("base-smoke"))}).strict();const bu="-cloud",t9=`codex${bu}`,Bf={standard:"default",fast:"priority"},n9=`claude${bu}`;function hT(e){return e==="codex"||e===t9}const fT="pi",r9=`${fT}${bu}`;function pT(e){return e===fT||e===r9}function ax(e){return typeof e=="string"&&e.length>bu.length&&e.endsWith(bu)}const mT=ge([Bf.standard,Bf.fast]),i9=["tiny","small","medium","large","xlarge"],s9=ge(i9),o9=[.5,1,2],a9=H().refine(e=>o9.includes(e),"Unsupported CPU"),gT=T({model:y().optional(),effort:y().optional()}).strict(),$f=T({personaId:y(),label:y(),model:y().optional(),effort:y().optional(),serviceTier:mT.optional(),public:ie(),iconKey:y().optional(),tool:y().optional(),size:y().optional(),cpu:H().finite().optional(),taskConcurrency:H().int().positive().optional(),cloudEngine:gT.optional(),createdAt:H(),updatedAt:H(),cloud:T({gatewayUrl:y().min(1),personaId:y().min(1),publishedByMe:ie().optional(),environment:er.optional(),expectedImage:es.optional(),testReleaseId:y().optional()}).strict().optional()}).strict(),l9=T({name:y().min(1),description:y().optional()}),c9=T({id:y().min(1)}),vT=T({writableRoots:G(y()).optional(),denyRead:G(y()).optional(),network:ie().optional()}).strict(),u9=T({permissions:T({defaultMode:y().optional(),allow:G(y()).optional(),deny:G(y()).optional()}).optional(),sandbox:T({enabled:ie().optional(),autoAllowBashIfSandboxed:ie().optional(),allowUnsandboxedCommands:ie().optional(),excludedCommands:G(y()).optional(),filesystem:T({denyRead:G(y()).optional(),allowRead:G(y()).optional(),denyWrite:G(y()).optional(),allowWrite:G(y()).optional()}).optional(),network:T({allowedDomains:G(y()).optional(),allowLocalBinding:ie().optional()}).optional()}).optional()});$f.extend({personality:y().optional(),personalityLocal:y().optional(),personalityManaged:ie().optional(),skills:G(l9).optional(),plugins:G(c9).optional(),sandboxSettings:u9.nullable().optional(),codexSandbox:vT.nullable().optional()});T({slug:y().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/).max(32),label:y().min(1),personality:y(),model:y().optional(),effort:y().optional(),serviceTier:$f.shape.serviceTier,tool:y().optional(),public:ie().optional(),iconKey:y().optional()}).strict();T({personaId:y().min(1)});T({personaId:y().min(1),patch:T({label:y().min(1).optional(),model:y().optional(),effort:y().optional(),serviceTier:$f.shape.serviceTier,tool:y().optional(),size:s9.optional(),cpu:a9.optional(),taskConcurrency:$f.shape.taskConcurrency,cloudEngine:gT.optional(),personality:y().optional(),personalityLocal:y().optional(),public:ie().optional(),iconKey:y().nullable().optional(),codexSandbox:vT.optional()}).strict()}).strict();T({version:q(1),manifest:zy}).strict();const d9=["hard","soft"],xT=ge(d9),h9=ge(["scanning","done","failed"]),yT=T({id:y().min(1),manifest:zy,scanSessionId:y().optional(),status:h9,evidence:G(ZB).default([]),notes:G(y()).default([]),head:y().min(1).optional(),baseKind:xT.default("hard"),base:y().min(1).optional(),startedAt:H(),finishedAt:H().optional(),error:y().optional()}).strict(),Fy=T({id:y().min(1).optional(),environment:er.optional(),legacy:ie().optional(),head:y().min(1),contentHead:y().min(1),scanId:y().min(1),at:H(),pushed:ie().optional(),runId:H().int().positive().optional(),runAttempt:H().int().positive().optional(),artifactId:H().int().positive().optional(),verified:dT.optional(),config:uT.optional(),reconfigOf:y().min(1).optional(),workflowVersion:H().int().positive().optional(),confirmation:T({fingerprint:y().regex(/^[a-f0-9]{64}$/),runId:H().int().positive(),runAttempt:H().int().positive(),at:H()}).strict().optional()}).strict(),f9=["prepared","main-pushed","dispatching","dispatched","completed","failed"],Hy=T({id:y().min(1),releaseId:y().min(1),at:H(),verified:dT.optional(),phase:ge(f9),expectedMain:y().optional(),runId:H().int().positive().optional(),runAttempt:H().int().positive().optional(),error:y().optional()}).strict(),BS=T({channelId:y().min(1),updatedAt:H()}).strict(),Uy=T({integration:BS.nullable().optional(),production:BS.nullable().optional()}).strict();T({version:q(4),engineChannels:Uy.optional(),scans:G(yT),releases:G(Fy),promotions:G(Hy).default([])}).strict();const p9=T({url:y().min(1),branch:y().min(1),head:y().min(1),dirty:ie(),ahead:H()}).strict(),Mh=T({env:y().min(1),setAt:H().optional()}).strict(),m9=["pending","running","done","failed","waiting","skipped"],g9=ge(m9),v9="verify",x9=["build","smoke","deploy",v9],y9=ge(x9),_9=T({key:y9,status:g9,url:y().optional(),jobId:H().optional(),startedAt:H().optional(),completedAt:H().optional()}).strict(),jh=T({runId:H(),headSha:y().min(1),status:ge(["queued","running","completed"]),htmlUrl:y().min(1),jobs:G(_9),environment:er.optional(),branch:y().optional(),event:y().optional(),runAttempt:H().int().positive().optional(),conclusion:ge(["success","failure"]).optional(),promotionId:y().optional()}).strict(),_g=T({runId:H(),status:jh.shape.status,conclusion:ge(["success","failure"]).optional(),htmlUrl:y().min(1)}).strict(),_T=T({personaId:y().min(1),engineChannels:Uy.optional(),github:WB.optional(),publisherFeishuAuth:T({integration:T({connected:ie(),authUrl:y().optional(),error:y().optional()}).strict(),production:T({connected:ie(),authUrl:y().optional(),error:y().optional()}).strict()}).strict().optional(),repo:p9.optional(),scans:G(yT).default([]),releases:G(Fy).default([]),promotions:G(Hy).optional(),targets:T({integration:T({run:jh.optional(),secrets:G(Mh).optional(),online:ie().optional(),image:es.optional(),unpublish:_g.optional()}).strict().optional(),production:T({run:jh.optional(),secrets:G(Mh).optional(),online:ie().optional(),image:es.optional(),unpublish:_g.optional()}).strict().optional()}).strict().optional(),secrets:G(Mh).optional(),run:jh.optional(),online:ie().optional(),unpublish:_g.optional(),historyError:y().optional()}).strict();T({before:H().nullable()}).strict();_T.pick({personaId:!0,github:!0,repo:!0,scans:!0,releases:!0,promotions:!0,engineChannels:!0,historyError:!0});_T.pick({scans:!0});T({environment:er,secrets:G(Mh).optional(),engineChannels:Uy.optional()}).strict();T({sha:y().min(1),actionsUrl:y().min(1),releaseId:y().optional()}).strict();const Hu=T({personaId:y().min(1)}).strict();Hu.extend({releaseHead:y().min(1).optional(),releaseId:y().min(1).optional(),environment:er.optional()}).strict();Hu.extend({scanBase:xT.optional()}).strict();Hu.extend({scanId:y().min(1)}).strict();Hu.extend({releaseId:y().min(1)}).strict();Hu.extend({environment:er.default("production")}).strict();T({confirmation:Fy.shape.confirmation.unwrap()}).strict();T({promotion:Hy}).strict();T({personaId:y().min(1),expectedImage:es}).strict();T({personaId:y().min(1),scanId:y().min(1),patch:T({manifest:zy.optional(),connector:oT.optional()}).strict()}).strict();T({personaId:y().min(1),environment:er.default("production"),scanId:y().min(1),name:y().min(1),values:Dr(y(),y())}).strict();T({personaId:y().min(1),environment:er.default("production"),channelId:y().min(1).optional(),auth:T({baseUrl:y(),apiKey:y()}).strict().nullable().optional()}).strict().refine(e=>e.channelId!==void 0||e.auth!==void 0,{message:"Either channelId or auth must be provided"});T({personaId:y().min(1),environment:er.default("production"),releaseId:y().optional(),jobId:H()}).strict();T({personaId:y().min(1),kind:ge(["package","secret","connector"]),item:Dr(y(),Gi()),evidence:T({reason:y().min(1),file:y().min(1),quote:y().min(1)})}).strict();T({personaId:y().min(1),notes:G(y()).default([])}).strict();T({environment:er.default("production")}).strict();const b9=T({deviceId:y().min(1),name:y().min(1),url:y().min(1)});T({type:q("device:list:ok"),devices:G(b9)});T({deviceId:y().min(1),url:y().min(1).optional(),name:y().optional()});T({type:q("device:connect:ok"),deviceId:y(),name:y(),url:y()});const bT=T({ownerId:y().min(1),provider:y().min(1),displayName:y().min(1),avatarUrl:y().optional(),unionId:y().optional()});T({type:q("auth:login:start:ok"),environment:er.optional(),authUrl:y().min(1),state:y().min(1)});T({type:q("auth:getIdentity:ok"),identity:bT.nullable(),deviceId:y().min(1)});T({type:q("auth:logout:ok")});const wT=y().nullable();T({type:q("auth:apiKey:get:ok"),apiKey:y().nullable(),createdAt:y().nullable(),gatewayUrl:wT});T({type:q("auth:apiKey:regenerate:ok"),apiKey:y().min(1),createdAt:y().min(1),gatewayUrl:wT});T({type:q("auth:apiKey:revoke:ok"),revoked:ie()});T({type:q("auth:login:done"),environment:er.optional(),identity:bT});T({type:q("auth:login:failed"),environment:er.optional(),reason:y()});T({deviceId:y().min(1),remoteAccessAllowed:ie()}).strict();T({type:q("contact:setRemoteAccess:ok"),deviceId:y().min(1),remoteAccessAllowed:ie()}).strict();T({type:q("contact:remote-access-updated"),deviceId:y().min(1),remoteAccessAllowed:ie()}).strict();T({personaId:y().min(1)}).strict();const w9=["connected","missing","reauth"],S9=["link","fill"],k9=T({name:By,id:y().min(1),kind:ge(rT),runner:ge(iT),auth:ge(sT),status:ge(w9),action:ge(S9),authUrl:y().optional(),fields:G($y)}).strict();T({connectors:G(k9)}).strict();T({personaId:y().min(1),name:By,values:Dr($y,y().min(1))}).strict();const C9=T({deviceId:y().min(1),ownerId:y().min(1),provider:y().min(1),displayName:y(),remoteUrl:y().min(1),connectToken:y(),grants:G(Oy),addedAt:H().int().nonnegative(),pinnedAt:H().int().nullable().default(null),remoteAccessAllowed:ie().default(!1),note:y().default("")}).strict(),ST=C9;T({deviceId:y().min(1)}).strict();T({type:q("contact:remove:ok"),deviceId:y().min(1)}).strict();T({type:q("contact:list:ok"),contacts:G(ST)}).strict();T({type:q("contact:added"),contact:ST}).strict();T({type:q("contact:removed"),deviceId:y().min(1)}).strict();T({deviceId:y().min(1),pinned:ie()}).strict();T({deviceId:y().min(1),note:y()}).strict();T({type:q("contact:setNote:ok"),deviceId:y().min(1),note:y()}).strict();T({type:q("contact:pin:ok"),deviceId:y().min(1),pinnedAt:H().int().nullable()}).strict();T({type:q("contact:pinned"),deviceId:y().min(1),pinnedAt:H().int().nullable()}).strict();const Wy=Jn("kind",[T({kind:q("success"),text:y(),brief:y().optional(),filePaths:G(y()).optional()}),T({kind:q("failure"),reason:y(),brief:y().optional()})]);T({targetPersona:y().min(1).optional(),dispatchId:y().min(1).optional(),prompt:y(),brief:y().optional(),targetDeviceId:y().min(1).optional(),model:y().min(1).optional(),tool:y().min(1).optional(),sessionLabel:y().min(1).max(60).optional(),meta:Dr(Gi()).optional()}).refine(e=>e.targetPersona!==void 0||e.dispatchId!==void 0,{message:"either targetPersona (new dispatch) or dispatchId (follow-up) is required"}).refine(e=>!(e.dispatchId!==void 0&&e.targetDeviceId!==void 0),{message:"cross-device dispatch cannot be continued (dispatchId + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.tool!==void 0&&e.targetDeviceId!==void 0),{message:"engine override is not supported for cross-device dispatch (tool + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.dispatchId!==void 0&&(e.tool!==void 0||e.model!==void 0)),{message:"a follow-up dispatch cannot change engine or model (dispatchId excludes tool / model); start a new dispatch instead"});T({dispatchId:y().min(1),outcome:Wy});const E9=["running","completed","failed"],qy=ge(E9),I9=T({dispatchId:y().min(1),sourceSessionId:y().min(1),sourcePersonaId:y().min(1).optional(),targetPersonaId:y().min(1),targetDeviceId:y().min(1).optional(),workerSessionId:y().min(1).optional(),taskText:y(),taskBrief:y().optional(),round:H().int().positive().optional(),status:qy,outcome:Wy.optional(),meta:Dr(Gi()).optional(),createdAt:y().min(1),completedAt:y().min(1).optional(),deliveredAt:y().min(1).optional()});T({sourceSessionId:y().min(1).optional(),relatedSessionId:y().min(1).optional()});T({records:G(I9)});T({dispatchId:y().min(1)});T({type:q("personaDispatch:get:ok"),status:qy,outcome:Wy.optional()});const N9=/^[a-z0-9][a-z0-9-]*$/;ge(["stopped","starting","running","crashed","invalid"]);const T9=new Set(["localhost","127.0.0.1"]);function P9(e){let t;try{t=new URL(e)}catch{return!1}return!!(t.protocol==="https:"||t.protocol==="http:"&&T9.has(t.hostname))}const zd=T({id:y().regex(N9),name:y().min(1),version:y().min(1),apiVersion:q("1"),runtime:T({startCommand:y().min(1)}).passthrough().optional(),entry:T({url:y().url().refine(P9,{message:"INVALID_URL_SCHEME: only https or http://localhost is allowed"})}).strict().optional()}).passthrough().superRefine((e,t)=>{var i;const n=!!e.runtime,r=!!((i=e.entry)!=null&&i.url);n&&r&&t.addIssue({code:X.custom,message:"INVALID_MANIFEST: entry.url and runtime cannot coexist"}),!n&&!r&&t.addIssue({code:X.custom,message:"INVALID_MANIFEST: must have either entry.url or runtime"})}),R9=Jn("kind",[T({kind:q("local"),port:H().int().min(1).max(65535)}),T({kind:q("hosted"),url:y().url()})]);Jn("state",[T({extId:y(),manifest:zd,state:q("stopped")}),T({extId:y(),manifest:zd,state:q("starting")}),T({extId:y(),manifest:zd,state:q("running"),target:R9}),T({extId:y(),manifest:zd,state:q("crashed")}),T({extId:y(),manifest:Gi().nullable(),state:q("invalid"),invalidReason:y().min(1)})]);T({snapshotHash:y().min(1),version:y().min(1),publishedAt:H()});const A9=Jn("kind",[T({kind:q("p2p-tunnel"),ownerPrincipalId:y().min(1),extId:y().min(1)})]);Jn("kind",[T({kind:q("p2p-tunnel"),ownerPrincipalId:y().min(1),extId:y().min(1),snapshotHash:y().min(1)})]);T({extId:y().min(1),name:y().min(1),version:y().min(1),contentHash:y().min(1),publishedAt:H()});const M9=Jn("kind",[T({kind:q("clean")}),T({kind:q("ready-new-version"),fromVersion:y().min(1),toVersion:y().min(1)}),T({kind:q("error-same-hash"),version:y().min(1)}),T({kind:q("error-version-not-bumped"),localVersion:y().min(1),publishedVersion:y().min(1)}),T({kind:q("error-version-regression"),localVersion:y().min(1),publishedVersion:y().min(1)})]);T({localManifest:T({name:y().min(1),version:y().min(1),contentHash:y().min(1)}),publishState:Jn("kind",[T({kind:q("unpublished")}),T({kind:q("published"),version:y().min(1),contentHash:y().min(1),publishedAt:H()})]),check:M9});T({extId:y().min(1),newVersion:y().min(1).nullish()});T({extId:y().min(1)});T({extId:y().min(1),snapshotHash:y().min(1)});T({channelRef:A9,snapshotHash:y().min(1),zipBase64:y().min(1)});T({id:y().min(1),peerDeviceId:y().min(1),senderDeviceId:y().min(1),text:y().min(1),createdAt:H().int().nonnegative(),readBy:Dr(y().min(1),H().int().positive()).default({}),origin:T({kind:q("persona"),personaId:y().min(1)}).optional()}).strict();T({peerDeviceId:y().min(1).optional(),id:y().min(1),text:y().min(1),createdAt:H().int().nonnegative(),origin:T({kind:q("persona"),personaId:y().min(1)}).optional()}).strict();T({peerDeviceId:y().min(1),sinceCreatedAt:H().int().nonnegative().optional()}).strict();T({peerDeviceId:y().min(1),upToCreatedAt:H().int().nonnegative()}).strict();T({peerDeviceId:y().min(1).optional(),text:y().min(1)});T({peerDeviceId:y().min(1).optional(),command:y().min(1),timeoutMs:H().int().positive().optional()}).strict();T({type:q("peerExec:run:ok"),stdout:y(),stderr:y(),exitCode:H().int().nullable(),timedOut:ie(),stdoutTruncated:ie(),stderrTruncated:ie()}).strict();const kT=Jn("kind",[T({kind:q("at"),at:y().min(1)}),T({kind:q("every"),everyMs:H().int().positive(),anchorMs:H().int().nonnegative().optional()}),T({kind:q("cron"),expr:y().min(1),tz:y().min(1).optional()})]),Uu=y().trim().min(1);T({personaId:Uu,name:y().min(1),schedule:kT,prompt:y().min(1),targetPersona:y().min(1).optional(),timeoutMs:H().int().positive().optional()});T({personaId:Uu,onlyMine:ie().optional()});T({personaId:Uu,shiftId:y().min(1)});const j9=T({name:y().min(1).optional(),schedule:kT.optional(),prompt:y().min(1).optional(),targetPersona:y().min(1).optional(),timeoutMs:H().int().positive().optional(),enabled:ie().optional()});T({personaId:Uu,shiftId:y().min(1),patch:j9});T({personaId:Uu,shiftId:y().min(1),limit:H().int().positive().optional()});const CT="persona-master",Vy=T({personaId:y().min(1),deviceId:y().min(1).optional()}),ET=T({id:y().min(1),name:y().min(1),memberPersonas:G(Vy),memberContactDeviceIds:G(y().min(1)),createdAt:y().min(1),updatedAt:y().min(1)}),IT=y().trim().min(1);T({name:IT,memberPersonas:G(Vy).default([]),memberContactDeviceIds:G(y().min(1)).default([])});T({channelId:y().min(1),name:IT.optional(),memberPersonas:G(Vy).optional(),memberContactDeviceIds:G(y().min(1)).optional()});T({channelId:y().min(1)});T({channels:G(ET)});T({channel:ET});T({ok:q(!0),removedTopics:H().int().min(0)});const Vt=y().trim().min(1),Ky=["master-confirmed","owner-needed"],Gy=["open","resolved"],L9=Ky[0];Ky[1];Gy[0];const D9=Gy[1],O9=ge(Ky),B9=ge(Gy),$9=T({id:Vt.optional(),resolves:Vt.optional(),type:O9,status:B9,question:Vt,recommendation:Vt}).superRefine((e,t)=>{e.type===L9&&e.status!==D9&&t.addIssue({code:X.custom,path:["status"],message:"master-confirmed decisions must be resolved"})}),z9=["planning","running","done"],F9=ge(z9),NT=T({at:y().min(1),actor:y().min(1),action:y().min(1),target:y().optional(),reason:y().min(1),artifacts:G(Vt).optional(),decision:$9.optional()}),H9=T({rejectCount:H().int().min(0),accepted:ie().default(!1),ordinal:H().int().min(1).optional(),overrideCount:H().int().min(0).optional()}),Yy=T({id:y().min(1),channelId:y().min(1),title:y(),masterSessionId:y().min(1),goal:y(),boundaries:y(),acceptanceCriteria:G(y()),activity:G(NT),lineMeta:Dr(H9),nextLineOrdinal:H().int().min(1).optional(),state:F9,createdAt:y().min(1),updatedAt:y().min(1)}),U9=T({lineId:y().min(1),dispatchId:y().min(1),workerSessionId:y().optional(),assignee:y().min(1),focus:y(),status:qy,acceptance:G(y()),rejectCount:H().int().min(0),accepted:ie(),ordinal:H().int().min(1).nullable()});T({channelId:y().min(1)});T({topicId:y().min(1).optional(),sessionId:y().min(1).optional()}).refine(e=>e.topicId!==void 0||e.sessionId!==void 0,{message:"either topicId or sessionId is required"});T({channelId:y().min(1),title:Vt.optional()});T({topicId:y().min(1),title:Vt.optional(),goal:Vt,boundaries:y(),acceptanceCriteria:G(Vt).min(1)});T({topicId:y().min(1),action:Vt,target:Vt.optional(),reason:Vt,artifacts:G(Vt).optional(),decision:NT.shape.decision});T({topicId:y().min(1),lineId:Vt,reason:Vt});T({topicId:y().min(1),lineId:Vt,reason:Vt,artifacts:G(Vt).optional(),watcherVerdict:ge(["pass","fail"]),overrideReason:Vt.optional()}).refine(e=>e.watcherVerdict!=="fail"||!!e.overrideReason,{message:"watcherVerdict=fail 时必须给 overrideReason(推翻 watcher 的理由)",path:["overrideReason"]});T({topicId:y().min(1),state:ge(["done"])});T({topicId:y().min(1),title:Vt});T({topicId:y().min(1)});const W9=Yy.extend({lineCount:H().int().min(0)});T({topics:G(W9)});T({topic:Yy,lines:G(U9)});T({topicId:y().min(1),masterSessionId:y().min(1)});T({rejectCount:H().int().min(1),needsOwnerAttention:ie()});T({acceptedLines:H().int().min(1),totalLines:H().int().min(1),allAccepted:ie(),overrides:H().int().min(0),needsOwnerAttention:ie()});T({topic:Yy});T({ok:q(!0),removedMasterSessionId:y().min(1).nullable(),removedWorkerSessionIds:G(y().min(1))});const q9=["ask","allow","deny"],TT=ge(q9),V9=T({id:y().min(1),desc:y().min(1),action:TT});T({rules:G(V9)});T({ruleId:y().min(1)});T({action:TT,desc:y(),source:y().min(1)});const K9=["created","review-requested"],PT=/^[A-Za-z0-9._-]+$/,Ol=y().min(1).regex(PT),Bl=y().min(1).regex(PT),Wu=H().int().positive();T({role:ge(K9)});T({owner:Ol,repo:Bl,number:Wu});T({owner:Ol,repo:Bl,number:Wu,expectedHeadSha:y().min(1)});T({owner:Ol,repo:Bl,number:Wu,body:y().min(1)});T({owner:Ol,repo:Bl,number:Wu,ready:ie()});T({owner:Ol,repo:Bl});T({owner:Ol,repo:Bl,number:Wu,reviewers:G(y().min(1)).min(1)});T({personaId:y().min(1)});T({personaId:y().min(1)});const G9=["expired","cancelled","access_denied","lark_protocol_error","cloud_unreachable","internal_error"],Y9=ge(G9);T({personaId:y().min(1),appId:y().min(1),appSecret:y().min(1),botName:y().min(1).optional()});const X9=T({chatId:y().min(1),chatName:y().optional(),lastActiveAt:H().int().optional()}),Z9=T({state:ge(["unbound","provisioning","bound","broken"]),appId:y().optional(),botName:y().optional(),brokenReason:y().optional(),qrUrl:y().optional(),provisionId:y().optional(),errorReason:Y9.optional(),groups:G(X9),needsUpgrade:ie().optional(),upgradeQrUrl:y().optional()});Z9.extend({personaId:y().min(1)});T({});T({onboardingCompletedAt:H()});const Gp=["claude","codex","pi"];T({});T({tools:G(T({id:ge(Gp),available:ie(),version:y().optional(),path:y().optional()}))});T({});const Q9=T({tool:ge(Gp),cwd:y(),toolSessionId:y(),label:y().optional(),createdAt:y(),updatedAt:y(),turns:H()});T({candidates:G(Q9)});T({});T({registered:ie()});T({tool:ge(Gp)});const $S=T({usedPercent:H(),windowDurationMins:H().optional(),resetsAt:H().optional()}).strict(),J9=Jn("kind",[T({kind:q("claude"),loggedIn:ie(),authMethod:y().optional(),apiProvider:y().optional(),apiKeySource:y().optional(),email:y().optional(),orgName:y().optional(),subscriptionType:y().optional()}).strict(),T({kind:q("codex"),login:Jn("type",[T({type:q("none")}).strict(),T({type:q("apiKey")}).strict(),T({type:q("chatgpt"),email:y(),planType:y()}).strict()]),provider:T({name:y(),baseUrl:y().optional()}).strict(),rateLimits:T({primary:$S.optional(),secondary:$S.optional()}).strict().optional()}).strict(),T({kind:q("pi"),providers:G(T({id:y(),modelCount:H(),credential:ge(["api_key","oauth"]).optional(),oauthExpiresAt:H().optional()}).strict())}).strict()]);T({tool:ge(Gp),installed:ie(),version:y().optional(),path:y().optional(),account:J9.optional(),error:y().optional(),modelsLoadedAt:H().optional()}).strict();T({apiKey:y().min(1)}).strict();T({ok:q(!0)}).strict();const e$=["cloud-persona-metrics","cloud-persona-conversations"],t$=ge(e$);T({page:t$}).strict();T({url:y(),expiresAt:H().int()}).strict();const RT=["ready","session:info","session:status","session:event","session:deleted","session:rewound","session:cleared","session:queue","permission:request","session:question","session:question:cleared","pong","error","subscribed","unsubscribed","auth:ok","tunnel:ready","tunnel:exited","tunnel:unavailable","session:control","session:pty","contact:added","contact:pinned","contact:removed","contact:remote-access-updated","contact:note-updated","org-mesh:progress","channel:changed","inbox:event","friend:reverseTokenOffered","auth:login:done","auth:login:failed","larkBot:state"],n$="cloud_history_refresh",AT=["idle","running","running-idle","stopped","error","observing"],r$=["task-notification","slash-command","local-command","system-reminder","skill-hint","meta-text","attachment-skills","attachment-deferred-tools","dispatch-task","dispatch-result"];function Yp(e){return e==="dispatch-task"||e==="dispatch-result"}const i$=["builtin","global","project","plugin"],s$=["builtin","global","project","policy","plugin"],MT=ge(["owner","guest"]);T({id:y().min(1),kind:MT,displayName:y(),feishuUnionId:y().optional()}).strict();const o$=T({did:y().min(1),displayName:y(),feishuUnionId:y().optional(),principal:MT}).strict(),a$=ge(AT),l$=T({inputTokens:H().int().nonnegative(),outputTokens:H().int().nonnegative(),cacheReadTokens:H().int().nonnegative().optional(),cacheCreateTokens:H().int().nonnegative().optional()}),jT={gitBranch:y().optional(),resolvedModel:y().optional(),resolvedEffort:y().optional(),contextUsage:l$.optional(),contextWindowSize:H().int().positive().optional(),aiLabel:y().optional()},c$=T(jT),LT=T({value:y(),label:y(),description:y().optional()}),u$=T({id:y().min(1),label:y().min(1),description:y().optional(),contextWindowSize:H().int().positive(),default:ie().optional(),efforts:G(LT).optional(),defaultEffort:y().optional(),group:y().optional()}),d$=T({id:y().min(1),label:y().min(1),description:y().optional()}),h$=T({name:y().min(1),type:ge(["string","select","toggle"]),label:y().min(1),description:y().optional(),options:G(LT).optional(),default:Gi().optional(),scope:ge(["core","tool-specific"])});T({tool:y().min(1),refresh:ie().optional()});const f$=T({rewind:ie(),subagents:ie(),tui:ie(),observe:ie(),fileSharing:ie(),fork:ie()});T({tool:y().min(1),toolSessionIdLabel:y().optional(),models:G(u$),permissionModes:G(d$),configSchema:G(h$),features:f$});const p$=T({tool:y().min(1),pattern:y().min(1),createdAt:y().min(1).optional()});T({cloudEnvironment:er.optional(),cloudExpectedImage:es.optional(),testReleaseId:y().optional(),sessionId:y().min(1),cloudExecutionId:y().min(1).optional(),cloudConversationId:y().min(1).optional(),cloudWorkspace:Dy.optional(),cloudPendingTurns:G(T({id:y().min(1),text:y(),prepared:ie().optional()})).optional(),cloudGatewaySessionId:y().min(1).optional(),cloudPendingCommand:T({id:y().min(1),text:y(),prepared:ie().optional()}).optional(),cwd:y().min(1),tool:q("claude").or(y().min(1)).default("claude"),toolSessionId:y().optional(),label:y().optional(),model:y().optional(),permissionMode:y().optional(),effort:y().optional(),serviceTier:y().optional(),...jT,aiLabelGeneratedAt:y().optional(),permissionRules:G(p$).optional(),pinnedAt:H().int().nonnegative().nullable().optional(),archivedAt:H().int().nonnegative().nullable().optional(),pinSortOrder:H().int().nullable().optional(),unreadAt:y().min(1).nullable().optional(),iconKey:y().optional(),forkedFromSessionId:y().min(1).optional(),ephemeral:ie().optional(),deployId:y().min(1).optional(),ownerPersonaId:y().min(1).optional(),projectPath:y().min(1).optional(),chatId:y().min(1).optional(),creatorPrincipalId:y().min(1).optional(),creatorDisplayName:y().min(1).optional(),creatorFeishuUnionId:y().min(1).optional(),originOwnerPrincipalId:y().min(1).optional(),originOwnerPersonaId:y().min(1).optional(),dispatchedFromSessionId:y().min(1).optional(),shiftFiredFromSessionId:y().min(1).optional(),larkChatId:y().min(1).optional(),larkChatName:y().min(1).optional(),larkChatType:ge(["p2p","group"]).optional(),createdAt:y().min(1),updatedAt:y().min(1)});const qn={turnId:y().min(1).optional(),seq:H().int().nonnegative().optional(),ts:y().optional(),uuid:y().optional()},m$=ge(r$),g$=T({readCount:H().int().nonnegative().optional(),searchCount:H().int().nonnegative().optional(),bashCount:H().int().nonnegative().optional(),editFileCount:H().int().nonnegative().optional(),linesAdded:H().int().nonnegative().optional(),linesRemoved:H().int().nonnegative().optional(),otherToolCount:H().int().nonnegative().optional()}),v$=T({oldStart:H().int().nonnegative(),oldLines:H().int().nonnegative(),newStart:H().int().nonnegative(),newLines:H().int().nonnegative(),lines:G(y())}),x$=T({agentId:y().optional(),agentType:y().optional(),status:y().optional(),prompt:y().optional(),filePath:y().optional(),structuredPatch:G(v$).optional(),stats:T({durationMs:H().int().nonnegative().optional(),tokens:H().int().nonnegative().optional(),toolUseCount:H().int().nonnegative().optional(),toolStats:g$.optional()}).optional()}),y$=T({path:y(),content:y(),mtimeMs:H().optional()}),_$=T({label:y().min(1),description:y().optional()}),DT=T({question:y().min(1),multiSelect:ie(),options:G(_$).min(1)}),b$=["completed","interrupted"];Jn("kind",[T({...qn,kind:q("session_init"),toolSessionId:y().optional()}),T({...qn,kind:q("thinking"),text:y(),partialId:y().optional()}),T({...qn,kind:q("text"),text:y(),partialId:y().optional()}),T({...qn,kind:q("user_text"),text:y(),meta:m$.optional(),taskId:y().optional(),parentToolUseId:y().optional(),sender:o$.optional()}),T({...qn,kind:q("tool_call"),toolUseId:y(),tool:y(),toolKind:y().optional(),input:Gi()}),T({...qn,kind:q("tool_result"),toolUseId:y(),output:Gi().optional(),error:y().optional(),toolResultExtra:x$.optional(),sourceToolAssistantUUID:y().optional(),askQuestionAnswers:Dr(y(),y()).optional()}),T({...qn,kind:q("attachment_memories"),memories:G(y$)}),T({...qn,kind:q("permission_request"),requestId:y(),tool:y(),input:Gi(),toolUseId:y().optional()}),T({...qn,kind:q("ask_user_question"),toolUseId:y(),questions:G(DT)}),T({...qn,kind:q("turn_end"),durationMs:H().int().nonnegative().optional(),reason:ge(b$).optional(),turnId:y().min(1).optional()}),T({...qn,kind:q("subagent_progress"),toolUseId:y(),agentId:y(),status:ge(["started","running","completed","failed"]),description:y().optional(),lastToolName:y().optional(),prompt:y().optional(),stats:T({durationMs:H().int().nonnegative().optional(),tokens:H().int().nonnegative().optional(),toolUseCount:H().int().nonnegative().optional()}).optional()}),T({...qn,kind:q("error"),message:y()}),T({...qn,kind:q("meta_update"),patch:c$}),T({...qn,kind:q("meta-text"),text:y(),metaSource:ge(["cc","owner"]).optional()})]);T({cwd:y().min(1).optional(),tool:y().optional(),label:y().optional(),aiLabel:y().optional(),model:y().optional(),permissionMode:y().optional(),effort:y().optional(),serviceTier:mT.optional(),iconKey:y().optional(),forkedFromSessionId:y().min(1).optional(),ephemeral:ie().optional(),ownerPersonaId:y().min(1).optional(),projectPath:y().min(1).optional()}).refine(e=>e.cwd!=null||e.ownerPersonaId!=null||e.projectPath!=null,{message:"cwd / ownerPersonaId / projectPath 至少传一个"});T({path:y().min(1),name:y().min(1),createdAt:y().datetime(),pinnedAt:H().optional()});T({path:y().min(1),pinnedAt:H().nullable()});T({path:y().min(1)});T({path:y().min(1).optional(),name:y().min(1).optional()}).refine(e=>e.path!=null||e.name!=null,{message:"path 与 name 至少给一个"});T({cwd:y().min(1),tool:y().min(1),toolSessionId:y().min(1),label:y().optional(),aiLabel:y().optional(),iconKey:y().optional(),createdAt:y().datetime(),updatedAt:y().datetime(),ownerPersonaId:y().min(1).optional()});T({originOnly:ie().optional(),ownerPersonaId:y().min(1).optional(),limit:H().int().positive().optional(),offset:H().int().nonnegative().optional()});T({sessionId:y().min(1)});T({sessionId:y().min(1),patch:T({label:y().optional(),model:y().optional(),permissionMode:y().optional(),effort:y().optional(),cwd:y().optional(),iconKey:y().optional(),ephemeral:q(!1).optional()})});T({id:y().min(1),text:y(),queuedAt:H(),senderDisplayName:y().optional()});T({sessionId:y().min(1),text:y(),queueWhileRunning:ie().optional()});T({sessionId:y().min(1),id:y().min(1).optional()});T({sessionId:y().min(1),userMessageId:y().min(1),dryRun:ie().optional()});T({canRewind:ie(),error:y().optional(),filesChanged:G(y()).optional(),insertions:H().int().nonnegative().optional(),deletions:H().int().nonnegative().optional()});T({sessionId:y().min(1),userMessageId:y().min(1)});const w$=T({oldStart:H().int().nonnegative(),oldLines:H().int().nonnegative(),newStart:H().int().nonnegative(),newLines:H().int().nonnegative(),lines:G(y())}),S$=T({filePath:y().min(1),hunks:G(w$),insertions:H().int().nonnegative(),deletions:H().int().nonnegative(),status:ge(["modified","added","deleted"]).optional()});T({canRewind:ie(),error:y().optional(),files:G(S$),totalInsertions:H().int().nonnegative(),totalDeletions:H().int().nonnegative()});T({userMessageIds:G(y())});T({sessionId:y().min(1),toolSessionId:y().min(1)});T({cwd:y().min(1),toolSessionId:y().min(1),messageUuid:y().min(1).optional(),turnId:y().min(1).optional(),sourceSessionId:y().min(1).optional(),targetCwd:y().min(1).optional()}).refine(e=>!!(e.messageUuid||e.turnId),"messageUuid or turnId required");T({forkedToolSessionId:y().min(1),forkedFilePath:y().min(1)});T({sessionId:y().min(1),toolSessionId:y().min(1),jsonlPath:y().optional()});T({sessionId:y().min(1),afterSeq:H().int().min(-1)});T({sessionId:y().min(1),permissionRequestId:y().min(1),allow:ie(),permanent:ie().optional(),pattern:y().optional()});T({projectPath:y().min(1)});T({sessionId:y().min(1),limit:H().int().positive().max(5e3).optional(),offset:H().int().nonnegative().optional(),snapshotId:y().uuid().optional(),slim:ie().optional(),view:ge(["turns","items"]).optional(),cursor:y().min(1).max(16384).optional(),turnId:y().min(1).max(256).optional()}).superRefine((e,t)=>{e.view==="items"&&!e.turnId&&t.addIssue({code:X.custom,path:["turnId"],message:"items requires turnId"}),e.view&&(e.offset!==void 0||e.slim!==void 0)&&t.addIssue({code:X.custom,message:"native views do not accept offset or slim"}),!e.view&&(e.cursor!==void 0||e.turnId!==void 0)&&t.addIssue({code:X.custom,message:"cursor and turnId require a native view"}),e.view==="turns"&&e.turnId!==void 0&&t.addIssue({code:X.custom,path:["turnId"],message:"turns does not accept turnId"}),e.view&&e.limit!==void 0&&e.limit>100&&t.addIssue({code:X.custom,path:["limit"],message:"native page limit is 100"})});T({cwd:y().min(1),toolSessionId:y().min(1)});T({cwd:y().min(1),toolSessionId:y().min(1),subagentId:y().min(1)});T({cwd:y().min(1).optional(),path:y().optional(),showHidden:ie().optional()});T({cwd:y().min(1),path:y().min(1)});T({cwd:y().min(1),tool:y().optional()});T({name:y().min(1),source:ge(i$),path:y().optional(),description:y().optional(),plugin:y().optional()});const k$=T({name:y().min(1),source:ge(s$),path:y().optional(),description:y().optional(),whenToUse:y().optional(),plugin:y().optional()});T({cwd:y().min(1),tool:y().optional()});T({agents:G(k$)});T({sessionId:y().optional()});T({sessionId:y().min(1).optional()});T({sessionId:y().min(1),pinned:ie()});T({sessionId:y().min(1),archived:ie()});T({query:y().min(1),sessionIds:G(y().min(1)),limit:H().int().positive().max(50).optional()});const C$=T({sessionId:y().min(1),snippet:y()});T({type:q("session:searchContent"),matches:G(C$)});T({type:q("peerSession:upsert:ok")});T({sessionId:y().min(1)});T({type:q("peerSession:remove:ok")});T({orderedIds:G(y().min(1)).min(1)});T({cwd:y().min(1)});T({isGitRoot:ie(),gitRoot:y().nullable()});T({cwd:y().min(1)});T({branch:y().nullable()});T({cwd:y().min(1)});T({branches:G(y()),head:y().nullable()});const E$=T({cwd:y().min(1),updatedAt:y().min(1)});T({dirs:G(E$)});T({type:q("session:question"),sessionId:y().min(1),toolUseId:y().min(1),requestId:y().min(1),questions:G(DT).min(1)});T({type:q("session:question:cleared"),sessionId:y().min(1),toolUseId:y().min(1),answers:Dr(y(),y()).optional()});T({sessionId:y().min(1),toolUseId:y().min(1),answers:Dr(y(),y())});T({ok:q(!0)});T({sessionId:y().min(1),toolUseId:y().min(1)});T({ok:q(!0)});const OT=T({name:y().min(1),version:y().min(1),instanceId:y().min(1),deviceLabel:y().transform(e=>e.trim().slice(0,64)).optional()});T({type:q("auth"),token:y().min(1),scheme:q("bearer").optional(),clientInfo:OT.optional()});T({type:q("auth:ok"),version:y().min(1).optional(),protocolVersion:H().int().nonnegative().optional()});const I$=T({clientId:y().min(1),connectedAt:H().int().nonnegative(),self:ie(),clientInfo:OT.optional()});T({type:q("device:connections:ok"),connections:G(I$)});T({type:q("tunnel:ready"),url:y().min(1),subdomain:y().min(1)});T({type:q("tunnel:exited"),code:H().int().nullable(),subdomain:y().nullable(),url:y().nullable()});T({type:q("tunnel:unavailable"),reason:y().min(1),failedAt:y().min(1)});const N$=T({sessionId:y().min(1),status:a$,freshSpawn:ie(),pendingPermissionRequestIds:G(y().min(1)),pendingQuestionToolUseIds:G(y().min(1))});T({type:q("info"),version:y(),protocolVersion:H(),hostname:y(),os:y(),tools:G(T({id:y(),available:ie()})),runningSessions:G(N$),tokenRole:ge(BB).optional(),isLoopback:ie().optional(),httpBaseUrl:y().optional(),httpToken:y().optional(),daemonSource:ge(["ota","packaged"]).optional(),globalCliVersion:y().nullable().optional()});T({});T({method:y().min(1).optional()});const T$=["allowed","conditional","denied"],P$=ge(T$),R$=T({name:y().min(1),status:P$,description:y().min(1),args:G(T({name:y(),required:ie()})).nullable(),argsSchema:Dr(Gi()).optional(),reason:y().optional()});T({type:q("meta:methods"),methods:G(R$)});const zS=1,A$=T({usedBytes:H().int().nonnegative(),sizeBytes:H().int().positive(),measuredAt:H().int().nonnegative()}).strict();T({volume:A$.nullable()}).strict();const FS=25*1024*1024,Xy={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".pdf":"application/pdf",".txt":"text/plain",".md":"text/plain",".markdown":"text/plain",".csv":"text/plain",".log":"text/plain",".json":"application/json",".xml":"application/xml",".yaml":"application/yaml",".yml":"application/yaml",".html":"text/html",".conf":"text/plain",".cfg":"text/plain",".ini":"text/plain",".toml":"text/plain"},BT=new Set([...Object.values(Xy),"application/x-yaml"]),M$=[...BT,"text/*",...Object.keys(Xy)].join(",");function $T(e,t){const n=t.split(";",1)[0].trim().toLowerCase();if(n===""||n==="application/octet-stream"){const r=e.lastIndexOf("."),i=r>0?e.slice(r).toLowerCase():"";return Xy[i]??null}return BT.has(n)||n.startsWith("text/")?n:null}const j$=["daemon","main","renderer"],L$=ge(j$),D$=["debug","info","warn","error"],O$=ge(D$);T({ts:H().int(),source:L$,level:O$,msg:y(),ownerPrincipalId:y(),deviceId:y(),appVersion:y(),daemonVersion:y().optional(),os:y(),meta_json:y().optional(),sessionId:y().optional()});T({v:q(1),visitorId:y().min(1),displayName:y(),provider:y(),iat:H(),exp:H()});const B$=T({visitorId:y(),displayName:y(),avatarUrl:y().optional(),provider:y(),firstSeen:H(),lastSeen:H()});T({visitors:G(B$)});const $$=/<system-reminder>此消息来自飞书群成员 (.+?)<\/system-reminder>\s*$/,zT=/<system-reminder>此消息来自 (owner|guest):(.+?)<\/system-reminder>\s*$/,FT="clawd-dispatch-task",HT="clawd-dispatch-result",HS=120;function z$(e){if(!e)return null;const t=e.search(US(FT)),n=e.search(US(HT));return t<0&&n<0?null:n<0?"task":t<0?"result":t<n?"task":"result"}function F$(e){if(!e)return[];const t=[];for(const n of["task","result"]){const r=n==="task"?FT:HT,i=new RegExp(`<${r}\\b([^>]*)>([\\s\\S]*?)</${r}>`,"gi");for(let s=i.exec(e);s!==null;s=i.exec(e))t.push({at:s.index,block:H$(n,s[1]??"",s[2]??"")})}return t.sort((n,r)=>n.at-r.at).map(n=>n.block)}function H$(e,t,n){var c;const r=Y$(t),i=lx(G$(bg(n,"detail")??n)),s=(c=bg(n,"brief"))==null?void 0:c.trim(),o=s&&s.length>0?lx(s):U$(i),a=r.round!==void 0?Number.parseInt(r.round,10):void 0,l=r.status;return{kind:e,dispatchId:r["dispatch-id"]??"",...r.from?{from:r.from}:{},...e==="task"&&a!==void 0&&Number.isFinite(a)?{round:a}:{},...e==="result"&&(l==="success"||l==="failure")?{status:l}:{},brief:o,briefIsDerived:!(s&&s.length>0),detail:i,filePaths:K$(bg(n,"files"))}}function U$(e){const t=e.split(/\n\s*\n/).map(r=>r.trim()).find(r=>r.length>0);if(!t)return"";const n=t.replace(/\s+/g," ");return n.length>HS?`${n.slice(0,HS)}…`:n}const W$="clawd-dispatch-task|clawd-dispatch-result|brief|detail|files",q$=new RegExp(`<\\\\(\\\\*)(/?)(${W$})\\b`,"g");function V$(e){return lx(e)}function lx(e){return e.replace(q$,"<$1$2$3")}function bg(e,t){const n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`,"i").exec(e);return n?n[1]??"":null}function K$(e){return e?e.split(`
|
|
96
|
+
`).map(t=>t.trim()).filter(t=>t.startsWith("- ")).map(t=>t.slice(2).trim()).filter(t=>t.length>0):[]}function G$(e){return e.replace(/^\n/,"").replace(/\n$/,"")}function US(e){return new RegExp(`<${e}\\b[^>]*>`,"i")}function Y$(e){const t={},n=/([a-z-]+)="([^"]*)"/gi;for(let r=n.exec(e);r!==null;r=n.exec(e))t[r[1]]=X$(r[2]??"");return t}function X$(e){return e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}const Z$=new Set(["localhost","127.0.0.1","0.0.0.0","::1"]);let ji=null;function Q$(){if(ji!==null)return ji;if(typeof window>"u")return ji=!1,!1;if(Z$.has(window.location.hostname)||window.location.protocol==="file:")return ji=!0,!0;if(new URLSearchParams(window.location.search).get("debug")==="1"){ji=!0;try{sessionStorage.setItem("debug","1")}catch{}}else try{ji=sessionStorage.getItem("debug")==="1"}catch{ji=!1}return ji}function Oe(e,...t){Q$()&&console.log(`[${e}][${new Date().toISOString()}]`,...t)}function Fd(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}const J$=e=>{const t=[1e3,2e3,4e3,8e3,16e3,3e4];return t[Math.min(e,t.length-1)]},ez=new Set(["auth:ok","pong","error"]),WS=new Set(RT.filter(e=>!ez.has(e)));let tz=0;const qS=()=>`r${++tz}`;function nz(e){let t=e.url,n=e.authToken,r=e.selfIdentity;const i=e.clientInfo,s=e.requestTimeoutMs??3e4,o=e.pingIntervalMs??3e4,a=e.watchdogMs??6e4,l=e.authTimeoutMs??1e4,c=e.backoffMs??J$;let u=null,d=!1,f=0,p=null,m=null,x=null,w=null,v=!1,_="disconnected";const b=new Map,S=new Map;let C=null;const k=(B,I)=>{var U;B==="ready"&&(C=I),(U=S.get(B))==null||U.forEach(V=>{try{V(I)}catch{}})},N=B=>{_!==B&&(_=B,k("status",B))},E=(B,I)=>{const U=S.get(B)??new Set;if(U.add(I),S.set(B,U),B==="ready"&&C!==null)try{I(C)}catch{}return()=>U.delete(I)},L=()=>{m&&(clearInterval(m),m=null),x&&(clearTimeout(x),x=null),w&&(clearTimeout(w),w=null)},P=()=>{x&&clearTimeout(x),x=setTimeout(()=>{try{u==null||u.close(4e3,"pong watchdog")}catch{}},a)},D=()=>{m&&clearInterval(m),m=setInterval(()=>{(u==null?void 0:u.readyState)===1&&u.send(JSON.stringify({type:"ping",requestId:qS()}))},o),P()},R=B=>{for(const[,I]of b)clearTimeout(I.timer),I.reject(new Error(B));b.clear()},A=[],M=()=>{if(A.length===0)return;const B=A.splice(0);for(const I of B)(u==null?void 0:u.readyState)===1&&!v?I.doSend():(clearTimeout(I.timer),I.reject(new Error("NOT_CONNECTED")))},j=B=>{if(A.length===0)return;const I=A.splice(0);for(const U of I)clearTimeout(U.timer),U.reject(new Error(B))},z=()=>{if(d)return;const B=c(f);if(B<0){j("connection closed: not reconnecting");return}k("daemon:reconnecting",{attempt:f+1,nextDelayMs:B,scheduledAt:Date.now()}),p&&clearTimeout(p),p=setTimeout(()=>{f+=1,$()},B)},F=B=>{P();const I=String(B.type??"");if(I==="auth:ok"){Oe("daemon-client","auth:ok received → connected",{url:t}),w&&(clearTimeout(w),w=null),v=!1,f=0,N("connected"),k("daemon:connected",{url:t}),D(),M();return}if(I==="pong")return;if(I==="ready"){const V=Number(B.protocolVersion??-1);V!==zS&&k("daemon:version-mismatch",{daemonProtocol:V,supportedProtocol:zS}),k("ready",B);return}const U=B.requestId;if(typeof U=="string"&&b.has(U)){const V=b.get(U);if(b.delete(U),clearTimeout(V.timer),I==="error"){const O=String(B.code??"ERR"),ne=String(B.message??"unknown");V.reject(new Error(`${O}: ${ne}`))}else WS.has(I)&&k(I,B),V.resolve(B);return}WS.has(I)&&k(I,B)},$=()=>{p&&(clearTimeout(p),p=null),Oe("daemon-client","connect →",{url:t,token:Fd(n),attempt:f}),N("connecting");let B;try{B=new WebSocket(t)}catch(I){N("disconnected"),k("daemon:disconnected",{reason:(I==null?void 0:I.message)??"ws constructor failed"}),z();return}u=B,v=!!n,B.onopen=()=>{if(B!==u){Oe("daemon-client","onopen → stale (replaced before opened), ignore");return}if(n){Oe("daemon-client","onopen → send auth frame",{token:Fd(n)});const I={type:"auth",token:n};r!=null&&r.principalId&&(I.selfPrincipalId=r.principalId),r!=null&&r.displayName&&(I.selfDisplayName=r.displayName),i&&(I.clientInfo=i),B.send(JSON.stringify(I)),w=setTimeout(()=>{try{B.close(4001,"auth handshake timeout")}catch{}},l)}else Oe("daemon-client","onopen → no token, treat as connected (daemon authMode=none)"),f=0,N("connected"),k("daemon:connected",{url:t}),D(),M()},B.onclose=I=>{if(B!==u){Oe("daemon-client","onclose → stale, ignore",{code:I.code,reason:I.reason});return}const U=I.reason||(I.code===1008?"auth failed":`close ${I.code}`);if(Oe("daemon-client","onclose →",{code:I.code,reason:U,awaitingAuth:v,manualStop:d}),L(),R(`connection closed: ${U}`),u=null,I.code===4401?N("revoked"):N("disconnected"),k("daemon:disconnected",{reason:U}),I.code===1008||I.code===4401){j(`connection closed: ${U}`);return}d?j(`connection closed: ${U}`):z()},B.onerror=()=>{},B.onmessage=I=>{if(B!==u)return;let U;try{U=JSON.parse(String(I.data))}catch{return}F(U)}};return{start(){d=!1,f=0,$()},stop(){d=!0,p&&(clearTimeout(p),p=null),L();try{u==null||u.close(1e3,"shutdown")}catch{}u=null,R("shutdown"),j("shutdown"),N("disconnected")},switchProfile(B){Oe("daemon-client","switchProfile →",{url:B.url,token:Fd(B.authToken)},"prev:",{url:t,token:Fd(n)}),t=B.url,n=B.authToken,B.selfIdentity!==void 0&&(r=B.selfIdentity),f=0,d=!0,p&&(clearTimeout(p),p=null),L(),R("switch profile"),j("switch profile");try{u==null||u.close(1e3,"switch profile")}catch{}u=null,d=!1,$()},request(B,I){return new Promise((U,V)=>{const O=qS(),ne=setTimeout(()=>{b.delete(O);const Y=A.findIndex(ye=>ye.timer===ne);Y>=0&&A.splice(Y,1),V(new Error(`request timeout: ${B}`))},B==="cloud:workspace"?Math.max(s,33e4):s),ae=()=>{b.set(O,{resolve:Y=>U(Y),reject:V,timer:ne}),u.send(JSON.stringify({...I,type:B,requestId:O}))};(u==null?void 0:u.readyState)===1&&!v?ae():d||u==null&&p==null?(clearTimeout(ne),V(new Error("NOT_CONNECTED"))):A.push({doSend:ae,reject:V,timer:ne})})},on:E,get isOpen(){return(u==null?void 0:u.readyState)===1&&!v},get url(){return t},getStatus(){return _}}}function rz(e){const t=e.trim(),n=t.indexOf("#");if(n<0)return{url:t};const r=t.slice(0,n),i=t.slice(n+1),o=new URLSearchParams(i).get("token")??void 0;return{url:r,token:o??void 0}}function iz(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}function sz(e){return e?{id:e.id,mode:e.mode,url:e.url,token:iz(e.token),name:e.name}:null}function Hd(e){return e?Array.isArray(e)?e.map(sz):{_notArray:typeof e,_value:e}:null}function VS(e){return e==null?null:typeof e=="object"&&"value"in e?e.value:e}const oz="ws://127.0.0.1:18790",KS="daemon:profiles",GS="daemon:active-profile-id";function az(){return Math.random().toString(36).slice(2,10)}function lz(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.name=="string"&&(t.mode==="localhost"||t.mode==="remote")&&typeof t.url=="string"&&(t.token===void 0||typeof t.token=="string")}function UT(e){let t={profiles:[],activeId:null},n=!1,r=null;const i=new Set,s=()=>{for(const l of i)l(t)},o=async()=>{Oe("profile-store","persist →",Hd(t.profiles),"active:",t.activeId),await e.kv.set(KS,t.profiles),await e.kv.set(GS,t.activeId)},a=async()=>{if(!n){if(r){await r;return}r=(async()=>{var l;try{let c=null;try{const d=await e.kv.get(KS);c=VS(d)}catch{c=null}let u=null;try{const d=await e.kv.get(GS);u=VS(d)??null}catch{u=null}if(Oe("profile-store","ensureLoaded read kv →","profiles:",Hd(c),"activeId:",u),Array.isArray(c)&&c.length>0){const d=c.filter(lz),f=u&&d.some(p=>p.id===u)?u:((l=d[0])==null?void 0:l.id)??null;t={profiles:d,activeId:f},n=!0,Oe("profile-store","ensureLoaded → use kv profiles",Hd(d),"active:",f);return}t={profiles:[{id:"default",name:"本机",mode:"localhost",url:oz}],activeId:"default"},Oe("profile-store","ensureLoaded → fallback synthesized default (NO token)",Hd(t.profiles)),n=!0,await o()}finally{r=null}})(),await r}};return{async load(){return await a(),s(),t},async snapshot(){return await a(),t},async upsert(l){var w;await a();let c=l.url,u=l.token;if(c&&c.includes("#")){const v=rz(c);c=v.url,!u&&v.token&&(u=v.token)}const d=l.id?t.profiles.find(v=>v.id===l.id):void 0,f=u!=null&&u.trim()?u.trim():d==null?void 0:d.token;if(l.mode==="remote"&&!f)throw new Error("remote mode requires token");const p=l.id??az(),m={id:p,name:((w=l.name)==null?void 0:w.trim())||(d==null?void 0:d.name)||(l.mode==="remote"?"远程":"本机"),mode:l.mode,url:c.trim(),token:f};return t={profiles:[...t.profiles.filter(v=>v.id!==p),m],activeId:p},await o(),s(),m},async delete(l){var d;await a();const c=t.profiles.filter(f=>f.id!==l);let u=t.activeId;u===l&&(u=((d=c[0])==null?void 0:d.id)??null),t={profiles:c,activeId:u},await o(),s()},async activate(l){await a(),t.profiles.some(c=>c.id===l)&&(t={...t,activeId:l},await o(),s())},subscribe(l){return i.add(l),()=>i.delete(l)},getActive(){return n?t.profiles.find(l=>l.id===t.activeId)??null:null}}}const YS="clawd.client-instance-id";let cz={name:"clawd-web",version:"unknown"};function uz(){let e=null;try{e=localStorage.getItem(YS),e||(e=crypto.randomUUID(),localStorage.setItem(YS,e))}catch{e=e??crypto.randomUUID()}return{...cz,instanceId:e}}function XS(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}const WT=g.createContext(null);function dz({host:e,children:t}){const[n,r]=g.useState(null),i=g.useMemo(()=>async()=>{const s=UT(e),o=await s.load(),a=o.profiles.find(c=>c.id===o.activeId)??o.profiles[0];if(!a)throw new Error("DaemonProvider: profile store has no profiles after load");return Oe("daemon-context","bootstrap → createDaemonClient",{id:a.id,url:a.url,token:XS(a.token)}),{client:nz({url:a.url,authToken:a.token,clientInfo:uz()}),store:s}},[e]);return g.useEffect(()=>{let s=!0,o=null,a=null;return i().then(l=>{s&&(l.client.start(),o=l,r(l),a=l.store.subscribe(()=>{const c=l.store.getActive();if(!c){Oe("daemon-context","subscribe → no active profile, skip switchProfile");return}Oe("daemon-context","subscribe → switchProfile",{id:c.id,url:c.url,token:XS(c.token)}),l.client.switchProfile({url:c.url,authToken:c.token})}))}),()=>{s=!1,a==null||a(),o==null||o.client.stop()}},[i]),n?h.jsx(WT.Provider,{value:n,children:t}):null}function Ti(){const e=g.useContext(WT);if(!e)throw new Error("useDaemonClient must be used inside <DaemonProvider>");return e.client}function hz(){const e=Ti(),[t,n]=g.useState(void 0);return g.useEffect(()=>e.on("ready",i=>{const s=i.mode,o=s==="tui"?"tui":"sdk";Oe("daemon-context","useDaemonMode ready.mode =",{rawMode:s,resolved:o}),n(o)}),[e]),t}function fz(){const e=Ti(),[t,n]=g.useState(void 0);return g.useEffect(()=>e.on("ready",i=>{const s=i;s.version!==void 0&&n(s.principalKind==="guest"?"guest":"owner")}),[e]),t}const qT=g.createContext(null);function pz({cache:e,children:t}){return g.createElement(qT.Provider,{value:e},t)}function as(){const e=g.useContext(qT);if(!e)throw new Error("useCache must be used inside <CacheProvider>");return e}function ts(e){const t=as(),n=g.useCallback(i=>t.observe(e,()=>i()),[t,e]),r=g.useCallback(()=>t.read(e),[t,e]);return g.useSyncExternalStore(n,r,r)}const VT={actionsLevel:"none",httpBaseUrl:null,httpToken:null},KT=g.createContext(VT);function Xp(){return g.useContext(KT)}function mz(e){return e!=null&&e.httpBaseUrl?{actionsLevel:e.tokenRole==="owner"?"owner":"none",httpBaseUrl:e.httpBaseUrl,httpToken:e.httpToken??null}:VT}function gz(){const e=ts("daemon-info");return g.useMemo(()=>mz(e),[e])}function vz({children:e}){const t=gz();return Qe.createElement(KT.Provider,{value:t},e)}function xz(e,t,n){if(!e.httpBaseUrl)return null;const r=encodeURIComponent(n);return`${e.httpBaseUrl}/session/${encodeURIComponent(t.sessionId)}/files?path=${r}`}function yz(e){const t=new Map;return{observe(n,r){let i=t.get(n);i||(i={data:void 0,hasData:!1,listeners:new Set},t.set(n,i));const s=l=>r(l);i.listeners.add(s);const o=i.listeners.size===1;s(i.hasData?i.data:void 0),o&&e.onFirstObserver(n);let a=!1;return()=>{if(a)return;a=!0;const l=t.get(n);l&&(l.listeners.delete(s),l.listeners.size===0&&(t.delete(n),e.onLastObserver(n)))}},read(n){const r=t.get(n);return r!=null&&r.hasData?r.data:void 0},setData(n,r){const i=t.get(n);if(!i)return;const s=i.hasData?i.data:void 0,o=r(s);i.data=o,i.hasData=!0;for(const a of i.listeners)a(o)}}}function _z(){const e=[],t=new Map,n=r=>{for(const i of e)if(i.pattern.test(r))return i.source;return null};return{register(r,i){e.push({pattern:r,source:i})},activate(r){if(t.has(r))return;const i=n(r);if(!i)throw new Error(`no source registered for key: ${r}`);t.set(r,i.start(r))},deactivate(r){const i=t.get(r);i&&(t.delete(r),i())}}}function bz(e){return{request:(t,n)=>e.request(t,n),onFrame(t){const n=[];for(const r of RT)n.push(e.on(r,i=>t(r,i)));return()=>{for(const r of n)r()}},onConnect(t){return e.on("daemon:connected",()=>t())},get isConnected(){return e.isOpen}}}function GT(e){const t=(e??"claude")==="claude";return{rewind:t,subagents:t,tui:t,observe:t,fileSharing:t,fork:t}}const wz=e=>({tool:e,models:[{id:"",label:"未指定",contextWindowSize:2e5,default:!0}],permissionModes:[{id:"",label:"未指定"}],configSchema:[],features:GT(e)});function Sz(e,t){return{start(n){const r=n.replace(/^capabilities\//,"");let i=!1;const s=async()=>{try{const a=await e.request("capabilities:get",{tool:r});if(i)return;t(n,()=>a)}catch{if(i)return;t(n,()=>wz(r))}},o=e.onConnect(()=>{s()});return s(),()=>{i=!0,o()}}}}function kz(e,t){return{start(n){let r=!1;const i=async()=>{try{const a=await e.request("session:list",void 0);if(r)return;t(n,()=>a.sessions??[])}catch{}},s=e.onFrame((a,l)=>{if(a==="session:info"){const c=l;if(c.chatId!==void 0)return;t(n,u=>[c,...(u??[]).filter(d=>d.sessionId!==c.sessionId)])}else if(a==="session:deleted"){const c=l;t(n,u=>(u??[]).filter(d=>d.sessionId!==c.sessionId))}}),o=e.onConnect(()=>{i()});return i(),()=>{r=!0,s(),o()}}}}const wu={sessionId:null,events:[],lastSeq:-1,pendingPermissions:[],status:"idle",pendingQuestions:{},queued:[]};function wg(e,t){const n=t;if(n.kind==="permission_request"&&typeof n.requestId=="string"){if(e.some(i=>i.requestId===n.requestId))return e;const r={requestId:n.requestId,tool:typeof n.tool=="string"?n.tool:"",input:n.input,...typeof n.toolUseId=="string"&&n.toolUseId?{toolUseId:n.toolUseId}:{}};return[...e,r]}if(n.kind==="tool_result"&&typeof n.toolUseId=="string"&&n.toolUseId){const r=e.findIndex(i=>i.toolUseId===n.toolUseId);if(r>=0)return e.filter((i,s)=>s!==r)}return e}function YT(e,t,n){const r=n===void 0?e.sessionId:n;switch(t.type){case"session:change":return{...wu,sessionId:t.sessionId};case"session:event":{if(!r||t.sessionId!==r)return e;const i=typeof t.event.seq=="number"?t.event.seq:-1,s=[...e.events,t.event],o=i>e.lastSeq?i:e.lastSeq,a=wg(e.pendingPermissions,t.event);return{...e,events:s,lastSeq:o,pendingPermissions:a}}case"session:status":return!r||t.sessionId!==r?e:{...e,status:t.status};case"session:queue":return!r||t.sessionId!==r?e:{...e,queued:t.items};case"session:events":{if(!r||t.sessionId!==r)return e;const i=t.events.map(o=>o.event),s=i.reduce((o,a)=>wg(o,a),[]);return{...e,sessionId:t.sessionId,events:i,lastSeq:t.latestSeq,pendingPermissions:s}}case"session:events:append":{if(!r||t.sessionId!==r)return e;const i=new Set;for(const c of e.events){const u=c.seq;typeof u=="number"&&i.add(u)}const s=[];for(const c of t.events)typeof c.seq=="number"&&(i.has(c.seq)||s.push(c.event));const o=t.latestSeq>e.lastSeq?t.latestSeq:e.lastSeq;if(s.length===0)return o===e.lastSeq?e:{...e,lastSeq:o};const a=[...e.events,...s].sort((c,u)=>{const d=c.seq??-1,f=u.seq??-1;return d-f}),l=s.reduce((c,u)=>wg(c,u),e.pendingPermissions);return{...e,events:a,lastSeq:o,pendingPermissions:l}}case"permission:request":{if(!r||t.sessionId!==r||e.pendingPermissions.some(s=>s.requestId===t.requestId))return e;const i={requestId:t.requestId,tool:t.tool,input:t.input,...t.toolUseId?{toolUseId:t.toolUseId}:{}};return{...e,pendingPermissions:[...e.pendingPermissions,i]}}case"permission:clear":{if(!r||r!==t.sessionId)return e;const i=t.requestId,s=e.pendingPermissions.findIndex(c=>c.requestId===i),o=s>=0?e.pendingPermissions.filter((c,u)=>u!==s):e.pendingPermissions;if(e.events.length===0)return o===e.pendingPermissions?e:{...e,pendingPermissions:o};const a=e.events.length-1,l=e.events[a];return l.kind==="permission_request"&&l.requestId===i?{...e,pendingPermissions:o,events:e.events.slice(0,a)}:o===e.pendingPermissions?e:{...e,pendingPermissions:o}}case"session:question":return!r||t.sessionId!==r?e:{...e,pendingQuestions:{...e.pendingQuestions,[t.toolUseId]:{toolUseId:t.toolUseId,requestId:t.requestId,questions:t.questions}}};case"session:question:clear":{if(!r||t.sessionId!==r||!(t.toolUseId in e.pendingQuestions))return e;const{[t.toolUseId]:i,...s}=e.pendingQuestions;return{...e,pendingQuestions:s}}case"session:question:submitted":{if(!r||t.sessionId!==r)return e;const i=e.pendingQuestions[t.toolUseId];return i?{...e,pendingQuestions:{...e.pendingQuestions,[t.toolUseId]:{...i,submittedAnswers:t.answers}}}:e}case"session:rewound":return!r||t.sessionId!==r?e:{...e,pendingPermissions:[],status:"idle"};case"ready":{if(!r)return e;const i=t.runningSessions.find(o=>o.sessionId===r);if(i!=null&&i.freshSpawn)return{...wu,sessionId:r};const s=(i==null?void 0:i.status)??"idle";return s===e.status?e:{...e,status:s}}case"daemon:disconnected":return{...e,pendingPermissions:[]};default:return e}}const Cz="session/";function Ez(e){return{sid:e.slice(Cz.length)}}const Iz=new Set(AT);function XT(e){return Iz.has(e)}function ZS(e){return XT(e)?e:"idle"}function Nz(e,t){return{start(n){const{sid:r}=Ez(n);let i=!1,s=-1;const o=f=>{t(n,p=>YT(p??wu,f,r))},a=async f=>{const p=f==="baseline"?-1:s;try{const m=await e.request("session:events",{sessionId:r,afterSeq:p});if(i)return;const x=m.events??[],w=m.latestSeq??-1;if(f==="baseline")o({type:"session:events",sessionId:r,events:x,latestSeq:w}),s=w;else{const v=m.bufferStartSeq??0,_=w<p||v>p+1;o({type:_?"session:events":"session:events:append",sessionId:r,events:x,latestSeq:w}),s=Math.max(s,w)}}catch{}},l=async()=>{try{const f=await e.request("info");if(i)return;o({type:"ready",runningSessions:(f.runningSessions??[]).map(p=>({sessionId:p.sessionId,freshSpawn:p.freshSpawn,status:ZS(p.status)}))})}catch{}},c=async()=>{try{await e.request("session:subscribe",{sessionId:r})}catch{}i||(await a(s<0?"baseline":"delta"),!i&&await l())},u=e.onFrame((f,p)=>{if(!i)if(f==="session:event"){const m=p;if(m.sessionId!==r)return;const x=m.event.seq;Oe("session-events","push session:event",{sid:r,kind:m.event.kind,seq:x,lastSeqBefore:s}),o({type:"session:event",sessionId:m.sessionId,event:m.event}),typeof x=="number"&&x>s&&(s=x)}else if(f==="session:status"){const m=p;if(m.sessionId!==r)return;if(!XT(m.status)){Oe("session-events","push session:status drop",{sid:r,status:m.status});return}Oe("session-events","push session:status",{sid:r,status:m.status}),o({type:"session:status",sessionId:m.sessionId,status:m.status})}else if(f==="session:cleared"){if(p.sessionId!==r)return;Oe("session-events","push session:cleared",{sid:r}),o({type:"session:change",sessionId:r}),s=-1}else if(f==="session:queue"){const m=p;if(m.sessionId!==r)return;Oe("session-events","push session:queue",{sid:r,count:m.items.length}),o({type:"session:queue",sessionId:m.sessionId,items:m.items})}else if(f==="permission:request"){const m=p;if(m.sessionId!==r)return;o({type:"permission:request",sessionId:m.sessionId,requestId:m.requestId,tool:m.tool,input:m.input,...typeof m.toolUseId=="string"&&m.toolUseId?{toolUseId:m.toolUseId}:{}})}else if(f==="session:question"){const m=p;if(m.sessionId!==r)return;o({type:"session:question",sessionId:m.sessionId,toolUseId:m.toolUseId,requestId:m.requestId,questions:m.questions})}else if(f==="session:question:cleared"){const m=p;if(m.sessionId!==r)return;m.answers&&Object.keys(m.answers).length>0?o({type:"session:question:submitted",sessionId:m.sessionId,toolUseId:m.toolUseId,answers:m.answers}):o({type:"session:question:clear",sessionId:m.sessionId,toolUseId:m.toolUseId})}else if(f==="session:rewound"){const m=p;if(m.sessionId!==r)return;o({type:"session:rewound",sessionId:m.sessionId,userMessageId:m.userMessageId})}else f==="ready"&&o({type:"ready",runningSessions:(p.runningSessions??[]).map(x=>({sessionId:x.sessionId,freshSpawn:x.freshSpawn,status:ZS(x.status)}))})}),d=e.onConnect(()=>{c()});return e.isConnected&&c(),()=>{i=!0,u(),d(),e.request("session:unsubscribe",{sessionId:r}).catch(()=>{})}}}}const Tz=new Set(["tunnel:ready","tunnel:exited","tunnel:unavailable"]);function Pz(e,t){return{start(n){let r=!1;const i=async()=>{try{const a=await e.request("info",void 0);if(r)return;t(n,()=>a)}catch{}},s=e.onConnect(()=>{i()}),o=e.onFrame(a=>{Tz.has(a)&&i()});return i(),()=>{r=!0,s(),o()}}}}function Rz(){return{start(){return()=>{}}}}function Az(e,t){return{start(n){let r=!1;const i=async()=>{try{const o=await e.request("persona:list",{});if(r)return;t(n,()=>o.personas??[])}catch{}},s=e.onConnect(()=>{i()});return i(),()=>{r=!0,s()}}}}function Mz(e){const t=bz(e),n=_z();let r=null;const i=(o,a)=>{r==null||r.setData(o,a)};n.register(/^capabilities\//,Sz(t,i)),n.register(/^sessions$/,kz(t,i)),n.register(/^session\//,Nz(t,i)),n.register(/^personas$/,Az(t,i)),n.register(/^persona-detail\//,Rz()),n.register(/^daemon-info$/,Pz(t,i));const s=yz({onFirstObserver:o=>{o&&n.activate(o)},onLastObserver:o=>{o&&n.deactivate(o)}});return r=s,{cache:s,channel:t}}class Zp{constructor(t){this.client=t}info(){return this.client.request("info")}attachmentSignUrl(t){return this.client.request("attachment.signUrl",t)}attachmentGroupAdd(t,n,r){return this.client.request("attachment.groupAdd",{sessionId:t,relPath:n,...r?{label:r}:{}})}attachmentGroupRemove(t,n){return this.client.request("attachment.groupRemove",{sessionId:t,relPath:n})}attachmentGroupList(t){return this.client.request("attachment.groupList",{sessionId:t})}sessionCreate(t){return this.client.request("session:create",t)}projectList(){return this.client.request("project:list")}projectCreate(t){return this.client.request("project:create",{...t.path?{path:t.path}:{},...t.name?{name:t.name}:{}})}projectPatch(t){return this.client.request("project:patch",t)}projectReveal(t){return this.client.request("project:reveal",{path:t})}sessionList(){return this.client.request("session:list")}sessionGet(t){return this.client.request("session:get",{sessionId:t})}sessionUpdate(t,n){return this.client.request("session:update",{sessionId:t,patch:n})}sessionDelete(t){return this.client.request("session:delete",{sessionId:t})}sessionSend(t,n,r){return this.client.request("session:send",{sessionId:t,text:n,...r!=null&&r.queueWhileRunning?{queueWhileRunning:!0}:{}})}sessionDequeue(t,n){return this.client.request("session:dequeue",{sessionId:t,...n?{id:n}:{}})}sessionStop(t){return this.client.request("session:stop",{sessionId:t})}sessionInterrupt(t){return this.client.request("session:interrupt",{sessionId:t})}sessionRewind(t){return this.client.request("session:rewind",t)}sessionRewindableMessageIds(t){return this.client.request("session:rewindable-message-ids",{sessionId:t})}sessionRewindDiff(t){return this.client.request("session:rewind-diff",t)}sessionNew(t){return this.client.request("session:new",{sessionId:t})}sessionFork(t){return this.client.request("session:fork",t)}sessionResume(t,n){return this.client.request("session:resume",{sessionId:t,toolSessionId:n})}sessionObserve(t){return this.client.request("session:observe",t)}sessionEvents(t,n){return this.client.request("session:events",{sessionId:t,afterSeq:n})}sessionSubscribe(t){return this.client.request("session:subscribe",{sessionId:t})}sessionUnsubscribe(t){return this.client.request("session:unsubscribe",{sessionId:t})}pinSession(t,n){return this.client.request("session:pin",{sessionId:t,pinned:n})}searchSessionContent(t){return this.client.request("session:searchContent",t)}archiveSession(t,n){return this.client.request("session:archive",{sessionId:t,archived:n})}markSessionRead(t){return this.client.request("session:markRead",{sessionId:t})}reorderPins(t){return this.client.request("session:reorderPins",{orderedIds:t})}peerSessionUpsert(t){return this.client.request("peerSession:upsert",t)}peerSessionRemove(t){return this.client.request("peerSession:remove",{sessionId:t})}permissionRespond(t){return this.client.request("permission:respond",t)}answerQuestion(t){return this.client.request("session:answerQuestion",t)}cancelQuestion(t){return this.client.request("session:cancelQuestion",t)}historyProjects(){return this.client.request("history:projects")}historyList(t){return this.client.request("history:list",{projectPath:t})}historyRead(t){return this.client.request("history:read",t)}historyPage(t){return this.client.request("history:read",t)}historySubagents(t){return this.client.request("history:subagents",t)}historySubagentRead(t){return this.client.request("history:subagent-read",t)}listRecentDirs(){return this.client.request("history:recentDirs",{})}getGitRoot(t){return this.client.request("git:root",{cwd:t})}getGitBranch(t){return this.client.request("git:branch",{cwd:t})}listGitBranches(t){return this.client.request("git:branches",{cwd:t})}personaCreate(t){return this.client.request("persona:create",t)}personaList(){return this.client.request("persona:list",{})}personaGet(t){return this.client.request("persona:get",{personaId:t})}personaUpdate(t,n){return this.client.request("persona:update",{personaId:t,patch:n})}personaDelete(t){return this.client.request("persona:delete",{personaId:t})}larkBotBindManual(t,n,r){return this.client.request("larkBot:bindManual",{personaId:t,appId:n,appSecret:r})}larkBotUnbind(t){return this.client.request("larkBot:unbind",{personaId:t})}larkBotStatus(t){return this.client.request("larkBot:status",{personaId:t})}toolsProbe(){return this.client.request("tools:probe",{})}sessionExternalScan(){return this.client.request("session:externalScan",{})}sessionImportExternal(t){return this.client.request("session:importExternal",t)}onboardingComplete(){return this.client.request("onboarding:complete",{})}onboardingIosInterest(){return this.client.request("onboarding:iosInterest",{})}visitorList(){return this.client.request("visitor:list",{})}workspaceList(t={}){return this.client.request("workspace:list",t)}workspaceRead(t){return this.client.request("workspace:read",t)}skillsList(t,n){return this.client.request("skills:list",{cwd:t,...n?{tool:n}:{}})}agentsList(t,n){return this.client.request("agents:list",{cwd:t,...n?{tool:n}:{}})}capabilitiesGet(t="claude",n){return this.client.request("capabilities:get",{tool:t,...n!=null&&n.refresh?{refresh:!0}:{}})}engineStatus(t){return this.client.request("engine:status",{tool:t})}engineConnectPool(t){return this.client.request("engine:connectPool",{apiKey:t})}subscriptionChannelGet(){return this.client.request("subscriptionChannel:get",{})}subscriptionChannelSave(t){return this.client.request("subscriptionChannel:save",t)}subscriptionChannelDelete(t){return this.client.request("subscriptionChannel:delete",{id:t})}subscriptionChannelActivate(t){return this.client.request("subscriptionChannel:activate",{id:t})}subscriptionChannelModels(t={}){return this.client.request("subscriptionChannel:models",t)}shiftList(){return this.client.request("shift:list")}deployGet(t,n={}){return this.client.request("deploy:get",{personaId:t,...n})}deployGetLocal(t){return this.client.request("deploy:getLocal",{personaId:t})}deployScan(t,n){return this.client.request("deploy:scan",{personaId:t,...n?{scanBase:n}:{}})}deployPatch(t,n,r){return this.client.request("deploy:patch",{personaId:t,scanId:n,patch:r})}deployPutSecret(t,n,r,i,s){return this.client.request("deploy:putSecret",{personaId:t,scanId:n,name:r,values:i,...s?{environment:s}:{}})}deploySetEngineAuth(t,n,r){return n&&"channelId"in n?this.client.request("deploy:setEngineAuth",{personaId:t,channelId:n.channelId,...r?{environment:r}:{}}):this.client.request("deploy:setEngineAuth",{personaId:t,auth:n,...r?{environment:r}:{}})}deployRerunJob(t,n,r){return this.client.request("deploy:rerunJob",{personaId:t,jobId:n,...r?{environment:r}:{}})}deployUnpublish(t){return this.client.request("deploy:unpublish",{personaId:t})}deployRelease(t,n){return this.client.request("deploy:release",{personaId:t,scanId:n})}deployConfirmTest(t,n){return this.client.request("deploy:confirmTest",{personaId:t,releaseId:n})}deployApplyConfig(t,n){return this.client.request("deploy:applyConfig",{personaId:t,releaseId:n})}deployPromote(t,n){return this.client.request("deploy:promote",{personaId:t,releaseId:n})}deployOpenTest(t,n){return this.client.request("deploy:openTest",{personaId:t,releaseId:n})}cloudConnectorsList(t){return this.client.request("cloud:connectors:list",{personaId:t})}cloudWorkspace(t){return this.client.request("cloud:workspace",t)}cloudVolumeGet(){return this.client.request("cloud:volume:get",{})}dashboardOpenUrl(t){return this.client.request("dashboard:openUrl",{page:t})}cloudConnectorFill(t,n,r){return this.client.request("cloud:connectors:fill",{personaId:t,name:n,values:r})}channelList(){return this.client.request("channel:list")}channelCreate(t){return this.client.request("channel:create",t)}channelUpdate(t){return this.client.request("channel:update",t)}channelDelete(t){return this.client.request("channel:delete",t)}topicList(t){return this.client.request("topic:list",t)}topicGet(t){return this.client.request("topic:get",t)}topicCreate(t){return this.client.request("topic:create",t)}topicClose(t){return this.client.request("topic:close",t)}topicRename(t){return this.client.request("topic:rename",t)}topicDelete(t){return this.client.request("topic:delete",t)}personaDispatchList(t){return this.client.request("personaDispatch:list",t)}githubAuthGet(){return this.client.request("githubAuth:get")}githubAuthOauthStart(t){return this.client.request("githubAuth:oauthStart",t?{returnTo:t}:{})}githubAuthAuthorize(t){return this.client.request("githubAuth:authorize",{token:t})}githubStatus(){return this.client.request("github:status")}githubPrList(t){return this.client.request("github:prList",{role:t})}githubPrDetail(t){return this.client.request("github:prDetail",{...t})}githubPrMerge(t){return this.client.request("github:prMerge",{...t})}githubPrComment(t){return this.client.request("github:prComment",{...t})}githubPrSetReady(t){return this.client.request("github:prSetReady",{...t})}githubCollaborators(t){return this.client.request("github:collaborators",{...t})}githubPrRequestReviewers(t){return this.client.request("github:prRequestReviewers",{...t})}}function jz(e){const[t,n]=g.useState(e.isOpen?{kind:"connected",url:""}:{kind:"connecting"});return g.useEffect(()=>{const r=e.on("ready",l=>{const c=l;n(u=>({kind:"connected",url:u.kind==="connected"?u.url:"",mode:u.kind==="connected"?u.mode:void 0,daemonVersion:c.version,protocolVersion:c.protocolVersion,daemonSource:c.daemonSource,globalCliVersion:c.globalCliVersion,onboardingCompletedAt:c.onboardingCompletedAt}))}),i=e.on("daemon:connected",l=>{const c=l;n(u=>({kind:"connected",url:c.url,mode:c.mode,daemonVersion:u.kind==="connected"?u.daemonVersion:void 0,protocolVersion:u.kind==="connected"?u.protocolVersion:void 0,daemonSource:u.kind==="connected"?u.daemonSource:void 0,globalCliVersion:u.kind==="connected"?u.globalCliVersion:void 0,onboardingCompletedAt:u.kind==="connected"?u.onboardingCompletedAt:void 0}))}),s=e.on("daemon:disconnected",l=>{const c=(l==null?void 0:l.reason)??"";/auth failed|auth timeout|auth required|auth handshake timeout/i.test(c)?n({kind:"auth-failed",reason:c}):n({kind:"disconnected",reason:c})}),o=e.on("daemon:reconnecting",l=>{const c=l;n({kind:"reconnecting",attempt:c.attempt,nextDelayMs:c.nextDelayMs,scheduledAt:c.scheduledAt??Date.now()})}),a=e.on("daemon:version-mismatch",l=>{const c=l;n({kind:"version-mismatch",daemonProtocol:c.daemonProtocol,supportedProtocol:c.supportedProtocol})});return()=>{r(),i(),s(),o(),a()}},[e]),t}function Lz(e){const t=as(),n=ts(e.kind==="connected"?"sessions":""),r=g.useCallback(async()=>{t.setData("sessions",i=>i??[])},[t]);return{sessions:n??[],loading:!1,loaded:n!==void 0,error:null,refresh:r}}function $l(){const e=Ti();return g.useMemo(()=>new Zp(e),[e])}function ZT(e){return{personaId:e.personaId,label:e.label,model:e.model,effort:e.effort,serviceTier:e.serviceTier,tool:e.tool,...e.size!==void 0?{size:e.size}:{},...e.cpu!==void 0?{cpu:e.cpu}:{},...e.taskConcurrency!==void 0?{taskConcurrency:e.taskConcurrency}:{},...e.cloudEngine?{cloudEngine:e.cloudEngine}:{},public:e.public,createdAt:e.createdAt,updatedAt:e.updatedAt,...e.cloud?{cloud:e.cloud}:{}}}function QT(){const e=as(),t=$l(),n=ts("personas")??[],r=g.useMemo(()=>n.map(s=>ZT(s)),[n]),i=g.useCallback(async()=>{const s=await t.personaList();e.setData("personas",()=>s.personas??[])},[t,e]);return{personas:r,raw:n,loaded:ts("personas")!==void 0,refresh:i}}function JT(e){const{raw:t}=QT(),n=as(),r=$l(),i=e?t.find(a=>a.personaId===e)??null:null,s=i?ZT(i):null,o=g.useCallback(async a=>{if(!e)return;(a==null?void 0:a.personaId)===e&&n.setData("personas",c=>{const u=c??[];return u.some(d=>d.personaId===e)?u.map(d=>d.personaId===e?a:d):[...u,a]});const l=await r.personaList();n.setData("personas",()=>l.personas??[])},[e,r,n]);return{persona:s,raw:i,loaded:!!s,refresh:o}}function Dz(e){const t=$l(),n=as(),r=e?`persona-detail/${e}`:"",i=ts(r),s=g.useCallback(async()=>{const o={personality:"",personalityLocal:"",personalityManaged:!1,skills:[],plugins:[],sandboxSettings:null,codexSandbox:null};if(!e)return o;let a=null;try{a=await t.personaGet(e)}catch(c){Oe("personas","personaGet failed → empty detail",{personaId:e,err:c}),a=null}const l=a?{personality:a.personality??"",personalityLocal:a.personalityLocal??"",personalityManaged:a.personalityManaged??!1,skills:a.skills??[],plugins:a.plugins??[],sandboxSettings:a.sandboxSettings??null,codexSandbox:a.codexSandbox??null}:o;return n.setData(r,()=>l),l},[t,n,e,r]);return g.useEffect(()=>{e&&s()},[e,s]),{personality:(i==null?void 0:i.personality)??"",personalityLocal:(i==null?void 0:i.personalityLocal)??"",personalityManaged:(i==null?void 0:i.personalityManaged)??!1,skills:(i==null?void 0:i.skills)??[],plugins:(i==null?void 0:i.plugins)??[],sandboxSettings:(i==null?void 0:i.sandboxSettings)??null,codexSandbox:(i==null?void 0:i.codexSandbox)??null,loaded:i!==void 0,refresh:s}}function e3(){const e=as(),t=$l();return g.useCallback(async()=>{const n=await t.personaList();e.setData("personas",()=>n.personas??[])},[e,t])}function Oz(){const e=$l(),t=e3();return g.useCallback(async(n,r)=>{const i=await e.personaUpdate(n,r);return await t(),i},[e,t])}function Bz(){const e=$l(),t=e3();return g.useCallback(async n=>{await e.personaDelete(n),await t()},[e,t])}const QS="clawd:sidebar:tree-collapsed";function $z(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function zz(e){const t=$z(e);if(!Array.isArray(t))return new Set;const n=new Set;for(const r of t)typeof r=="string"&&n.add(r);return n}function Fz(){const e=wy(),[t,n]=g.useState(()=>new Set),r=g.useRef(t);r.current=t,g.useEffect(()=>{let l=!1;return(async()=>{try{const c=await e.kv.get(QS);if(l)return;n(zz(c))}catch{}})(),()=>{l=!0}},[e]);const i=g.useCallback(l=>{e.kv.set(QS,[...l]).catch(()=>{})},[e]),s=g.useCallback(l=>r.current.has(l),[]),o=g.useCallback(l=>{n(c=>{const u=new Set(c);return u.has(l)?u.delete(l):u.add(l),i(u),u})},[i]),a=g.useCallback(l=>{n(c=>{let u=!1;const d=new Set;for(const f of c)l.has(f)?d.add(f):u=!0;return u?(i(d),d):c})},[i]);return{isCollapsed:s,toggle:o,prune:a}}const Zy=g.createContext(null);function Hz(){const e=g.useContext(Zy);if(!e)throw new Error("SessionTreeCollapsedContext.Provider missing — wrap SessionTreeNode tree with <SessionTreeCollapsedContext.Provider value={useSessionTreeCollapsed()}>");return e}/**
|
|
97
|
+
* @license lucide-react v0.577.0 - ISC
|
|
98
|
+
*
|
|
99
|
+
* This source code is licensed under the ISC license.
|
|
100
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
+
*/const t3=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
|
|
102
|
+
* @license lucide-react v0.577.0 - ISC
|
|
103
|
+
*
|
|
104
|
+
* This source code is licensed under the ISC license.
|
|
105
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
+
*/const Uz=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
107
|
+
* @license lucide-react v0.577.0 - ISC
|
|
108
|
+
*
|
|
109
|
+
* This source code is licensed under the ISC license.
|
|
110
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
+
*/const Wz=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
|
|
112
|
+
* @license lucide-react v0.577.0 - ISC
|
|
113
|
+
*
|
|
114
|
+
* This source code is licensed under the ISC license.
|
|
115
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
+
*/const JS=e=>{const t=Wz(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
|
|
117
|
+
* @license lucide-react v0.577.0 - ISC
|
|
118
|
+
*
|
|
119
|
+
* This source code is licensed under the ISC license.
|
|
120
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
+
*/var qz={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
122
|
+
* @license lucide-react v0.577.0 - ISC
|
|
123
|
+
*
|
|
124
|
+
* This source code is licensed under the ISC license.
|
|
125
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
+
*/const Vz=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
|
|
127
|
+
* @license lucide-react v0.577.0 - ISC
|
|
128
|
+
*
|
|
129
|
+
* This source code is licensed under the ISC license.
|
|
130
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
+
*/const Kz=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>g.createElement("svg",{ref:l,...qz,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:t3("lucide",i),...!s&&!Vz(a)&&{"aria-hidden":"true"},...a},[...o.map(([c,u])=>g.createElement(c,u)),...Array.isArray(s)?s:[s]]));/**
|
|
132
|
+
* @license lucide-react v0.577.0 - ISC
|
|
133
|
+
*
|
|
134
|
+
* This source code is licensed under the ISC license.
|
|
135
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
+
*/const ue=(e,t)=>{const n=g.forwardRef(({className:r,...i},s)=>g.createElement(Kz,{ref:s,iconNode:t,className:t3(`lucide-${Uz(JS(e))}`,`lucide-${e}`,r),...i}));return n.displayName=JS(e),n};/**
|
|
137
|
+
* @license lucide-react v0.577.0 - ISC
|
|
138
|
+
*
|
|
139
|
+
* This source code is licensed under the ISC license.
|
|
140
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
+
*/const Gz=[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M12 9v4l2 2",key:"1c63tq"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}]],Yz=ue("alarm-clock",Gz);/**
|
|
142
|
+
* @license lucide-react v0.577.0 - ISC
|
|
143
|
+
*
|
|
144
|
+
* This source code is licensed under the ISC license.
|
|
145
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
146
|
+
*/const Xz=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],ek=ue("archive",Xz);/**
|
|
147
|
+
* @license lucide-react v0.577.0 - ISC
|
|
148
|
+
*
|
|
149
|
+
* This source code is licensed under the ISC license.
|
|
150
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
+
*/const Zz=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],n3=ue("arrow-left",Zz);/**
|
|
152
|
+
* @license lucide-react v0.577.0 - ISC
|
|
153
|
+
*
|
|
154
|
+
* This source code is licensed under the ISC license.
|
|
155
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
156
|
+
*/const Qz=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],cx=ue("arrow-up-right",Qz);/**
|
|
157
|
+
* @license lucide-react v0.577.0 - ISC
|
|
158
|
+
*
|
|
159
|
+
* This source code is licensed under the ISC license.
|
|
160
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
+
*/const Jz=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],e7=ue("arrow-up",Jz);/**
|
|
162
|
+
* @license lucide-react v0.577.0 - ISC
|
|
163
|
+
*
|
|
164
|
+
* This source code is licensed under the ISC license.
|
|
165
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
166
|
+
*/const t7=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]],n7=ue("bell-ring",t7);/**
|
|
167
|
+
* @license lucide-react v0.577.0 - ISC
|
|
168
|
+
*
|
|
169
|
+
* This source code is licensed under the ISC license.
|
|
170
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
+
*/const r7=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],tk=ue("bell",r7);/**
|
|
172
|
+
* @license lucide-react v0.577.0 - ISC
|
|
173
|
+
*
|
|
174
|
+
* This source code is licensed under the ISC license.
|
|
175
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
176
|
+
*/const i7=[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]],s7=ue("book-marked",i7);/**
|
|
177
|
+
* @license lucide-react v0.577.0 - ISC
|
|
178
|
+
*
|
|
179
|
+
* This source code is licensed under the ISC license.
|
|
180
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
181
|
+
*/const o7=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],a7=ue("bookmark",o7);/**
|
|
182
|
+
* @license lucide-react v0.577.0 - ISC
|
|
183
|
+
*
|
|
184
|
+
* This source code is licensed under the ISC license.
|
|
185
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
186
|
+
*/const l7=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Qp=ue("bot",l7);/**
|
|
187
|
+
* @license lucide-react v0.577.0 - ISC
|
|
188
|
+
*
|
|
189
|
+
* This source code is licensed under the ISC license.
|
|
190
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
191
|
+
*/const c7=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Qo=ue("check",c7);/**
|
|
192
|
+
* @license lucide-react v0.577.0 - ISC
|
|
193
|
+
*
|
|
194
|
+
* This source code is licensed under the ISC license.
|
|
195
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
196
|
+
*/const u7=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Pn=ue("chevron-down",u7);/**
|
|
197
|
+
* @license lucide-react v0.577.0 - ISC
|
|
198
|
+
*
|
|
199
|
+
* This source code is licensed under the ISC license.
|
|
200
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
201
|
+
*/const d7=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Fn=ue("chevron-right",d7);/**
|
|
202
|
+
* @license lucide-react v0.577.0 - ISC
|
|
203
|
+
*
|
|
204
|
+
* This source code is licensed under the ISC license.
|
|
205
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
206
|
+
*/const h7=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],r3=ue("chevron-up",h7);/**
|
|
207
|
+
* @license lucide-react v0.577.0 - ISC
|
|
208
|
+
*
|
|
209
|
+
* This source code is licensed under the ISC license.
|
|
210
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
211
|
+
*/const f7=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Jo=ue("circle-alert",f7);/**
|
|
212
|
+
* @license lucide-react v0.577.0 - ISC
|
|
213
|
+
*
|
|
214
|
+
* This source code is licensed under the ISC license.
|
|
215
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
216
|
+
*/const p7=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Qy=ue("circle-check",p7);/**
|
|
217
|
+
* @license lucide-react v0.577.0 - ISC
|
|
218
|
+
*
|
|
219
|
+
* This source code is licensed under the ISC license.
|
|
220
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
221
|
+
*/const m7=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],g7=ue("circle-question-mark",m7);/**
|
|
222
|
+
* @license lucide-react v0.577.0 - ISC
|
|
223
|
+
*
|
|
224
|
+
* This source code is licensed under the ISC license.
|
|
225
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
226
|
+
*/const v7=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],x7=ue("circle",v7);/**
|
|
227
|
+
* @license lucide-react v0.577.0 - ISC
|
|
228
|
+
*
|
|
229
|
+
* This source code is licensed under the ISC license.
|
|
230
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
231
|
+
*/const y7=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],_7=ue("clock",y7);/**
|
|
232
|
+
* @license lucide-react v0.577.0 - ISC
|
|
233
|
+
*
|
|
234
|
+
* This source code is licensed under the ISC license.
|
|
235
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
236
|
+
*/const b7=[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]],w7=ue("cloud-download",b7);/**
|
|
237
|
+
* @license lucide-react v0.577.0 - ISC
|
|
238
|
+
*
|
|
239
|
+
* This source code is licensed under the ISC license.
|
|
240
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
241
|
+
*/const S7=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],k7=ue("cloud",S7);/**
|
|
242
|
+
* @license lucide-react v0.577.0 - ISC
|
|
243
|
+
*
|
|
244
|
+
* This source code is licensed under the ISC license.
|
|
245
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
246
|
+
*/const C7=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Jy=ue("copy",C7);/**
|
|
247
|
+
* @license lucide-react v0.577.0 - ISC
|
|
248
|
+
*
|
|
249
|
+
* This source code is licensed under the ISC license.
|
|
250
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
251
|
+
*/const E7=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],I7=ue("corner-down-right",E7);/**
|
|
252
|
+
* @license lucide-react v0.577.0 - ISC
|
|
253
|
+
*
|
|
254
|
+
* This source code is licensed under the ISC license.
|
|
255
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
256
|
+
*/const N7=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],T7=ue("download",N7);/**
|
|
257
|
+
* @license lucide-react v0.577.0 - ISC
|
|
258
|
+
*
|
|
259
|
+
* This source code is licensed under the ISC license.
|
|
260
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
261
|
+
*/const P7=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],i3=ue("ellipsis",P7);/**
|
|
262
|
+
* @license lucide-react v0.577.0 - ISC
|
|
263
|
+
*
|
|
264
|
+
* This source code is licensed under the ISC license.
|
|
265
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
266
|
+
*/const R7=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],fl=ue("external-link",R7);/**
|
|
267
|
+
* @license lucide-react v0.577.0 - ISC
|
|
268
|
+
*
|
|
269
|
+
* This source code is licensed under the ISC license.
|
|
270
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
271
|
+
*/const A7=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],M7=ue("file-code-corner",A7);/**
|
|
272
|
+
* @license lucide-react v0.577.0 - ISC
|
|
273
|
+
*
|
|
274
|
+
* This source code is licensed under the ISC license.
|
|
275
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
276
|
+
*/const j7=[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]],L7=ue("file-pen",j7);/**
|
|
277
|
+
* @license lucide-react v0.577.0 - ISC
|
|
278
|
+
*
|
|
279
|
+
* This source code is licensed under the ISC license.
|
|
280
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
281
|
+
*/const D7=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Ei=ue("file-text",D7);/**
|
|
282
|
+
* @license lucide-react v0.577.0 - ISC
|
|
283
|
+
*
|
|
284
|
+
* This source code is licensed under the ISC license.
|
|
285
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
286
|
+
*/const O7=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],Sg=ue("folder-git-2",O7);/**
|
|
287
|
+
* @license lucide-react v0.577.0 - ISC
|
|
288
|
+
*
|
|
289
|
+
* This source code is licensed under the ISC license.
|
|
290
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
291
|
+
*/const B7=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],$7=ue("folder-open",B7);/**
|
|
292
|
+
* @license lucide-react v0.577.0 - ISC
|
|
293
|
+
*
|
|
294
|
+
* This source code is licensed under the ISC license.
|
|
295
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
296
|
+
*/const z7=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],pl=ue("git-branch",z7);/**
|
|
297
|
+
* @license lucide-react v0.577.0 - ISC
|
|
298
|
+
*
|
|
299
|
+
* This source code is licensed under the ISC license.
|
|
300
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
301
|
+
*/const F7=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]],H7=ue("git-pull-request",F7);/**
|
|
302
|
+
* @license lucide-react v0.577.0 - ISC
|
|
303
|
+
*
|
|
304
|
+
* This source code is licensed under the ISC license.
|
|
305
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
306
|
+
*/const U7=[["path",{d:"M15.686 15A14.5 14.5 0 0 1 12 22a14.5 14.5 0 0 1 0-20 10 10 0 1 0 9.542 13",key:"qkt0x6"}],["path",{d:"M2 12h8.5",key:"ovaggd"}],["path",{d:"M20 6V4a2 2 0 1 0-4 0v2",key:"1of5e8"}],["rect",{width:"8",height:"5",x:"14",y:"6",rx:"1",key:"1fmf51"}]],W7=ue("globe-lock",U7);/**
|
|
307
|
+
* @license lucide-react v0.577.0 - ISC
|
|
308
|
+
*
|
|
309
|
+
* This source code is licensed under the ISC license.
|
|
310
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
311
|
+
*/const q7=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],V7=ue("globe",q7);/**
|
|
312
|
+
* @license lucide-react v0.577.0 - ISC
|
|
313
|
+
*
|
|
314
|
+
* This source code is licensed under the ISC license.
|
|
315
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
316
|
+
*/const K7=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],G7=ue("image",K7);/**
|
|
317
|
+
* @license lucide-react v0.577.0 - ISC
|
|
318
|
+
*
|
|
319
|
+
* This source code is licensed under the ISC license.
|
|
320
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
321
|
+
*/const Y7=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],s3=ue("inbox",Y7);/**
|
|
322
|
+
* @license lucide-react v0.577.0 - ISC
|
|
323
|
+
*
|
|
324
|
+
* This source code is licensed under the ISC license.
|
|
325
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
326
|
+
*/const X7=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],o3=ue("info",X7);/**
|
|
327
|
+
* @license lucide-react v0.577.0 - ISC
|
|
328
|
+
*
|
|
329
|
+
* This source code is licensed under the ISC license.
|
|
330
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
331
|
+
*/const Z7=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],Q7=ue("laptop",Z7);/**
|
|
332
|
+
* @license lucide-react v0.577.0 - ISC
|
|
333
|
+
*
|
|
334
|
+
* This source code is licensed under the ISC license.
|
|
335
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
336
|
+
*/const J7=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],eF=ue("link-2",J7);/**
|
|
337
|
+
* @license lucide-react v0.577.0 - ISC
|
|
338
|
+
*
|
|
339
|
+
* This source code is licensed under the ISC license.
|
|
340
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
341
|
+
*/const tF=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Tn=ue("loader-circle",tF);/**
|
|
342
|
+
* @license lucide-react v0.577.0 - ISC
|
|
343
|
+
*
|
|
344
|
+
* This source code is licensed under the ISC license.
|
|
345
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
346
|
+
*/const nF=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],rF=ue("message-circle-question-mark",nF);/**
|
|
347
|
+
* @license lucide-react v0.577.0 - ISC
|
|
348
|
+
*
|
|
349
|
+
* This source code is licensed under the ISC license.
|
|
350
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
351
|
+
*/const iF=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],sF=ue("message-square-plus",iF);/**
|
|
352
|
+
* @license lucide-react v0.577.0 - ISC
|
|
353
|
+
*
|
|
354
|
+
* This source code is licensed under the ISC license.
|
|
355
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
356
|
+
*/const oF=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],aF=ue("messages-square",oF);/**
|
|
357
|
+
* @license lucide-react v0.577.0 - ISC
|
|
358
|
+
*
|
|
359
|
+
* This source code is licensed under the ISC license.
|
|
360
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
361
|
+
*/const lF=[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]],cF=ue("octagon-alert",lF);/**
|
|
362
|
+
* @license lucide-react v0.577.0 - ISC
|
|
363
|
+
*
|
|
364
|
+
* This source code is licensed under the ISC license.
|
|
365
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
366
|
+
*/const uF=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],nk=ue("panel-right",uF);/**
|
|
367
|
+
* @license lucide-react v0.577.0 - ISC
|
|
368
|
+
*
|
|
369
|
+
* This source code is licensed under the ISC license.
|
|
370
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
371
|
+
*/const dF=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],hF=ue("paperclip",dF);/**
|
|
372
|
+
* @license lucide-react v0.577.0 - ISC
|
|
373
|
+
*
|
|
374
|
+
* This source code is licensed under the ISC license.
|
|
375
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
376
|
+
*/const fF=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],a3=ue("pause",fF);/**
|
|
377
|
+
* @license lucide-react v0.577.0 - ISC
|
|
378
|
+
*
|
|
379
|
+
* This source code is licensed under the ISC license.
|
|
380
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
381
|
+
*/const pF=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],ux=ue("pencil",pF);/**
|
|
382
|
+
* @license lucide-react v0.577.0 - ISC
|
|
383
|
+
*
|
|
384
|
+
* This source code is licensed under the ISC license.
|
|
385
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
386
|
+
*/const mF=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]],rk=ue("pin-off",mF);/**
|
|
387
|
+
* @license lucide-react v0.577.0 - ISC
|
|
388
|
+
*
|
|
389
|
+
* This source code is licensed under the ISC license.
|
|
390
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
391
|
+
*/const gF=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],ik=ue("pin",gF);/**
|
|
392
|
+
* @license lucide-react v0.577.0 - ISC
|
|
393
|
+
*
|
|
394
|
+
* This source code is licensed under the ISC license.
|
|
395
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
396
|
+
*/const vF=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],xF=ue("plug",vF);/**
|
|
397
|
+
* @license lucide-react v0.577.0 - ISC
|
|
398
|
+
*
|
|
399
|
+
* This source code is licensed under the ISC license.
|
|
400
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
401
|
+
*/const yF=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],e_=ue("plus",yF);/**
|
|
402
|
+
* @license lucide-react v0.577.0 - ISC
|
|
403
|
+
*
|
|
404
|
+
* This source code is licensed under the ISC license.
|
|
405
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
406
|
+
*/const _F=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],bF=ue("refresh-cw",_F);/**
|
|
407
|
+
* @license lucide-react v0.577.0 - ISC
|
|
408
|
+
*
|
|
409
|
+
* This source code is licensed under the ISC license.
|
|
410
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
411
|
+
*/const wF=[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]],SF=ue("repeat-2",wF);/**
|
|
412
|
+
* @license lucide-react v0.577.0 - ISC
|
|
413
|
+
*
|
|
414
|
+
* This source code is licensed under the ISC license.
|
|
415
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
416
|
+
*/const kF=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],zf=ue("search",kF);/**
|
|
417
|
+
* @license lucide-react v0.577.0 - ISC
|
|
418
|
+
*
|
|
419
|
+
* This source code is licensed under the ISC license.
|
|
420
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
421
|
+
*/const CF=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],l3=ue("send",CF);/**
|
|
422
|
+
* @license lucide-react v0.577.0 - ISC
|
|
423
|
+
*
|
|
424
|
+
* This source code is licensed under the ISC license.
|
|
425
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
426
|
+
*/const EF=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],IF=ue("settings",EF);/**
|
|
427
|
+
* @license lucide-react v0.577.0 - ISC
|
|
428
|
+
*
|
|
429
|
+
* This source code is licensed under the ISC license.
|
|
430
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
431
|
+
*/const NF=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],t_=ue("share-2",NF);/**
|
|
432
|
+
* @license lucide-react v0.577.0 - ISC
|
|
433
|
+
*
|
|
434
|
+
* This source code is licensed under the ISC license.
|
|
435
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
436
|
+
*/const TF=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],PF=ue("shield-alert",TF);/**
|
|
437
|
+
* @license lucide-react v0.577.0 - ISC
|
|
438
|
+
*
|
|
439
|
+
* This source code is licensed under the ISC license.
|
|
440
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
441
|
+
*/const RF=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}]],AF=ue("sparkle",RF);/**
|
|
442
|
+
* @license lucide-react v0.577.0 - ISC
|
|
443
|
+
*
|
|
444
|
+
* This source code is licensed under the ISC license.
|
|
445
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
446
|
+
*/const MF=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],dx=ue("sparkles",MF);/**
|
|
447
|
+
* @license lucide-react v0.577.0 - ISC
|
|
448
|
+
*
|
|
449
|
+
* This source code is licensed under the ISC license.
|
|
450
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
451
|
+
*/const jF=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],LF=ue("square-slash",jF);/**
|
|
452
|
+
* @license lucide-react v0.577.0 - ISC
|
|
453
|
+
*
|
|
454
|
+
* This source code is licensed under the ISC license.
|
|
455
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
456
|
+
*/const DF=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],OF=ue("square-terminal",DF);/**
|
|
457
|
+
* @license lucide-react v0.577.0 - ISC
|
|
458
|
+
*
|
|
459
|
+
* This source code is licensed under the ISC license.
|
|
460
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
461
|
+
*/const BF=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],c3=ue("terminal",BF);/**
|
|
462
|
+
* @license lucide-react v0.577.0 - ISC
|
|
463
|
+
*
|
|
464
|
+
* This source code is licensed under the ISC license.
|
|
465
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
466
|
+
*/const $F=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],n_=ue("trash-2",$F);/**
|
|
467
|
+
* @license lucide-react v0.577.0 - ISC
|
|
468
|
+
*
|
|
469
|
+
* This source code is licensed under the ISC license.
|
|
470
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
471
|
+
*/const zF=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ff=ue("triangle-alert",zF);/**
|
|
472
|
+
* @license lucide-react v0.577.0 - ISC
|
|
473
|
+
*
|
|
474
|
+
* This source code is licensed under the ISC license.
|
|
475
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
476
|
+
*/const FF=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],u3=ue("undo-2",FF);/**
|
|
477
|
+
* @license lucide-react v0.577.0 - ISC
|
|
478
|
+
*
|
|
479
|
+
* This source code is licensed under the ISC license.
|
|
480
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
481
|
+
*/const HF=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],UF=ue("user-round",HF);/**
|
|
482
|
+
* @license lucide-react v0.577.0 - ISC
|
|
483
|
+
*
|
|
484
|
+
* This source code is licensed under the ISC license.
|
|
485
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
486
|
+
*/const WF=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],d3=ue("user",WF);/**
|
|
487
|
+
* @license lucide-react v0.577.0 - ISC
|
|
488
|
+
*
|
|
489
|
+
* This source code is licensed under the ISC license.
|
|
490
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
491
|
+
*/const qF=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],VF=ue("wrench",qF);/**
|
|
492
|
+
* @license lucide-react v0.577.0 - ISC
|
|
493
|
+
*
|
|
494
|
+
* This source code is licensed under the ISC license.
|
|
495
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
496
|
+
*/const KF=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Jr=ue("x",KF);/**
|
|
497
|
+
* @license lucide-react v0.577.0 - ISC
|
|
498
|
+
*
|
|
499
|
+
* This source code is licensed under the ISC license.
|
|
500
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
501
|
+
*/const GF=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],YF=ue("zap",GF);function h3(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=h3(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function f3(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=h3(e))&&(r&&(r+=" "),r+=t);return r}const XF=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},ZF=(e,t)=>({classGroupId:e,validator:t}),p3=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Hf="-",sk=[],QF="arbitrary..",JF=e=>{const t=tH(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return eH(o);const a=o.split(Hf),l=a[0]===""&&a.length>1?1:0;return m3(a,l,t)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=r[o],c=n[o];return l?c?XF(c,l):l:c||sk}return n[o]||sk}}},m3=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],s=n.nextPart.get(i);if(s){const c=m3(e,t+1,s);if(c)return c}const o=n.validators;if(o===null)return;const a=t===0?e.join(Hf):e.slice(t).join(Hf),l=o.length;for(let c=0;c<l;c++){const u=o[c];if(u.validator(a))return u.classGroupId}},eH=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?QF+r:void 0})(),tH=e=>{const{theme:t,classGroups:n}=e;return nH(n,t)},nH=(e,t)=>{const n=p3();for(const r in e){const i=e[r];r_(i,n,r,t)}return n},r_=(e,t,n,r)=>{const i=e.length;for(let s=0;s<i;s++){const o=e[s];rH(o,t,n,r)}},rH=(e,t,n,r)=>{if(typeof e=="string"){iH(e,t,n);return}if(typeof e=="function"){sH(e,t,n,r);return}oH(e,t,n,r)},iH=(e,t,n)=>{const r=e===""?t:g3(t,e);r.classGroupId=n},sH=(e,t,n,r)=>{if(aH(e)){r_(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ZF(n,e))},oH=(e,t,n,r)=>{const i=Object.entries(e),s=i.length;for(let o=0;o<s;o++){const[a,l]=i[o];r_(l,g3(t,a),n,r)}},g3=(e,t)=>{let n=e;const r=t.split(Hf),i=r.length;for(let s=0;s<i;s++){const o=r[s];let a=n.nextPart.get(o);a||(a=p3(),n.nextPart.set(o,a)),n=a}return n},aH=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,lH=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const i=(s,o)=>{n[s]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let o=n[s];if(o!==void 0)return o;if((o=r[s])!==void 0)return i(s,o),o},set(s,o){s in n?n[s]=o:i(s,o)}}},hx="!",ok=":",cH=[],ak=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),uH=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=i=>{const s=[];let o=0,a=0,l=0,c;const u=i.length;for(let x=0;x<u;x++){const w=i[x];if(o===0&&a===0){if(w===ok){s.push(i.slice(l,x)),l=x+1;continue}if(w==="/"){c=x;continue}}w==="["?o++:w==="]"?o--:w==="("?a++:w===")"&&a--}const d=s.length===0?i:i.slice(l);let f=d,p=!1;d.endsWith(hx)?(f=d.slice(0,-1),p=!0):d.startsWith(hx)&&(f=d.slice(1),p=!0);const m=c&&c>l?c-l:void 0;return ak(s,p,f,m)};if(t){const i=t+ok,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):ak(cH,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},dH=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let s=0;s<n.length;s++){const o=n[s],a=o[0]==="[",l=t.has(o);a||l?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},hH=e=>({cache:lH(e.cacheSize),parseClassName:uH(e),sortModifiers:dH(e),...JF(e)}),fH=/\s+/,pH=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],a=e.trim().split(fH);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{isExternal:d,modifiers:f,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:x}=n(u);if(d){l=u+(l.length>0?" "+l:l);continue}let w=!!x,v=r(w?m.substring(0,x):m);if(!v){if(!w){l=u+(l.length>0?" "+l:l);continue}if(v=r(m),!v){l=u+(l.length>0?" "+l:l);continue}w=!1}const _=f.length===0?"":f.length===1?f[0]:s(f).join(":"),b=p?_+hx:_,S=b+v;if(o.indexOf(S)>-1)continue;o.push(S);const C=i(v,w);for(let k=0;k<C.length;++k){const N=C[k];o.push(b+N)}l=u+(l.length>0?" "+l:l)}return l},mH=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=v3(n))&&(i&&(i+=" "),i+=r);return i},v3=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=v3(e[r]))&&(n&&(n+=" "),n+=t);return n},gH=(e,...t)=>{let n,r,i,s;const o=l=>{const c=t.reduce((u,d)=>d(u),e());return n=hH(c),r=n.cache.get,i=n.cache.set,s=a,a(l)},a=l=>{const c=r(l);if(c)return c;const u=pH(l,n);return i(l,u),u};return s=o,(...l)=>s(mH(...l))},vH=[],Yt=e=>{const t=n=>n[e]||vH;return t.isThemeGetter=!0,t},x3=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,y3=/^\((?:(\w[\w-]*):)?(.+)\)$/i,xH=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,yH=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_H=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,bH=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,wH=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,SH=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ms=e=>xH.test(e),We=e=>!!e&&!Number.isNaN(Number(e)),gs=e=>!!e&&Number.isInteger(Number(e)),kg=e=>e.endsWith("%")&&We(e.slice(0,-1)),Li=e=>yH.test(e),_3=()=>!0,kH=e=>_H.test(e)&&!bH.test(e),i_=()=>!1,CH=e=>wH.test(e),EH=e=>SH.test(e),IH=e=>!me(e)&&!ve(e),NH=e=>no(e,S3,i_),me=e=>x3.test(e),ho=e=>no(e,k3,kH),lk=e=>no(e,DH,We),TH=e=>no(e,E3,_3),PH=e=>no(e,C3,i_),ck=e=>no(e,b3,i_),RH=e=>no(e,w3,EH),Ud=e=>no(e,I3,CH),ve=e=>y3.test(e),uc=e=>ea(e,k3),AH=e=>ea(e,C3),uk=e=>ea(e,b3),MH=e=>ea(e,S3),jH=e=>ea(e,w3),Wd=e=>ea(e,I3,!0),LH=e=>ea(e,E3,!0),no=(e,t,n)=>{const r=x3.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},ea=(e,t,n=!1)=>{const r=y3.exec(e);return r?r[1]?t(r[1]):n:!1},b3=e=>e==="position"||e==="percentage",w3=e=>e==="image"||e==="url",S3=e=>e==="length"||e==="size"||e==="bg-size",k3=e=>e==="length",DH=e=>e==="number",C3=e=>e==="family-name",E3=e=>e==="number"||e==="weight",I3=e=>e==="shadow",OH=()=>{const e=Yt("color"),t=Yt("font"),n=Yt("text"),r=Yt("font-weight"),i=Yt("tracking"),s=Yt("leading"),o=Yt("breakpoint"),a=Yt("container"),l=Yt("spacing"),c=Yt("radius"),u=Yt("shadow"),d=Yt("inset-shadow"),f=Yt("text-shadow"),p=Yt("drop-shadow"),m=Yt("blur"),x=Yt("perspective"),w=Yt("aspect"),v=Yt("ease"),_=Yt("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...S(),ve,me],k=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],E=()=>[ve,me,l],L=()=>[ms,"full","auto",...E()],P=()=>[gs,"none","subgrid",ve,me],D=()=>["auto",{span:["full",gs,ve,me]},gs,ve,me],R=()=>[gs,"auto",ve,me],A=()=>["auto","min","max","fr",ve,me],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],j=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...E()],F=()=>[ms,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...E()],$=()=>[ms,"screen","full","dvw","lvw","svw","min","max","fit",...E()],B=()=>[ms,"screen","full","lh","dvh","lvh","svh","min","max","fit",...E()],I=()=>[e,ve,me],U=()=>[...S(),uk,ck,{position:[ve,me]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],O=()=>["auto","cover","contain",MH,NH,{size:[ve,me]}],ne=()=>[kg,uc,ho],ae=()=>["","none","full",c,ve,me],Y=()=>["",We,uc,ho],ye=()=>["solid","dashed","dotted","double"],Ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],oe=()=>[We,kg,uk,ck],je=()=>["","none",m,ve,me],Ae=()=>["none",We,ve,me],De=()=>["none",We,ve,me],xe=()=>[We,ve,me],Ke=()=>[ms,"full",...E()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Li],breakpoint:[Li],color:[_3],container:[Li],"drop-shadow":[Li],ease:["in","out","in-out"],font:[IH],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Li],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Li],shadow:[Li],spacing:["px",We],text:[Li],"text-shadow":[Li],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ms,me,ve,w]}],container:["container"],columns:[{columns:[We,me,ve,a]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{"inset-s":L(),start:L()}],end:[{"inset-e":L(),end:L()}],"inset-bs":[{"inset-bs":L()}],"inset-be":[{"inset-be":L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[gs,"auto",ve,me]}],basis:[{basis:[ms,"full","auto",a,...E()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[We,ms,"auto","initial","none",me]}],grow:[{grow:["",We,ve,me]}],shrink:[{shrink:["",We,ve,me]}],order:[{order:[gs,"first","last","none",ve,me]}],"grid-cols":[{"grid-cols":P()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:E()}],"gap-x":[{"gap-x":E()}],"gap-y":[{"gap-y":E()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...j(),"normal"]}],"justify-self":[{"justify-self":["auto",...j()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...j(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...j(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...j(),"baseline"]}],"place-self":[{"place-self":["auto",...j()]}],p:[{p:E()}],px:[{px:E()}],py:[{py:E()}],ps:[{ps:E()}],pe:[{pe:E()}],pbs:[{pbs:E()}],pbe:[{pbe:E()}],pt:[{pt:E()}],pr:[{pr:E()}],pb:[{pb:E()}],pl:[{pl:E()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":E()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":E()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],"inline-size":[{inline:["auto",...$()]}],"min-inline-size":[{"min-inline":["auto",...$()]}],"max-inline-size":[{"max-inline":["none",...$()]}],"block-size":[{block:["auto",...B()]}],"min-block-size":[{"min-block":["auto",...B()]}],"max-block-size":[{"max-block":["none",...B()]}],w:[{w:[a,"screen",...F()]}],"min-w":[{"min-w":[a,"screen","none",...F()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",n,uc,ho]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,LH,TH]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",kg,me]}],"font-family":[{font:[AH,PH,t]}],"font-features":[{"font-features":[me]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,ve,me]}],"line-clamp":[{"line-clamp":[We,"none",ve,lk]}],leading:[{leading:[s,...E()]}],"list-image":[{"list-image":["none",ve,me]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ve,me]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ye(),"wavy"]}],"text-decoration-thickness":[{decoration:[We,"from-font","auto",ve,ho]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[We,"auto",ve,me]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ve,me]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ve,me]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:U()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:O()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gs,ve,me],radial:["",ve,me],conic:[gs,ve,me]},jH,RH]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:ne()}],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"border-w":[{border:Y()}],"border-w-x":[{"border-x":Y()}],"border-w-y":[{"border-y":Y()}],"border-w-s":[{"border-s":Y()}],"border-w-e":[{"border-e":Y()}],"border-w-bs":[{"border-bs":Y()}],"border-w-be":[{"border-be":Y()}],"border-w-t":[{"border-t":Y()}],"border-w-r":[{"border-r":Y()}],"border-w-b":[{"border-b":Y()}],"border-w-l":[{"border-l":Y()}],"divide-x":[{"divide-x":Y()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Y()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ye(),"hidden","none"]}],"divide-style":[{divide:[...ye(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...ye(),"none","hidden"]}],"outline-offset":[{"outline-offset":[We,ve,me]}],"outline-w":[{outline:["",We,uc,ho]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",u,Wd,Ud]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",d,Wd,Ud]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[We,ho]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":Y()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",f,Wd,Ud]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[We,ve,me]}],"mix-blend":[{"mix-blend":[...Ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ce()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[We]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[ve,me]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[We]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:U()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:O()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ve,me]}],filter:[{filter:["","none",ve,me]}],blur:[{blur:je()}],brightness:[{brightness:[We,ve,me]}],contrast:[{contrast:[We,ve,me]}],"drop-shadow":[{"drop-shadow":["","none",p,Wd,Ud]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",We,ve,me]}],"hue-rotate":[{"hue-rotate":[We,ve,me]}],invert:[{invert:["",We,ve,me]}],saturate:[{saturate:[We,ve,me]}],sepia:[{sepia:["",We,ve,me]}],"backdrop-filter":[{"backdrop-filter":["","none",ve,me]}],"backdrop-blur":[{"backdrop-blur":je()}],"backdrop-brightness":[{"backdrop-brightness":[We,ve,me]}],"backdrop-contrast":[{"backdrop-contrast":[We,ve,me]}],"backdrop-grayscale":[{"backdrop-grayscale":["",We,ve,me]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[We,ve,me]}],"backdrop-invert":[{"backdrop-invert":["",We,ve,me]}],"backdrop-opacity":[{"backdrop-opacity":[We,ve,me]}],"backdrop-saturate":[{"backdrop-saturate":[We,ve,me]}],"backdrop-sepia":[{"backdrop-sepia":["",We,ve,me]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":E()}],"border-spacing-x":[{"border-spacing-x":E()}],"border-spacing-y":[{"border-spacing-y":E()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ve,me]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[We,"initial",ve,me]}],ease:[{ease:["linear","initial",v,ve,me]}],delay:[{delay:[We,ve,me]}],animate:[{animate:["none",_,ve,me]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,ve,me]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:Ae()}],"rotate-x":[{"rotate-x":Ae()}],"rotate-y":[{"rotate-y":Ae()}],"rotate-z":[{"rotate-z":Ae()}],scale:[{scale:De()}],"scale-x":[{"scale-x":De()}],"scale-y":[{"scale-y":De()}],"scale-z":[{"scale-z":De()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[ve,me,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ke()}],"translate-x":[{"translate-x":Ke()}],"translate-y":[{"translate-y":Ke()}],"translate-z":[{"translate-z":Ke()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ve,me]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mbs":[{"scroll-mbs":E()}],"scroll-mbe":[{"scroll-mbe":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pbs":[{"scroll-pbs":E()}],"scroll-pbe":[{"scroll-pbe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ve,me]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[We,uc,ho,lk]}],stroke:[{stroke:["none",...I()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},BH=gH(OH);function re(...e){return BH(f3(e))}const dk={path:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"},hk={path:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"},fk="M2 2H17V12H12V17H7V22H2ZM7 7V12H12V7ZM17 12H22V22H17Z",N3={claude:dk.path,"claude-cloud":dk.path,codex:hk.path,"codex-cloud":hk.path,pi:fk,"pi-cloud":fk},$H=new Set(["pi","pi-cloud"]);function zH(e){return e!=null&&e in N3}function Jp({tool:e,className:t}){const n=e?N3[e]:void 0;return n?h.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:t,"aria-hidden":"true",children:h.jsx("path",{d:n,fillRule:e&&$H.has(e)?"evenodd":void 0})}):h.jsx(Qp,{className:t})}function s_(e){return e==="codex"?"Codex":e==="codex-cloud"?"Codex(云上)":e==="pi"?"pi":e==="pi-cloud"?"pi(云上)":e==="claude-cloud"?"Claude(云上)":"Claude Code"}function em(e){return e==="claude"?"text-engine-claude":e==="codex"?"text-engine-codex":e==="codex-cloud"?"text-engine-codex-cloud":e==="pi"?"text-engine-pi":e==="pi-cloud"?"text-engine-pi-cloud":e==="claude-cloud"?"text-engine-claude-cloud":"text-text-400"}function o_(e){return e.label||e.aiLabel||e.larkChatName||e.larkChatId||e.cwd.split("/").filter(Boolean).pop()||e.sessionId.slice(0,8)}function FH(e){const t=new Date(e),n=Date.now()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const i=Math.floor(r/60);if(i<24)return`${i}h ago`;const s=Math.floor(i/24);return s<7?`${s}d ago`:t.toLocaleDateString()}function HH(e){return`'${e.replace(/'/g,"'\\''")}'`}function UH(e){return e.toolSessionId?e.tool==="codex"?`codex resume ${e.toolSessionId}`:e.tool==="pi"?`pi --session-id ${e.toolSessionId}`:`claude --resume ${e.toolSessionId} --permission-mode bypassPermissions`:null}function T3(e){const t=UH(e);return!t||!e.cwd?null:`cd ${HH(e.cwd)} && ${t}`}function Ie(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function pk(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function qu(...e){return t=>{let n=!1;const r=e.map(i=>{const s=pk(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():pk(e[i],null)}}}}function Ot(...e){return g.useCallback(qu(...e),e)}function WH(e,t){const n=g.createContext(t),r=s=>{const{children:o,...a}=s,l=g.useMemo(()=>a,Object.values(a));return h.jsx(n.Provider,{value:l,children:o})};r.displayName=e+"Provider";function i(s){const o=g.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,i]}function ro(e,t=[]){let n=[];function r(s,o){const a=g.createContext(o),l=n.length;n=[...n,o];const c=d=>{var v;const{scope:f,children:p,...m}=d,x=((v=f==null?void 0:f[e])==null?void 0:v[l])||a,w=g.useMemo(()=>m,Object.values(m));return h.jsx(x.Provider,{value:w,children:p})};c.displayName=s+"Provider";function u(d,f){var x;const p=((x=f==null?void 0:f[e])==null?void 0:x[l])||a,m=g.useContext(p);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const i=()=>{const s=n.map(o=>g.createContext(o));return function(a){const l=(a==null?void 0:a[e])||s;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,qH(i,...t)]}function qH(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Ys=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},VH=Pl[" useInsertionEffect ".trim().toString()]||Ys;function zl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,s,o]=KH({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i;{const u=g.useRef(e!==void 0);g.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=g.useCallback(u=>{var d;if(a){const f=GH(u)?u(e):u;f!==e&&((d=o.current)==null||d.call(o,f))}else s(u)},[a,e,s,o]);return[l,c]}function KH({defaultProp:e,onChange:t}){const[n,r]=g.useState(e),i=g.useRef(n),s=g.useRef(t);return VH(()=>{s.current=t},[t]),g.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function GH(e){return typeof e=="function"}function ml(e){const t=YH(e),n=g.forwardRef((r,i)=>{const{children:s,...o}=r,a=g.Children.toArray(s),l=a.find(ZH);if(l){const c=l.props.children,u=a.map(d=>d===l?g.Children.count(c)>1?g.Children.only(null):g.isValidElement(c)?c.props.children:null:d);return h.jsx(t,{...o,ref:i,children:g.isValidElement(c)?g.cloneElement(c,void 0,u):null})}return h.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function YH(e){const t=g.forwardRef((n,r)=>{const{children:i,...s}=n;if(g.isValidElement(i)){const o=JH(i),a=QH(s,i.props);return i.type!==g.Fragment&&(a.ref=r?qu(r,o):o),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var P3=Symbol("radix.slottable");function XH(e){const t=({children:n})=>h.jsx(h.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=P3,t}function ZH(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===P3}function QH(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function JH(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var eU=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wt=eU.reduce((e,t)=>{const n=ml(`Primitive.${t}`),r=g.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function R3(e,t){e&&Oo.flushSync(()=>e.dispatchEvent(t))}function A3(e){const t=e+"CollectionProvider",[n,r]=ro(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=x=>{const{scope:w,children:v}=x,_=Qe.useRef(null),b=Qe.useRef(new Map).current;return h.jsx(i,{scope:w,itemMap:b,collectionRef:_,children:v})};o.displayName=t;const a=e+"CollectionSlot",l=ml(a),c=Qe.forwardRef((x,w)=>{const{scope:v,children:_}=x,b=s(a,v),S=Ot(w,b.collectionRef);return h.jsx(l,{ref:S,children:_})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=ml(u),p=Qe.forwardRef((x,w)=>{const{scope:v,children:_,...b}=x,S=Qe.useRef(null),C=Ot(w,S),k=s(u,v);return Qe.useEffect(()=>(k.itemMap.set(S,{ref:S,...b}),()=>void k.itemMap.delete(S))),h.jsx(f,{[d]:"",ref:C,children:_})});p.displayName=u;function m(x){const w=s(e+"CollectionConsumer",x);return Qe.useCallback(()=>{const _=w.collectionRef.current;if(!_)return[];const b=Array.from(_.querySelectorAll(`[${d}]`));return Array.from(w.itemMap.values()).sort((k,N)=>b.indexOf(k.ref.current)-b.indexOf(N.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:c,ItemSlot:p},m,r]}var tU=g.createContext(void 0);function M3(e){const t=g.useContext(tU);return e||t||"ltr"}function Ii(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function nU(e,t=globalThis==null?void 0:globalThis.document){const n=Ii(e);g.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var rU="DismissableLayer",fx="dismissableLayer.update",iU="dismissableLayer.pointerDownOutside",sU="dismissableLayer.focusOutside",mk,j3=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Vu=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=e,c=g.useContext(j3),[u,d]=g.useState(null),f=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=g.useState({}),m=Ot(t,N=>d(N)),x=Array.from(c.layers),[w]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),v=x.indexOf(w),_=u?x.indexOf(u):-1,b=c.layersWithOutsidePointerEventsDisabled.size>0,S=_>=v,C=lU(N=>{const E=N.target,L=[...c.branches].some(P=>P.contains(E));!S||L||(i==null||i(N),o==null||o(N),N.defaultPrevented||a==null||a())},f),k=cU(N=>{const E=N.target;[...c.branches].some(P=>P.contains(E))||(s==null||s(N),o==null||o(N),N.defaultPrevented||a==null||a())},f);return nU(N=>{_===c.layers.size-1&&(r==null||r(N),!N.defaultPrevented&&a&&(N.preventDefault(),a()))},f),g.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(mk=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),gk(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=mk)}},[u,f,n,c]),g.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),gk())},[u,c]),g.useEffect(()=>{const N=()=>p({});return document.addEventListener(fx,N),()=>document.removeEventListener(fx,N)},[]),h.jsx(wt.div,{...l,ref:m,style:{pointerEvents:b?S?"auto":"none":void 0,...e.style},onFocusCapture:Ie(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Ie(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Ie(e.onPointerDownCapture,C.onPointerDownCapture)})});Vu.displayName=rU;var oU="DismissableLayerBranch",aU=g.forwardRef((e,t)=>{const n=g.useContext(j3),r=g.useRef(null),i=Ot(t,r);return g.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),h.jsx(wt.div,{...e,ref:i})});aU.displayName=oU;function lU(e,t=globalThis==null?void 0:globalThis.document){const n=Ii(e),r=g.useRef(!1),i=g.useRef(()=>{});return g.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){L3(iU,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=l,t.addEventListener("click",i.current,{once:!0})):l()}else t.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",s),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function cU(e,t=globalThis==null?void 0:globalThis.document){const n=Ii(e),r=g.useRef(!1);return g.useEffect(()=>{const i=s=>{s.target&&!r.current&&L3(sU,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function gk(){const e=new CustomEvent(fx);document.dispatchEvent(e)}function L3(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?R3(i,s):i.dispatchEvent(s)}var Cg=0;function a_(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??vk()),document.body.insertAdjacentElement("beforeend",e[1]??vk()),Cg++,()=>{Cg===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Cg--}},[])}function vk(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Eg="focusScope.autoFocusOnMount",Ig="focusScope.autoFocusOnUnmount",xk={bubbles:!1,cancelable:!0},uU="FocusScope",tm=g.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,l]=g.useState(null),c=Ii(i),u=Ii(s),d=g.useRef(null),f=Ot(t,x=>l(x)),p=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(r){let x=function(b){if(p.paused||!a)return;const S=b.target;a.contains(S)?d.current=S:ws(d.current,{select:!0})},w=function(b){if(p.paused||!a)return;const S=b.relatedTarget;S!==null&&(a.contains(S)||ws(d.current,{select:!0}))},v=function(b){if(document.activeElement===document.body)for(const C of b)C.removedNodes.length>0&&ws(a)};document.addEventListener("focusin",x),document.addEventListener("focusout",w);const _=new MutationObserver(v);return a&&_.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",w),_.disconnect()}}},[r,a,p.paused]),g.useEffect(()=>{if(a){_k.add(p);const x=document.activeElement;if(!a.contains(x)){const v=new CustomEvent(Eg,xk);a.addEventListener(Eg,c),a.dispatchEvent(v),v.defaultPrevented||(dU(gU(D3(a)),{select:!0}),document.activeElement===x&&ws(a))}return()=>{a.removeEventListener(Eg,c),setTimeout(()=>{const v=new CustomEvent(Ig,xk);a.addEventListener(Ig,u),a.dispatchEvent(v),v.defaultPrevented||ws(x??document.body,{select:!0}),a.removeEventListener(Ig,u),_k.remove(p)},0)}}},[a,c,u,p]);const m=g.useCallback(x=>{if(!n&&!r||p.paused)return;const w=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,v=document.activeElement;if(w&&v){const _=x.currentTarget,[b,S]=hU(_);b&&S?!x.shiftKey&&v===S?(x.preventDefault(),n&&ws(b,{select:!0})):x.shiftKey&&v===b&&(x.preventDefault(),n&&ws(S,{select:!0})):v===_&&x.preventDefault()}},[n,r,p.paused]);return h.jsx(wt.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});tm.displayName=uU;function dU(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ws(r,{select:t}),document.activeElement!==n)return}function hU(e){const t=D3(e),n=yk(t,e),r=yk(t.reverse(),e);return[n,r]}function D3(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function yk(e,t){for(const n of e)if(!fU(n,{upTo:t}))return n}function fU(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function pU(e){return e instanceof HTMLInputElement&&"select"in e}function ws(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&pU(e)&&t&&e.select()}}var _k=mU();function mU(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=bk(e,t),e.unshift(t)},remove(t){var n;e=bk(e,t),(n=e[0])==null||n.resume()}}}function bk(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function gU(e){return e.filter(t=>t.tagName!=="A")}var vU=Pl[" useId ".trim().toString()]||(()=>{}),xU=0;function wi(e){const[t,n]=g.useState(vU());return Ys(()=>{n(r=>r??String(xU++))},[e]),t?`radix-${t}`:""}const yU=["top","right","bottom","left"],Xs=Math.min,ar=Math.max,Uf=Math.round,qd=Math.floor,Si=e=>({x:e,y:e}),_U={left:"right",right:"left",bottom:"top",top:"bottom"};function px(e,t,n){return ar(e,Xs(t,n))}function ns(e,t){return typeof e=="function"?e(t):e}function rs(e){return e.split("-")[0]}function Fl(e){return e.split("-")[1]}function l_(e){return e==="x"?"y":"x"}function c_(e){return e==="y"?"height":"width"}function gi(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function u_(e){return l_(gi(e))}function bU(e,t,n){n===void 0&&(n=!1);const r=Fl(e),i=u_(e),s=c_(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=Wf(o)),[o,Wf(o)]}function wU(e){const t=Wf(e);return[mx(e),t,mx(t)]}function mx(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const wk=["left","right"],Sk=["right","left"],SU=["top","bottom"],kU=["bottom","top"];function CU(e,t,n){switch(e){case"top":case"bottom":return n?t?Sk:wk:t?wk:Sk;case"left":case"right":return t?SU:kU;default:return[]}}function EU(e,t,n,r){const i=Fl(e);let s=CU(rs(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(mx)))),s}function Wf(e){const t=rs(e);return _U[t]+e.slice(t.length)}function IU(e){return{top:0,right:0,bottom:0,left:0,...e}}function O3(e){return typeof e!="number"?IU(e):{top:e,right:e,bottom:e,left:e}}function qf(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function kk(e,t,n){let{reference:r,floating:i}=e;const s=gi(t),o=u_(t),a=c_(o),l=rs(t),c=s==="y",u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-i.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Fl(t)){case"start":p[o]-=f*(n&&c?-1:1);break;case"end":p[o]+=f*(n&&c?-1:1);break}return p}async function NU(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=ns(t,e),m=O3(p),w=a[f?d==="floating"?"reference":"floating":d],v=qf(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),_=d==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),S=await(s.isElement==null?void 0:s.isElement(b))?await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1}:{x:1,y:1},C=qf(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:_,offsetParent:b,strategy:l}):_);return{top:(v.top-C.top+m.top)/S.y,bottom:(C.bottom-v.bottom+m.bottom)/S.y,left:(v.left-C.left+m.left)/S.x,right:(C.right-v.right+m.right)/S.x}}const TU=50,PU=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:NU},l=await(o.isRTL==null?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=kk(c,r,l),f=r,p=0;const m={};for(let x=0;x<s.length;x++){const w=s[x];if(!w)continue;const{name:v,fn:_}=w,{x:b,y:S,data:C,reset:k}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:c,platform:a,elements:{reference:e,floating:t}});u=b??u,d=S??d,m[v]={...m[v],...C},k&&p<TU&&(p++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(c=k.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):k.rects),{x:u,y:d}=kk(c,f,l)),x=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},RU=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=ns(e,t)||{};if(c==null)return{};const d=O3(u),f={x:n,y:r},p=u_(i),m=c_(p),x=await o.getDimensions(c),w=p==="y",v=w?"top":"left",_=w?"bottom":"right",b=w?"clientHeight":"clientWidth",S=s.reference[m]+s.reference[p]-f[p]-s.floating[m],C=f[p]-s.reference[p],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let N=k?k[b]:0;(!N||!await(o.isElement==null?void 0:o.isElement(k)))&&(N=a.floating[b]||s.floating[m]);const E=S/2-C/2,L=N/2-x[m]/2-1,P=Xs(d[v],L),D=Xs(d[_],L),R=P,A=N-x[m]-D,M=N/2-x[m]/2+E,j=px(R,M,A),z=!l.arrow&&Fl(i)!=null&&M!==j&&s.reference[m]/2-(M<R?P:D)-x[m]/2<0,F=z?M<R?M-R:M-A:0;return{[p]:f[p]+F,data:{[p]:j,centerOffset:M-j-F,...z&&{alignmentOffset:F}},reset:z}}}),AU=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:x=!0,...w}=ns(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=rs(i),_=gi(a),b=rs(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=f||(b||!x?[Wf(a)]:wU(a)),k=m!=="none";!f&&k&&C.push(...EU(a,x,m,S));const N=[a,...C],E=await l.detectOverflow(t,w),L=[];let P=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&L.push(E[v]),d){const M=bU(i,o,S);L.push(E[M[0]],E[M[1]])}if(P=[...P,{placement:i,overflows:L}],!L.every(M=>M<=0)){var D,R;const M=(((D=s.flip)==null?void 0:D.index)||0)+1,j=N[M];if(j&&(!(d==="alignment"?_!==gi(j):!1)||P.every($=>gi($.placement)===_?$.overflows[0]>0:!0)))return{data:{index:M,overflows:P},reset:{placement:j}};let z=(R=P.filter(F=>F.overflows[0]<=0).sort((F,$)=>F.overflows[1]-$.overflows[1])[0])==null?void 0:R.placement;if(!z)switch(p){case"bestFit":{var A;const F=(A=P.filter($=>{if(k){const B=gi($.placement);return B===_||B==="y"}return!0}).map($=>[$.placement,$.overflows.filter(B=>B>0).reduce((B,I)=>B+I,0)]).sort(($,B)=>$[1]-B[1])[0])==null?void 0:A[0];F&&(z=F);break}case"initialPlacement":z=a;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function Ck(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ek(e){return yU.some(t=>e[t]>=0)}const MU=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=ns(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=Ck(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Ek(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),a=Ck(o,n.floating);return{data:{escapedOffsets:a,escaped:Ek(a)}}}default:return{}}}}},B3=new Set(["left","top"]);async function jU(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=rs(n),a=Fl(n),l=gi(n)==="y",c=B3.has(o)?-1:1,u=s&&l?-1:1,d=ns(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),l?{x:p*u,y:f*c}:{x:f*c,y:p*u}}const LU=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=t,l=await jU(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},DU=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:v=>{let{x:_,y:b}=v;return{x:_,y:b}}},...c}=ns(e,t),u={x:n,y:r},d=await s.detectOverflow(t,c),f=gi(rs(i)),p=l_(f);let m=u[p],x=u[f];if(o){const v=p==="y"?"top":"left",_=p==="y"?"bottom":"right",b=m+d[v],S=m-d[_];m=px(b,m,S)}if(a){const v=f==="y"?"top":"left",_=f==="y"?"bottom":"right",b=x+d[v],S=x-d[_];x=px(b,x,S)}const w=l.fn({...t,[p]:m,[f]:x});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[p]:o,[f]:a}}}}}},OU=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=ns(e,t),u={x:n,y:r},d=gi(i),f=l_(d);let p=u[f],m=u[d];const x=ns(a,t),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(l){const b=f==="y"?"height":"width",S=s.reference[f]-s.floating[b]+w.mainAxis,C=s.reference[f]+s.reference[b]-w.mainAxis;p<S?p=S:p>C&&(p=C)}if(c){var v,_;const b=f==="y"?"width":"height",S=B3.has(rs(i)),C=s.reference[d]-s.floating[b]+(S&&((v=o.offset)==null?void 0:v[d])||0)+(S?0:w.crossAxis),k=s.reference[d]+s.reference[b]+(S?0:((_=o.offset)==null?void 0:_[d])||0)-(S?w.crossAxis:0);m<C?m=C:m>k&&(m=k)}return{[f]:p,[d]:m}}}},BU=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:a}=t,{apply:l=()=>{},...c}=ns(e,t),u=await o.detectOverflow(t,c),d=rs(i),f=Fl(i),p=gi(i)==="y",{width:m,height:x}=s.floating;let w,v;d==="top"||d==="bottom"?(w=d,v=f===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(v=d,w=f==="end"?"top":"bottom");const _=x-u.top-u.bottom,b=m-u.left-u.right,S=Xs(x-u[w],_),C=Xs(m-u[v],b),k=!t.middlewareData.shift;let N=S,E=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(E=b),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(N=_),k&&!f){const P=ar(u.left,0),D=ar(u.right,0),R=ar(u.top,0),A=ar(u.bottom,0);p?E=m-2*(P!==0||D!==0?P+D:ar(u.left,u.right)):N=x-2*(R!==0||A!==0?R+A:ar(u.top,u.bottom))}await l({...t,availableWidth:E,availableHeight:N});const L=await o.getDimensions(a.floating);return m!==L.width||x!==L.height?{reset:{rects:!0}}:{}}}};function nm(){return typeof window<"u"}function Hl(e){return $3(e)?(e.nodeName||"").toLowerCase():"#document"}function ur(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Pi(e){var t;return(t=($3(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function $3(e){return nm()?e instanceof Node||e instanceof ur(e).Node:!1}function Zr(e){return nm()?e instanceof Element||e instanceof ur(e).Element:!1}function ls(e){return nm()?e instanceof HTMLElement||e instanceof ur(e).HTMLElement:!1}function Ik(e){return!nm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ur(e).ShadowRoot}function Ku(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Qr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function $U(e){return/^(table|td|th)$/.test(Hl(e))}function rm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const zU=/transform|translate|scale|rotate|perspective|filter/,FU=/paint|layout|strict|content/,fo=e=>!!e&&e!=="none";let Ng;function d_(e){const t=Zr(e)?Qr(e):e;return fo(t.transform)||fo(t.translate)||fo(t.scale)||fo(t.rotate)||fo(t.perspective)||!h_()&&(fo(t.backdropFilter)||fo(t.filter))||zU.test(t.willChange||"")||FU.test(t.contain||"")}function HU(e){let t=Zs(e);for(;ls(t)&&!gl(t);){if(d_(t))return t;if(rm(t))return null;t=Zs(t)}return null}function h_(){return Ng==null&&(Ng=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ng}function gl(e){return/^(html|body|#document)$/.test(Hl(e))}function Qr(e){return ur(e).getComputedStyle(e)}function im(e){return Zr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zs(e){if(Hl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ik(e)&&e.host||Pi(e);return Ik(t)?t.host:t}function z3(e){const t=Zs(e);return gl(t)?e.ownerDocument?e.ownerDocument.body:e.body:ls(t)&&Ku(t)?t:z3(t)}function Su(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=z3(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=ur(i);if(s){const a=gx(o);return t.concat(o,o.visualViewport||[],Ku(i)?i:[],a&&n?Su(a):[])}else return t.concat(i,Su(i,[],n))}function gx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function F3(e){const t=Qr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=ls(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,a=Uf(n)!==s||Uf(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function f_(e){return Zr(e)?e:e.contextElement}function Ga(e){const t=f_(e);if(!ls(t))return Si(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=F3(t);let o=(s?Uf(n.width):n.width)/r,a=(s?Uf(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const UU=Si(0);function H3(e){const t=ur(e);return!h_()||!t.visualViewport?UU:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function WU(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ur(e)?!1:t}function Fo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=f_(e);let o=Si(1);t&&(r?Zr(r)&&(o=Ga(r)):o=Ga(e));const a=WU(s,n,r)?H3(s):Si(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(s){const f=ur(s),p=r&&Zr(r)?ur(r):r;let m=f,x=gx(m);for(;x&&r&&p!==m;){const w=Ga(x),v=x.getBoundingClientRect(),_=Qr(x),b=v.left+(x.clientLeft+parseFloat(_.paddingLeft))*w.x,S=v.top+(x.clientTop+parseFloat(_.paddingTop))*w.y;l*=w.x,c*=w.y,u*=w.x,d*=w.y,l+=b,c+=S,m=ur(x),x=gx(m)}}return qf({width:u,height:d,x:l,y:c})}function sm(e,t){const n=im(e).scrollLeft;return t?t.left+n:Fo(Pi(e)).left+n}function U3(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-sm(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function qU(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=Pi(r),a=t?rm(t.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=Si(1);const u=Si(0),d=ls(r);if((d||!d&&!s)&&((Hl(r)!=="body"||Ku(o))&&(l=im(r)),d)){const p=Fo(r);c=Ga(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const f=o&&!d&&!s?U3(o,l):Si(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}}function VU(e){return Array.from(e.getClientRects())}function KU(e){const t=Pi(e),n=im(e),r=e.ownerDocument.body,i=ar(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ar(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+sm(e);const a=-n.scrollTop;return Qr(r).direction==="rtl"&&(o+=ar(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const Nk=25;function GU(e,t){const n=ur(e),r=Pi(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const u=h_();(!u||u&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=sm(r);if(c<=0){const u=r.ownerDocument,d=u.body,f=getComputedStyle(d),p=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(r.clientWidth-d.clientWidth-p);m<=Nk&&(s-=m)}else c<=Nk&&(s+=c);return{width:s,height:o,x:a,y:l}}function YU(e,t){const n=Fo(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=ls(e)?Ga(e):Si(1),o=e.clientWidth*s.x,a=e.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function Tk(e,t,n){let r;if(t==="viewport")r=GU(e,n);else if(t==="document")r=KU(Pi(e));else if(Zr(t))r=YU(t,n);else{const i=H3(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return qf(r)}function W3(e,t){const n=Zs(e);return n===t||!Zr(n)||gl(n)?!1:Qr(n).position==="fixed"||W3(n,t)}function XU(e,t){const n=t.get(e);if(n)return n;let r=Su(e,[],!1).filter(a=>Zr(a)&&Hl(a)!=="body"),i=null;const s=Qr(e).position==="fixed";let o=s?Zs(e):e;for(;Zr(o)&&!gl(o);){const a=Qr(o),l=d_(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Ku(o)&&!l&&W3(e,o))?r=r.filter(u=>u!==o):i=a,o=Zs(o)}return t.set(e,r),r}function ZU(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?rm(t)?[]:XU(t,this._c):[].concat(n),r],a=Tk(t,o[0],i);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let f=1;f<o.length;f++){const p=Tk(t,o[f],i);l=ar(p.top,l),c=Xs(p.right,c),u=Xs(p.bottom,u),d=ar(p.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function QU(e){const{width:t,height:n}=F3(e);return{width:t,height:n}}function JU(e,t,n){const r=ls(t),i=Pi(t),s=n==="fixed",o=Fo(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=Si(0);function c(){l.x=sm(i)}if(r||!r&&!s)if((Hl(t)!=="body"||Ku(i))&&(a=im(t)),r){const p=Fo(t,!0,s,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else i&&c();s&&!r&&i&&c();const u=i&&!r&&!s?U3(i,a):Si(0),d=o.left+a.scrollLeft-l.x-u.x,f=o.top+a.scrollTop-l.y-u.y;return{x:d,y:f,width:o.width,height:o.height}}function Tg(e){return Qr(e).position==="static"}function Pk(e,t){if(!ls(e)||Qr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Pi(e)===n&&(n=n.ownerDocument.body),n}function q3(e,t){const n=ur(e);if(rm(e))return n;if(!ls(e)){let i=Zs(e);for(;i&&!gl(i);){if(Zr(i)&&!Tg(i))return i;i=Zs(i)}return n}let r=Pk(e,t);for(;r&&$U(r)&&Tg(r);)r=Pk(r,t);return r&&gl(r)&&Tg(r)&&!d_(r)?n:r||HU(e)||n}const eW=async function(e){const t=this.getOffsetParent||q3,n=this.getDimensions,r=await n(e.floating);return{reference:JU(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function tW(e){return Qr(e).direction==="rtl"}const nW={convertOffsetParentRelativeRectToViewportRelativeRect:qU,getDocumentElement:Pi,getClippingRect:ZU,getOffsetParent:q3,getElementRects:eW,getClientRects:VU,getDimensions:QU,getScale:Ga,isElement:Zr,isRTL:tW};function V3(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function rW(e,t){let n=null,r;const i=Pi(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=c;if(a||t(),!f||!p)return;const m=qd(d),x=qd(i.clientWidth-(u+f)),w=qd(i.clientHeight-(d+p)),v=qd(u),b={rootMargin:-m+"px "+-x+"px "+-w+"px "+-v+"px",threshold:ar(0,Xs(1,l))||1};let S=!0;function C(k){const N=k[0].intersectionRatio;if(N!==l){if(!S)return o();N?o(!1,N):r=setTimeout(()=>{o(!1,1e-7)},1e3)}N===1&&!V3(c,e.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(C,{...b,root:i.ownerDocument})}catch{n=new IntersectionObserver(C,b)}n.observe(e)}return o(!0),s}function iW(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=f_(e),u=i||s?[...c?Su(c):[],...t?Su(t):[]]:[];u.forEach(v=>{i&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const d=c&&a?rW(c,n):null;let f=-1,p=null;o&&(p=new ResizeObserver(v=>{let[_]=v;_&&_.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var b;(b=p)==null||b.observe(t)})),n()}),c&&!l&&p.observe(c),t&&p.observe(t));let m,x=l?Fo(e):null;l&&w();function w(){const v=Fo(e);x&&!V3(x,v)&&n(),x=v,m=requestAnimationFrame(w)}return n(),()=>{var v;u.forEach(_=>{i&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),d==null||d(),(v=p)==null||v.disconnect(),p=null,l&&cancelAnimationFrame(m)}}const sW=LU,oW=DU,aW=AU,lW=BU,cW=MU,Rk=RU,uW=OU,dW=(e,t,n)=>{const r=new Map,i={platform:nW,...n},s={...i.platform,_c:r};return PU(e,t,{...i,platform:s})};var hW=typeof document<"u",fW=function(){},Lh=hW?g.useLayoutEffect:fW;function Vf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Vf(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!Vf(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function K3(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ak(e,t){const n=K3(e);return Math.round(t*n)/n}function Pg(e){const t=g.useRef(e);return Lh(()=>{t.current=e}),t}function pW(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=g.useState(r);Vf(f,r)||p(r);const[m,x]=g.useState(null),[w,v]=g.useState(null),_=g.useCallback($=>{$!==k.current&&(k.current=$,x($))},[]),b=g.useCallback($=>{$!==N.current&&(N.current=$,v($))},[]),S=s||m,C=o||w,k=g.useRef(null),N=g.useRef(null),E=g.useRef(u),L=l!=null,P=Pg(l),D=Pg(i),R=Pg(c),A=g.useCallback(()=>{if(!k.current||!N.current)return;const $={placement:t,strategy:n,middleware:f};D.current&&($.platform=D.current),dW(k.current,N.current,$).then(B=>{const I={...B,isPositioned:R.current!==!1};M.current&&!Vf(E.current,I)&&(E.current=I,Oo.flushSync(()=>{d(I)}))})},[f,t,n,D,R]);Lh(()=>{c===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d($=>({...$,isPositioned:!1})))},[c]);const M=g.useRef(!1);Lh(()=>(M.current=!0,()=>{M.current=!1}),[]),Lh(()=>{if(S&&(k.current=S),C&&(N.current=C),S&&C){if(P.current)return P.current(S,C,A);A()}},[S,C,A,P,L]);const j=g.useMemo(()=>({reference:k,floating:N,setReference:_,setFloating:b}),[_,b]),z=g.useMemo(()=>({reference:S,floating:C}),[S,C]),F=g.useMemo(()=>{const $={position:n,left:0,top:0};if(!z.floating)return $;const B=Ak(z.floating,u.x),I=Ak(z.floating,u.y);return a?{...$,transform:"translate("+B+"px, "+I+"px)",...K3(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:I}},[n,a,z.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:A,refs:j,elements:z,floatingStyles:F}),[u,A,j,z,F])}const mW=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Rk({element:r.current,padding:i}).fn(n):{}:r?Rk({element:r,padding:i}).fn(n):{}}}},gW=(e,t)=>{const n=sW(e);return{name:n.name,fn:n.fn,options:[e,t]}},vW=(e,t)=>{const n=oW(e);return{name:n.name,fn:n.fn,options:[e,t]}},xW=(e,t)=>({fn:uW(e).fn,options:[e,t]}),yW=(e,t)=>{const n=aW(e);return{name:n.name,fn:n.fn,options:[e,t]}},_W=(e,t)=>{const n=lW(e);return{name:n.name,fn:n.fn,options:[e,t]}},bW=(e,t)=>{const n=cW(e);return{name:n.name,fn:n.fn,options:[e,t]}},wW=(e,t)=>{const n=mW(e);return{name:n.name,fn:n.fn,options:[e,t]}};var SW="Arrow",G3=g.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return h.jsx(wt.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:h.jsx("polygon",{points:"0,0 30,0 15,10"})})});G3.displayName=SW;var kW=G3;function CW(e){const[t,n]=g.useState(void 0);return Ys(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var p_="Popper",[Y3,Ul]=ro(p_),[EW,X3]=Y3(p_),Z3=e=>{const{__scopePopper:t,children:n}=e,[r,i]=g.useState(null);return h.jsx(EW,{scope:t,anchor:r,onAnchorChange:i,children:n})};Z3.displayName=p_;var Q3="PopperAnchor",J3=g.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=X3(Q3,n),o=g.useRef(null),a=Ot(t,o),l=g.useRef(null);return g.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||o.current,c!==l.current&&s.onAnchorChange(l.current)}),r?null:h.jsx(wt.div,{...i,ref:a})});J3.displayName=Q3;var m_="PopperContent",[IW,NW]=Y3(m_),e4=g.forwardRef((e,t)=>{var ye,Ce,oe,je,Ae,De;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:m,...x}=e,w=X3(m_,n),[v,_]=g.useState(null),b=Ot(t,xe=>_(xe)),[S,C]=g.useState(null),k=CW(S),N=(k==null?void 0:k.width)??0,E=(k==null?void 0:k.height)??0,L=r+(s!=="center"?"-"+s:""),P=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(c)?c:[c],R=D.length>0,A={padding:P,boundary:D.filter(PW),altBoundary:R},{refs:M,floatingStyles:j,placement:z,isPositioned:F,middlewareData:$}=pW({strategy:"fixed",placement:L,whileElementsMounted:(...xe)=>iW(...xe,{animationFrame:p==="always"}),elements:{reference:w.anchor},middleware:[gW({mainAxis:i+E,alignmentAxis:o}),l&&vW({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?xW():void 0,...A}),l&&yW({...A}),_W({...A,apply:({elements:xe,rects:Ke,availableWidth:rt,availableHeight:Ze})=>{const{width:ht,height:Kt}=Ke.reference,de=xe.floating.style;de.setProperty("--radix-popper-available-width",`${rt}px`),de.setProperty("--radix-popper-available-height",`${Ze}px`),de.setProperty("--radix-popper-anchor-width",`${ht}px`),de.setProperty("--radix-popper-anchor-height",`${Kt}px`)}}),S&&wW({element:S,padding:a}),RW({arrowWidth:N,arrowHeight:E}),f&&bW({strategy:"referenceHidden",...A})]}),[B,I]=r4(z),U=Ii(m);Ys(()=>{F&&(U==null||U())},[F,U]);const V=(ye=$.arrow)==null?void 0:ye.x,O=(Ce=$.arrow)==null?void 0:Ce.y,ne=((oe=$.arrow)==null?void 0:oe.centerOffset)!==0,[ae,Y]=g.useState();return Ys(()=>{v&&Y(window.getComputedStyle(v).zIndex)},[v]),h.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:F?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[(je=$.transformOrigin)==null?void 0:je.x,(Ae=$.transformOrigin)==null?void 0:Ae.y].join(" "),...((De=$.hide)==null?void 0:De.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:h.jsx(IW,{scope:n,placedSide:B,onArrowChange:C,arrowX:V,arrowY:O,shouldHideArrow:ne,children:h.jsx(wt.div,{"data-side":B,"data-align":I,...x,ref:b,style:{...x.style,animation:F?void 0:"none"}})})})});e4.displayName=m_;var t4="PopperArrow",TW={top:"bottom",right:"left",bottom:"top",left:"right"},n4=g.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=NW(t4,r),o=TW[s.placedSide];return h.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:h.jsx(kW,{...i,ref:n,style:{...i.style,display:"block"}})})});n4.displayName=t4;function PW(e){return e!==null}var RW=e=>({name:"transformOrigin",options:e,fn(t){var w,v,_;const{placement:n,rects:r,middlewareData:i}=t,o=((w=i.arrow)==null?void 0:w.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[c,u]=r4(n),d={start:"0%",center:"50%",end:"100%"}[u],f=(((v=i.arrow)==null?void 0:v.x)??0)+a/2,p=(((_=i.arrow)==null?void 0:_.y)??0)+l/2;let m="",x="";return c==="bottom"?(m=o?d:`${f}px`,x=`${-l}px`):c==="top"?(m=o?d:`${f}px`,x=`${r.floating.height+l}px`):c==="right"?(m=`${-l}px`,x=o?d:`${p}px`):c==="left"&&(m=`${r.floating.width+l}px`,x=o?d:`${p}px`),{data:{x:m,y:x}}}});function r4(e){const[t,n="center"]=e.split("-");return[t,n]}var om=Z3,am=J3,g_=e4,v_=n4,AW="Portal",lm=g.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[i,s]=g.useState(!1);Ys(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?vv.createPortal(h.jsx(wt.div,{...r,ref:t}),o):null});lm.displayName=AW;function MW(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var ei=e=>{const{present:t,children:n}=e,r=jW(t),i=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),s=Ot(r.ref,LW(i));return typeof n=="function"||r.isPresent?g.cloneElement(i,{ref:s}):null};ei.displayName="Presence";function jW(e){const[t,n]=g.useState(),r=g.useRef(null),i=g.useRef(e),s=g.useRef("none"),o=e?"mounted":"unmounted",[a,l]=MW(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const c=Vd(r.current);s.current=a==="mounted"?c:"none"},[a]),Ys(()=>{const c=r.current,u=i.current;if(u!==e){const f=s.current,p=Vd(c);e?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&f!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Ys(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=p=>{const x=Vd(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&x&&(l("ANIMATION_END"),!i.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},f=p=>{p.target===t&&(s.current=Vd(r.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:g.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function Vd(e){return(e==null?void 0:e.animationName)||"none"}function LW(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Rg="rovingFocusGroup.onEntryFocus",DW={bubbles:!1,cancelable:!0},Gu="RovingFocusGroup",[vx,i4,OW]=A3(Gu),[BW,s4]=ro(Gu,[OW]),[$W,zW]=BW(Gu),o4=g.forwardRef((e,t)=>h.jsx(vx.Provider,{scope:e.__scopeRovingFocusGroup,children:h.jsx(vx.Slot,{scope:e.__scopeRovingFocusGroup,children:h.jsx(FW,{...e,ref:t})})}));o4.displayName=Gu;var FW=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,f=g.useRef(null),p=Ot(t,f),m=M3(s),[x,w]=zl({prop:o,defaultProp:a??null,onChange:l,caller:Gu}),[v,_]=g.useState(!1),b=Ii(c),S=i4(n),C=g.useRef(!1),[k,N]=g.useState(0);return g.useEffect(()=>{const E=f.current;if(E)return E.addEventListener(Rg,b),()=>E.removeEventListener(Rg,b)},[b]),h.jsx($W,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:x,onItemFocus:g.useCallback(E=>w(E),[w]),onItemShiftTab:g.useCallback(()=>_(!0),[]),onFocusableItemAdd:g.useCallback(()=>N(E=>E+1),[]),onFocusableItemRemove:g.useCallback(()=>N(E=>E-1),[]),children:h.jsx(wt.div,{tabIndex:v||k===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:Ie(e.onMouseDown,()=>{C.current=!0}),onFocus:Ie(e.onFocus,E=>{const L=!C.current;if(E.target===E.currentTarget&&L&&!v){const P=new CustomEvent(Rg,DW);if(E.currentTarget.dispatchEvent(P),!P.defaultPrevented){const D=S().filter(z=>z.focusable),R=D.find(z=>z.active),A=D.find(z=>z.id===x),j=[R,A,...D].filter(Boolean).map(z=>z.ref.current);c4(j,u)}}C.current=!1}),onBlur:Ie(e.onBlur,()=>_(!1))})})}),a4="RovingFocusGroupItem",l4=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...a}=e,l=wi(),c=s||l,u=zW(a4,n),d=u.currentTabStopId===c,f=i4(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:x}=u;return g.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),h.jsx(vx.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:h.jsx(wt.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:Ie(e.onMouseDown,w=>{r?u.onItemFocus(c):w.preventDefault()}),onFocus:Ie(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Ie(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){u.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const v=WW(w,u.orientation,u.dir);if(v!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let b=f().filter(S=>S.focusable).map(S=>S.ref.current);if(v==="last")b.reverse();else if(v==="prev"||v==="next"){v==="prev"&&b.reverse();const S=b.indexOf(w.currentTarget);b=u.loop?qW(b,S+1):b.slice(S+1)}setTimeout(()=>c4(b))}}),children:typeof o=="function"?o({isCurrentTabStop:d,hasTabStop:x!=null}):o})})});l4.displayName=a4;var HW={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function UW(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function WW(e,t,n){const r=UW(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return HW[r]}function c4(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function qW(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var VW=o4,KW=l4,GW=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},fa=new WeakMap,Kd=new WeakMap,Gd={},Ag=0,u4=function(e){return e&&(e.host||u4(e.parentNode))},YW=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=u4(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},XW=function(e,t,n,r){var i=YW(t,Array.isArray(e)?e:[e]);Gd[n]||(Gd[n]=new WeakMap);var s=Gd[n],o=[],a=new Set,l=new Set(i),c=function(d){!d||a.has(d)||(a.add(d),c(d.parentNode))};i.forEach(c);var u=function(d){!d||l.has(d)||Array.prototype.forEach.call(d.children,function(f){if(a.has(f))u(f);else try{var p=f.getAttribute(r),m=p!==null&&p!=="false",x=(fa.get(f)||0)+1,w=(s.get(f)||0)+1;fa.set(f,x),s.set(f,w),o.push(f),x===1&&m&&Kd.set(f,!0),w===1&&f.setAttribute(n,"true"),m||f.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",f,v)}})};return u(t),a.clear(),Ag++,function(){o.forEach(function(d){var f=fa.get(d)-1,p=s.get(d)-1;fa.set(d,f),s.set(d,p),f||(Kd.has(d)||d.removeAttribute(r),Kd.delete(d)),p||d.removeAttribute(n)}),Ag--,Ag||(fa=new WeakMap,fa=new WeakMap,Kd=new WeakMap,Gd={})}},x_=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=GW(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),XW(r,i,n,"aria-hidden")):function(){return null}},mi=function(){return mi=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},mi.apply(this,arguments)};function d4(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function ZW(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Dh="right-scroll-bar-position",Oh="width-before-scroll-bar",QW="with-scroll-bars-hidden",JW="--removed-body-scroll-bar-size";function Mg(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function eq(e,t){var n=g.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var tq=typeof window<"u"?g.useLayoutEffect:g.useEffect,Mk=new WeakMap;function nq(e,t){var n=eq(null,function(r){return e.forEach(function(i){return Mg(i,r)})});return tq(function(){var r=Mk.get(n);if(r){var i=new Set(r),s=new Set(e),o=n.current;i.forEach(function(a){s.has(a)||Mg(a,null)}),s.forEach(function(a){i.has(a)||Mg(a,o)})}Mk.set(n,e)},[e]),n}function rq(e){return e}function iq(e,t){t===void 0&&(t=rq);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var o=t(s,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var l=function(){var u=o;o=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){o.push(u),c()},filter:function(u){return o=o.filter(u),n}}}};return i}function sq(e){e===void 0&&(e={});var t=iq(null);return t.options=mi({async:!0,ssr:!1},e),t}var h4=function(e){var t=e.sideCar,n=d4(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return g.createElement(r,mi({},n))};h4.isSideCarExport=!0;function oq(e,t){return e.useMedium(t),h4}var f4=sq(),jg=function(){},cm=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:jg,onWheelCapture:jg,onTouchMoveCapture:jg}),i=r[0],s=r[1],o=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,x=e.inert,w=e.allowPinchZoom,v=e.as,_=v===void 0?"div":v,b=e.gapMode,S=d4(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=f,k=nq([n,t]),N=mi(mi({},S),i);return g.createElement(g.Fragment,null,u&&g.createElement(C,{sideCar:f4,removeScrollBar:c,shards:d,noRelative:p,noIsolation:m,inert:x,setCallbacks:s,allowPinchZoom:!!w,lockRef:n,gapMode:b}),o?g.cloneElement(g.Children.only(a),mi(mi({},N),{ref:k})):g.createElement(_,mi({},N,{className:l,ref:k}),a))});cm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};cm.classNames={fullWidth:Oh,zeroRight:Dh};var aq=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function lq(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=aq();return t&&e.setAttribute("nonce",t),e}function cq(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function uq(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var dq=function(){var e=0,t=null;return{add:function(n){e==0&&(t=lq())&&(cq(t,n),uq(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},hq=function(){var e=dq();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},p4=function(){var e=hq(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},fq={left:0,top:0,right:0,gap:0},Lg=function(e){return parseInt(e||"",10)||0},pq=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Lg(n),Lg(r),Lg(i)]},mq=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return fq;var t=pq(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},gq=p4(),Ya="data-scroll-locked",vq=function(e,t,n,r){var i=e.left,s=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
502
|
+
.`.concat(QW,` {
|
|
503
|
+
overflow: hidden `).concat(r,`;
|
|
504
|
+
padding-right: `).concat(a,"px ").concat(r,`;
|
|
505
|
+
}
|
|
506
|
+
body[`).concat(Ya,`] {
|
|
507
|
+
overflow: hidden `).concat(r,`;
|
|
508
|
+
overscroll-behavior: contain;
|
|
509
|
+
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
510
|
+
padding-left: `.concat(i,`px;
|
|
511
|
+
padding-top: `).concat(s,`px;
|
|
512
|
+
padding-right: `).concat(o,`px;
|
|
513
|
+
margin-left:0;
|
|
514
|
+
margin-top:0;
|
|
515
|
+
margin-right: `).concat(a,"px ").concat(r,`;
|
|
516
|
+
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.`).concat(Dh,` {
|
|
520
|
+
right: `).concat(a,"px ").concat(r,`;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
.`).concat(Oh,` {
|
|
524
|
+
margin-right: `).concat(a,"px ").concat(r,`;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.`).concat(Dh," .").concat(Dh,` {
|
|
528
|
+
right: 0 `).concat(r,`;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.`).concat(Oh," .").concat(Oh,` {
|
|
532
|
+
margin-right: 0 `).concat(r,`;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
body[`).concat(Ya,`] {
|
|
536
|
+
`).concat(JW,": ").concat(a,`px;
|
|
537
|
+
}
|
|
538
|
+
`)},jk=function(){var e=parseInt(document.body.getAttribute(Ya)||"0",10);return isFinite(e)?e:0},xq=function(){g.useEffect(function(){return document.body.setAttribute(Ya,(jk()+1).toString()),function(){var e=jk()-1;e<=0?document.body.removeAttribute(Ya):document.body.setAttribute(Ya,e.toString())}},[])},yq=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;xq();var s=g.useMemo(function(){return mq(i)},[i]);return g.createElement(gq,{styles:vq(s,!t,i,n?"":"!important")})},xx=!1;if(typeof window<"u")try{var Yd=Object.defineProperty({},"passive",{get:function(){return xx=!0,!0}});window.addEventListener("test",Yd,Yd),window.removeEventListener("test",Yd,Yd)}catch{xx=!1}var pa=xx?{passive:!1}:!1,_q=function(e){return e.tagName==="TEXTAREA"},m4=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!_q(e)&&n[t]==="visible")},bq=function(e){return m4(e,"overflowY")},wq=function(e){return m4(e,"overflowX")},Lk=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=g4(e,r);if(i){var s=v4(e,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Sq=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},kq=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},g4=function(e,t){return e==="v"?bq(t):wq(t)},v4=function(e,t){return e==="v"?Sq(t):kq(t)},Cq=function(e,t){return e==="h"&&t==="rtl"?-1:1},Eq=function(e,t,n,r,i){var s=Cq(e,window.getComputedStyle(t).direction),o=s*r,a=n.target,l=t.contains(a),c=!1,u=o>0,d=0,f=0;do{if(!a)break;var p=v4(e,a),m=p[0],x=p[1],w=p[2],v=x-w-s*m;(m||v)&&g4(e,a)&&(d+=v,f+=m);var _=a.parentNode;a=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&Math.abs(d)<1||!u&&Math.abs(f)<1)&&(c=!0),c},Xd=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Dk=function(e){return[e.deltaX,e.deltaY]},Ok=function(e){return e&&"current"in e?e.current:e},Iq=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Nq=function(e){return`
|
|
539
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
540
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
541
|
+
`)},Tq=0,ma=[];function Pq(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(Tq++)[0],s=g.useState(p4)[0],o=g.useRef(e);g.useEffect(function(){o.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var x=ZW([e.lockRef.current],(e.shards||[]).map(Ok),!0).filter(Boolean);return x.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),x.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(x,w){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!o.current.allowPinchZoom;var v=Xd(x),_=n.current,b="deltaX"in x?x.deltaX:_[0]-v[0],S="deltaY"in x?x.deltaY:_[1]-v[1],C,k=x.target,N=Math.abs(b)>Math.abs(S)?"h":"v";if("touches"in x&&N==="h"&&k.type==="range")return!1;var E=window.getSelection(),L=E&&E.anchorNode,P=L?L===k||L.contains(k):!1;if(P)return!1;var D=Lk(N,k);if(!D)return!0;if(D?C=N:(C=N==="v"?"h":"v",D=Lk(N,k)),!D)return!1;if(!r.current&&"changedTouches"in x&&(b||S)&&(r.current=C),!C)return!0;var R=r.current||C;return Eq(R,w,x,R==="h"?b:S)},[]),l=g.useCallback(function(x){var w=x;if(!(!ma.length||ma[ma.length-1]!==s)){var v="deltaY"in w?Dk(w):Xd(w),_=t.current.filter(function(C){return C.name===w.type&&(C.target===w.target||w.target===C.shadowParent)&&Iq(C.delta,v)})[0];if(_&&_.should){w.cancelable&&w.preventDefault();return}if(!_){var b=(o.current.shards||[]).map(Ok).filter(Boolean).filter(function(C){return C.contains(w.target)}),S=b.length>0?a(w,b[0]):!o.current.noIsolation;S&&w.cancelable&&w.preventDefault()}}},[]),c=g.useCallback(function(x,w,v,_){var b={name:x,delta:w,target:v,should:_,shadowParent:Rq(v)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(S){return S!==b})},1)},[]),u=g.useCallback(function(x){n.current=Xd(x),r.current=void 0},[]),d=g.useCallback(function(x){c(x.type,Dk(x),x.target,a(x,e.lockRef.current))},[]),f=g.useCallback(function(x){c(x.type,Xd(x),x.target,a(x,e.lockRef.current))},[]);g.useEffect(function(){return ma.push(s),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,pa),document.addEventListener("touchmove",l,pa),document.addEventListener("touchstart",u,pa),function(){ma=ma.filter(function(x){return x!==s}),document.removeEventListener("wheel",l,pa),document.removeEventListener("touchmove",l,pa),document.removeEventListener("touchstart",u,pa)}},[]);var p=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(s,{styles:Nq(i)}):null,p?g.createElement(yq,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Rq(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Aq=oq(f4,Pq);var um=g.forwardRef(function(e,t){return g.createElement(cm,mi({},e,{ref:t,sideCar:Aq}))});um.classNames=cm.classNames;var yx=["Enter"," "],Mq=["ArrowDown","PageUp","Home"],x4=["ArrowUp","PageDown","End"],jq=[...Mq,...x4],Lq={ltr:[...yx,"ArrowRight"],rtl:[...yx,"ArrowLeft"]},Dq={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Yu="Menu",[ku,Oq,Bq]=A3(Yu),[ta,y4]=ro(Yu,[Bq,Ul,s4]),Xu=Ul(),_4=s4(),[b4,io]=ta(Yu),[$q,Zu]=ta(Yu),w4=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,a=Xu(t),[l,c]=g.useState(null),u=g.useRef(!1),d=Ii(s),f=M3(i);return g.useEffect(()=>{const p=()=>{u.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>u.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),h.jsx(om,{...a,children:h.jsx(b4,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:h.jsx($q,{scope:t,onClose:g.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};w4.displayName=Yu;var zq="MenuAnchor",y_=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Xu(n);return h.jsx(am,{...i,...r,ref:t})});y_.displayName=zq;var __="MenuPortal",[Fq,S4]=ta(__,{forceMount:void 0}),k4=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=io(__,t);return h.jsx(Fq,{scope:t,forceMount:n,children:h.jsx(ei,{present:n||s.open,children:h.jsx(lm,{asChild:!0,container:i,children:r})})})};k4.displayName=__;var Tr="MenuContent",[Hq,b_]=ta(Tr),C4=g.forwardRef((e,t)=>{const n=S4(Tr,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=io(Tr,e.__scopeMenu),o=Zu(Tr,e.__scopeMenu);return h.jsx(ku.Provider,{scope:e.__scopeMenu,children:h.jsx(ei,{present:r||s.open,children:h.jsx(ku.Slot,{scope:e.__scopeMenu,children:o.modal?h.jsx(Uq,{...i,ref:t}):h.jsx(Wq,{...i,ref:t})})})})}),Uq=g.forwardRef((e,t)=>{const n=io(Tr,e.__scopeMenu),r=g.useRef(null),i=Ot(t,r);return g.useEffect(()=>{const s=r.current;if(s)return x_(s)},[]),h.jsx(w_,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ie(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Wq=g.forwardRef((e,t)=>{const n=io(Tr,e.__scopeMenu);return h.jsx(w_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),qq=ml("MenuContent.ScrollLock"),w_=g.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...x}=e,w=io(Tr,n),v=Zu(Tr,n),_=Xu(n),b=_4(n),S=Oq(n),[C,k]=g.useState(null),N=g.useRef(null),E=Ot(t,N,w.onContentChange),L=g.useRef(0),P=g.useRef(""),D=g.useRef(0),R=g.useRef(null),A=g.useRef("right"),M=g.useRef(0),j=m?um:g.Fragment,z=m?{as:qq,allowPinchZoom:!0}:void 0,F=B=>{var ye,Ce;const I=P.current+B,U=S().filter(oe=>!oe.disabled),V=document.activeElement,O=(ye=U.find(oe=>oe.ref.current===V))==null?void 0:ye.textValue,ne=U.map(oe=>oe.textValue),ae=rV(ne,I,O),Y=(Ce=U.find(oe=>oe.textValue===ae))==null?void 0:Ce.ref.current;(function oe(je){P.current=je,window.clearTimeout(L.current),je!==""&&(L.current=window.setTimeout(()=>oe(""),1e3))})(I),Y&&setTimeout(()=>Y.focus())};g.useEffect(()=>()=>window.clearTimeout(L.current),[]),a_();const $=g.useCallback(B=>{var U,V;return A.current===((U=R.current)==null?void 0:U.side)&&sV(B,(V=R.current)==null?void 0:V.area)},[]);return h.jsx(Hq,{scope:n,searchRef:P,onItemEnter:g.useCallback(B=>{$(B)&&B.preventDefault()},[$]),onItemLeave:g.useCallback(B=>{var I;$(B)||((I=N.current)==null||I.focus(),k(null))},[$]),onTriggerLeave:g.useCallback(B=>{$(B)&&B.preventDefault()},[$]),pointerGraceTimerRef:D,onPointerGraceIntentChange:g.useCallback(B=>{R.current=B},[]),children:h.jsx(j,{...z,children:h.jsx(tm,{asChild:!0,trapped:i,onMountAutoFocus:Ie(s,B=>{var I;B.preventDefault(),(I=N.current)==null||I.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:h.jsx(Vu,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:h.jsx(VW,{asChild:!0,...b,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:k,onEntryFocus:Ie(l,B=>{v.isUsingKeyboardRef.current||B.preventDefault()}),preventScrollOnEntryFocus:!0,children:h.jsx(g_,{role:"menu","aria-orientation":"vertical","data-state":H4(w.open),"data-radix-menu-content":"",dir:v.dir,..._,...x,ref:E,style:{outline:"none",...x.style},onKeyDown:Ie(x.onKeyDown,B=>{const U=B.target.closest("[data-radix-menu-content]")===B.currentTarget,V=B.ctrlKey||B.altKey||B.metaKey,O=B.key.length===1;U&&(B.key==="Tab"&&B.preventDefault(),!V&&O&&F(B.key));const ne=N.current;if(B.target!==ne||!jq.includes(B.key))return;B.preventDefault();const Y=S().filter(ye=>!ye.disabled).map(ye=>ye.ref.current);x4.includes(B.key)&&Y.reverse(),tV(Y)}),onBlur:Ie(e.onBlur,B=>{B.currentTarget.contains(B.target)||(window.clearTimeout(L.current),P.current="")}),onPointerMove:Ie(e.onPointerMove,Cu(B=>{const I=B.target,U=M.current!==B.clientX;if(B.currentTarget.contains(I)&&U){const V=B.clientX>M.current?"right":"left";A.current=V,M.current=B.clientX}}))})})})})})})});C4.displayName=Tr;var Vq="MenuGroup",S_=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(wt.div,{role:"group",...r,ref:t})});S_.displayName=Vq;var Kq="MenuLabel",E4=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(wt.div,{...r,ref:t})});E4.displayName=Kq;var Kf="MenuItem",Bk="menu.itemSelect",dm=g.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=g.useRef(null),o=Zu(Kf,e.__scopeMenu),a=b_(Kf,e.__scopeMenu),l=Ot(t,s),c=g.useRef(!1),u=()=>{const d=s.current;if(!n&&d){const f=new CustomEvent(Bk,{bubbles:!0,cancelable:!0});d.addEventListener(Bk,p=>r==null?void 0:r(p),{once:!0}),R3(d,f),f.defaultPrevented?c.current=!1:o.onClose()}};return h.jsx(I4,{...i,ref:l,disabled:n,onClick:Ie(e.onClick,u),onPointerDown:d=>{var f;(f=e.onPointerDown)==null||f.call(e,d),c.current=!0},onPointerUp:Ie(e.onPointerUp,d=>{var f;c.current||(f=d.currentTarget)==null||f.click()}),onKeyDown:Ie(e.onKeyDown,d=>{const f=a.searchRef.current!=="";n||f&&d.key===" "||yx.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});dm.displayName=Kf;var I4=g.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=b_(Kf,n),a=_4(n),l=g.useRef(null),c=Ot(t,l),[u,d]=g.useState(!1),[f,p]=g.useState("");return g.useEffect(()=>{const m=l.current;m&&p((m.textContent??"").trim())},[s.children]),h.jsx(ku.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:h.jsx(KW,{asChild:!0,...a,focusable:!r,children:h.jsx(wt.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:Ie(e.onPointerMove,Cu(m=>{r?o.onItemLeave(m):(o.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ie(e.onPointerLeave,Cu(m=>o.onItemLeave(m))),onFocus:Ie(e.onFocus,()=>d(!0)),onBlur:Ie(e.onBlur,()=>d(!1))})})})}),Gq="MenuCheckboxItem",N4=g.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return h.jsx(M4,{scope:e.__scopeMenu,checked:n,children:h.jsx(dm,{role:"menuitemcheckbox","aria-checked":Gf(n)?"mixed":n,...i,ref:t,"data-state":E_(n),onSelect:Ie(i.onSelect,()=>r==null?void 0:r(Gf(n)?!0:!n),{checkForDefaultPrevented:!1})})})});N4.displayName=Gq;var T4="MenuRadioGroup",[Yq,Xq]=ta(T4,{value:void 0,onValueChange:()=>{}}),P4=g.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=Ii(r);return h.jsx(Yq,{scope:e.__scopeMenu,value:n,onValueChange:s,children:h.jsx(S_,{...i,ref:t})})});P4.displayName=T4;var R4="MenuRadioItem",A4=g.forwardRef((e,t)=>{const{value:n,...r}=e,i=Xq(R4,e.__scopeMenu),s=n===i.value;return h.jsx(M4,{scope:e.__scopeMenu,checked:s,children:h.jsx(dm,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":E_(s),onSelect:Ie(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});A4.displayName=R4;var k_="MenuItemIndicator",[M4,Zq]=ta(k_,{checked:!1}),j4=g.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=Zq(k_,n);return h.jsx(ei,{present:r||Gf(s.checked)||s.checked===!0,children:h.jsx(wt.span,{...i,ref:t,"data-state":E_(s.checked)})})});j4.displayName=k_;var Qq="MenuSeparator",L4=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return h.jsx(wt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});L4.displayName=Qq;var Jq="MenuArrow",D4=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=Xu(n);return h.jsx(v_,{...i,...r,ref:t})});D4.displayName=Jq;var C_="MenuSub",[eV,O4]=ta(C_),B4=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,s=io(C_,t),o=Xu(t),[a,l]=g.useState(null),[c,u]=g.useState(null),d=Ii(i);return g.useEffect(()=>(s.open===!1&&d(!1),()=>d(!1)),[s.open,d]),h.jsx(om,{...o,children:h.jsx(b4,{scope:t,open:r,onOpenChange:d,content:c,onContentChange:u,children:h.jsx(eV,{scope:t,contentId:wi(),triggerId:wi(),trigger:a,onTriggerChange:l,children:n})})})};B4.displayName=C_;var Cc="MenuSubTrigger",$4=g.forwardRef((e,t)=>{const n=io(Cc,e.__scopeMenu),r=Zu(Cc,e.__scopeMenu),i=O4(Cc,e.__scopeMenu),s=b_(Cc,e.__scopeMenu),o=g.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,c={__scopeMenu:e.__scopeMenu},u=g.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return g.useEffect(()=>u,[u]),g.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),h.jsx(y_,{asChild:!0,...c,children:h.jsx(I4,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":H4(n.open),...e,ref:qu(t,i.onTriggerChange),onClick:d=>{var f;(f=e.onClick)==null||f.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ie(e.onPointerMove,Cu(d=>{s.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:Ie(e.onPointerLeave,Cu(d=>{var p,m;u();const f=(p=n.content)==null?void 0:p.getBoundingClientRect();if(f){const x=(m=n.content)==null?void 0:m.dataset.side,w=x==="right",v=w?-5:5,_=f[w?"left":"right"],b=f[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+v,y:d.clientY},{x:_,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x:_,y:f.bottom}],side:x}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(d),d.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Ie(e.onKeyDown,d=>{var p;const f=s.searchRef.current!=="";e.disabled||f&&d.key===" "||Lq[r.dir].includes(d.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),d.preventDefault())})})})});$4.displayName=Cc;var z4="MenuSubContent",F4=g.forwardRef((e,t)=>{const n=S4(Tr,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=io(Tr,e.__scopeMenu),o=Zu(Tr,e.__scopeMenu),a=O4(z4,e.__scopeMenu),l=g.useRef(null),c=Ot(t,l);return h.jsx(ku.Provider,{scope:e.__scopeMenu,children:h.jsx(ei,{present:r||s.open,children:h.jsx(ku.Slot,{scope:e.__scopeMenu,children:h.jsx(w_,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:c,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var d;o.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Ie(e.onFocusOutside,u=>{u.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Ie(e.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:Ie(e.onKeyDown,u=>{var p;const d=u.currentTarget.contains(u.target),f=Dq[o.dir].includes(u.key);d&&f&&(s.onOpenChange(!1),(p=a.trigger)==null||p.focus(),u.preventDefault())})})})})})});F4.displayName=z4;function H4(e){return e?"open":"closed"}function Gf(e){return e==="indeterminate"}function E_(e){return Gf(e)?"indeterminate":e?"checked":"unchecked"}function tV(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function nV(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function rV(e,t,n){const i=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=nV(e,Math.max(s,0));i.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function iV(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],l=t[o],c=a.x,u=a.y,d=l.x,f=l.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(i=!i)}return i}function sV(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return iV(n,t)}function Cu(e){return t=>t.pointerType==="mouse"?e(t):void 0}var oV=w4,aV=y_,lV=k4,cV=C4,uV=S_,dV=E4,hV=dm,fV=N4,pV=P4,mV=A4,gV=j4,vV=L4,xV=D4,yV=B4,_V=$4,bV=F4,hm="DropdownMenu",[wV]=ro(hm,[y4]),Rn=y4(),[SV,U4]=wV(hm),W4=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,l=Rn(t),c=g.useRef(null),[u,d]=zl({prop:i,defaultProp:s??!1,onChange:o,caller:hm});return h.jsx(SV,{scope:t,triggerId:wi(),triggerRef:c,contentId:wi(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(f=>!f),[d]),modal:a,children:h.jsx(oV,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};W4.displayName=hm;var q4="DropdownMenuTrigger",V4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,s=U4(q4,n),o=Rn(n);return h.jsx(aV,{asChild:!0,...o,children:h.jsx(wt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:qu(t,s.triggerRef),onPointerDown:Ie(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:Ie(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});V4.displayName=q4;var kV="DropdownMenuPortal",K4=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Rn(t);return h.jsx(lV,{...r,...n})};K4.displayName=kV;var G4="DropdownMenuContent",Y4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=U4(G4,n),s=Rn(n),o=g.useRef(!1);return h.jsx(cV,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:t,onCloseAutoFocus:Ie(e.onCloseAutoFocus,a=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:Ie(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!i.modal||u)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Y4.displayName=G4;var CV="DropdownMenuGroup",EV=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rn(n);return h.jsx(uV,{...i,...r,ref:t})});EV.displayName=CV;var IV="DropdownMenuLabel",X4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rn(n);return h.jsx(dV,{...i,...r,ref:t})});X4.displayName=IV;var NV="DropdownMenuItem",Z4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rn(n);return h.jsx(hV,{...i,...r,ref:t})});Z4.displayName=NV;var TV="DropdownMenuCheckboxItem",Q4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rn(n);return h.jsx(fV,{...i,...r,ref:t})});Q4.displayName=TV;var PV="DropdownMenuRadioGroup",RV=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rn(n);return h.jsx(pV,{...i,...r,ref:t})});RV.displayName=PV;var AV="DropdownMenuRadioItem",MV=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rn(n);return h.jsx(mV,{...i,...r,ref:t})});MV.displayName=AV;var jV="DropdownMenuItemIndicator",J4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rn(n);return h.jsx(gV,{...i,...r,ref:t})});J4.displayName=jV;var LV="DropdownMenuSeparator",eP=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rn(n);return h.jsx(vV,{...i,...r,ref:t})});eP.displayName=LV;var DV="DropdownMenuArrow",OV=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rn(n);return h.jsx(xV,{...i,...r,ref:t})});OV.displayName=DV;var BV=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:s}=e,o=Rn(t),[a,l]=zl({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return h.jsx(yV,{...o,open:a,onOpenChange:l,children:n})},$V="DropdownMenuSubTrigger",tP=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rn(n);return h.jsx(_V,{...i,...r,ref:t})});tP.displayName=$V;var zV="DropdownMenuSubContent",nP=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Rn(n);return h.jsx(bV,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});nP.displayName=zV;var FV=W4,HV=V4,rP=K4,iP=Y4,sP=X4,oP=Z4,aP=Q4,UV=J4,lP=eP,WV=BV,cP=tP,uP=nP;const dP=FV,hP=HV,I_=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(rP,{children:h.jsx(iP,{ref:r,sideOffset:t,className:re("z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-elevated p-1","text-text-100 shadow-md",e),...n})}));I_.displayName=iP.displayName;const fP=WV,N_=g.forwardRef(({className:e,...t},n)=>h.jsx(cP,{ref:n,className:re("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none","focus:bg-bg-200 focus:text-text-100 data-[highlighted]:bg-bg-200 data-[highlighted]:text-text-100 data-[state=open]:bg-bg-200","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));N_.displayName=cP.displayName;const T_=g.forwardRef(({className:e,...t},n)=>h.jsx(rP,{children:h.jsx(uP,{ref:n,className:re("z-50 min-w-[6rem] overflow-hidden rounded-md border border-border bg-elevated p-1","text-text-100 shadow-md",e),...t})}));T_.displayName=uP.displayName;const Wr=g.forwardRef(({className:e,inset:t,...n},r)=>h.jsx(oP,{ref:r,className:re("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none","focus:bg-bg-200 focus:text-text-100 data-[highlighted]:bg-bg-200 data-[highlighted]:text-text-100","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Wr.displayName=oP.displayName;const qV=g.forwardRef(({className:e,children:t,checked:n,...r},i)=>h.jsxs(aP,{ref:i,checked:n,className:re("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-7 pr-2 text-sm outline-none","focus:bg-bg-200 focus:text-text-100 data-[highlighted]:bg-bg-200 data-[highlighted]:text-text-100","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(UV,{children:h.jsx(Qo,{className:"h-3.5 w-3.5"})})}),t]}));qV.displayName=aP.displayName;const fm=g.forwardRef(({className:e,...t},n)=>h.jsx(lP,{ref:n,className:re("-mx-1 my-1 h-px bg-border",e),...t}));fm.displayName=lP.displayName;const P_=g.forwardRef(({className:e,...t},n)=>h.jsx(sP,{ref:n,className:re("px-2 py-1.5 text-xs font-semibold text-text-400",e),...t}));P_.displayName=sP.displayName;function VV({tool:e,className:t}){const n=zH(e);return h.jsx("span",{"data-testid":n?`session-icon-${e}`:"session-icon-default","aria-label":n?s_(e):"未知引擎",className:re("w-3.5 h-3.5 shrink-0 inline-flex items-center justify-center",em(e),t),children:h.jsx(Jp,{tool:e,className:"w-full h-full"})})}function KV({sessionId:e,hasUnread:t,running:n=!1,awaitingUser:r=!1,style:i}){return r?h.jsx(n7,{"data-testid":`awaiting-dot-${e}`,style:i,className:"w-3 h-3 text-warning shrink-0 animate-pulse",strokeWidth:2.25,"aria-label":"awaiting user"}):t?h.jsx("span",{"data-testid":`unread-dot-${e}`,style:i,className:"w-2 h-2 rounded-full bg-error shrink-0","aria-label":"unread"}):n?h.jsx("span",{"data-testid":`running-dot-${e}`,style:i,className:"w-2 h-2 rounded-full bg-success shrink-0 animate-pulse","aria-label":"running"}):null}function pP(e){return e.compositionActive||!!e.nativeIsComposing||e.keyCode===229}function mP(e){return e.key==="Enter"&&!e.shiftKey&&!pP(e)}function Qu(e,t){const n=g.useRef(!1),r=g.useCallback(()=>{n.current=!0},[]),i=g.useCallback(()=>{setTimeout(()=>{n.current=!1},0)},[]);return{onKeyDown:g.useCallback(o=>{const a=o.nativeEvent;if(mP({key:o.key,shiftKey:o.shiftKey,compositionActive:n.current,nativeIsComposing:a.isComposing,keyCode:a.keyCode})){o.preventDefault(),e();return}t&&o.key==="Escape"&&(o.preventDefault(),t())},[e,t]),onCompositionStart:r,onCompositionEnd:i}}function GV({open:e,initialLabel:t,placeholder:n,onSubmit:r,onCancel:i,title:s="Edit session",fieldLabel:o="Label",testId:a="session-edit-dialog",requireNonEmpty:l=!1}){const[c,u]=g.useState(t);g.useEffect(()=>{e&&u(t)},[e,t]);const d=c.trim(),f=l&&d==="",p=()=>{f||r({label:d})},m=Qu(p,i);return e?Oo.createPortal(h.jsx("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-bg-0/40 backdrop-blur-[2px]",onClick:i,"data-testid":`${a}-overlay`,children:h.jsxs("div",{"data-testid":a,className:"w-[420px] max-w-[calc(100vw-32px)] rounded-2xl border border-text-100/[0.12] flex flex-col gap-4 p-5",style:{backgroundColor:"var(--bg-0)",boxShadow:"0 12px 40px rgba(0,0,0,0.04)"},onClick:x=>x.stopPropagation(),children:[h.jsx("div",{className:"text-[15px] font-semibold text-text-100",children:s}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-[12px] font-semibold text-text-200 mb-1",children:o}),h.jsx("input",{autoFocus:!0,type:"text",value:c,onChange:x=>u(x.target.value),...m,placeholder:n,"data-testid":`${a}-label`,className:"w-full px-3 py-2 text-[13px] bg-bg-50 border border-bg-300 rounded-lg focus:outline-none focus:border-text-300 transition-colors"})]}),h.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[h.jsx("button",{type:"button",onClick:i,className:"px-4 py-1.5 text-[12px] text-text-300 rounded-lg hover:bg-text-100/5 transition-colors cursor-pointer",children:"Cancel"}),h.jsx("button",{type:"button",onClick:p,disabled:f,"data-testid":`${a}-save`,className:"px-4 py-1.5 text-[12px] font-medium text-bg-0 rounded-lg bg-text-100 hover:bg-text-200 transition-colors cursor-pointer disabled:cursor-not-allowed disabled:opacity-40",children:"Save"})]})]})}),document.body):null}var YV=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),XV="VisuallyHidden",gP=g.forwardRef((e,t)=>h.jsx(wt.span,{...e,ref:t,style:{...YV,...e.style}}));gP.displayName=XV;var ZV=gP,[pm]=ro("Tooltip",[Ul]),mm=Ul(),vP="TooltipProvider",QV=700,_x="tooltip.open",[JV,R_]=pm(vP),xP=e=>{const{__scopeTooltip:t,delayDuration:n=QV,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,o=g.useRef(!0),a=g.useRef(!1),l=g.useRef(0);return g.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),h.jsx(JV,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:g.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:g.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:g.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:s})};xP.displayName=vP;var Eu="Tooltip",[eK,gm]=pm(Eu),yP=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=e,l=R_(Eu,e.__scopeTooltip),c=mm(t),[u,d]=g.useState(null),f=wi(),p=g.useRef(0),m=o??l.disableHoverableContent,x=a??l.delayDuration,w=g.useRef(!1),[v,_]=zl({prop:r,defaultProp:i??!1,onChange:N=>{N?(l.onOpen(),document.dispatchEvent(new CustomEvent(_x))):l.onClose(),s==null||s(N)},caller:Eu}),b=g.useMemo(()=>v?w.current?"delayed-open":"instant-open":"closed",[v]),S=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w.current=!1,_(!0)},[_]),C=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),k=g.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{w.current=!0,_(!0),p.current=0},x)},[x,_]);return g.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),h.jsx(om,{...c,children:h.jsx(eK,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:g.useCallback(()=>{l.isOpenDelayedRef.current?k():S()},[l.isOpenDelayedRef,k,S]),onTriggerLeave:g.useCallback(()=>{m?C():(window.clearTimeout(p.current),p.current=0)},[C,m]),onOpen:S,onClose:C,disableHoverableContent:m,children:n})})};yP.displayName=Eu;var bx="TooltipTrigger",_P=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=gm(bx,n),s=R_(bx,n),o=mm(n),a=g.useRef(null),l=Ot(t,a,i.onTriggerChange),c=g.useRef(!1),u=g.useRef(!1),d=g.useCallback(()=>c.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),h.jsx(am,{asChild:!0,...o,children:h.jsx(wt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Ie(e.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:Ie(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:Ie(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Ie(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Ie(e.onBlur,i.onClose),onClick:Ie(e.onClick,i.onClose)})})});_P.displayName=bx;var tK="TooltipPortal",[Ide,nK]=pm(tK,{forceMount:void 0}),vl="TooltipContent",bP=g.forwardRef((e,t)=>{const n=nK(vl,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=gm(vl,e.__scopeTooltip);return h.jsx(ei,{present:r||o.open,children:o.disableHoverableContent?h.jsx(wP,{side:i,...s,ref:t}):h.jsx(rK,{side:i,...s,ref:t})})}),rK=g.forwardRef((e,t)=>{const n=gm(vl,e.__scopeTooltip),r=R_(vl,e.__scopeTooltip),i=g.useRef(null),s=Ot(t,i),[o,a]=g.useState(null),{trigger:l,onClose:c}=n,u=i.current,{onPointerInTransitChange:d}=r,f=g.useCallback(()=>{a(null),d(!1)},[d]),p=g.useCallback((m,x)=>{const w=m.currentTarget,v={x:m.clientX,y:m.clientY},_=lK(v,w.getBoundingClientRect()),b=cK(v,_),S=uK(x.getBoundingClientRect()),C=hK([...b,...S]);a(C),d(!0)},[d]);return g.useEffect(()=>()=>f(),[f]),g.useEffect(()=>{if(l&&u){const m=w=>p(w,u),x=w=>p(w,l);return l.addEventListener("pointerleave",m),u.addEventListener("pointerleave",x),()=>{l.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",x)}}},[l,u,p,f]),g.useEffect(()=>{if(o){const m=x=>{const w=x.target,v={x:x.clientX,y:x.clientY},_=(l==null?void 0:l.contains(w))||(u==null?void 0:u.contains(w)),b=!dK(v,o);_?f():b&&(f(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,u,o,c,f]),h.jsx(wP,{...e,ref:s})}),[iK,sK]=pm(Eu,{isInside:!1}),oK=XH("TooltipContent"),wP=g.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,l=gm(vl,n),c=mm(n),{onClose:u}=l;return g.useEffect(()=>(document.addEventListener(_x,u),()=>document.removeEventListener(_x,u)),[u]),g.useEffect(()=>{if(l.trigger){const d=f=>{const p=f.target;p!=null&&p.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),h.jsx(Vu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:h.jsxs(g_,{"data-state":l.stateAttribute,...c,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[h.jsx(oK,{children:r}),h.jsx(iK,{scope:n,isInside:!0,children:h.jsx(ZV,{id:l.contentId,role:"tooltip",children:i||r})})]})})});bP.displayName=vl;var SP="TooltipArrow",aK=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=mm(n);return sK(SP,n).isInside?null:h.jsx(v_,{...i,...r,ref:t})});aK.displayName=SP;function lK(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function cK(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function uK(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function dK(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],l=t[o],c=a.x,u=a.y,d=l.x,f=l.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(i=!i)}return i}function hK(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),fK(t)}function fK(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var pK=xP,mK=yP,gK=_P,kP=bP;const Iu=pK,Ju=mK,ed=gK,Wl=g.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(kP,{ref:r,sideOffset:t,className:re("z-50 overflow-hidden rounded-sm border border-border bg-bg-0 px-2 py-1 text-xs text-text-300 shadow-md",e),...n}));Wl.displayName=kP.displayName;const vK={held:!1,indexBySessionId:new Map},xK=g.createContext(vK);function yK(){return g.useContext(xK)}const _K=Array.from({length:9},(e,t)=>({id:`switch-session-${t+1}`,combo:{key:String(t+1),mod:!0},label:`切换到第 ${t+1} 个会话`,group:"会话",desktopOnly:!0,hiddenInList:!0})),bK=[{id:"new-session",combo:{key:"n",mod:!0},label:"新建任务",description:"打开快捷新建弹窗",group:"通用",desktopOnly:!0},{id:"open-search",combo:{key:"k",mod:!0},label:"全局搜索",description:"搜会话内容 / persona / 联系人",group:"通用",desktopOnly:!0},{id:"search-tab-prev",combo:{key:"ArrowLeft",mod:!0},label:"搜索:上一组",description:"搜索浮层里切到左边那个 tab(会话 / persona / 联系人)",group:"通用"},{id:"search-tab-next",combo:{key:"ArrowRight",mod:!0},label:"搜索:下一组",description:"搜索浮层里切到右边那个 tab",group:"通用"},..._K,{id:"archive-session",combo:{key:"Backspace",mod:!0,shift:!0},label:"归档当前会话",description:"归档当前聊天区的会话,Enter 确认 / Esc 取消",group:"会话",desktopOnly:!0},{id:"tab-prev",combo:{key:"ArrowLeft",mod:!0,shift:!0},label:"上一个标签页",description:"连按快速移动,停下或松开修饰键后切换",group:"标签页"},{id:"tab-next",combo:{key:"ArrowRight",mod:!0,shift:!0},label:"下一个标签页",description:"连按快速移动,停下或松开修饰键后切换",group:"标签页"},{id:"toggle-hive",combo:{key:"h",mod:!0,shift:!0},label:"Hive 看板",description:"全屏看所有 agent 在干什么;Esc 或点任意行退出",group:"通用"},{id:"send-message",combo:{key:"Enter"},label:"发送消息",description:"在输入框中发送当前内容",group:"输入",displayOnly:!0},{id:"newline",combo:{key:"Enter",shift:!0},label:"换行",description:"在输入框中插入换行",group:"输入",displayOnly:!0},{id:"interrupt",combo:{key:"Escape"},label:"打断回复",description:"打断当前回复;2 秒内按两次停止任务",group:"输入",displayOnly:!0}];bK.filter(e=>!e.displayOnly);function wK(){return/Mac|iP(hone|od|ad)/.test(navigator.platform)}const SK=10,kK=20,CK=16,$k=20,zk=60,EK=4;function Zd({testId:e,label:t,children:n}){return h.jsxs(Ju,{children:[h.jsx(ed,{asChild:!0,children:h.jsx("span",{"data-testid":e,role:"img","aria-label":t,tabIndex:0,className:"inline-flex shrink-0",children:n})}),h.jsx(Wl,{side:"bottom",children:t})]})}function IK({session:e,active:t,hasUnread:n,running:r=!1,awaitingUser:i=!1,onSelect:s,onEdit:o,onDelete:a,onPin:l,onArchive:c,quickAction:u,depth:d=0,chevron:f,showCopyResume:p=!0,contactDisplayName:m,ownerPrincipalId:x,creatorDisplayName:w,dispatchedFromSessionTitle:v}){const[_,b]=g.useState(!1),S=yK(),C=S.held?S.indexBySessionId.get(e.sessionId):void 0,k=!!e.pinnedAt,N=d===0,E=d===0&&!!c,L=SK+d*kK;let P=null;u==="pin"&&N&&l?P={icon:k?h.jsx(rk,{className:"w-4 h-4"}):h.jsx(ik,{className:"w-4 h-4"}),label:k?"取消置顶":"置顶",run:()=>l(e.sessionId,!k)}:u==="archive"&&E&&c?P={icon:h.jsx(ek,{className:"w-4 h-4"}),label:"归档",run:()=>c(e.sessionId,!0)}:u==="rename"&&o&&(P={icon:h.jsx(ux,{className:"w-4 h-4"}),label:"重命名",run:()=>b(!0)});const D=g.useCallback(async()=>{const z=T3(e);if(z)try{await navigator.clipboard.writeText(z)}catch{}},[e]),R=o_(e),A=e.originOwnerPrincipalId,M=A?`@${m??`…${A.slice(-8)}`}`:null,j=!!(e.ownerPersonaId&&x&&e.creatorPrincipalId&&e.creatorPrincipalId!==x&&!e.larkChatId&&!e.shiftFiredFromSessionId&&!e.dispatchedFromSessionId);return h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-testid":`session-item-${e.sessionId}`,onClick:s,style:{paddingLeft:L,display:"grid",gridTemplateColumns:f?`${CK}px ${$k}px 1fr auto ${zk}px`:`${$k}px 1fr auto ${zk}px`,gridTemplateAreas:f?'"chev icon name dot time"':'"icon name dot time"',columnGap:`${EK}px`,alignItems:"center"},className:re("group relative rounded-lg cursor-pointer transition-all duration-150 pr-2.5 py-1.5",t?"bg-accent-dim":"hover:bg-sidebar-hover-bg"),children:[t?h.jsx("span",{"aria-hidden":"true",className:"absolute left-0 top-1/2 -translate-y-1/2 w-[3px] h-7 rounded-r-full bg-accent"}):null,h.jsx("div",{style:{gridArea:"chev"},className:"flex items-center justify-center",children:f??null}),h.jsx("div",{style:{gridArea:"icon"},className:"flex items-center justify-center",children:h.jsx(VV,{tool:e.tool})}),h.jsxs("div",{style:{gridArea:"name"},className:"flex items-center gap-1 min-w-0",children:[h.jsxs(Iu,{delayDuration:200,skipDelayDuration:100,children:[e.dispatchedFromSessionId?h.jsx(Zd,{testId:`dispatched-icon-${e.sessionId}`,label:`来自【${v??"另一会话"}】dispatch`,children:h.jsx(I7,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null,e.shiftFiredFromSessionId?h.jsx(Zd,{testId:`shift-fired-icon-${e.sessionId}`,label:"定时任务",children:h.jsx(Yz,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null,e.larkChatId?h.jsx(Zd,{testId:`lark-chat-icon-${e.sessionId}`,label:e.larkChatType==="p2p"?"来自飞书DM":"来自飞书群",children:h.jsx(aF,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null,j?h.jsx(Zd,{testId:`guest-created-icon-${e.sessionId}`,label:w?`${w}创建`:"其他人创建",children:h.jsx(UF,{"aria-hidden":"true",className:"w-3 h-3 text-accent",strokeWidth:2.25})}):null]}),h.jsx("span",{"data-testid":`session-title-${e.sessionId}`,className:re("text-[13px] truncate min-w-0","group-hover:whitespace-normal group-hover:overflow-visible group-hover:break-words",t?"text-text-100 font-medium":"text-text-200"),children:R}),M?h.jsx("span",{"data-testid":`session-mirror-chip-${e.sessionId}`,title:`在 ${M.replace(/^@/,"")} 的设备上`,className:"shrink-0 inline-flex items-center px-1.5 py-0 rounded text-[10px] bg-accent-dim/40 text-accent border border-accent/20 max-w-[120px] truncate",children:M}):null]}),h.jsx(KV,{sessionId:e.sessionId,hasUnread:n,running:r,awaitingUser:i,style:{gridArea:"dot"}}),C!=null?h.jsx("span",{style:{gridArea:"time"},"data-testid":`session-quick-switch-badge-${e.sessionId}`,className:"text-right shrink-0 transition-opacity duration-150 group-hover:opacity-0",children:h.jsx("span",{className:"inline-flex items-center justify-center h-[18px] px-1.5 rounded-[5px] border border-border bg-bg-200/70 text-[11px] text-text-200 font-medium leading-none",children:wK()?`⌘${C}`:`Ctrl+${C}`})}):h.jsx("span",{style:{gridArea:"time"},className:re("text-[11px] text-text-400/70 text-right shrink-0","transition-opacity duration-150 group-hover:opacity-0"),children:e.updatedAt?FH(e.updatedAt):""}),o||a||l||c?h.jsxs("div",{className:"absolute right-2 top-[3px] flex items-center opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100 transition-opacity",children:[P?h.jsx(Iu,{delayDuration:200,skipDelayDuration:100,children:h.jsxs(Ju,{children:[h.jsx(ed,{asChild:!0,children:h.jsx("button",{type:"button",onClick:z=>{z.stopPropagation(),P.run()},className:"flex items-center justify-center w-7 h-7 rounded-md text-text-400 hover:text-text-100 hover:bg-text-100/5 transition-colors cursor-pointer","aria-label":P.label,"data-testid":`quick-action-${u}-${e.sessionId}`,children:P.icon})}),h.jsx(Wl,{side:"bottom",children:P.label})]})}):null,h.jsxs(dP,{modal:!1,children:[h.jsx(hP,{asChild:!0,children:h.jsx("button",{type:"button",onClick:z=>z.stopPropagation(),className:"flex items-center justify-center w-7 h-7 rounded-md text-text-400 hover:text-text-100 hover:bg-text-100/5 transition-colors cursor-pointer","aria-label":"session actions","data-testid":`session-menu-${e.sessionId}`,children:h.jsx(i3,{className:"w-4 h-4"})})}),h.jsxs(I_,{align:"end",onClick:z=>z.stopPropagation(),children:[l&&N&&h.jsxs(Wr,{onSelect:()=>l(e.sessionId,!k),"data-testid":`session-${k?"unpin":"pin"}-${e.sessionId}`,children:[k?h.jsx(rk,{className:"w-3 h-3 mr-2 text-text-400"}):h.jsx(ik,{className:"w-3 h-3 mr-2 text-text-400"}),k?"Unpin":"Pin"]}),E&&c&&h.jsxs(Wr,{onSelect:()=>c(e.sessionId,!0),"data-testid":`session-archive-${e.sessionId}`,children:[h.jsx(ek,{className:"w-3 h-3 mr-2 text-text-400"}),"Archive"]}),o&&h.jsxs(Wr,{onSelect:()=>b(!0),"data-testid":`session-rename-${e.sessionId}`,children:[h.jsx(ux,{className:"w-3 h-3 mr-2 text-text-400"}),"Rename"]}),p&&e.toolSessionId?h.jsxs(Wr,{onSelect:()=>void D(),"data-testid":`session-copy-resume-${e.sessionId}`,children:[h.jsx(Jy,{className:"w-3 h-3 mr-2 text-text-400"}),"Copy Resume Command"]}):null,(l||o||p&&e.toolSessionId)&&a&&h.jsx(fm,{}),a&&h.jsxs(Wr,{onSelect:()=>void a(e.sessionId),className:"text-destructive focus:text-destructive focus:bg-destructive/10","data-testid":`session-delete-${e.sessionId}`,children:[h.jsx(n_,{className:"w-3 h-3 mr-2"}),"Delete"]})]})]})]}):null]}),o?h.jsx(GV,{open:_,initialLabel:e.label??"",placeholder:e.cwd.split("/").pop()||"",onSubmit:z=>{o(e.sessionId,z),b(!1)},onCancel:()=>b(!1)}):null]})}function A_({node:e,depth:t=0,activeId:n,unreadIds:r,runningIds:i,awaitingIds:s,onSelect:o,onEdit:a,onDelete:l,onPin:c,onArchive:u,quickAction:d,getContactDisplayName:f,showCopyResume:p,ownerPrincipalId:m,getCreatorDisplayName:x,getSessionDisplayName:w,parentSession:v}){const _=e.children.length>0,{isCollapsed:b,toggle:S}=Hz(),C=!b(e.session.sessionId),k=g.useCallback(E=>{E.stopPropagation(),S(e.session.sessionId)},[S,e.session.sessionId]),N=_?h.jsx("button",{type:"button",onClick:k,"data-testid":`session-chevron-${e.session.sessionId}`,"aria-label":C?"collapse":"expand","aria-expanded":C,className:"shrink-0 flex items-center justify-center w-4 h-4 text-text-400 hover:text-text-100 cursor-pointer",children:C?h.jsx(Pn,{className:"w-3 h-3"}):h.jsx(Fn,{className:"w-3 h-3"})}):null;return h.jsxs("div",{"data-testid":`session-tree-node-${e.session.sessionId}`,children:[h.jsx(IK,{session:e.session,active:n===e.session.sessionId,hasUnread:(r==null?void 0:r.has(e.session.sessionId))??!1,running:(i==null?void 0:i.has(e.session.sessionId))??!1,awaitingUser:(s==null?void 0:s.has(e.session.sessionId))??!1,onSelect:()=>o(e.session.sessionId),onEdit:a,onDelete:l,onPin:c,onArchive:u,quickAction:d,showCopyResume:p,ownerPrincipalId:m,creatorDisplayName:e.session.creatorPrincipalId?x==null?void 0:x(e.session.creatorPrincipalId):void 0,dispatchedFromSessionTitle:e.session.dispatchedFromSessionId?(w==null?void 0:w(e.session.dispatchedFromSessionId))??((v==null?void 0:v.sessionId)===e.session.dispatchedFromSessionId?o_(v):void 0):void 0,depth:t,chevron:N,contactDisplayName:e.session.originOwnerPrincipalId?f==null?void 0:f(e.session.originOwnerPrincipalId):void 0}),_&&C?h.jsx("div",{"data-testid":`session-tree-children-${e.session.sessionId}`,children:e.children.map(E=>h.jsx(A_,{node:E,depth:t+1,activeId:n,unreadIds:r,runningIds:i,awaitingIds:s,onSelect:o,onEdit:a,onDelete:l,onPin:c,onArchive:u,quickAction:d,getContactDisplayName:f,showCopyResume:p,ownerPrincipalId:m,getCreatorDisplayName:x,getSessionDisplayName:w,parentSession:e.session},E.session.sessionId))}):null]})}function NK(e){return e.forkedFromSessionId??e.dispatchedFromSessionId??e.shiftFiredFromSessionId}function M_(e,t){return e.updatedAt<t.updatedAt?1:e.updatedAt>t.updatedAt?-1:0}function CP(e){e=e.filter(s=>!s.ephemeral&&s.deployId===void 0&&s.testReleaseId===void 0);const t=new Map;for(const s of e)t.set(s.sessionId,s);const n=new Map,r=[];for(const s of e){const o=NK(s);if(o&&t.has(o)){const a=n.get(o)??[];a.push(s),n.set(o,a)}else r.push(s)}const i=s=>{const a=[...n.get(s.sessionId)??[]].sort(M_);return{session:s,children:a.map(i)}};return[...r].sort(TK).map(i)}function EP(e){return[...e].sort((t,n)=>M_(t.session,n.session))}function TK(e,t){const n=typeof e.pinnedAt=="number",r=typeof t.pinnedAt=="number";if(n&&r){const i=typeof e.pinSortOrder=="number",s=typeof t.pinSortOrder=="number";return i&&s?e.pinSortOrder-t.pinSortOrder:i?-1:s?1:t.pinnedAt-e.pinnedAt}return n?-1:r?1:M_(e,t)}function PK(e){return e.label?e.label:e.aiLabel?e.aiLabel:e.cwd.split("/").filter(Boolean).pop()??""}function Fk(e,t){const n=t.trim().toLowerCase();return n===""?!0:e.toLowerCase().includes(n)}const RK={isCollapsed:()=>!1,toggle:()=>{},prune:()=>{}};function AK({personas:e,activePersonaId:t,onSelectPersona:n,onCreateSession:r,sessions:i,activeSessionId:s,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f,isPersonaExpanded:p,onTogglePersonaExpanded:m,onEditSession:x,onPinSession:w,showCopyResume:v,treatSessionsAsRoots:_,searchQuery:b}){const[S,C]=g.useState(null),[k,N]=g.useState(()=>new Set),E=p??(j=>k.has(j)),L=g.useCallback(j=>{if(m){m(j);return}N(z=>{const F=new Set(z);return F.has(j)?F.delete(j):F.add(j),F})},[m]),P=g.useMemo(()=>i==null?void 0:i.filter(j=>!j.ephemeral),[i]),D=g.useMemo(()=>new Map((P??[]).map(j=>[j.sessionId,o_(j)])),[P]),R=g.useCallback(j=>f==null?void 0:f.get(j),[f]),A=g.useCallback(j=>D.get(j),[D]);if(e.length===0)return h.jsx(MK,{});const M=(b??"").trim();return M?h.jsx(Zy.Provider,{value:RK,children:h.jsx("div",{"data-testid":"my-personas-list",className:"flex flex-col gap-0.5",children:e.map(j=>{const z=P?P.filter(I=>I.ownerPersonaId===j.personaId).sort((I,U)=>U.updatedAt>I.updatedAt?1:-1):[],F=Fk(j.label,M),$=z.filter(I=>Fk(PK(I),M));if(!F&&$.length===0)return null;const B=F?z:$;return h.jsx(Hk,{persona:j,active:j.personaId===t,editing:!1,onSelectPersona:n,onSubmitCreateSession:()=>{},onCancelCreateSession:()=>{},personaSessions:B,collapsed:!1,onToggleCollapsed:()=>{},activeSessionId:s??null,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,onEditSession:x,onPinSession:w,showCopyResume:v,treatSessionsAsRoots:_,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f,getCreatorDisplayName:R,getSessionDisplayName:A},j.personaId)})})}):h.jsx("div",{"data-testid":"my-personas-list",className:"flex flex-col gap-0.5",children:e.map(j=>{const z=P?P.filter(F=>F.ownerPersonaId===j.personaId).sort((F,$)=>$.updatedAt>F.updatedAt?1:-1):[];return h.jsx(Hk,{persona:j,active:j.personaId===t,editing:j.personaId===S,onSelectPersona:n,onStartCreateSession:r?()=>C(j.personaId):void 0,onSubmitCreateSession:F=>{C(null),r==null||r(j.personaId,F)},onCancelCreateSession:()=>C(null),personaSessions:z,collapsed:!E(j.personaId),onToggleCollapsed:()=>L(j.personaId),activeSessionId:s??null,awaitingIds:o,runningIds:a,unreadIds:l,onSelectSession:c,onDeleteSession:u,onEditSession:x,onPinSession:w,showCopyResume:v,treatSessionsAsRoots:_,ownerPrincipalId:d,creatorDisplayNameByOwnerId:f,getCreatorDisplayName:R,getSessionDisplayName:A},j.personaId)})})}function MK(){return h.jsx("div",{className:"px-3 py-3 text-[11px] leading-relaxed text-text-400",children:"还没有 persona。点上方 Personas 标题右侧 + 创建第一个。"})}function Hk({persona:e,active:t,editing:n,onSelectPersona:r,onStartCreateSession:i,onSubmitCreateSession:s,onCancelCreateSession:o,personaSessions:a,collapsed:l,onToggleCollapsed:c,activeSessionId:u,awaitingIds:d,runningIds:f,unreadIds:p,onSelectSession:m,onDeleteSession:x,onEditSession:w,onPinSession:v,showCopyResume:_,treatSessionsAsRoots:b,ownerPrincipalId:S,creatorDisplayNameByOwnerId:C,getCreatorDisplayName:k,getSessionDisplayName:N}){const E=a.length>0,L=!l,P=g.useMemo(()=>{const A=[],M=new Map;for(const j of a){const z=j.creatorPrincipalId;if(j.larkChatId!=null||!z||S&&z===S){A.push(j);continue}const F=z,$=(C==null?void 0:C.get(F))??`…${F.slice(-8)}`,B=M.get(F);B?B.sessions.push(j):M.set(F,{groupKey:F,displayName:$,sessions:[j]})}return{self:A,byPeer:[...M.values()]}},[a,S,C]),D=P.byPeer.length>0,R=g.useMemo(()=>L&&!D?EP(CP(a)):[],[L,D,a]);return h.jsxs("div",{"data-testid":`persona-node-${e.personaId}`,children:[h.jsxs("div",{className:re("group flex items-center gap-1 px-2 py-1.5 cursor-pointer",t?"bg-accent-dim text-text-100":"hover:bg-bg-200 text-text-200"),onClick:()=>r==null?void 0:r(e.personaId),role:"button",tabIndex:0,children:[E?h.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),c()},"aria-label":L?"collapse":"expand","aria-expanded":L,"data-testid":`persona-chevron-${e.personaId}`,className:"flex h-4 w-4 shrink-0 items-center justify-center text-text-400 hover:text-text-100",children:L?h.jsx(Pn,{className:"h-3 w-3"}):h.jsx(Fn,{className:"h-3 w-3"})}):h.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),h.jsx(Jp,{tool:e.tool,className:re("h-3.5 w-3.5 shrink-0",em(e.tool))}),h.jsx("span",{className:"flex-1 truncate text-[13px]",children:e.label}),E?h.jsx("span",{className:"shrink-0 text-[10px] text-text-400 tabular-nums","aria-label":`${a.length} sessions`,children:a.length}):null,i?h.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),i()},"aria-label":"新建会话",title:"新建会话","data-testid":`persona-create-session-${e.personaId}`,className:"flex h-5 w-5 shrink-0 items-center justify-center rounded text-text-400 opacity-0 hover:bg-text-100/10 hover:text-text-100 focus-visible:opacity-100 group-hover:opacity-100",children:h.jsx(e_,{className:"h-3.5 w-3.5"})}):null]}),n?h.jsx(jK,{personaId:e.personaId,tool:e.tool,onSubmit:s,onCancel:o}):null,E&&L?h.jsx("div",{"data-testid":`persona-sessions-${e.personaId}`,children:D?h.jsxs(h.Fragment,{children:[P.self.length>0&&h.jsx(Uk,{groupKey:`${e.personaId}-self`,label:"我自己",testId:`persona-sessions-${e.personaId}-self`,sessions:P.self,activeSessionId:u,awaitingIds:d,runningIds:f,unreadIds:p,onSelectSession:m,onDeleteSession:x,onEditSession:w,onPinSession:v,showCopyResume:_,ownerPrincipalId:S,getCreatorDisplayName:k,getSessionDisplayName:N}),P.byPeer.map(A=>h.jsx(Uk,{groupKey:`${e.personaId}-peer-${A.groupKey}`,label:A.displayName,testId:`persona-sessions-${e.personaId}-peer-${A.groupKey}`,sessions:A.sessions,activeSessionId:u,awaitingIds:d,runningIds:f,unreadIds:p,onSelectSession:m,onDeleteSession:x,onEditSession:w,onPinSession:v,showCopyResume:_,ownerPrincipalId:S,getCreatorDisplayName:k,getSessionDisplayName:N},`${e.personaId}-peer-${A.groupKey}`))]}):R.map(A=>h.jsx(A_,{node:A,depth:b?0:1,activeId:u,unreadIds:p,runningIds:f,awaitingIds:d,onSelect:M=>m==null?void 0:m(M),onDelete:x,onEdit:w,onPin:v,showCopyResume:_,ownerPrincipalId:S,getCreatorDisplayName:k,getSessionDisplayName:N},A.session.sessionId))}):null]})}function Uk({label:e,testId:t,sessions:n,activeSessionId:r,awaitingIds:i,runningIds:s,unreadIds:o,onSelectSession:a,onDeleteSession:l,onEditSession:c,onPinSession:u,showCopyResume:d,ownerPrincipalId:f,getCreatorDisplayName:p,getSessionDisplayName:m}){const[x,w]=g.useState(!1),v=!x,_=g.useMemo(()=>v?EP(CP(n)):[],[v,n]);return h.jsxs("div",{"data-testid":t,children:[h.jsxs("button",{type:"button",onClick:()=>w(b=>!b),"aria-label":v?"collapse":"expand","aria-expanded":v,"data-testid":`${t}-chevron`,className:"flex items-center gap-1 w-full pl-7 pr-2 py-0.5 text-[11px] text-text-400 hover:text-text-200 transition-colors",children:[v?h.jsx(Pn,{className:"h-3 w-3"}):h.jsx(Fn,{className:"h-3 w-3"}),h.jsx(d3,{className:"h-3 w-3","aria-hidden":!0}),h.jsx("span",{className:"truncate",children:e}),h.jsx("span",{className:"ml-auto tabular-nums",children:n.length})]}),v&&h.jsx("div",{children:_.map(b=>h.jsx(A_,{node:b,depth:2,activeId:r,unreadIds:o,runningIds:s,awaitingIds:i,onSelect:S=>a==null?void 0:a(S),onDelete:l,onEdit:c,onPin:u,showCopyResume:d,ownerPrincipalId:f,getCreatorDisplayName:p,getSessionDisplayName:m},b.session.sessionId))})]})}function jK({personaId:e,tool:t,onSubmit:n,onCancel:r}){const[i,s]=g.useState(""),o=g.useRef(null),a=i.trim(),l=a.length>0;g.useEffect(()=>{var d;(d=o.current)==null||d.focus()},[]);const c=g.useCallback(()=>{l&&n(a)},[l,a,n]),u=Qu(c,r);return h.jsxs("div",{className:"flex items-center gap-1.5 pl-9 pr-2 py-1","data-testid":`persona-new-session-row-${e}`,children:[h.jsx(Jp,{tool:t,className:re("h-3 w-3 shrink-0",em(t))}),h.jsx("input",{ref:o,type:"text",value:i,onChange:d=>s(d.target.value),...u,onBlur:r,placeholder:"session label...","data-testid":`persona-new-session-input-${e}`,className:"flex-1 min-w-0 bg-bg-100 border border-text-100/15 rounded px-1.5 py-0.5 text-[12px] text-text-100 placeholder:text-text-400 focus:outline-none focus:border-text-100/40"}),h.jsx("button",{type:"button",onMouseDown:d=>{d.preventDefault(),c()},disabled:!l,"aria-label":"确认",title:"确认(Enter)","data-testid":`persona-new-session-confirm-${e}`,className:"flex h-4 w-4 shrink-0 items-center justify-center rounded text-text-300 hover:bg-text-100/10 hover:text-text-100 disabled:opacity-30 disabled:hover:bg-transparent disabled:hover:text-text-300",children:h.jsx(Qo,{className:"h-3 w-3"})}),h.jsx("button",{type:"button",onMouseDown:d=>{d.preventDefault(),r()},"aria-label":"取消",title:"取消(Esc)","data-testid":`persona-new-session-cancel-${e}`,className:"flex h-4 w-4 shrink-0 items-center justify-center rounded text-text-300 hover:bg-text-100/10 hover:text-text-100",children:h.jsx(Jr,{className:"h-3 w-3"})})]})}function LK(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function DK(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),r=parseFloat(n.fontSize);return t*r}function OK(e){return e/100*window.innerHeight}function BK(e){return e/100*window.innerWidth}function $K(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function Ec({groupSize:e,panelElement:t,styleProp:n}){let r;const[i,s]=$K(n);switch(s){case"%":{r=i/100*e;break}case"px":{r=i;break}case"rem":{r=DK(t,i);break}case"em":{r=LK(t,i);break}case"vh":{r=OK(i);break}case"vw":{r=BK(i);break}}return r}function Dn(e){return parseFloat(e.toFixed(3))}function xl({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,i)=>(r+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,r),0)}function wx(e){const{panels:t}=e,n=xl({group:e});return n===0?t.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:i,panelConstraints:s}=r;let o=0;if(s.collapsedSize!==void 0){const u=Ec({groupSize:n,panelElement:i,styleProp:s.collapsedSize});o=Dn(u/n*100)}let a;if(s.defaultSize!==void 0){const u=Ec({groupSize:n,panelElement:i,styleProp:s.defaultSize});a=Dn(u/n*100)}let l=0;if(s.minSize!==void 0){const u=Ec({groupSize:n,panelElement:i,styleProp:s.minSize});l=Dn(u/n*100)}let c=100;if(s.maxSize!==void 0){const u=Ec({groupSize:n,panelElement:i,styleProp:s.maxSize});c=Dn(u/n*100)}return{groupResizeBehavior:s.groupResizeBehavior,collapsedSize:o,collapsible:s.collapsible===!0,defaultSize:a,disabled:s.disabled,minSize:l,maxSize:c,panelId:r.id}})}function ut(e,t="Assertion error"){if(!e)throw Error(t)}function Sx(e,t){return Array.from(t).sort(e==="horizontal"?zK:FK)}function zK(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function FK(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function IP(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function NP(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function HK({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let i,s=Number.MAX_VALUE;for(const o of t){const{x:a,y:l}=NP(r,o),c=e==="horizontal"?a:l;c<s&&(s=c,i=o)}return ut(i,"No rect found"),i}let Qd;function UK(){return Qd===void 0&&(typeof matchMedia=="function"?Qd=!!matchMedia("(pointer:coarse)").matches:Qd=!1),Qd}function TP(e){const{element:t,orientation:n,panels:r,separators:i}=e,s=Sx(n,Array.from(t.children).filter(IP).map(m=>({element:m}))).map(({element:m})=>m),o=[];let a=!1,l=!1,c=-1,u=-1,d=0,f,p=[];{let m=-1;for(const x of s)x.hasAttribute("data-panel")&&(m++,x.hasAttribute("data-disabled")||(d++,c===-1&&(c=m),u=m))}if(d>1){let m=-1;for(const x of s)if(x.hasAttribute("data-panel")){m++;const w=r.find(v=>v.element===x);if(w){if(f){const v=f.element.getBoundingClientRect(),_=x.getBoundingClientRect();let b;if(l){const S=n==="horizontal"?new DOMRect(v.right,v.top,0,v.height):new DOMRect(v.left,v.bottom,v.width,0),C=n==="horizontal"?new DOMRect(_.left,_.top,0,_.height):new DOMRect(_.left,_.top,_.width,0);switch(p.length){case 0:{b=[S,C];break}case 1:{const k=p[0],N=HK({orientation:n,rects:[v,_],targetRect:k.element.getBoundingClientRect()});b=[k,N===v?C:S];break}default:{b=p;break}}}else p.length?b=p:b=[n==="horizontal"?new DOMRect(v.right,_.top,_.left-v.right,_.height):new DOMRect(_.left,v.bottom,_.width,_.top-v.bottom)];for(const S of b){let C="width"in S?S:S.element.getBoundingClientRect();const k=UK()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(C.width<k){const E=k-C.width;C=new DOMRect(C.x-E/2,C.y,C.width+E,C.height)}if(C.height<k){const E=k-C.height;C=new DOMRect(C.x,C.y-E/2,C.width,C.height+E)}const N=m<=c||m>u;!a&&!N&&o.push({group:e,groupSize:xl({group:e}),panels:[f,w],separator:"width"in S?void 0:S,rect:C}),a=!1}}l=!1,f=w,p=[]}}else if(x.hasAttribute("data-separator")){x.ariaDisabled!==null&&(a=!0);const w=i.find(v=>v.element===x);w?p.push(w):(f=void 0,p=[])}else l=!0}return o}var Ts;class PP{constructor(){Ob(this,Ts,{})}addListener(t,n){const r=Jl(this,Ts)[t];return r===void 0?Jl(this,Ts)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=Jl(this,Ts)[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let i=!1,s=null;const o=Array.from(r);for(let a=0;a<o.length;a++){const l=o[a];try{l.call(null,n)}catch(c){s===null&&(i=!0,s=c)}}if(i)throw s}}removeAllListeners(){Bb(this,Ts,{})}removeListener(t,n){const r=Jl(this,Ts)[t];if(r!==void 0){const i=r.indexOf(n);i>=0&&r.splice(i,1)}}}Ts=new WeakMap;let Xa={cursorFlags:0,state:"inactive"};const j_=new PP;function Ho(){return Xa}function WK(e){return j_.addListener("change",e)}function qK(e){const t=Xa,n={...Xa};n.cursorFlags=e,Xa=n,j_.emit("change",{prev:t,next:n})}function Za(e){const t=Xa;Xa=e,j_.emit("change",{prev:t,next:e})}const VK=e=>e,Dg=()=>{},RP=1,AP=2,MP=4,jP=8,Wk=3,qk=12;let Jd;function Vk(){return Jd===void 0&&(Jd=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Jd=!0)),Jd}function KK({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case"active":case"hover":t.forEach(s=>{if(!s.mutableState.disableCursor)switch(s.orientation){case"horizontal":{r++;break}case"vertical":{i++;break}}})}if(!(r===0&&i===0)){switch(n){case"active":{if(e&&Vk()){const s=(e&RP)!==0,o=(e&AP)!==0,a=(e&MP)!==0,l=(e&jP)!==0;if(s)return a?"se-resize":l?"ne-resize":"e-resize";if(o)return a?"sw-resize":l?"nw-resize":"w-resize";if(a)return"s-resize";if(l)return"n-resize"}break}}return Vk()?r>0&&i>0?"move":r>0?"ew-resize":"ns-resize":r>0&&i>0?"grab":r>0?"col-resize":"row-resize"}}const Kk=new WeakMap;function L_(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Kk.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));const r=Ho();switch(r.state){case"active":case"hover":{const i=KK({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(o=>o.group),state:r.state}),s=`*, *:hover {cursor: ${i} !important; }`;if(t===s)return;t=s,i?n.cssRules.length===0?n.insertRule(s):n.replaceSync(s):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Kk.set(e,{prevStyle:t,styleSheet:n})}let vi=new Map;const LP=new PP;function GK(e){vi=new Map(vi),vi.delete(e)}function Gk(e,t){for(const[n]of vi)if(n.id===e)return n}function Us(e,t){for(const[n,r]of vi)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function na(){return vi}function D_(e,t){return LP.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function is(e,t,n){const r=vi.get(e);vi=new Map(vi),vi.set(e,t),LP.emit("groupChange",{group:e,isUserInteraction:(n==null?void 0:n.isUserInteraction)===!0,prev:r,next:t})}function DP(e){const t=Ho();let n=!1;switch(t.state){case"active":Za({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(L_(e),n=!0,t.hitRegions.forEach(r=>{const i=Us(r.group.id,!0);is(r.group,i,{isUserInteraction:!0})}))}return n}function Yk(e){e.defaultPrevented||DP(e.currentTarget)}function YK(e,t,n){let r,i={x:1/0,y:1/0};for(const s of t){const o=NP(n,s.rect);switch(e){case"horizontal":{o.x<=i.x&&(r=s,i=o);break}case"vertical":{o.y<=i.y&&(r=s,i=o);break}}}return r?{distance:i,hitRegion:r}:void 0}function XK(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function ZK(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Qk(e),b:Qk(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();ut(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:Zk(Xk(n.a)),b:Zk(Xk(n.b))};if(i.a===i.b){const s=r.childNodes,o={a:n.a.at(-1),b:n.b.at(-1)};let a=s.length;for(;a--;){const l=s[a];if(l===o.a)return 1;if(l===o.b)return-1}}return Math.sign(i.a-i.b)}const QK=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function JK(e){const t=getComputedStyle(OP(e)??e).display;return t==="flex"||t==="inline-flex"}function eG(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||JK(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||QK.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Xk(e){let t=e.length;for(;t--;){const n=e[t];if(ut(n,"Missing node"),eG(n))return n}return null}function Zk(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Qk(e){const t=[];for(;e;)t.push(e),e=OP(e);return t}function OP(e){const{parentNode:t}=e;return XK(t)?t.host:t}function tG(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function nG({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!IP(n)||n.contains(e)||e.contains(n))return!0;if(ZK(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(tG(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function O_(e,t){const n=[];return t.forEach((r,i)=>{if(i.disabled)return;const s=TP(i),o=YK(i.orientation,s,{x:e.clientX,y:e.clientY});o&&o.distance.x<=0&&o.distance.y<=0&&nG({groupElement:i.element,hitRegion:o.hitRegion.rect,pointerEventTarget:e.target})&&n.push(o.hitRegion)}),n}function rG(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Cn(e,t,n=0){return Math.abs(Dn(e)-Dn(t))<=n}function fi(e,t){return Cn(e,t)?0:e>t?1:-1}function Ba({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:i=0,collapsible:s,disabled:o,maxSize:a=100,minSize:l=0}=t;if(o&&!e)return n;if(fi(r,l)<0)if(s){const c=(i+l)/2;fi(r,c)<0?r=i:r=l}else r=l;return r=Math.min(a,r),r=Dn(r),r}function Nu({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:s}){if(Cn(e,0))return t;const o=s==="imperative-api",a=Object.values(t),l=Object.values(i),c=[...a],[u,d]=r;ut(u!=null,"Invalid first pivot index"),ut(d!=null,"Invalid second pivot index");let f=0;switch(s){case"keyboard":{{const x=e<0?d:u,w=n[x];ut(w,`Panel constraints not found for index ${x}`);const{collapsedSize:v=0,collapsible:_,minSize:b=0}=w;if(_){const S=a[x];if(ut(S!=null,`Previous layout not found for panel index ${x}`),Cn(S,v)){const C=b-S;fi(C,Math.abs(e))>0&&(e=e<0?0-C:C)}}}{const x=e<0?u:d,w=n[x];ut(w,`No panel constraints found for index ${x}`);const{collapsedSize:v=0,collapsible:_,minSize:b=0}=w;if(_){const S=a[x];if(ut(S!=null,`Previous layout not found for panel index ${x}`),Cn(S,b)){const C=S-v;fi(C,Math.abs(e))>0&&(e=e<0?0-C:C)}}}break}default:{const x=e<0?d:u,w=n[x];ut(w,`Panel constraints not found for index ${x}`);const v=a[x],{collapsible:_,collapsedSize:b,minSize:S}=w;if(_&&fi(v,S)<0)if(e>0){const C=S-b,k=C/2,N=v+e;fi(N,S)<0&&(e=fi(e,k)<=0?0:C)}else{const C=S-b,k=100-C/2,N=v-e;fi(N,S)<0&&(e=fi(100+e,k)>0?0:-C)}break}}{const x=e<0?1:-1;let w=e<0?d:u,v=0;for(;;){const b=a[w];ut(b!=null,`Previous layout not found for panel index ${w}`);const S=Ba({overrideDisabledPanels:o,panelConstraints:n[w],prevSize:b,size:100})-b;if(v+=S,w+=x,w<0||w>=n.length)break}const _=Math.min(Math.abs(e),Math.abs(v));e=e<0?0-_:_}{let x=e<0?u:d;for(;x>=0&&x<n.length;){const w=Math.abs(e)-Math.abs(f),v=a[x];ut(v!=null,`Previous layout not found for panel index ${x}`);const _=v-w,b=Ba({overrideDisabledPanels:o,panelConstraints:n[x],prevSize:v,size:_});if(!Cn(v,b)&&(f+=v-b,c[x]=b,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?x--:x++}}if(rG(l,c))return i;{const x=e<0?d:u,w=a[x];ut(w!=null,`Previous layout not found for panel index ${x}`);const v=w+f,_=Ba({overrideDisabledPanels:o,panelConstraints:n[x],prevSize:w,size:v});if(c[x]=_,!Cn(_,v)){let b=v-_,S=e<0?d:u;for(;S>=0&&S<n.length;){const C=c[S];ut(C!=null,`Previous layout not found for panel index ${S}`);const k=C+b,N=Ba({overrideDisabledPanels:o,panelConstraints:n[S],prevSize:C,size:k});if(Cn(C,N)||(b-=N-C,c[S]=N),Cn(b,0))break;e>0?S--:S++}}}const p=Object.values(c).reduce((x,w)=>w+x,0);if(!Cn(p,100,.1))return i;const m=Object.keys(i);return c.reduce((x,w,v)=>(x[m[v]]=w,x),{})}function Uo(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||fi(e[n],t[n])!==0)return!1;return!0}function Wo({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],i=r.reduce((a,l)=>a+l,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(a=>`${a}%`).join(", ")}`);if(!Cn(i,100)&&r.length>0)for(let a=0;a<t.length;a++){const l=r[a];ut(l!=null,`No layout data found for index ${a}`);const c=100/i*l;r[a]=c}let s=0;for(let a=0;a<t.length;a++){const l=n[a];ut(l!=null,`No layout data found for index ${a}`);const c=r[a];ut(c!=null,`No layout data found for index ${a}`);const u=Ba({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:l,size:c});c!=u&&(s+=c-u,r[a]=u)}if(!Cn(s,0))for(let a=0;a<t.length;a++){const l=r[a];ut(l!=null,`No layout data found for index ${a}`);const c=l+s,u=Ba({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:l,size:c});if(l!==u&&(s-=u-l,r[a]=u,Cn(s,0)))break}const o=Object.keys(e);return r.reduce((a,l,c)=>(a[o[c]]=l,a),{})}function BP({groupId:e,panelId:t}){const n=()=>{const l=na();for(const[c,{defaultLayoutDeferred:u,derivedPanelConstraints:d,layout:f,groupSize:p,separatorToPanels:m}]of l)if(c.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:c,groupSize:p,layout:f,separatorToPanels:m};throw Error(`Group ${e} not found`)},r=()=>{const l=n().derivedPanelConstraints.find(c=>c.panelId===t);if(l!==void 0)return l;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const l=n().group.panels.find(c=>c.id===t);if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const l=n().layout[t];if(l!==void 0)return l;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:l,panels:c,prevLayout:u,derivedPanelConstraints:d})=>{const f=s(),p=c.findIndex(w=>w.id===t),m=p===0,x=p===c.length-1;if(x&&l<f&&(m||c.slice(0,p).every((w,v)=>{const _=d[v];return(_==null?void 0:_.collapsible)&&Cn(_.collapsedSize,u[_.panelId])}))){const w=c.slice(0,p).reduce((v,_)=>v+u[_.id],0);return{...u,[t]:Dn(100-w)}}return Nu({delta:x?f-l:l-f,initialLayout:u,panelConstraints:d,pivotIndices:x?[p-1,p]:[p,p+1],prevLayout:u,trigger:"imperative-api"})},a=l=>{const c=s();if(l===c)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:d,group:f,groupSize:p,layout:m,separatorToPanels:x}=n(),w=o({nextSize:l,panels:f.panels,prevLayout:m,derivedPanelConstraints:d}),v=Wo({layout:w,panelConstraints:d});Uo(m,v)||is(f,{defaultLayoutDeferred:u,derivedPanelConstraints:d,groupSize:p,layout:v,separatorToPanels:x})};return{collapse:()=>{const{collapsible:l,collapsedSize:c}=r(),{mutableValues:u}=i(),d=s();l&&d!==c&&(u.expandToSize=d,a(c))},expand:()=>{const{collapsible:l,collapsedSize:c,minSize:u}=r(),{mutableValues:d}=i(),f=s();if(l&&f===c){let p=d.expandToSize??u;p===0&&(p=1),a(p)}},getSize:()=>{const{group:l}=n(),c=s(),{element:u}=i(),d=l.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:c,inPixels:d}},isCollapsed:()=>{const{collapsible:l,collapsedSize:c}=r(),u=s();return l&&Cn(c,u)},resize:l=>{const{group:c}=n(),{element:u}=i(),d=xl({group:c}),f=Ec({groupSize:d,panelElement:u,styleProp:l}),p=Dn(f/d*100);a(p)}}}function Jk(e){if(e.defaultPrevented)return;const t=na();O_(e,t).forEach(n=>{if(n.separator&&!n.separator.disableDoubleClick){const r=n.panels.find(i=>i.panelConstraints.defaultSize!==void 0);if(r){const i=r.panelConstraints.defaultSize,s=BP({groupId:n.group.id,panelId:r.id});s&&i!==void 0&&(s.resize(i),e.preventDefault())}}})}function Bh(e){const t=na();for(const[n]of t)if(n.separators.some(r=>r.element===e))return n;throw Error("Could not find parent Group for separator element")}function $P({groupId:e}){const t=()=>{const n=na();for(const[r,i]of n)if(r.id===e)return{group:r,...i};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:s,groupSize:o,layout:a,separatorToPanels:l}=t(),c=Wo({layout:n,panelConstraints:i});return r?a:(Uo(a,c)||is(s,{defaultLayoutDeferred:r,derivedPanelConstraints:i,groupSize:o,layout:c,separatorToPanels:l}),c)}}}function po(e,t){const n=Bh(e),r=Us(n.id,!0),i=n.separators.find(u=>u.element===e);ut(i,"Matching separator not found");const s=r.separatorToPanels.get(i);ut(s,"Matching panels not found");const o=s.map(u=>n.panels.indexOf(u)),a=$P({groupId:n.id}).getLayout(),l=Nu({delta:t,initialLayout:a,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:a,trigger:"keyboard"}),c=Wo({layout:l,panelConstraints:r.derivedPanelConstraints});Uo(a,c)||is(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function eC(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=Bh(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&po(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&po(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&po(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&po(t,-5);break}case"End":{e.preventDefault(),po(t,100);break}case"Enter":{e.preventDefault();const r=Bh(t),i=Us(r.id,!0),{derivedPanelConstraints:s,layout:o,separatorToPanels:a}=i,l=r.separators.find(f=>f.element===t);ut(l,"Matching separator not found");const c=a.get(l);ut(c,"Matching panels not found");const u=c[0],d=s.find(f=>f.panelId===u.id);if(ut(d,"Panel metadata not found"),d.collapsible){const f=o[u.id],p=d.collapsedSize===f?r.mutableState.expandedPanelSizes[u.id]??d.minSize:d.collapsedSize;po(t,p-f)}break}case"F6":{e.preventDefault();const r=Bh(t).separators.map(o=>o.element),i=Array.from(r).findIndex(o=>o===e.currentTarget);ut(i!==null,"Index not found");const s=e.shiftKey?i>0?i-1:r.length-1:i+1<r.length?i+1:0;r[s].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),po(t,-100);break}}}function tC(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=na(),n=O_(e,t),r=new Map;let i=!1;n.forEach(s=>{s.separator&&(i||(i=!0,s.separator.element.focus({focusVisible:!1,preventScroll:!0})));const o=t.get(s.group);o&&r.set(s.group,o.layout)}),Za({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}function zP({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:s,prevCursorFlags:o}){let a=0;n.forEach(c=>{const{group:u,groupSize:d}=c,{orientation:f,panels:p}=u,{disableCursor:m}=u.mutableState;let x=0;s?f==="horizontal"?x=(t.clientX-s.x)/d*100:x=(t.clientY-s.y)/d*100:f==="horizontal"?x=t.clientX<0?-100:100:x=t.clientY<0?-100:100;const w=r.get(u),v=i.get(u);if(!w||!v)return;const{defaultLayoutDeferred:_,derivedPanelConstraints:b,groupSize:S,layout:C,separatorToPanels:k}=v;if(b&&C&&k){const N=Nu({delta:x,initialLayout:w,panelConstraints:b,pivotIndices:c.panels.map(E=>p.indexOf(E)),prevLayout:C,trigger:"mouse-or-touch"});if(Uo(N,C)){if(x!==0&&!m)switch(f){case"horizontal":{a|=x<0?RP:AP;break}case"vertical":{a|=x<0?MP:jP;break}}}else is(c.group,{defaultLayoutDeferred:_,derivedPanelConstraints:b,groupSize:S,layout:N,separatorToPanels:k})}});let l=0;t.movementX===0?l|=o&Wk:l|=a&Wk,t.movementY===0?l|=o&qk:l|=a&qk,qK(l),L_(e)}function nC(e){const t=na(),n=Ho();switch(n.state){case"active":zP({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function rC(e){var r,i;if(e.defaultPrevented)return;const t=Ho(),n=na();switch(t.state){case"active":{if(e.buttons===0){Za({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(s=>{const o=Us(s.group.id,!0);is(s.group,o,{isUserInteraction:!0})});return}for(const s of t.hitRegions)if(s.separator){const{element:o}=s.separator;(r=o.hasPointerCapture)!=null&&r.call(o,e.pointerId)||((i=o.setPointerCapture)==null||i.call(o,e.pointerId))}zP({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const s=O_(e,n);s.length===0?t.state!=="inactive"&&Za({cursorFlags:0,state:"inactive"}):Za({cursorFlags:0,hitRegions:s,state:"hover"}),L_(e.currentTarget);break}}}function iC(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Ho().state){case"hover":Za({cursorFlags:0,state:"inactive"})}}function sC(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||DP(e.currentTarget)&&e.preventDefault()}function oC(e){let t=0,n=0;const r={};for(const s of e)if(s.defaultSize!==void 0){t++;const o=Dn(s.defaultSize);n+=o,r[s.panelId]=o}else r[s.panelId]=void 0;const i=e.length-t;if(i!==0){const s=Dn((100-n)/i);for(const o of e)o.defaultSize===void 0&&(r[o.panelId]=s)}return r}function iG(e,t,n){if(!n[0])return;const r=e.panels.find(l=>l.element===t);if(!r||!r.onResize)return;const i=xl({group:e}),s=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,a={asPercentage:Dn(s/i*100),inPixels:s};r.mutableValues.prevSize=a,r.onResize(a,r.id,o)}function sG(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function oG({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,s=0,o=!1;const a=new Map,l=[];for(const d of e.panels){const f=r[d.id]??0;switch(d.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{o=!0;const p=f/100*n,m=Dn(p/t*100);a.set(d.id,m),i+=m;break}case"preserve-relative-size":default:{l.push(d.id),s+=f;break}}}if(!o||l.length===0)return r;const c=100-i,u={...r};if(a.forEach((d,f)=>{u[f]=d}),s>0)for(const d of l){const f=r[d]??0;u[d]=Dn(f/s*c)}else{const d=Dn(c/l.length);for(const f of l)u[f]=d}return u}function aG(e,t){const n=e.map(i=>i.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n)if(!r.includes(i))return!1;return!0}const ga=new Map;function lG(e){let t=!0;ut(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,s=new n(m=>{for(const x of m){const{borderBoxSize:w,target:v}=x;if(v===e.element){if(t){const _=xl({group:e});if(_===0)return;const b=Us(e.id);if(!b)return;const S=wx(e),C=b.defaultLayoutDeferred?oC(S):b.layout,k=oG({group:e,nextGroupSize:_,prevGroupSize:b.groupSize,prevLayout:C}),N=Wo({layout:k,panelConstraints:S});if(!b.defaultLayoutDeferred&&Uo(b.layout,N)&&sG(b.derivedPanelConstraints,S)&&b.groupSize===_)return;is(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:S,groupSize:_,layout:N,separatorToPanels:b.separatorToPanels})}}else iG(e,v,w)}});s.observe(e.element),e.panels.forEach(m=>{ut(!r.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),r.add(m.id),m.onResize&&s.observe(m.element)});const o=xl({group:e}),a=wx(e),l=e.panels.map(({id:m})=>m).join(",");let c=e.mutableState.defaultLayout;c&&(aG(e.panels,c)||(c=void 0));const u=e.mutableState.layouts[l]??c??oC(a),d=Wo({layout:u,panelConstraints:a}),f=e.element.ownerDocument;ga.set(f,(ga.get(f)??0)+1);const p=new Map;return TP(e).forEach(m=>{m.separator&&p.set(m.separator,m.panels)}),is(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:a,groupSize:o,layout:d,separatorToPanels:p}),e.separators.forEach(m=>{ut(!i.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),i.add(m.id),m.element.addEventListener("keydown",eC)}),ga.get(f)===1&&(f.addEventListener("contextmenu",Yk,!0),f.addEventListener("dblclick",Jk,!0),f.addEventListener("pointerdown",tC,!0),f.addEventListener("pointerleave",nC),f.addEventListener("pointermove",rC),f.addEventListener("pointerout",iC),f.addEventListener("pointerup",sC,!0)),function(){t=!1,ga.set(f,Math.max(0,(ga.get(f)??0)-1)),GK(e),e.separators.forEach(m=>{m.element.removeEventListener("keydown",eC)}),ga.get(f)||(f.removeEventListener("contextmenu",Yk,!0),f.removeEventListener("dblclick",Jk,!0),f.removeEventListener("pointerdown",tC,!0),f.removeEventListener("pointerleave",nC),f.removeEventListener("pointermove",rC),f.removeEventListener("pointerout",iC),f.removeEventListener("pointerup",sC,!0)),s.disconnect()}}function cG(){const[e,t]=g.useState({}),n=g.useCallback(()=>t({}),[]);return[e,n]}function B_(e){const t=g.useId();return`${e??t}`}const ra=typeof window<"u"?g.useLayoutEffect:g.useEffect;function qc(e){const t=g.useRef(e);return ra(()=>{t.current=e},[e]),g.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function $_(...e){return qc(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function z_(e){const t=g.useRef({...e});return ra(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const FP=g.createContext(null);function uG(e,t){const n=g.useRef({getLayout:()=>({}),setLayout:VK});g.useImperativeHandle(t,()=>n.current,[]),ra(()=>{Object.assign(n.current,$P({groupId:e}))})}function F_({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:s,groupRef:o,id:a,onLayoutChange:l,onLayoutChanged:c,orientation:u="horizontal",resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){const m=g.useRef({onLayoutChange:{},onLayoutChanged:{}}),x=qc(D=>{Uo(m.current.onLayoutChange,D)||(m.current.onLayoutChange=D,l==null||l(D))}),w=qc((D,R)=>{Uo(m.current.onLayoutChanged,D)||(m.current.onLayoutChanged=D,c==null||c(D,{isUserInteraction:R}))}),v=B_(a),_=g.useRef(null),[b,S]=cG(),C=g.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),k=$_(_,s);uG(v,o);const N=qc((D,R)=>{const A=Ho(),M=Gk(D),j=Us(D);if(j){let z=!1;switch(A.state){case"active":{z=A.hitRegions.some(F=>F.group===M);break}}return{flexGrow:j.layout[R]??1,pointerEvents:z?"none":void 0}}if(n!=null&&n[R])return{flexGrow:n==null?void 0:n[R]}}),E=z_({defaultLayout:n,disableCursor:r}),L=g.useMemo(()=>({get disableCursor(){return!!E.disableCursor},getPanelStyles:N,id:v,orientation:u,registerPanel:D=>{const R=C.current;return R.panels=Sx(u,[...R.panels,D]),S(),()=>{R.panels=R.panels.filter(A=>A!==D),S()}},registerSeparator:D=>{const R=C.current;return R.separators=Sx(u,[...R.separators,D]),S(),()=>{R.separators=R.separators.filter(A=>A!==D),S()}},updatePanelProps:(D,{disabled:R})=>{const A=C.current.panels.find(z=>z.id===D);A&&(A.panelConstraints.disabled=R);const M=Gk(v),j=Us(v);M&&j&&is(M,{...j,derivedPanelConstraints:wx(M)})},updateSeparatorProps:(D,{disabled:R,disableDoubleClick:A})=>{const M=C.current.separators.find(j=>j.id===D);M&&(M.disabled=R,M.disableDoubleClick=A)}}),[N,v,S,u,E]),P=g.useRef(null);return ra(()=>{const D=_.current;if(D===null)return;const R=C.current;let A;if(E.defaultLayout!==void 0&&Object.keys(E.defaultLayout).length===R.panels.length){A={};for(const I of R.panels){const U=E.defaultLayout[I.id];U!==void 0&&(A[I.id]=U)}}const M={disabled:!!i,element:D,id:v,mutableState:{defaultLayout:A,disableCursor:!!E.disableCursor,expandedPanelSizes:C.current.lastExpandedPanelSizes,layouts:C.current.layouts},orientation:u,panels:R.panels,resizeTargetMinimumSize:R.resizeTargetMinimumSize,separators:R.separators};P.current=M;const j=lG(M),{defaultLayoutDeferred:z,derivedPanelConstraints:F,layout:$}=Us(M.id,!0);!z&&F.length>0&&(x($),w($,!1));const B=D_(v,I=>{const{defaultLayoutDeferred:U,derivedPanelConstraints:V,layout:O}=I.next;if(U||V.length===0)return;const ne=M.panels.map(({id:Y})=>Y).join(",");M.mutableState.layouts[ne]=O,V.forEach(Y=>{if(Y.collapsible){const{layout:ye}=I.prev??{};if(ye){const Ce=Cn(Y.collapsedSize,O[Y.panelId]),oe=Cn(Y.collapsedSize,ye[Y.panelId]);Ce&&!oe&&(M.mutableState.expandedPanelSizes[Y.panelId]=ye[Y.panelId])}}});const ae=Ho().state!=="active";x(O),ae&&w(O,I.isUserInteraction)});return()=>{P.current=null,j(),B()}},[i,v,w,x,u,b,E]),g.useEffect(()=>{const D=P.current;D&&(D.mutableState.defaultLayout=n,D.mutableState.disableCursor=!!r)}),h.jsx(FP.Provider,{value:L,children:h.jsx("div",{...p,className:t,"data-group":!0,"data-testid":v,id:v,ref:k,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:u==="horizontal"?"pan-y":"pan-x"},children:e})})}F_.displayName="Group";function H_(){const e=g.useContext(FP);return ut(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function dG(e,t){const{id:n}=H_(),r=g.useRef({collapse:Dg,expand:Dg,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Dg});g.useImperativeHandle(t,()=>r.current,[]),ra(()=>{Object.assign(r.current,BP({groupId:n,panelId:e}))})}function Yf({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,disabled:s,elementRef:o,groupResizeBehavior:a="preserve-relative-size",id:l,maxSize:c="100%",minSize:u="0%",onResize:d,panelRef:f,style:p,...m}){const x=!!l,w=B_(l),v=z_({disabled:s}),_=g.useRef(null),b=$_(_,o),{getPanelStyles:S,id:C,orientation:k,registerPanel:N,updatePanelProps:E}=H_(),L=d!==null,P=qc((M,j,z)=>{d==null||d(M,l,z)});ra(()=>{const M=_.current;if(M!==null){const j={element:M,id:w,idIsStable:x,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:L?P:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:r,defaultSize:i,disabled:v.disabled,maxSize:c,minSize:u}};return N(j)}},[a,n,r,i,L,w,x,c,u,P,N,v]),g.useEffect(()=>{E(w,{disabled:s})},[s,w,E]),dG(w,f);const D=()=>{const M=S(C,w);if(M)return JSON.stringify(M)},R=g.useSyncExternalStore(M=>D_(C,M),D,D);let A;return R?A=JSON.parse(R):i!==void 0?A={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:A={flexGrow:1},h.jsx("div",{...m,"data-disabled":s||void 0,"data-panel":!0,"data-testid":w,id:w,ref:b,style:{...hG,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...A},children:h.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...p,touchAction:k==="horizontal"?"pan-y":"pan-x"},children:e})})}Yf.displayName="Panel";const hG={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function fG({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,s;const o=e[n],a=t.find(l=>l.panelId===n);if(a){const l=a.maxSize,c=a.collapsible?a.collapsedSize:a.minSize,u=[r,r+1];s=Wo({layout:Nu({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Wo({layout:Nu({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:s,valueNow:o}}function HP({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:s,style:o,...a}){const l=B_(s),c=z_({disabled:n,disableDoubleClick:r}),[u,d]=g.useState({}),[f,p]=g.useState("inactive"),[m,x]=g.useState(!1),w=g.useRef(null),v=$_(w,i),{disableCursor:_,id:b,orientation:S,registerSeparator:C,updateSeparatorProps:k}=H_(),N=S==="horizontal"?"vertical":"horizontal";ra(()=>{const P=w.current;if(P!==null){const D={disabled:c.disabled,disableDoubleClick:c.disableDoubleClick,element:P,id:l},R=C(D),A=WK(j=>{p(j.next.state!=="inactive"&&j.next.hitRegions.some(z=>z.separator===D)?j.next.state:"inactive")}),M=D_(b,j=>{const{derivedPanelConstraints:z,layout:F,separatorToPanels:$}=j.next,B=$.get(D);if(B){const I=B[0],U=B.indexOf(I);d(fG({layout:F,panelConstraints:z,panelId:I.id,panelIndex:U}))}});return()=>{A(),M(),R()}}},[b,l,C,c]),g.useEffect(()=>{k(l,{disabled:n,disableDoubleClick:r})},[n,r,l,k]);let E;n&&!_&&(E="not-allowed");let L;if(n)L="disabled";else switch(f){case"active":{L="active";break}default:m?L="focus":L=f}return h.jsx("div",{...a,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":N,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":L,"data-testid":l,id:l,onBlur:()=>x(!1),onFocus:()=>x(!0),ref:v,role:"separator",style:{flexBasis:"auto",cursor:E,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}HP.displayName="Separator";function pG(e){if(!e)return;const t=e.contextUsage,n=e.contextWindowSize;if(!t||!n||n<=0)return;const r=t.inputTokens+(t.cacheReadTokens??0)+(t.cacheCreateTokens??0);if(!(r<=0))return Math.round(r/n*100)}function UP(e,t){const n=as(),r=e?`session/${e}`:"",i=ts(r)??wu,s=g.useCallback(d=>{!e||!r||n.setData(r,f=>YT(f??wu,d,e))},[n,r,e]),o=g.useCallback(()=>{e&&s({type:"session:change",sessionId:e})},[s,e]),a=g.useCallback(d=>{e&&s({type:"permission:clear",sessionId:e,requestId:d})},[s,e]),l=g.useCallback(d=>{e&&s({type:"permission:request",sessionId:e,requestId:d.requestId,tool:d.tool,input:d.input,...d.toolUseId?{toolUseId:d.toolUseId}:{}})},[s,e]),c=g.useCallback(d=>{e&&s({type:"session:question:clear",sessionId:e,toolUseId:d})},[s,e]),u=g.useCallback((d,f)=>{e&&s({type:"session:question:submitted",sessionId:e,toolUseId:d,answers:f})},[s,e]);return{...i,reset:o,clearPermission:a,restorePermission:l,clearQuestion:c,markQuestionSubmitted:u}}function mG(e){return e.kind!=="user-text"?!1:e.meta===void 0||e.meta==="slash-command"||Yp(e.meta)}function gG(e,t={}){let n=0;if(t.implicitCloseOnUserText){for(const r of e)mG(r)&&n++;return n}for(const r of e)r.kind==="turn-end"&&n++;return n}const vG=g.createContext(null);function WP(){return g.useContext(vG)}const xG=50;function yG({api:e,sessionId:t,focused:n=!0,toolSessionId:r,initialTurns:i,implicitCloseOnUserText:s,pageSize:o=xG,enabled:a=!0,refreshVersion:l=0}){const c=WP(),[u,d]=g.useState({messages:[],total:0,loading:!1,error:null}),f=g.useRef(r),p=g.useRef(n),m=g.useRef(null),x=g.useRef(l),w=g.useRef(0),v=g.useRef(!0);return g.useEffect(()=>(v.current=!0,()=>{v.current=!1}),[]),g.useEffect(()=>{const _=f.current;f.current=r;const b=n&&!p.current;if(p.current=n,!a){m.current!==null&&(m.current=null,++w.current,d({messages:[],total:0,loading:!1,error:null}));return}const S=m.current!==t,C=x.current!==l;x.current=l;const k=typeof _=="string"&&_!==r,N=b&&u.error!==null;if(_!==r&&(c==null||c.push({level:"info",msg:"chatflow.history.identity",sessionId:t,meta:{previousToolSessionId:_??null,toolSessionId:r??null,willReload:S||k}})),!S&&!k&&!N&&!C)return;if((S||k)&&d({messages:[],total:0,loading:!1,error:null}),!t){m.current=null;return}m.current=t;const E=++w.current;c==null||c.push({level:"info",msg:"chatflow.history.read.start",sessionId:t,meta:{toolSessionId:r??null,initialTurns:i??null,pageSize:i===void 0?null:o,readSeq:E}}),d(L=>({...L,loading:!0,error:null})),(async()=>{var M;let L=[],P=!1,D,R=i===void 0?{}:{limit:o},A=Number.POSITIVE_INFINITY;for(;;){let j;try{j=await e.historyRead({sessionId:t,...R})}catch(V){if(E!==w.current||!v.current)return;const O=V.message??"history load failed";c==null||c.push({level:"warn",msg:"chatflow.history.read.error",sessionId:t,meta:{readSeq:E,shown:P,errorCode:V&&typeof V=="object"&&"code"in V?String(V.code):null}}),d(ne=>({...ne,loading:!1,error:O}));return}if(E!==w.current||!v.current)return;c==null||c.push({level:"info",msg:"chatflow.history.read.result",sessionId:t,meta:{readSeq:E,pageMessages:((M=j.messages)==null?void 0:M.length)??0,total:j.total??0,offset:j.offset??null}}),D&&j.snapshotId&&D!==j.snapshotId&&(L=[],P=!1,A=Number.POSITIVE_INFINITY,d({messages:[],total:0,loading:!0,error:null})),D=j.snapshotId,L=[...j.messages??[],...L];const z=j.total??0,F=typeof j.offset=="number"?j.offset:0,$=F>=A,B=F<=0||$;A=F;const I=i!==void 0&&gG(L,{implicitCloseOnUserText:s})>=i;if(P?d({messages:L,total:z,loading:!1,error:null}):(B||I)&&(P=!0,d({messages:L,total:z,loading:!1,error:null})),B)return;const U=Math.max(0,F-o);R={offset:U,limit:F-U,...D?{snapshotId:D}:{}}}})()},[e,t,r,n,o,i,a,l,c]),u}const _G=["TaskCreate","TaskUpdate","TaskList","TaskGet"];function bG(e){return _G.includes(e)}function qP(e){return e==="in_progress"||e==="completed"?e:"pending"}function wG(e,t){if(!t||typeof t!="object")return e;const n=t,r=typeof n.subject=="string"&&n.subject?n.subject:typeof n.content=="string"&&n.content?n.content:null;if(!r)return e;const i=typeof n.activeForm=="string"?n.activeForm:void 0,s=typeof n.description=="string"?n.description:void 0;return[...e,{id:String(e.length+1),content:r,status:qP(n.status),activeForm:i,description:s}]}function SG(e,t){if(!t||typeof t!="object")return e;const n=t,r=typeof n.taskId=="string"&&n.taskId?n.taskId:typeof n.id=="string"&&n.id?n.id:null;if(!r)return e;const i=e.findIndex(a=>a.id===r);if(i<0)return e;const s=[...e],o={...s[i]};return"status"in n&&(o.status=qP(n.status)),typeof n.subject=="string"&&(o.content=n.subject),typeof n.content=="string"&&(o.content=n.content),typeof n.activeForm=="string"&&(o.activeForm=n.activeForm),typeof n.description=="string"&&(o.description=n.description),s[i]=o,s}function kG(e){let t=[],n=-1;for(let r=0;r<e.length;r++){const i=e[r];if(i.kind==="task-event")switch(n=r,i.name){case"TaskCreate":t=wG(t,i.input);break;case"TaskUpdate":t=SG(t,i.input);break}}return{tasks:t,lastEventIndex:n}}function CG(e){return e==="TodoWrite"}function EG(e){if(!e||typeof e!="object")return null;const t=e;if(!Array.isArray(t.todos))return null;const n=[];for(const r of t.todos){if(!r||typeof r!="object")continue;const i=r,s=typeof i.content=="string"?i.content:"";if(!s)continue;const o=i.status==="in_progress"||i.status==="completed"?i.status:"pending",a=typeof i.activeForm=="string"?i.activeForm:void 0;n.push({content:s,status:o,activeForm:a})}return n}function $h(e,t,n){var o;const r=[],i=new Map;for(let a=0;a<e.length;a++){const l=e[a],c=typeof l.seq=="number"?l.seq:a;switch(l.kind){case"session_init":r.push({kind:"session-init",seq:c,toolSessionId:l.toolSessionId});break;case"text":aC(r,c,"assistant-text",l.text,l.partialId,l.uuid);break;case"thinking":aC(r,c,"assistant-thinking",l.text,l.partialId);break;case"user_text":{l.meta==="task-notification"?r.push({kind:"agent-notification",seq:c,text:l.text,taskId:l.taskId,parentToolUseId:l.parentToolUseId}):l.meta?r.push({kind:"user-meta",seq:c,metaKind:l.meta,text:l.text}):r.push({kind:"user-text",seq:c,text:l.text,uuid:l.uuid,...l.sender&&(l.sender.principal!=="owner"||zT.test(l.text))?{senderDisplayName:l.sender.displayName}:{},senderPrincipal:((o=l.sender)==null?void 0:o.principal)==="guest"?"guest":"owner"});break}case"tool_call":VP(r,c,l.toolUseId,l.tool,l.input,l.toolKind);break;case"tool_result":{const u=i.get(l.toolUseId);if(u!==void 0){if(l.askQuestionAnswers){const f=r[u];f.submittedAnswers=l.askQuestionAnswers}i.delete(l.toolUseId);break}const d={kind:"tool-result",seq:c,toolUseId:l.toolUseId,output:l.output,error:l.error};l.toolResultExtra&&(d.toolResultExtra=l.toolResultExtra),r.push(d);break}case"attachment_memories":r.push({kind:"memory-callout",seq:c,memories:l.memories});break;case"permission_request":{if(!t||l.requestId!==t)break;r.push({kind:"permission-inline",seq:c,requestId:l.requestId,tool:l.tool,input:l.input});break}case"ask_user_question":i.set(l.toolUseId,r.length),r.push({kind:"question-card",seq:c,toolUseId:l.toolUseId,questions:l.questions});break;case"turn_end":{const u={kind:"turn-end",seq:c};l.durationMs!==void 0&&(u.durationMs=l.durationMs),l.reason!==void 0&&(u.reason=l.reason),l.turnId!==void 0&&(u.turnId=l.turnId),r.push(u);break}case"subagent_progress":{const u={kind:"agent-progress",seq:c,toolUseId:l.toolUseId,agentId:l.agentId,status:l.status};l.description&&(u.description=l.description),l.lastToolName&&(u.lastToolName=l.lastToolName),l.prompt&&(u.prompt=l.prompt),l.stats&&(u.stats=l.stats),r.push(u);break}case"error":r.push({kind:"error",seq:c,message:l.message});break}}const s=new Map(e.flatMap((a,l)=>a.turnId?[[a.seq??l,a.turnId]]:[]));for(const a of r){const l=s.get(a.seq);l&&(a.turnId=l)}return r}function VP(e,t,n,r,i,s){if(CG(r)){const o=EG(i);if(o){e.push({kind:"todo-checklist",seq:t,toolUseId:n,todos:o});return}}if(r==="Agent"){const o=i??{},a=typeof o.description=="string"&&o.description?o.description:typeof o.subagent_type=="string"&&o.subagent_type?o.subagent_type:"Subagent";e.push({kind:"agent-call",seq:t,toolUseId:n,description:a,input:i});return}if(bG(r)){e.push({kind:"task-event",seq:t,toolUseId:n,name:r,input:i});return}e.push({kind:"tool-call",seq:t,toolUseId:n,tool:r,toolKind:s,input:i})}function aC(e,t,n,r,i,s){let o=-1;for(let c=e.length-1;c>=0;c--)if(e[c].kind===n){o=c;break}const a=o>=0?e[o]:null;if(i){if(a&&a.partialId===i){const u=n==="assistant-text"?{kind:n,seq:a.seq,text:a.text+r,partialId:i,...s?{uuid:s}:{}}:{kind:n,seq:a.seq,text:a.text+r,partialId:i};e[o]=u;return}const c=n==="assistant-text"?{kind:n,seq:t,text:r,partialId:i,...s?{uuid:s}:{}}:{kind:n,seq:t,text:r,partialId:i};e.push(c);return}if(a&&a.partialId){const c=n==="assistant-text"?{kind:n,seq:a.seq,text:r,...s?{uuid:s}:{}}:{kind:n,seq:a.seq,text:r};e[o]=c;return}const l=n==="assistant-text"?{kind:n,seq:t,text:r,...s?{uuid:s}:{}}:{kind:n,seq:t,text:r};e.push(l)}const IG="AskUserQuestion";function U_(e,t=0,n){var o;const r=[],i=new Map;let s=t;for(const a of e){const l=s++,c=a.toolUseId??`hist-${l}`;switch(a.kind){case"user-text":if(a.meta==="task-notification")r.push({kind:"agent-notification",seq:l,text:a.text??"",taskId:a.taskId,parentToolUseId:a.parentToolUseId});else if(a.meta)r.push({kind:"user-meta",seq:l,metaKind:a.meta,text:a.text??""});else{const u=zT.exec(a.text??""),d=(o=$$.exec(a.text??""))==null?void 0:o[1],f=(u==null?void 0:u[2])??d,p=(u==null?void 0:u[1])==="guest"||d?"guest":"owner";r.push({kind:"user-text",seq:l,text:a.text??"",uuid:a.uuid,...f?{senderDisplayName:f}:{},senderPrincipal:p})}break;case"assistant-text":r.push({kind:"assistant-text",seq:l,text:a.text??"",uuid:a.uuid});break;case"tool_call":{if(a.tool===IG){const u=a.input??{},d=Array.isArray(u.questions)?u.questions:[];i.set(c,r.length),r.push({kind:"question-card",seq:l,toolUseId:c,questions:d});break}VP(r,l,c,a.tool??"",a.input,n);break}case"tool_result":{const u=i.get(c);if(u!==void 0){if(a.askQuestionAnswers){const f=r[u];f.submittedAnswers=a.askQuestionAnswers}i.delete(c);break}const d={kind:"tool-result",seq:l,toolUseId:c,output:a.output};a.error!==void 0&&(d.error=a.error),a.toolResultExtra&&(d.toolResultExtra=a.toolResultExtra),r.push(d);break}case"attachment_memories":a.memories&&a.memories.length>0&&r.push({kind:"memory-callout",seq:l,memories:a.memories});break;case"summary":break;case"turn-end":{const u={kind:"turn-end",seq:l};typeof a.durationMs=="number"&&(u.durationMs=a.durationMs),typeof a.turnId=="string"&&(u.turnId=a.turnId),r.push(u);break}}}return r}const NG=5e5;function TG(e){const t=NG-e.length;return e.map(n=>({...n,seq:n.seq+t}))}const lC=/\[attachment:(image|file):([^\]]+)\]/g;function cC(e){try{return decodeURIComponent(e)}catch{return e}}function PG(e){var n,r;if(e.startsWith("data:")){const i=e.slice(5,e.indexOf(",")),s=(n=/;name=([^;]+)/i.exec(i))==null?void 0:n[1];if(s)return cC(s);const o=(r=i.split(";")[0])==null?void 0:r.toLowerCase(),a={"text/plain":"txt","application/pdf":"pdf","image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/webp":"webp"}[o??""];return(o!=null&&o.startsWith("image/")?"图片":"附件")+(a?"."+a:"")}const t=e.split(/[?#]/,1)[0];return cC(t.split("/").pop()||"附件")}function Xf(e){const t=[];let n;for(;(n=lC.exec(e))!==null;){const i=n[2],s=PG(i);t.push({type:n[1],url:i,fileName:s})}const r=e.replace(lC,"").trim();return{attachments:t,text:r}}function RG(e,t){const n=t.filter(i=>i.status==="done"&&i.url);return n.length===0?e:n.map(i=>`[attachment:${i.mimeType.startsWith("image/")?"image":"file"}:${i.url}]`).join(`
|
|
542
|
+
`)+`
|
|
543
|
+
`+e}const br=e=>typeof e=="string"?e:"",uC=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[];function AG(e){var s;if(e.type==="userMessage"){const a=(Array.isArray(e.content)?e.content:[]).map(c=>c.type==="text"?br(c.text):c.type==="image"?`[attachment:image:${br(c.url)}]`:c.type==="localImage"?`[图片](${br(c.path)})`:"").filter(Boolean).join(`
|
|
544
|
+
`),l=z$(a);return U_([{kind:"user-text",text:a,uuid:e.id,...l?{meta:l==="task"?"dispatch-task":"dispatch-result"}:{}}],0,"codex")}if(e.type==="agentMessage")return[{kind:"assistant-text",seq:0,text:br(e.text),uuid:e.id}];if(e.type==="reasoning")return[{kind:"assistant-thinking",seq:0,text:[...uC(e.summary),...uC(e.content)].join(`
|
|
545
|
+
`)}];if(e.type==="plan")return[{kind:"assistant-text",seq:0,text:br(e.text),uuid:e.id}];if(e.type==="hookPrompt"||e.type==="contextCompaction")return[];if(e.type==="subAgentActivity"){const o=br(e.agentThreadId);return e.kind==="started"?$h([{kind:"tool_call",tool:"Agent",toolKind:"codex",toolUseId:`codex-agent-${o}`,input:{agentId:o,description:br(e.agentPath)}}]):e.kind==="completed"||e.kind==="interrupted"?$h([{kind:"tool_result",toolUseId:`codex-agent-${o}`,output:e.kind==="completed"?"已完成":"已中断"}]):[]}const t=e.type==="mcpToolCall"?`${br(e.server)}.${br(e.tool)}`:e.type==="dynamicToolCall"?br(e.tool):e.type,n=e.type==="commandExecution"?{command:e.command,cwd:e.cwd}:e.type==="fileChange"?{changes:e.changes}:e.arguments??e,r=e.type==="commandExecution"?e.aggregatedOutput:e.type==="fileChange"?(Array.isArray(e.changes)?e.changes:[]).map(o=>br(o.diff)).join(`
|
|
546
|
+
`):e.result??e.contentItems??e.output??e,i=e.status==="failed"||e.status==="declined"||e.success===!1?br((s=e.error)==null?void 0:s.message)||"执行失败":e.type==="commandExecution"&&typeof e.exitCode=="number"&&e.exitCode!==0?`exit ${e.exitCode}`:void 0;return $h([{kind:"tool_call",tool:t,toolKind:"codex",toolUseId:e.id,input:n},{kind:"tool_result",toolUseId:e.id,output:r,...i?{error:i}:{}}])}function MG(e,t,n){const r=new Set,s=(t===void 0?e.items:[...e.items.filter(a=>a.type==="userMessage"&&!t.some(l=>l.id===a.id)),...t,...e.items.filter(a=>a.type!=="userMessage"&&!t.some(l=>l.id===a.id))]).flatMap(a=>r.has(a.id)?[]:(r.add(a.id),AG(a)));let o=!1;for(const a of s)a.kind==="user-text"&&(o&&(a.continuesTurn=!0),o=!0);return e.error&&s.push({kind:"error",seq:0,message:e.error.message}),s.push({kind:"turn-end",seq:0,turnId:e.id,...e.durationMs!==null?{durationMs:e.durationMs}:{},reason:e.status==="interrupted"?"interrupted":"completed"}),s.map((a,l)=>({...a,seq:n+l}))}function jG(e,t){const n=new Map,r=[];let i=[];for(const c of e)c.kind==="turn-end"&&c.turnId?(n.set(c.turnId,{order:n.size,body:i,end:c}),r.push(c.turnId),i=[]):i.push(c);r.push(i);const s=[];let o=-1;const a=c=>{const u=new Set(c.flatMap(_=>_.turnId?[_.turnId]:[])),d=c.at(-1),f=(d==null?void 0:d.kind)==="turn-end"&&d.turnId?n.get(d.turnId):void 0;if(f&&(d==null?void 0:d.kind)==="turn-end"&&u.size>1){f.end={...f.end,...d,seq:f.end.seq,reason:d.reason??"completed"},o=Math.max(o,f.order),a(c.slice(0,-1));return}const p=u.size===1?[...u][0]:void 0,m=p?n.get(p):void 0;if(!p||!m){s.push(...c);return}const x=o<0?c.some(_=>_.kind==="session-init"):m.order>o,w=c.some(_=>_.kind!=="turn-end"&&_.turnId===p);let v=0;for(const _ of c){if(_.kind==="turn-end"){m.end={...m.end,..._,seq:m.end.seq,reason:_.reason??"completed"},o=Math.max(o,m.order);continue}if(_.kind==="session-init")continue;const b=_.kind==="user-text"||_.kind==="user-meta";b||(v=Math.max(v,m.body.findIndex(E=>E.kind==="user-text"||E.kind==="user-meta")+1));const S=m.body.findIndex((E,L)=>L>=v&&LG(E,_)),C=m.body[S],k=C&&"uuid"in C&&C.uuid&&"uuid"in _&&C.uuid===_.uuid,N=_.turnId===p||k||x&&w;if(b&&(S<0||!N)){s.push(_);continue}if(S>=0){const E=m.body[S];m.body[S]={...E,..._,...!b&&"text"in E&&"text"in _&&E.text.length>_.text.length?{text:E.text}:{}},v=S+1}else m.body.splice(v++,0,_)}};let l=[];for(const c of t)l.push(c),c.kind==="turn-end"&&(a(l),l=[]);return a(l),[...r.flatMap(c=>{if(typeof c!="string")return c;const u=n.get(c);return[...u.body,u.end]}),...s]}function LG(e,t){if(e.kind!==t.kind)return!1;const n="partialId"in t&&t.partialId;if("uuid"in e&&e.uuid){if(n)return e.uuid===n;if("uuid"in t&&e.uuid===t.uuid)return!0}if("toolUseId"in e&&"toolUseId"in t)return e.toolUseId===t.toolUseId;if("text"in e&&"text"in t){if(e.text===t.text)return!0;if(e.kind==="user-text"&&t.kind==="user-text"){const r=Xf(e.text),i=Xf(t.text),s=r.attachments.filter(a=>a.type==="file"),o=i.attachments.filter(a=>a.type==="file");return r.attachments.some(a=>a.type==="image")&&r.text===i.text&&r.attachments.length===i.attachments.length&&s.length===o.length&&s.every((a,l)=>a.url===o[l].url)}}return!1}const eh=()=>({turns:[],details:{},nextCursor:null,loading:!1,loadingOlder:!1,error:null});function Og(e,t){if(e.view!==t||!Array.isArray(e.data))throw new Error("历史分页需要更新对端 daemon;未退回全量加载")}function DG(e){const{api:t,sessionId:n,toolSessionId:r,forkedFromSessionId:i,initialTurnStarted:s=!1,enabled:o,focused:a=!0,refreshVersion:l=0}=e,c=`${o}:${n}:${r??""}`,u=g.useRef(c);u.current=c;const d=g.useRef(0),f=g.useRef(!0),[p,m]=g.useState(eh),x=g.useRef(p);x.current=p;const w=g.useRef(!1),v=g.useRef(new Set),_=g.useRef(),b=g.useRef({sessionId:n,toolSessionId:r,enabled:o,focused:a,refreshVersion:l,api:t,hasAssignedThread:!!r});g.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]);const S=g.useCallback(async()=>{if(!o||!r)return;_.current={identity:c,version:l,api:t};const L=++d.current,P=c;w.current=!1,v.current.clear(),m(D=>({...D,loading:!0,loadingOlder:!1,error:null}));try{const D=await t.historyPage({sessionId:n,view:"turns",limit:10});if(Og(D,"turns"),!f.current||d.current!==L||u.current!==P||D.view!=="turns")return;m({...eh(),turns:[...D.data].reverse(),snapshotId:D.snapshotId,nextCursor:D.nextCursor})}catch(D){if(!f.current||d.current!==L||u.current!==P)return;m(R=>({...R,loading:!1,error:D.message}))}},[t,c,o,r,n,l]);g.useEffect(()=>{const L=b.current,P=L.sessionId===n&&L.enabled,D=!!r||P&&L.hasAssignedThread;if(b.current={sessionId:n,toolSessionId:r,enabled:o,focused:a,refreshVersion:l,api:t,hasAssignedThread:D},!o||!r){d.current++,_.current=void 0,m(eh());return}if(!a)return;const R=!!i&&!L.hasAssignedThread;if(P&&L.focused&&!L.toolSessionId&&s&&!R&&L.refreshVersion===l&&L.api===t){_.current={identity:c,version:l,api:t,deferred:!0};return}const A=_.current,M=P&&!L.focused&&((A==null?void 0:A.deferred)||x.current.error!==null);(A==null?void 0:A.identity)===c&&A.version===l&&A.api===t&&!M||(((A==null?void 0:A.identity)!==c||A.api!==t)&&m(eh()),_.current={identity:c,version:l,api:t},S())},[t,c,n,o,r,i,s,a,l,S]);const C=g.useCallback(async()=>{const L=x.current;if(!o||L.loading||w.current||!L.nextCursor||!L.snapshotId)return;const P=d.current,D=c;w.current=!0,m(R=>({...R,loadingOlder:!0,error:null}));try{const R=await t.historyPage({sessionId:n,view:"turns",limit:10,cursor:L.nextCursor,snapshotId:L.snapshotId});if(Og(R,"turns"),!f.current||P!==d.current||D!==u.current||R.view!=="turns")return;if(R.snapshotId!==L.snapshotId||R.nextCursor===L.nextCursor)throw new Error("历史分页快照或游标失效,请刷新历史");m(A=>{const M=new Set(A.turns.map(j=>j.id));return{...A,turns:[...R.data.filter(j=>!M.has(j.id)).reverse(),...A.turns],nextCursor:R.nextCursor,loadingOlder:!1}})}catch(R){f.current&&P===d.current&&D===u.current&&m(A=>({...A,loadingOlder:!1,error:R.message}))}finally{P===d.current&&(w.current=!1)}},[t,o,c,n]),k=g.useCallback(async(L,P=!1)=>{const D=x.current,R=D.details[L];if(!o||D.loading||!D.snapshotId||v.current.has(L)||R&&!R.error&&!P||P&&!(R!=null&&R.nextCursor))return;const A=d.current,M=c;v.current.add(L);const j=R??{items:[],loading:!1,error:null,nextCursor:null};m(z=>({...z,details:{...z.details,[L]:{...j,loading:!0,error:null}}}));try{const z=await t.historyPage({sessionId:n,view:"items",turnId:L,limit:50,snapshotId:D.snapshotId,...R!=null&&R.nextCursor?{cursor:R.nextCursor}:{}});if(Og(z,"items"),!f.current||A!==d.current||M!==u.current||z.view!=="items")return;if(z.snapshotId!==D.snapshotId||R!=null&&R.nextCursor&&z.nextCursor===R.nextCursor)throw new Error("轮次详情快照或游标失效,请刷新历史");if(z.data.some(B=>B.turnId!==L))throw new Error("轮次详情身份不匹配");const F=new Set(j.items.map(B=>B.id)),$=[...j.items,...z.data.map(B=>B.item).filter(B=>!F.has(B.id))];m(B=>({...B,details:{...B.details,[L]:{items:$,loading:!1,error:null,nextCursor:z.nextCursor}}}))}catch(z){f.current&&A===d.current&&M===u.current&&m(F=>({...F,details:{...F.details,[L]:{...j,loading:!1,error:z.message}}}))}finally{A===d.current&&v.current.delete(L)}},[t,o,c,n]),N=g.useMemo(()=>p.turns.flatMap((L,P)=>{var D;return MG(L,(D=p.details[L.id])==null?void 0:D.items,(P-p.turns.length)*1e6)}),[p.turns,p.details]),E=g.useMemo(()=>N.map(L=>({kind:L.kind,..."text"in L?{text:L.text}:{},..."uuid"in L?{uuid:L.uuid}:{}})),[N]);return{...p,lines:N,messages:E,total:p.turns.length,loadOlder:C,loadDetails:k,refresh:S}}const OG=/<command-name>([\s\S]*?)<\/command-name>/i,BG=/<command-message>([\s\S]*?)<\/command-message>/i,$G=/<command-args>([\s\S]*?)<\/command-args>/i,zG=/<(local-command-[a-z]+|command-(?:stdout|stderr))>[\s\S]*?<\/\1>/gi;function vm(e){if(!e)return{commandName:null,commandMessage:null,commandArgs:null,body:""};const t=e.match(OG),n=e.match(BG),r=e.match($G);let i=e;return t&&(i=i.replace(t[0],"")),n&&(i=i.replace(n[0],"")),r&&(i=i.replace(r[0],"")),i=i.replace(zG,""),i=i.trim(),{commandName:t?t[1].trim():null,commandMessage:n?n[1].trim():null,commandArgs:r?r[1].trim():null,body:i}}function dC(e){const t=vm(e);return t.commandName?t.commandArgs?`${t.commandName} ${t.commandArgs}`:t.commandName:e}function hC(e){return e.kind==="user-text"?!0:e.kind!=="user-meta"?!1:e.metaKind==="slash-command"||Yp(e.metaKind)}function FG(e,t){const n=t.find(hC);if(!n)return e;const r=dC(n.text);for(let s=e.length-1;s>=0;s--){const o=e[s];if(hC(o)&&dC(o.text)===r)return e.slice(0,s)}const i=e[e.length-1];return i!==void 0&&i.kind!=="turn-end"?[...e,{kind:"turn-end",seq:i.seq+1}]:e}function HG(e){return e==="running"||e==="observing"}function KP(e){return e==="running"||e==="running-idle"||e==="observing"}const UG=1e6,WG=5;function GP(e,t=!0){const n=WP(),r=Ti(),i=g.useMemo(()=>new Zp(r),[r]),s=ts("sessions"),o=g.useMemo(()=>s==null?void 0:s.find(de=>de.sessionId===e),[s,e]),a=o==null?void 0:o.toolSessionId,l=o==null?void 0:o.tool,[c,u]=g.useState(0),[d,f]=g.useState(null),p=as(),m=g.useRef(p);m.current=p;const[x,w]=g.useState(null),v=g.useRef(null),_=g.useRef(null);g.useEffect(()=>(f(null),w(null),_.current=null,r.on("session:control",de=>{const ze=de;if(!((ze==null?void 0:ze.sessionId)!==e||ze.kind!==n$))if(ze.synchronized===!0){const ke=m.current.read(`session/${e}`);ke!=null&&ke.events.length&&w({first:ke.events[0],count:ke.events.length,historyBefore:v.current}),f(null),u(Fe=>Fe+1)}else f("断线期间的部分内容未显示,完整内容已保存在云端")})),[r,e]);const b=g.useCallback(()=>{const de=m.current.read(`session/${e}`),ze=(de==null?void 0:de.events)??[];let ke=ze.length;for(;ke>0&&ze[ke-1].kind!=="turn_end";)ke--;ke>0&&w({first:ze[0],count:ke,historyBefore:v.current}),_.current={historyBefore:v.current},u(Fe=>Fe+1)},[e]),S=UP(e),{events:C,pendingPermissions:k,queued:N,status:E,clearPermission:L,restorePermission:P}=S,D=fz(),R=l==="codex",A=yG({api:i,sessionId:e,focused:t,toolSessionId:a,enabled:D!==void 0&&!R,refreshVersion:c,initialTurns:D==="owner"?void 0:WG,implicitCloseOnUserText:l==="codex"}),M=DG({api:i,sessionId:e,focused:t,toolSessionId:a,forkedFromSessionId:o==null?void 0:o.forkedFromSessionId,initialTurnStarted:C.some(de=>de.kind==="user_text"),enabled:D!==void 0&&R,refreshVersion:c}),j=R?M:A,z=g.useMemo(()=>({details:M.details,turnIds:new Set(M.turns.map(de=>de.id)),loadDetails:M.loadDetails}),[M.details,M.turns,M.loadDetails]);v.current=j.messages,g.useEffect(()=>{const de=_.current;!de||j.loading||j.messages===de.historyBefore||(_.current=null,f(null))},[j.messages,j.loading]);const F=g.useMemo(()=>j.messages.filter(de=>!de.isSidechain),[j.messages]),$=g.useMemo(()=>{const de=x;return!de||j.messages===de.historyBefore||j.loading||C[0]!==de.first||C.length<de.count?C:C.slice(de.count)},[C,x,j.messages,j.loading]),B=g.useMemo(()=>R?M.lines:TG(U_(F,0,l)),[F,l,R,M.lines]),I=k[0]??null,U=g.useMemo(()=>$h($,(I==null?void 0:I.requestId)??null),[$,I==null?void 0:I.requestId]),V=g.useMemo(()=>R?B:FG(B,U),[B,U,R]),O=g.useMemo(()=>U.map((de,ze)=>({...de,seq:UG+ze})),[U]),ne=g.useMemo(()=>R?jG(V,O):[...V,...O],[V,O,R]),ae=g.useRef(j.messages);g.useEffect(()=>{ae.current!==j.messages&&(ae.current=j.messages,!j.loading&&(n==null||n.push({level:"info",msg:"chatflow.history.display",sessionId:e,meta:{historyMessages:j.messages.length,mainChainMessages:F.length,historyLines:V.length,panelLines:ne.length,total:j.total,error:j.error!==null}})))},[j.messages,j.loading,j.total,j.error,F.length,V.length,ne.length,n,e]);const Y=KP(E),ye=HG(E),Ce=(o==null?void 0:o.resolvedModel)??(o==null?void 0:o.model),oe=g.useMemo(()=>({sessionLabel:(o==null?void 0:o.label)||(o==null?void 0:o.aiLabel)||(o==null?void 0:o.larkChatName)||(o==null?void 0:o.larkChatId)||e,sessionId:e,...o!=null&&o.larkChatId?{larkChatName:o.larkChatName??o.larkChatId,larkChatType:o.larkChatType??"group"}:{},...Ce?{model:Ce}:{},...(()=>{const de=o==null?void 0:o.gitBranch;return de?{gitBranch:de}:{}})(),...(()=>{const de=pG(o);return de!==void 0?{contextPct:de}:{}})(),...o!=null&&o.cwd?{cwd:o.cwd}:{},...(()=>{const de=o==null?void 0:o.permissionMode;return de?{permissionMode:de}:{}})(),procAlive:Y,streamInProgress:ye,pinnedAt:(o==null?void 0:o.pinnedAt)??null}),[o,e,Ce,Y,ye]),je=g.useMemo(()=>r.isOpen?E==="error"?{kind:"error",message:"session error"}:{kind:"ready"}:{kind:"closed"},[r.isOpen,E]),Ae=g.useCallback(async(de,ze)=>{await i.sessionSend(e,de,ze)},[i,e]),De=g.useCallback(async de=>{await i.sessionDequeue(e,de)},[i,e]),xe=g.useCallback(async()=>(await i.sessionInterrupt(e)).queued??[],[i,e]),Ke=g.useCallback(async de=>{if(!(o!=null&&o.cwd)||!a)throw new Error("fork requires sessionFile with cwd + toolSessionId");await i.sessionFork({cwd:o.cwd,toolSessionId:a,messageUuid:de})},[i,o==null?void 0:o.cwd,a]),rt=g.useCallback(async de=>{await i.sessionRewind({sessionId:e,userMessageId:de,dryRun:!1})},[i,e]),Ze=g.useCallback(async de=>{await i.sessionUpdate(e,{model:de})},[i,e]),ht=g.useCallback(async()=>{await i.sessionNew(e)},[i,e]),Kt=g.useCallback(async(de,ze)=>{const ke=k.find(Fe=>Fe.requestId===de);ke&&L(de);try{await i.permissionRespond({sessionId:e,permissionRequestId:de,allow:ze==="allow"})}catch(Fe){throw!((Fe==null?void 0:Fe.message)??"").startsWith("PERMISSION_REQUEST_STALE")&&ke&&P(ke),Fe}},[i,e,k,L,P]);return g.useMemo(()=>({lines:ne,connState:je,meta:oe,historyLoading:j.loading,historyError:j.error,...R?{codexHistory:z,historyHasMore:M.nextCursor!==null,historyLoaded:M.snapshotId!==void 0,historyLoadingOlder:M.loadingOlder,loadOlderHistory:M.loadOlder,refreshHistory:M.refresh}:{},historySyncError:d,pendingPermissions:k,queued:N,sendText:Ae,dequeue:De,interrupt:xe,fork:Ke,rewind:rt,switchModel:Ze,clearSession:ht,respondPermission:Kt,reloadFromCloud:b}),[ne,je,oe,j.loading,j.error,R,z,M.nextCursor,M.snapshotId,M.loadingOlder,M.loadOlder,M.refresh,d,k,N,Ae,De,xe,Ke,rt,Ze,ht,Kt,b])}const qG={codex:"on-request",claude:"bypassPermissions",pi:"never"};function VG(e){const t={cwd:e.cwd,permissionMode:e.sourcePermissionMode??qG[e.sourceTool??"claude"]??"bypassPermissions",forkedFromSessionId:e.sourceSessionId};return e.sourceOwnerPersonaId&&(t.ownerPersonaId=e.sourceOwnerPersonaId),e.sourceTool&&(t.tool=e.sourceTool),e.sourceModel&&(t.model=e.sourceModel),e.sourceEffort&&(t.effort=e.sourceEffort),e.sourceProjectPath&&(t.projectPath=e.sourceProjectPath),t}async function KG(e,t,n,r={}){if(!t.toolSessionId)return null;const i=await e.sessionCreate({...VG({cwd:t.cwd,sourceSessionId:t.sessionId,sourcePermissionMode:t.permissionMode,sourceOwnerPersonaId:t.ownerPersonaId,sourceTool:t.tool,sourceModel:t.model,sourceEffort:t.effort,sourceProjectPath:t.projectPath}),...r.ephemeral?{ephemeral:!0}:{}});try{const{forkedToolSessionId:s}=await e.sessionFork({cwd:t.cwd,toolSessionId:t.toolSessionId,...t.tool==="codex"?{sourceSessionId:t.sessionId,turnId:n}:{messageUuid:n},targetCwd:i.cwd});await e.sessionResume(i.sessionId,s)}catch(s){throw e.sessionDelete(i.sessionId).catch(o=>Oe("quick-ask","fork rollback failed",o)),s}return i}async function GG(e,t,n){return KG(e,t,n,{ephemeral:!0})}function th(e){return e!=null&&e.ephemeral!==!1}async function YG(e,t){return t.stillEphemeral?(await e.sessionUpdate(t.sessionId,{ephemeral:!1}),!0):!1}function XG(e){try{const t=new URL(e);return t.protocol==="ws:"?t.protocol="http:":t.protocol==="wss:"&&(t.protocol="https:"),`${t.protocol}//${t.host}`}catch{return e}}function ZG(e,t){try{const n=new URL(e),r=new URL(t);return n.protocol=r.protocol,n.host=r.host,n.toString()}catch{return e}}async function W_(e,t,n,r,i){const s=await e.attachmentSignUrl({sessionId:n,relPath:r,...i!==void 0?{ttlSeconds:i}:{}});return ZG(s.url,XG(t.url))}async function fC(e,t,n,r,i=60,s){const o=window.open("about:blank","_blank");try{s&&await s();const a=await W_(e,t,n,r,i);o?o.location.href=a:window.open(a,"_blank")}catch(a){throw o&&o.close(),a}}async function QG(e){const t=window.open("about:blank","_blank");try{const n=await e();t?t.location.href=n:window.open(n,"_blank")}catch(n){throw t&&t.close(),n}}async function JG(e){var t;try{if((t=navigator.clipboard)!=null&&t.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.left="-9999px",n.style.top="0",n.setAttribute("readonly",""),document.body.appendChild(n),n.select();const r=document.execCommand("copy");return document.body.removeChild(n),r}catch{return!1}}const eY=300;function tY(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function nY(e,t){const n=wy(),[r,i]=g.useState(null),s=g.useRef(null);g.useEffect(()=>{let a=!1;return(async()=>{try{const l=await n.kv.get(e);if(a)return;const c=tY(l);typeof c=="number"&&Number.isFinite(c)&&c>0?i(c):i(t)}catch{a||i(t)}})(),()=>{a=!0}},[n,e,t]);const o=g.useCallback(a=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{s.current=null,n.kv.set(e,a).catch(()=>{})},eY)},[n,e]);return g.useEffect(()=>()=>{s.current&&(clearTimeout(s.current),s.current=null)},[]),{initialSize:r??t,setSize:o,loading:r===null}}function rY(){return{quickAsk:null,mds:[],active:null}}function iY(e,t){return{...e,quickAsk:{sessionId:t.sessionId,ephemeral:!0},active:"quick-ask"}}function sY(e,t){const n=e.mds.includes(t);return{...e,mds:n?e.mds:[...e.mds,t],active:{kind:"md",relPath:t}}}function oY(e){if(!e.quickAsk)return e;const t=e.active==="quick-ask",n=e.mds[0],r=t?n?{kind:"md",relPath:n}:null:e.active;return{...e,quickAsk:null,active:r}}function aY(e){return e.quickAsk?{...e,quickAsk:{...e.quickAsk,ephemeral:!1}}:e}function lY(e,t){const n=e.mds.indexOf(t);if(n<0)return e;const r=e.mds.filter(l=>l!==t);if(!(e.active!==null&&e.active!=="quick-ask"&&e.active.relPath===t))return{...e,mds:r};const s=r[n],o=n>0?r[n-1]:void 0;let a=null;return s?a={kind:"md",relPath:s}:o?a={kind:"md",relPath:o}:e.quickAsk&&(a="quick-ask"),{...e,mds:r,active:a}}function cY(e,t){return{...e,active:t}}function uY(e,t){return e===null||t===null||e==="quick-ask"||t==="quick-ask"?e===t:e.relPath===t.relPath}function YP(e){return e.quickAsk!==null||e.mds.length>0}function dY(e,t,n,r=!0){const i=g.useRef({sid:null,tsid:void 0});g.useEffect(()=>{const s=i.current;i.current={sid:t,tsid:n},!(!r||!n||s.sid===t&&(s.tsid===void 0||s.tsid===null)&&typeof n=="string")&&e.sessionObserve({sessionId:t,toolSessionId:n}).catch(()=>{})},[e,t,n,r])}function hY(e,t,n){const r=g.useRef(e),i=g.useRef(t),s=g.useRef(n);s.current=n,g.useEffect(()=>{const o=r.current,a=i.current;r.current=e,i.current=t;const l=o!==e,c=typeof a=="string"&&t==null;!l&&!c||s.current()},[e,t])}const fY=/^Scheduled (?:recurring job|one-shot task) ([0-9a-f]{8}) \(([^)]+)\)/;function pY(e){const t=new Map,n=new Map,r=new Map;for(const i of e)if(i.kind==="tool_call"&&i.tool==="CronCreate"){const s=i.input;if(!s||typeof s.cron!="string"||typeof s.prompt!="string")continue;const o=i.ts;t.set(i.toolUseId,{cron:s.cron,prompt:s.prompt,recurring:s.recurring!==!1,ts:typeof o=="string"?o:"",toolUseId:i.toolUseId})}else if(i.kind==="tool_call"&&i.tool==="CronDelete"){const s=i.input;if(!s||typeof s.id!="string")continue;n.set(i.toolUseId,s.id)}else if(i.kind==="tool_result"){const s=t.get(i.toolUseId);if(s){if(t.delete(i.toolUseId),i.error||typeof i.output!="string")continue;const a=i.output.match(fY);if(!a)continue;r.set(a[1],{id:a[1],cron:s.cron,prompt:s.prompt,recurring:s.recurring,humanSchedule:a[2],createdAt:s.ts,toolUseId:s.toolUseId});continue}const o=n.get(i.toolUseId);o!==void 0&&(n.delete(i.toolUseId),i.error||r.delete(o))}return Array.from(r.values()).sort((i,s)=>i.createdAt.localeCompare(s.createdAt))}function XP(e){var n;if(e.error)return!1;if(e.pending)return!0;if(e.notifications.length>0)return!1;const t=(n=e.progress)==null?void 0:n.status;return t==="running"?!0:t==="started"?mY(e.input):!1}function mY(e){return!e||typeof e!="object"?!1:e.run_in_background===!0}function gY(e){return e.filter(t=>t.kind==="merged-agent"&&XP(t))}function ZP(e){var d;const{tasks:t,lastEventIndex:n}=kG(e);let r=-1;for(let f=e.length-1;f>=0;f--)if(e[f].kind==="todo-checklist"){r=f;break}const i=[],s=new Map,o=new Map,a=new Map,l=new Map,c=new Map,u=(f,p)=>{var _,b,S,C,k,N;const m=i[f],x=c.get(f),w=x!==void 0&&x!==p.toolUseId;if(!w&&(((_=m.progress)==null?void 0:_.status)==="completed"||((b=m.progress)==null?void 0:b.status)==="failed"))return;if(c.set(f,p.toolUseId),l.set(p.agentId,f),w&&(m.pending=!0,(S=m.toolResultExtra)!=null&&S.stats)){const{stats:E,...L}=m.toolResultExtra;m.toolResultExtra=L}const v={agentId:p.agentId,status:p.status};p.description?v.description=p.description:(C=m.progress)!=null&&C.description&&(v.description=m.progress.description),p.lastToolName?v.lastToolName=p.lastToolName:!w&&((k=m.progress)!=null&&k.lastToolName)&&(v.lastToolName=m.progress.lastToolName),p.stats?v.stats=p.stats:!w&&((N=m.progress)!=null&&N.stats)&&(v.stats=m.progress.stats),m.progress=v,(p.status==="completed"||p.status==="failed")&&(m.pending=!1)};for(let f=0;f<e.length;f++){const p=e[f];switch(p.kind){case"tool-call":{const m={kind:"merged-tool",seq:p.seq,tool:p.tool,toolKind:p.toolKind,toolUseId:p.toolUseId,input:p.input,pending:!0};s.set(p.toolUseId,i.length),i.push(m);break}case"tool-result":{const m=s.get(p.toolUseId);if(m!==void 0){const w=i[m];w.output=p.output,w.error=p.error,w.pending=!1,s.delete(p.toolUseId);break}const x=o.get(p.toolUseId);if(x!==void 0){const w=i[x];w.output=p.output,w.error=p.error,w.pending=!1,p.toolResultExtra&&(w.toolResultExtra=p.toolResultExtra),(d=p.toolResultExtra)!=null&&d.agentId&&(l.set(p.toolResultExtra.agentId,x),c.set(x,p.toolUseId));break}break}case"agent-call":{const m={kind:"merged-agent",seq:p.seq,toolUseId:p.toolUseId,description:p.description,input:p.input,pending:!0,notifications:[]},x=i.length;o.set(p.toolUseId,x),i.push(m);const w=a.get(p.toolUseId);w&&(u(x,w),a.delete(p.toolUseId));break}case"agent-progress":{const m=o.get(p.toolUseId)??l.get(p.agentId);if(m!==void 0){u(m,p);break}const x=a.get(p.toolUseId);if((x==null?void 0:x.status)==="completed"||(x==null?void 0:x.status)==="failed")break;a.set(p.toolUseId,p);break}case"agent-notification":{const m=(p.parentToolUseId?o.get(p.parentToolUseId):void 0)??(p.taskId?l.get(p.taskId):void 0);if(m!==void 0){i[m].notifications.push({text:p.text,taskId:p.taskId});break}i.push({kind:"agent-notification",seq:p.seq,text:p.text,taskId:p.taskId,parentToolUseId:p.parentToolUseId});break}case"todo-checklist":{f===r&&p.todos.length>0&&i.push({kind:"todo-checklist",seq:p.seq,toolUseId:p.toolUseId,todos:p.todos});break}case"task-event":{f===n&&t.length>0&&i.push({kind:"plan-card",seq:p.seq,tasks:t});break}default:i.push(p)}}return i}const vY=new Set(["permission-inline","question-card"]);function xY(e){return e.kind==="user-text"?!0:e.kind!=="user-meta"?!1:e.metaKind==="slash-command"||Yp(e.metaKind)}function yY(e){return e.kind==="user-text"&&e.continuesTurn===!0}function _Y(e,t={}){const n=[];let r=null;const i=(s,o)=>{r&&(n.push(bY(r,s,o)),r=null)};for(const s of e){if(s.kind==="turn-end"){i(s,!0);continue}if(xY(s)&&(r===null||!yY(s))){i(void 0,!0),r={query:s,body:[]};continue}r===null?r={body:[s]}:r.body.push(s)}return i(void 0,t.closeTrailing===!0),n}function bY(e,t,n){const{query:r,body:i}=e,s=wY(i,t,n),o=SY(i,s),a=CY(i,o),l=r??i[0]??t,c={kind:"turn",seq:l?l.seq:0,status:s,process:a,tail:o};return t!=null&&t.turnId&&(c.turnId=t.turnId),r&&(c.query=r),(t==null?void 0:t.durationMs)!==void 0&&(c.durationMs=t.durationMs),c}function wY(e,t,n){if(!n)return"running";if((t==null?void 0:t.reason)==="interrupted")return"interrupted";const r=kx(e,i=>i.kind==="error");return r>=0&&!e.slice(r+1).some(s=>s.kind==="assistant-text")?"error":"done"}function SY(e,t){if(t==="running"){const r=[];for(let i=e.length-1;i>=0&&vY.has(e[i].kind);i--)r.unshift(e[i]);return r}const n=t==="error"?kx(e,r=>r.kind==="error"):kx(e,r=>r.kind==="assistant-text");return n>=0?[e[n]]:[]}const kY=new Set(["assistant-thinking","user-meta"]);function CY(e,t){const n=new Set(t),r=[];let i=null;const s=()=>{i&&(r.push({kind:"tool-group",seq:i[0].seq,items:i}),i=null)};for(const o of e){if(n.has(o)){s();continue}if(o.kind==="merged-tool"){i?i.push(o):i=[o];continue}if(kY.has(o.kind)){r.push(o);continue}s(),r.push(o)}return s(),r}function kx(e,t){for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return-1}const EY={Read:["正在读取","已读取"],Bash:["正在运行","已运行"],Grep:["正在搜索","已搜索"],Glob:["正在搜索","已搜索"],Edit:["正在编辑","已编辑"],Write:["正在写入","已写入"],WebFetch:["正在抓取","已抓取"],WebSearch:["正在搜索","已搜索"],Skill:["正在读取","已读取"]};function IY(e){if(!e||typeof e!="object")return"";const t=e,n=t.command??t.file_path??t.path??t.pattern??t.query??t.url??t.description;if(typeof n=="string")return n;for(const r of Object.values(t))if(typeof r=="string"&&r)return r;return""}function QP(e){const t=EY[e.tool],n=t?e.pending?t[0]:t[1]:e.pending?`正在执行 ${e.tool}`:`已执行 ${e.tool}`,r=IY(e.input);return r?`${n} ${r}`:n}function NY({item:e,renderItemDetail:t}){const[n,r]=g.useState(!1),i=n?Pn:Fn,s=n?(t==null?void 0:t(e))??null:null;return h.jsxs("div",{className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(o=>!o),"aria-expanded":n,"data-testid":"tool-call-group-row",className:re("flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] hover:text-text-200",e.error?"text-destructive/80":"text-text-400"),children:[e.pending?h.jsx(Tn,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(i,{className:"w-3.5 h-3.5 shrink-0 opacity-60"}),h.jsx("span",{className:"truncate min-w-0",children:QP(e)})]}),n?h.jsx("div",{"data-testid":"tool-call-group-row-detail",className:"pl-5 py-1 min-w-0 space-y-1.5 text-[12px] text-text-300",children:s!==null?s:h.jsxs(h.Fragment,{children:[h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono",children:JSON.stringify(e.input,null,2)}),e.output!==void 0?h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono text-text-400",children:typeof e.output=="string"?e.output:JSON.stringify(e.output,null,2)}):null,e.error?h.jsx("pre",{className:"min-w-0 max-w-full overflow-auto whitespace-pre-wrap font-mono text-destructive",children:e.error}):null]})}):null]})}function TY({items:e,renderItemDetail:t}){const[n,r]=g.useState(!1);if(e.length===0)return null;const i=e.some(l=>l.pending),s=i?[...e].reverse().find(l=>l.pending):e[e.length-1],o=!i&&e.length>1?` 等 ${e.length} 项`:"",a=n?Pn:Fn;return h.jsxs("div",{"data-testid":"tool-call-group",className:"min-w-0 max-w-full",children:[h.jsxs("button",{type:"button",onClick:()=>r(l=>!l),"aria-expanded":n,"data-testid":"tool-call-group-header",className:"flex w-full items-center gap-1.5 text-left cursor-pointer min-w-0 py-0.5 text-[13px] text-text-400 hover:text-text-200",children:[i&&!n?h.jsx(Tn,{className:"w-3.5 h-3.5 animate-spin shrink-0"}):h.jsx(a,{className:"w-3.5 h-3.5 shrink-0"}),n?h.jsx("span",{className:"min-w-0 truncate opacity-70",children:i?"正在执行":`${e.length} 项`}):h.jsxs("span",{className:re("truncate min-w-0",i&&"text-text-300"),children:[QP(s),o]})]}),n?h.jsx("div",{className:"mt-0.5 flex flex-col pl-5",children:e.map(l=>h.jsx(NY,{item:l,renderItemDetail:t},l.toolUseId))}):null]})}function PY(e){const t=Math.round(e/1e3);if(t<60)return`${t}秒`;const n=Math.floor(t/60),r=t%60;return r>0?`${n}分${r}秒`:`${n}分钟`}function RY(e,t){const n=t!==void 0?`耗时 ${PY(t)}`:"";switch(e){case"interrupted":return n?`已中断 · ${n}`:"已中断";case"error":return n?`出错 · ${n}`:"出错";default:return n||"已完成"}}function AY({status:e="done",durationMs:t,defaultExpanded:n=!1,onExpandedChange:r,children:i}){const[s,o]=g.useState(n),a=s?Pn:Fn;return h.jsxs("div",{"data-testid":"turn-process-block",className:"min-w-0 max-w-full border-t border-border pt-2",children:[h.jsxs("button",{type:"button",onClick:()=>{const l=!s;o(l),r==null||r(l)},"aria-expanded":s,"data-testid":"turn-process-block-header",className:re("flex w-full items-center gap-1 text-left cursor-pointer min-w-0 py-0.5 text-[13px]",e!=="done"?"text-destructive/80 hover:text-destructive":"text-text-400 hover:text-text-200"),children:[h.jsx("span",{className:"truncate min-w-0",children:RY(e,t)}),h.jsx(a,{className:"w-3.5 h-3.5 shrink-0"})]}),s?h.jsx("div",{"data-testid":"turn-process-body",className:"mt-2 flex flex-col gap-2 border-l-2 border-border pl-3",children:i}):null]})}const MY=/<(system-reminder|related-dir|clawd-shift-fire)\b[^>]*>[\s\S]*?<\/\1>/gi,jY=/<builder-preview\b[^>]*\/>/gi,LY=/<(clawd-dispatch-task|clawd-dispatch-result)\b[^>]*>([\s\S]*?)<\/\1>/gi,DY=/<\/?(brief|detail|files)>/gi;function JP(e){return e?e.replace(LY,(t,n,r)=>V$(r.replace(DY,"")).trim()).replace(MY,"").replace(jY,"").trim():""}const OY=JP;function BY(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const $Y=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zY=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,FY={};function pC(e,t){return(FY.jsx?zY:$Y).test(e)}const HY=/[ \t\n\f\r]/g;function UY(e){return typeof e=="object"?e.type==="text"?mC(e.value):!1:mC(e)}function mC(e){return e.replace(HY,"")===""}class td{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}td.prototype.normal={};td.prototype.property={};td.prototype.space=void 0;function eR(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new td(n,r,t)}function Cx(e){return e.toLowerCase()}class tr{constructor(t,n){this.attribute=n,this.property=t}}tr.prototype.attribute="";tr.prototype.booleanish=!1;tr.prototype.boolean=!1;tr.prototype.commaOrSpaceSeparated=!1;tr.prototype.commaSeparated=!1;tr.prototype.defined=!1;tr.prototype.mustUseProperty=!1;tr.prototype.number=!1;tr.prototype.overloadedBoolean=!1;tr.prototype.property="";tr.prototype.spaceSeparated=!1;tr.prototype.space=void 0;let WY=0;const Be=ia(),zt=ia(),Ex=ia(),J=ia(),ft=ia(),Qa=ia(),sr=ia();function ia(){return 2**++WY}const Ix=Object.freeze(Object.defineProperty({__proto__:null,boolean:Be,booleanish:zt,commaOrSpaceSeparated:sr,commaSeparated:Qa,number:J,overloadedBoolean:Ex,spaceSeparated:ft},Symbol.toStringTag,{value:"Module"})),Bg=Object.keys(Ix);class q_ extends tr{constructor(t,n,r,i){let s=-1;if(super(t,n),gC(this,"space",i),typeof r=="number")for(;++s<Bg.length;){const o=Bg[s];gC(this,Bg[s],(r&Ix[o])===Ix[o])}}}q_.prototype.defined=!0;function gC(e,t,n){n&&(e[t]=n)}function ql(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new q_(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Cx(r)]=r,n[Cx(s.attribute)]=r}return new td(t,n,e.space)}const tR=ql({properties:{ariaActiveDescendant:null,ariaAtomic:zt,ariaAutoComplete:null,ariaBusy:zt,ariaChecked:zt,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:ft,ariaCurrent:null,ariaDescribedBy:ft,ariaDetails:null,ariaDisabled:zt,ariaDropEffect:ft,ariaErrorMessage:null,ariaExpanded:zt,ariaFlowTo:ft,ariaGrabbed:zt,ariaHasPopup:null,ariaHidden:zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ft,ariaLevel:J,ariaLive:null,ariaModal:zt,ariaMultiLine:zt,ariaMultiSelectable:zt,ariaOrientation:null,ariaOwns:ft,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:zt,ariaReadOnly:zt,ariaRelevant:null,ariaRequired:zt,ariaRoleDescription:ft,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:zt,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function nR(e,t){return t in e?e[t]:t}function rR(e,t){return nR(e,t.toLowerCase())}const qY=ql({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Qa,acceptCharset:ft,accessKey:ft,action:null,allow:null,allowFullScreen:Be,allowPaymentRequest:Be,allowUserMedia:Be,alt:null,as:null,async:Be,autoCapitalize:null,autoComplete:ft,autoFocus:Be,autoPlay:Be,blocking:ft,capture:null,charSet:null,checked:Be,cite:null,className:ft,cols:J,colSpan:null,content:null,contentEditable:zt,controls:Be,controlsList:ft,coords:J|Qa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Be,defer:Be,dir:null,dirName:null,disabled:Be,download:Ex,draggable:zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Be,formTarget:null,headers:ft,height:J,hidden:Ex,high:J,href:null,hrefLang:null,htmlFor:ft,httpEquiv:ft,id:null,imageSizes:null,imageSrcSet:null,inert:Be,inputMode:null,integrity:null,is:null,isMap:Be,itemId:null,itemProp:ft,itemRef:ft,itemScope:Be,itemType:ft,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Be,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:Be,muted:Be,name:null,nonce:null,noModule:Be,noValidate:Be,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Be,optimum:J,pattern:null,ping:ft,placeholder:null,playsInline:Be,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Be,referrerPolicy:null,rel:ft,required:Be,reversed:Be,rows:J,rowSpan:J,sandbox:ft,scope:null,scoped:Be,seamless:Be,selected:Be,shadowRootClonable:Be,shadowRootDelegatesFocus:Be,shadowRootMode:null,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:Be,useMap:null,value:zt,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ft,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Be,declare:Be,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:Be,noHref:Be,noShade:Be,noWrap:Be,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:zt,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Be,disableRemotePlayback:Be,prefix:null,property:null,results:J,security:null,unselectable:null},space:"html",transform:rR}),VY=ql({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:sr,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:ft,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:Be,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Qa,g2:Qa,glyphName:Qa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:sr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:J,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ft,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:sr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:sr,rev:sr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:sr,requiredFeatures:sr,requiredFonts:sr,requiredFormats:sr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:sr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:sr,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:sr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:nR}),iR=ql({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),sR=ql({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:rR}),oR=ql({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),KY={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},GY=/[A-Z]/g,vC=/-[a-z]/g,YY=/^data[-\w.:]+$/i;function XY(e,t){const n=Cx(t);let r=t,i=tr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&YY.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(vC,QY);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!vC.test(s)){let o=s.replace(GY,ZY);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=q_}return new i(r,t)}function ZY(e){return"-"+e.toLowerCase()}function QY(e){return e.charAt(1).toUpperCase()}const JY=eR([tR,qY,iR,sR,oR],"html"),V_=eR([tR,VY,iR,sR,oR],"svg");function eX(e){return e.join(" ").trim()}var K_={},xC=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,tX=/\n/g,nX=/^\s*/,rX=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,iX=/^:\s*/,sX=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,oX=/^[;\s]*/,aX=/^\s+|\s+$/g,lX=`
|
|
547
|
+
`,yC="/",_C="*",wo="",cX="comment",uX="declaration";function dX(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(m){var x=m.match(tX);x&&(n+=x.length);var w=m.lastIndexOf(lX);r=~w?m.length-w:r+m.length}function s(){var m={line:n,column:r};return function(x){return x.position=new o(m),c(),x}}function o(m){this.start=m,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(m){var x=new Error(t.source+":"+n+":"+r+": "+m);if(x.reason=m,x.filename=t.source,x.line=n,x.column=r,x.source=e,!t.silent)throw x}function l(m){var x=m.exec(e);if(x){var w=x[0];return i(w),e=e.slice(w.length),x}}function c(){l(nX)}function u(m){var x;for(m=m||[];x=d();)x!==!1&&m.push(x);return m}function d(){var m=s();if(!(yC!=e.charAt(0)||_C!=e.charAt(1))){for(var x=2;wo!=e.charAt(x)&&(_C!=e.charAt(x)||yC!=e.charAt(x+1));)++x;if(x+=2,wo===e.charAt(x-1))return a("End of comment missing");var w=e.slice(2,x-2);return r+=2,i(w),e=e.slice(x),r+=2,m({type:cX,comment:w})}}function f(){var m=s(),x=l(rX);if(x){if(d(),!l(iX))return a("property missing ':'");var w=l(sX),v=m({type:uX,property:bC(x[0].replace(xC,wo)),value:w?bC(w[0].replace(xC,wo)):wo});return l(oX),v}}function p(){var m=[];u(m);for(var x;x=f();)x!==!1&&(m.push(x),u(m));return m}return c(),p()}function bC(e){return e?e.replace(aX,wo):wo}var hX=dX,fX=Yh&&Yh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(K_,"__esModule",{value:!0});K_.default=mX;const pX=fX(hX);function mX(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,pX.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?t(o,a,s):a&&(n=n||{},n[o]=a)}),n}var xm={};Object.defineProperty(xm,"__esModule",{value:!0});xm.camelCase=void 0;var gX=/^--[a-zA-Z0-9_-]+$/,vX=/-([a-z])/g,xX=/^[^-]+$/,yX=/^-(webkit|moz|ms|o|khtml)-/,_X=/^-(ms)-/,bX=function(e){return!e||xX.test(e)||gX.test(e)},wX=function(e,t){return t.toUpperCase()},wC=function(e,t){return"".concat(t,"-")},SX=function(e,t){return t===void 0&&(t={}),bX(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(_X,wC):e=e.replace(yX,wC),e.replace(vX,wX))};xm.camelCase=SX;var kX=Yh&&Yh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},CX=kX(K_),EX=xm;function Nx(e,t){var n={};return!e||typeof e!="string"||(0,CX.default)(e,function(r,i){r&&i&&(n[(0,EX.camelCase)(r,t)]=i)}),n}Nx.default=Nx;var IX=Nx;const NX=Du(IX),aR=lR("end"),G_=lR("start");function lR(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function TX(e){const t=G_(e),n=aR(e);if(t&&n)return{start:t,end:n}}function Vc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?SC(e.position):"start"in e||"end"in e?SC(e):"line"in e||"column"in e?Tx(e):""}function Tx(e){return kC(e&&e.line)+":"+kC(e&&e.column)}function SC(e){return Tx(e&&e.start)+"-"+Tx(e&&e.end)}function kC(e){return e&&typeof e=="number"?e:1}class An extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Vc(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}An.prototype.file="";An.prototype.name="";An.prototype.reason="";An.prototype.message="";An.prototype.stack="";An.prototype.column=void 0;An.prototype.line=void 0;An.prototype.ancestors=void 0;An.prototype.cause=void 0;An.prototype.fatal=void 0;An.prototype.place=void 0;An.prototype.ruleId=void 0;An.prototype.source=void 0;const Y_={}.hasOwnProperty,PX=new Map,RX=/[A-Z]/g,AX=new Set(["table","tbody","thead","tfoot","tr"]),MX=new Set(["td","th"]),cR="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function jX(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=HX(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=FX(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?V_:JY,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=uR(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function uR(e,t,n){if(t.type==="element")return LX(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return DX(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return BX(e,t,n);if(t.type==="mdxjsEsm")return OX(e,t);if(t.type==="root")return $X(e,t,n);if(t.type==="text")return zX(e,t)}function LX(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=V_,e.schema=i),e.ancestors.push(t);const s=hR(e,t.tagName,!1),o=UX(e,t);let a=Z_(e,t);return AX.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!UY(l):!0})),dR(e,o,s,t),X_(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function DX(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Tu(e,t.position)}function OX(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Tu(e,t.position)}function BX(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=V_,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:hR(e,t.name,!0),o=WX(e,t),a=Z_(e,t);return dR(e,o,s,t),X_(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function $X(e,t,n){const r={};return X_(r,Z_(e,t)),e.create(t,e.Fragment,r,n)}function zX(e,t){return t.value}function dR(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function X_(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function FX(e,t,n){return r;function r(i,s,o,a){const c=Array.isArray(o.children)?n:t;return a?c(s,o,a):c(s,o)}}function HX(e,t){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=G_(r);return t(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function UX(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Y_.call(t.properties,i)){const s=qX(e,i,t.properties[i]);if(s){const[o,a]=s;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&MX.has(t.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function WX(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Tu(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else Tu(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Z_(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:PX;for(;++r<t.children.length;){const s=t.children[r];let o;if(e.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=i.get(l)||0;o=l+"-"+c,i.set(l,c+1)}}const a=uR(e,s,o);a!==void 0&&n.push(a)}return n}function qX(e,t,n){const r=XY(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?BY(n):eX(n)),r.property==="style"){let i=typeof n=="object"?n:VX(e,String(n));return e.stylePropertyNameCase==="css"&&(i=KX(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?KY[r.property]||r.property:r.attribute,n]}}function VX(e,t){try{return NX(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new An("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=cR+"#cannot-parse-style-attribute",i}}function hR(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const a=pC(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=o}else r=pC(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Y_.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Tu(e)}function Tu(e,t){const n=new An("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=cR+"#cannot-handle-mdx-estrees-without-createevaluater",n}function KX(e){const t={};let n;for(n in e)Y_.call(e,n)&&(t[GX(n)]=e[n]);return t}function GX(e){let t=e.replace(RX,YX);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function YX(e){return"-"+e.toLowerCase()}const $g={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},XX={};function Q_(e,t){const n=XX,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return fR(e,r,i)}function fR(e,t,n){if(ZX(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return CC(e.children,t,n)}return Array.isArray(e)?CC(e,t,n):""}function CC(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=fR(e[i],t,n);return r.join("")}function ZX(e){return!!(e&&typeof e=="object")}const EC=document.createElement("i");function J_(e){const t="&"+e+";";EC.innerHTML=t;const n=EC.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function yn(e,t,n,r){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function gn(e,t){return e.length>0?(yn(e,e.length,0,t),e):t}const IC={}.hasOwnProperty;function pR(e){const t={};let n=-1;for(;++n<e.length;)QX(t,e[n]);return t}function QX(e,t){let n;for(n in t){const i=(IC.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){IC.call(i,o)||(i[o]=[]);const a=s[o];JX(i[o],Array.isArray(a)?a:a?[a]:[])}}}function JX(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);yn(e,0,0,r)}function mR(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Yr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ln=so(/[A-Za-z]/),In=so(/[\dA-Za-z]/),eZ=so(/[#-'*+\--9=?A-Z^-~]/);function Zf(e){return e!==null&&(e<32||e===127)}const Px=so(/\d/),tZ=so(/[\dA-Fa-f]/),nZ=so(/[!-/:-@[-`{-~]/);function Ee(e){return e!==null&&e<-2}function dt(e){return e!==null&&(e<0||e===32)}function Ge(e){return e===-2||e===-1||e===32}const ym=so(new RegExp("\\p{P}|\\p{S}","u")),qo=so(/\s/);function so(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Vl(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&In(e.charCodeAt(n+1))&&In(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Je(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Ge(l)?(e.enter(n),a(l)):t(l)}function a(l){return Ge(l)&&s++<i?(e.consume(l),a):(e.exit(n),t(l))}}const rZ={tokenize:iZ};function iZ(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Je(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),s(a)}function s(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return Ee(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),o)}}const sZ={tokenize:oZ},NC={tokenize:aZ};function oZ(e){const t=this,n=[];let r=0,i,s,o;return a;function a(b){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,l,c)(b)}return c(b)}function l(b){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&_();const S=t.events.length;let C=S,k;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){k=t.events[C][1].end;break}v(r);let N=S;for(;N<t.events.length;)t.events[N][1].end={...k},N++;return yn(t.events,C+1,0,t.events.slice(S)),t.events.length=N,c(b)}return a(b)}function c(b){if(r===n.length){if(!i)return f(b);if(i.currentConstruct&&i.currentConstruct.concrete)return m(b);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(NC,u,d)(b)}function u(b){return i&&_(),v(r),f(b)}function d(b){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(b)}function f(b){return t.containerState={},e.attempt(NC,p,m)(b)}function p(b){return r++,n.push([t.currentConstruct,t.containerState]),f(b)}function m(b){if(b===null){i&&_(),v(0),e.consume(b);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),x(b)}function x(b){if(b===null){w(e.exit("chunkFlow"),!0),v(0),e.consume(b);return}return Ee(b)?(e.consume(b),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(b),x)}function w(b,S){const C=t.sliceStream(b);if(S&&C.push(null),b.previous=s,s&&(s.next=b),s=b,i.defineSkip(b.start),i.write(C),t.parser.lazy[b.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<o&&(!i.events[k][1].end||i.events[k][1].end.offset>o))return;const N=t.events.length;let E=N,L,P;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){if(L){P=t.events[E][1].end;break}L=!0}for(v(r),k=N;k<t.events.length;)t.events[k][1].end={...P},k++;yn(t.events,E+1,0,t.events.slice(N)),t.events.length=k}}function v(b){let S=n.length;for(;S-- >b;){const C=n[S];t.containerState=C[1],C[0].exit.call(t,e)}n.length=b}function _(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function aZ(e,t,n){return Je(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function yl(e){if(e===null||dt(e)||qo(e))return 1;if(ym(e))return 2}function Kl(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const Rx={name:"attention",resolveAll:lZ,tokenize:cZ};function lZ(e,t){let n=-1,r,i,s,o,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};TC(d,-l),TC(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=gn(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=gn(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=gn(c,Kl(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=gn(c,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=gn(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,yn(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function cZ(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=yl(r);let s;return o;function o(l){return s=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===s)return e.consume(l),a;const c=e.exit("attentionSequence"),u=yl(l),d=!u||u===2&&i||n.includes(l),f=!i||i===2&&u||n.includes(r);return c._open=!!(s===42?d:d&&(i||!f)),c._close=!!(s===42?f:f&&(u||!d)),t(l)}}function TC(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const uZ={name:"autolink",tokenize:dZ};function dZ(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(p){return Ln(p)?(e.consume(p),o):p===64?n(p):c(p)}function o(p){return p===43||p===45||p===46||In(p)?(r=1,a(p)):c(p)}function a(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||In(p))&&r++<32?(e.consume(p),a):(r=0,c(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Zf(p)?n(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),u):eZ(p)?(e.consume(p),c):n(p)}function u(p){return In(p)?d(p):n(p)}function d(p){return p===46?(e.consume(p),r=0,u):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||In(p))&&r++<63){const m=p===45?f:d;return e.consume(p),m}return n(p)}}const nd={partial:!0,tokenize:hZ};function hZ(e,t,n){return r;function r(s){return Ge(s)?Je(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||Ee(s)?t(s):n(s)}}const gR={continuation:{tokenize:pZ},exit:mZ,name:"blockQuote",tokenize:fZ};function fZ(e,t,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return n(o)}function s(o){return Ge(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function pZ(e,t,n){const r=this;return i;function i(o){return Ge(o)?Je(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(gR,t,n)(o)}}function mZ(e){e.exit("blockQuote")}const vR={name:"characterEscape",tokenize:gZ};function gZ(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return nZ(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const xR={name:"characterReference",tokenize:vZ};function vZ(e,t,n){const r=this;let i=0,s,o;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,o=In,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=tZ,u):(e.enter("characterReferenceValue"),s=7,o=Px,u(d))}function u(d){if(d===59&&i){const f=e.exit("characterReferenceValue");return o===In&&!J_(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&i++<s?(e.consume(d),u):n(d)}}const PC={partial:!0,tokenize:yZ},RC={concrete:!0,name:"codeFenced",tokenize:xZ};function xZ(e,t,n){const r=this,i={partial:!0,tokenize:C};let s=0,o=0,a;return l;function l(k){return c(k)}function c(k){const N=r.events[r.events.length-1];return s=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,a=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(k)}function u(k){return k===a?(o++,e.consume(k),u):o<3?n(k):(e.exit("codeFencedFenceSequence"),Ge(k)?Je(e,d,"whitespace")(k):d(k))}function d(k){return k===null||Ee(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(PC,x,S)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(k))}function f(k){return k===null||Ee(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(k)):Ge(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Je(e,p,"whitespace")(k)):k===96&&k===a?n(k):(e.consume(k),f)}function p(k){return k===null||Ee(k)?d(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||Ee(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(k)):k===96&&k===a?n(k):(e.consume(k),m)}function x(k){return e.attempt(i,S,w)(k)}function w(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),v}function v(k){return s>0&&Ge(k)?Je(e,_,"linePrefix",s+1)(k):_(k)}function _(k){return k===null||Ee(k)?e.check(PC,x,S)(k):(e.enter("codeFlowValue"),b(k))}function b(k){return k===null||Ee(k)?(e.exit("codeFlowValue"),_(k)):(e.consume(k),b)}function S(k){return e.exit("codeFenced"),t(k)}function C(k,N,E){let L=0;return P;function P(j){return k.enter("lineEnding"),k.consume(j),k.exit("lineEnding"),D}function D(j){return k.enter("codeFencedFence"),Ge(j)?Je(k,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):R(j)}function R(j){return j===a?(k.enter("codeFencedFenceSequence"),A(j)):E(j)}function A(j){return j===a?(L++,k.consume(j),A):L>=o?(k.exit("codeFencedFenceSequence"),Ge(j)?Je(k,M,"whitespace")(j):M(j)):E(j)}function M(j){return j===null||Ee(j)?(k.exit("codeFencedFence"),N(j)):E(j)}}}function yZ(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const zg={name:"codeIndented",tokenize:bZ},_Z={partial:!0,tokenize:wZ};function bZ(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),Je(e,s,"linePrefix",5)(c)}function s(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):Ee(c)?e.attempt(_Z,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||Ee(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function wZ(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Ee(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Je(e,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):Ee(o)?i(o):n(o)}}const SZ={name:"codeText",previous:CZ,resolve:kZ,tokenize:EZ};function kZ(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function CZ(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function EZ(e,t,n){let r=0,i,s;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),a(d)}function a(d){return d===96?(e.consume(d),r++,a):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(s=e.enter("codeTextSequence"),i=0,u(d)):Ee(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||Ee(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),c)}function u(d){return d===96?(e.consume(d),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(s.type="codeTextData",c(d))}}class IZ{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&dc(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),dc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),dc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);dc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);dc(this.left,n.reverse())}}}function dc(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function yR(e){const t={};let n=-1,r,i,s,o,a,l,c;const u=new IZ(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,NZ(u,n)),n=t[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},a=u.slice(i,n),a.unshift(r),u.splice(i,n-i+1,a))}}return yn(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function NZ(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,d,f=-1,p=n,m=0,x=0;const w=[x];for(;p;){for(;e.get(++i)[1]!==p;);s.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(x=f+1,w.push(x),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):w.pop(),f=w.length;f--;){const v=a.slice(w[f],w[f+1]),_=s.pop();l.push([_,_+v.length-1]),e.splice(_,2,v)}for(l.reverse(),f=-1;++f<l.length;)c[m+l[f][0]]=m+l[f][1],m+=l[f][1]-l[f][0]-1;return c}const TZ={resolve:RZ,tokenize:AZ},PZ={partial:!0,tokenize:MZ};function RZ(e){return yR(e),e}function AZ(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):Ee(a)?e.check(PZ,o,s)(a):(e.consume(a),i)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function MZ(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Je(e,s,"linePrefix")}function s(o){if(o===null||Ee(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function _R(e,t,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(v){return v===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(v),e.exit(s),f):v===null||v===32||v===41||Zf(v)?n(v):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),x(v))}function f(v){return v===62?(e.enter(s),e.consume(v),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===62?(e.exit("chunkString"),e.exit(a),f(v)):v===null||v===60||Ee(v)?n(v):(e.consume(v),v===92?m:p)}function m(v){return v===60||v===62||v===92?(e.consume(v),p):p(v)}function x(v){return!u&&(v===null||v===41||dt(v))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(v)):u<c&&v===40?(e.consume(v),u++,x):v===41?(e.consume(v),u--,x):v===null||v===32||v===40||Zf(v)?n(v):(e.consume(v),v===92?w:x)}function w(v){return v===40||v===41||v===92?(e.consume(v),x):x(v)}}function bR(e,t,n,r,i,s){const o=this;let a=0,l;return c;function c(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(s),u}function u(p){return a>999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(s),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):Ee(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||Ee(p)||a++>999?(e.exit("chunkString"),u(p)):(e.consume(p),l||(l=!Ge(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(e.consume(p),a++,d):d(p)}}function wR(e,t,n,r,i,s){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,l):n(f)}function l(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(s),c(f))}function c(f){return f===o?(e.exit(s),l(o)):f===null?n(f):Ee(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Je(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||Ee(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:u)}function d(f){return f===o||f===92?(e.consume(f),u):u(f)}}function Kc(e,t){let n;return r;function r(i){return Ee(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ge(i)?Je(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const jZ={name:"definition",tokenize:DZ},LZ={partial:!0,tokenize:OZ};function DZ(e,t,n){const r=this;let i;return s;function s(p){return e.enter("definition"),o(p)}function o(p){return bR.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return i=Yr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return dt(p)?Kc(e,c)(p):c(p)}function c(p){return _R(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(LZ,d,d)(p)}function d(p){return Ge(p)?Je(e,f,"whitespace")(p):f(p)}function f(p){return p===null||Ee(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function OZ(e,t,n){return r;function r(a){return dt(a)?Kc(e,i)(a):n(a)}function i(a){return wR(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Ge(a)?Je(e,o,"whitespace")(a):o(a)}function o(a){return a===null||Ee(a)?t(a):n(a)}}const BZ={name:"hardBreakEscape",tokenize:$Z};function $Z(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Ee(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const zZ={name:"headingAtx",resolve:FZ,tokenize:HZ};function FZ(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},yn(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function HZ(e,t,n){let r=0;return i;function i(u){return e.enter("atxHeading"),s(u)}function s(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(e.consume(u),o):u===null||dt(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||Ee(u)?(e.exit("atxHeading"),t(u)):Ge(u)?Je(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||dt(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const UZ=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],AC=["pre","script","style","textarea"],WZ={concrete:!0,name:"htmlFlow",resolveTo:KZ,tokenize:GZ},qZ={partial:!0,tokenize:XZ},VZ={partial:!0,tokenize:YZ};function KZ(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function GZ(e,t,n){const r=this;let i,s,o,a,l;return c;function c(O){return u(O)}function u(O){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(O),d}function d(O){return O===33?(e.consume(O),f):O===47?(e.consume(O),s=!0,x):O===63?(e.consume(O),i=3,r.interrupt?t:I):Ln(O)?(e.consume(O),o=String.fromCharCode(O),w):n(O)}function f(O){return O===45?(e.consume(O),i=2,p):O===91?(e.consume(O),i=5,a=0,m):Ln(O)?(e.consume(O),i=4,r.interrupt?t:I):n(O)}function p(O){return O===45?(e.consume(O),r.interrupt?t:I):n(O)}function m(O){const ne="CDATA[";return O===ne.charCodeAt(a++)?(e.consume(O),a===ne.length?r.interrupt?t:R:m):n(O)}function x(O){return Ln(O)?(e.consume(O),o=String.fromCharCode(O),w):n(O)}function w(O){if(O===null||O===47||O===62||dt(O)){const ne=O===47,ae=o.toLowerCase();return!ne&&!s&&AC.includes(ae)?(i=1,r.interrupt?t(O):R(O)):UZ.includes(o.toLowerCase())?(i=6,ne?(e.consume(O),v):r.interrupt?t(O):R(O)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(O):s?_(O):b(O))}return O===45||In(O)?(e.consume(O),o+=String.fromCharCode(O),w):n(O)}function v(O){return O===62?(e.consume(O),r.interrupt?t:R):n(O)}function _(O){return Ge(O)?(e.consume(O),_):P(O)}function b(O){return O===47?(e.consume(O),P):O===58||O===95||Ln(O)?(e.consume(O),S):Ge(O)?(e.consume(O),b):P(O)}function S(O){return O===45||O===46||O===58||O===95||In(O)?(e.consume(O),S):C(O)}function C(O){return O===61?(e.consume(O),k):Ge(O)?(e.consume(O),C):b(O)}function k(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),l=O,N):Ge(O)?(e.consume(O),k):E(O)}function N(O){return O===l?(e.consume(O),l=null,L):O===null||Ee(O)?n(O):(e.consume(O),N)}function E(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||dt(O)?C(O):(e.consume(O),E)}function L(O){return O===47||O===62||Ge(O)?b(O):n(O)}function P(O){return O===62?(e.consume(O),D):n(O)}function D(O){return O===null||Ee(O)?R(O):Ge(O)?(e.consume(O),D):n(O)}function R(O){return O===45&&i===2?(e.consume(O),z):O===60&&i===1?(e.consume(O),F):O===62&&i===4?(e.consume(O),U):O===63&&i===3?(e.consume(O),I):O===93&&i===5?(e.consume(O),B):Ee(O)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(qZ,V,A)(O)):O===null||Ee(O)?(e.exit("htmlFlowData"),A(O)):(e.consume(O),R)}function A(O){return e.check(VZ,M,V)(O)}function M(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),j}function j(O){return O===null||Ee(O)?A(O):(e.enter("htmlFlowData"),R(O))}function z(O){return O===45?(e.consume(O),I):R(O)}function F(O){return O===47?(e.consume(O),o="",$):R(O)}function $(O){if(O===62){const ne=o.toLowerCase();return AC.includes(ne)?(e.consume(O),U):R(O)}return Ln(O)&&o.length<8?(e.consume(O),o+=String.fromCharCode(O),$):R(O)}function B(O){return O===93?(e.consume(O),I):R(O)}function I(O){return O===62?(e.consume(O),U):O===45&&i===2?(e.consume(O),I):R(O)}function U(O){return O===null||Ee(O)?(e.exit("htmlFlowData"),V(O)):(e.consume(O),U)}function V(O){return e.exit("htmlFlow"),t(O)}}function YZ(e,t,n){const r=this;return i;function i(o){return Ee(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function XZ(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(nd,t,n)}}const ZZ={name:"htmlText",tokenize:QZ};function QZ(e,t,n){const r=this;let i,s,o;return a;function a(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),l}function l(I){return I===33?(e.consume(I),c):I===47?(e.consume(I),C):I===63?(e.consume(I),b):Ln(I)?(e.consume(I),E):n(I)}function c(I){return I===45?(e.consume(I),u):I===91?(e.consume(I),s=0,m):Ln(I)?(e.consume(I),_):n(I)}function u(I){return I===45?(e.consume(I),p):n(I)}function d(I){return I===null?n(I):I===45?(e.consume(I),f):Ee(I)?(o=d,F(I)):(e.consume(I),d)}function f(I){return I===45?(e.consume(I),p):d(I)}function p(I){return I===62?z(I):I===45?f(I):d(I)}function m(I){const U="CDATA[";return I===U.charCodeAt(s++)?(e.consume(I),s===U.length?x:m):n(I)}function x(I){return I===null?n(I):I===93?(e.consume(I),w):Ee(I)?(o=x,F(I)):(e.consume(I),x)}function w(I){return I===93?(e.consume(I),v):x(I)}function v(I){return I===62?z(I):I===93?(e.consume(I),v):x(I)}function _(I){return I===null||I===62?z(I):Ee(I)?(o=_,F(I)):(e.consume(I),_)}function b(I){return I===null?n(I):I===63?(e.consume(I),S):Ee(I)?(o=b,F(I)):(e.consume(I),b)}function S(I){return I===62?z(I):b(I)}function C(I){return Ln(I)?(e.consume(I),k):n(I)}function k(I){return I===45||In(I)?(e.consume(I),k):N(I)}function N(I){return Ee(I)?(o=N,F(I)):Ge(I)?(e.consume(I),N):z(I)}function E(I){return I===45||In(I)?(e.consume(I),E):I===47||I===62||dt(I)?L(I):n(I)}function L(I){return I===47?(e.consume(I),z):I===58||I===95||Ln(I)?(e.consume(I),P):Ee(I)?(o=L,F(I)):Ge(I)?(e.consume(I),L):z(I)}function P(I){return I===45||I===46||I===58||I===95||In(I)?(e.consume(I),P):D(I)}function D(I){return I===61?(e.consume(I),R):Ee(I)?(o=D,F(I)):Ge(I)?(e.consume(I),D):L(I)}function R(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),i=I,A):Ee(I)?(o=R,F(I)):Ge(I)?(e.consume(I),R):(e.consume(I),M)}function A(I){return I===i?(e.consume(I),i=void 0,j):I===null?n(I):Ee(I)?(o=A,F(I)):(e.consume(I),A)}function M(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||dt(I)?L(I):(e.consume(I),M)}function j(I){return I===47||I===62||dt(I)?L(I):n(I)}function z(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function F(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),$}function $(I){return Ge(I)?Je(e,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):B(I)}function B(I){return e.enter("htmlTextData"),o(I)}}const eb={name:"labelEnd",resolveAll:nQ,resolveTo:rQ,tokenize:iQ},JZ={tokenize:sQ},eQ={tokenize:oQ},tQ={tokenize:aQ};function nQ(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&yn(e,0,e.length,n),e}function rQ(e,t){let n=e.length,r=0,i,s,o,a;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=gn(a,e.slice(s+1,s+r+3)),a=gn(a,[["enter",u,t]]),a=gn(a,Kl(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),a=gn(a,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),a=gn(a,e.slice(o+1)),a=gn(a,[["exit",l,t]]),yn(e,s,e.length,a),e}function iQ(e,t,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(f){return s?s._inactive?d(f):(o=r.parser.defined.includes(Yr(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(JZ,u,o?u:d)(f):f===91?e.attempt(eQ,u,o?c:d)(f):o?u(f):d(f)}function c(f){return e.attempt(tQ,u,d)(f)}function u(f){return t(f)}function d(f){return s._balanced=!0,n(f)}}function sQ(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),i}function i(d){return dt(d)?Kc(e,s)(d):s(d)}function s(d){return d===41?u(d):_R(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return dt(d)?Kc(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?wR(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return dt(d)?Kc(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function oQ(e,t,n){const r=this;return i;function i(a){return bR.call(r,e,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(Yr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function aQ(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const lQ={name:"labelStartImage",resolveAll:eb.resolveAll,tokenize:cQ};function cQ(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const uQ={name:"labelStartLink",resolveAll:eb.resolveAll,tokenize:dQ};function dQ(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Fg={name:"lineEnding",tokenize:hQ};function hQ(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Je(e,t,"linePrefix")}}const zh={name:"thematicBreak",tokenize:fQ};function fQ(e,t,n){let r=0,i;return s;function s(c){return e.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||Ee(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Ge(c)?Je(e,a,"whitespace")(c):a(c))}}const Kn={continuation:{tokenize:vQ},exit:yQ,name:"list",tokenize:gQ},pQ={partial:!0,tokenize:_Q},mQ={partial:!0,tokenize:xQ};function gQ(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Px(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(zh,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Px(p)&&++o<10?(e.consume(p),l):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(nd,r.interrupt?n:u,e.attempt(pQ,f,d))}function u(p){return r.containerState.initialBlankLine=!0,s++,f(p)}function d(p){return Ge(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function vQ(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(nd,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Je(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!Ge(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(mQ,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Je(e,e.attempt(Kn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function xQ(e,t,n){const r=this;return Je(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function yQ(e){e.exit(this.containerState.type)}function _Q(e,t,n){const r=this;return Je(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!Ge(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const MC={name:"setextUnderline",resolveTo:bQ,tokenize:wQ};function bQ(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function wQ(e,t,n){const r=this;let i;return s;function s(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Ge(c)?Je(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Ee(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const SQ={tokenize:kQ};function kQ(e){const t=this,n=e.attempt(nd,r,e.attempt(this.parser.constructs.flowInitial,i,Je(e,e.attempt(this.parser.constructs.flow,i,e.attempt(TZ,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const CQ={resolveAll:kR()},EQ=SR("string"),IQ=SR("text");function SR(e){return{resolveAll:kR(e==="text"?NQ:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,a);return o;function o(u){return c(u)?s(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),s(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=i[u];let f=-1;if(d)for(;++f<d.length;){const p=d[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function kR(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function NQ(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let s=i.length,o=-1,a=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const TQ={42:Kn,43:Kn,45:Kn,48:Kn,49:Kn,50:Kn,51:Kn,52:Kn,53:Kn,54:Kn,55:Kn,56:Kn,57:Kn,62:gR},PQ={91:jZ},RQ={[-2]:zg,[-1]:zg,32:zg},AQ={35:zZ,42:zh,45:[MC,zh],60:WZ,61:MC,95:zh,96:RC,126:RC},MQ={38:xR,92:vR},jQ={[-5]:Fg,[-4]:Fg,[-3]:Fg,33:lQ,38:xR,42:Rx,60:[uZ,ZZ],91:uQ,92:[BZ,vR],93:eb,95:Rx,96:SZ},LQ={null:[Rx,CQ]},DQ={null:[42,95]},OQ={null:[]},BQ=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:DQ,contentInitial:PQ,disable:OQ,document:TQ,flow:AQ,flowInitial:RQ,insideSpan:LQ,string:MQ,text:jQ},Symbol.toStringTag,{value:"Module"}));function $Q(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:N(C),check:N(k),consume:_,enter:b,exit:S,interrupt:N(k,{interrupt:!0})},c={code:null,containerState:{},defineSkip:x,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d};let u=t.tokenize.call(c,l);return t.resolveAll&&s.push(t),c;function d(D){return o=gn(o,D),w(),o[o.length-1]!==null?[]:(E(t,0),c.events=Kl(s,c.events,c),c.events)}function f(D,R){return FQ(p(D),R)}function p(D){return zQ(o,D)}function m(){const{_bufferIndex:D,_index:R,line:A,column:M,offset:j}=r;return{_bufferIndex:D,_index:R,line:A,column:M,offset:j}}function x(D){i[D.line]=D.column,P()}function w(){let D;for(;r._index<o.length;){const R=o[r._index];if(typeof R=="string")for(D=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===D&&r._bufferIndex<R.length;)v(R.charCodeAt(r._bufferIndex));else v(R)}}function v(D){u=u(D)}function _(D){Ee(D)?(r.line++,r.column=1,r.offset+=D===-3?2:1,P()):D!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=D}function b(D,R){const A=R||{};return A.type=D,A.start=m(),c.events.push(["enter",A,c]),a.push(A),A}function S(D){const R=a.pop();return R.end=m(),c.events.push(["exit",R,c]),R}function C(D,R){E(D,R.from)}function k(D,R){R.restore()}function N(D,R){return A;function A(M,j,z){let F,$,B,I;return Array.isArray(M)?V(M):"tokenize"in M?V([M]):U(M);function U(Y){return ye;function ye(Ce){const oe=Ce!==null&&Y[Ce],je=Ce!==null&&Y.null,Ae=[...Array.isArray(oe)?oe:oe?[oe]:[],...Array.isArray(je)?je:je?[je]:[]];return V(Ae)(Ce)}}function V(Y){return F=Y,$=0,Y.length===0?z:O(Y[$])}function O(Y){return ye;function ye(Ce){return I=L(),B=Y,Y.partial||(c.currentConstruct=Y),Y.name&&c.parser.constructs.disable.null.includes(Y.name)?ae():Y.tokenize.call(R?Object.assign(Object.create(c),R):c,l,ne,ae)(Ce)}}function ne(Y){return D(B,I),j}function ae(Y){return I.restore(),++$<F.length?O(F[$]):z}}}function E(D,R){D.resolveAll&&!s.includes(D)&&s.push(D),D.resolve&&yn(c.events,R,c.events.length-R,D.resolve(c.events.slice(R),c)),D.resolveTo&&(c.events=D.resolveTo(c.events,c))}function L(){const D=m(),R=c.previous,A=c.currentConstruct,M=c.events.length,j=Array.from(a);return{from:M,restore:z};function z(){r=D,c.previous=R,c.currentConstruct=A,c.events.length=M,a=j,P()}}function P(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function zQ(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,s)];else{if(o=e.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function FQ(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
548
|
+
`;break}case-3:{o=`\r
|
|
549
|
+
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function HQ(e){const r={constructs:pR([BQ,...(e||{}).extensions||[]]),content:i(rZ),defined:[],document:i(sZ),flow:i(SQ),lazy:{},string:i(EQ),text:i(IQ)};return r;function i(s){return o;function o(a){return $Q(r,s,a)}}}function UQ(e){for(;!yR(e););return e}const jC=/[\0\t\n\r]/g;function WQ(){let e=1,t="",n=!0,r;return i;function i(s,o,a){const l=[];let c,u,d,f,p;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),d=0,t="",n&&(s.charCodeAt(0)===65279&&d++,n=void 0);d<s.length;){if(jC.lastIndex=d,c=jC.exec(s),f=c&&c.index!==void 0?c.index:s.length,p=s.charCodeAt(f),!c){t=s.slice(d);break}if(p===10&&d===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<f&&(l.push(s.slice(d,f)),e+=f-d),p){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const qQ=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function VQ(e){return e.replace(qQ,KQ)}function KQ(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return mR(n.slice(s?2:1),s?16:10)}return J_(n)||e}const CR={}.hasOwnProperty;function GQ(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),YQ(n)(UQ(HQ(n).document().write(WQ()(e,t,!0))))}function YQ(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(de),autolinkProtocol:L,autolinkEmail:L,atxHeading:s(rt),blockQuote:s(je),characterEscape:L,characterReference:L,codeFenced:s(Ae),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Ae,o),codeText:s(De,o),codeTextData:L,data:L,codeFlowValue:L,definition:s(xe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Ke),hardBreakEscape:s(Ze),hardBreakTrailing:s(Ze),htmlFlow:s(ht,o),htmlFlowData:L,htmlText:s(ht,o),htmlTextData:L,image:s(Kt),label:o,link:s(de),listItem:s(ke),listItemValue:f,listOrdered:s(ze,d),listUnordered:s(ze),paragraph:s(Fe),reference:O,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(rt),strong:s(yt),thematicBreak:s(hn)},exit:{atxHeading:l(),atxHeadingSequence:C,autolink:l(),autolinkEmail:oe,autolinkProtocol:Ce,blockQuote:l(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:Y,characterReference:ye,codeFenced:l(w),codeFencedFence:x,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:P,codeIndented:l(v),codeText:l(j),codeTextData:P,data:P,definition:l(),definitionDestinationString:S,definitionLabelString:_,definitionTitleString:b,emphasis:l(),hardBreakEscape:l(R),hardBreakTrailing:l(R),htmlFlow:l(A),htmlFlowData:P,htmlText:l(M),htmlTextData:P,image:l(F),label:B,labelText:$,lineEnding:D,link:l(z),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ne,resourceDestinationString:I,resourceTitleString:U,resource:V,setextHeading:l(E),setextHeadingLineSequence:N,setextHeadingText:k,strong:l(),thematicBreak:l()}};ER(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(W){let ee={type:"root",children:[]};const be={stack:[ee],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:u,data:n},Le=[];let He=-1;for(;++He<W.length;)if(W[He][1].type==="listOrdered"||W[He][1].type==="listUnordered")if(W[He][0]==="enter")Le.push(He);else{const Mt=Le.pop();He=i(W,Mt,He)}for(He=-1;++He<W.length;){const Mt=t[W[He][0]];CR.call(Mt,W[He][1].type)&&Mt[W[He][1].type].call(Object.assign({sliceSerialize:W[He][2].sliceSerialize},be),W[He][1])}if(be.tokenStack.length>0){const Mt=be.tokenStack[be.tokenStack.length-1];(Mt[1]||LC).call(be,void 0,Mt[0])}for(ee.position={start:vs(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:vs(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},He=-1;++He<t.transforms.length;)ee=t.transforms[He](ee)||ee;return ee}function i(W,ee,be){let Le=ee-1,He=-1,Mt=!1,bn,nn,fn,le;for(;++Le<=be;){const Se=W[Le];switch(Se[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Se[0]==="enter"?He++:He--,le=void 0;break}case"lineEndingBlank":{Se[0]==="enter"&&(bn&&!le&&!He&&!fn&&(fn=Le),le=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:le=void 0}if(!He&&Se[0]==="enter"&&Se[1].type==="listItemPrefix"||He===-1&&Se[0]==="exit"&&(Se[1].type==="listUnordered"||Se[1].type==="listOrdered")){if(bn){let it=Le;for(nn=void 0;it--;){const mt=W[it];if(mt[1].type==="lineEnding"||mt[1].type==="lineEndingBlank"){if(mt[0]==="exit")continue;nn&&(W[nn][1].type="lineEndingBlank",Mt=!0),mt[1].type="lineEnding",nn=it}else if(!(mt[1].type==="linePrefix"||mt[1].type==="blockQuotePrefix"||mt[1].type==="blockQuotePrefixWhitespace"||mt[1].type==="blockQuoteMarker"||mt[1].type==="listItemIndent"))break}fn&&(!nn||fn<nn)&&(bn._spread=!0),bn.end=Object.assign({},nn?W[nn][1].start:Se[1].end),W.splice(nn||Le,0,["exit",bn,Se[2]]),Le++,be++}if(Se[1].type==="listItemPrefix"){const it={type:"listItem",_spread:!1,start:Object.assign({},Se[1].start),end:void 0};bn=it,W.splice(Le,0,["enter",it,Se[2]]),Le++,be++,fn=void 0,le=!0}}}return W[ee][1]._spread=Mt,be}function s(W,ee){return be;function be(Le){a.call(this,W(Le),Le),ee&&ee.call(this,Le)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(W,ee,be){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([ee,be||void 0]),W.position={start:vs(ee.start),end:void 0}}function l(W){return ee;function ee(be){W&&W.call(this,be),c.call(this,be)}}function c(W,ee){const be=this.stack.pop(),Le=this.tokenStack.pop();if(Le)Le[0].type!==W.type&&(ee?ee.call(this,W,Le[0]):(Le[1]||LC).call(this,W,Le[0]));else throw new Error("Cannot close `"+W.type+"` ("+Vc({start:W.start,end:W.end})+"): it’s not open");be.position.end=vs(W.end)}function u(){return Q_(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(W){if(this.data.expectingFirstListItemValue){const ee=this.stack[this.stack.length-2];ee.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function p(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.lang=W}function m(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.meta=W}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W.replace(/(\r?\n|\r)$/g,"")}function _(W){const ee=this.resume(),be=this.stack[this.stack.length-1];be.label=ee,be.identifier=Yr(this.sliceSerialize(W)).toLowerCase()}function b(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.title=W}function S(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.url=W}function C(W){const ee=this.stack[this.stack.length-1];if(!ee.depth){const be=this.sliceSerialize(W).length;ee.depth=be}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function N(W){const ee=this.stack[this.stack.length-1];ee.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function E(){this.data.setextHeadingSlurpLineEnding=void 0}function L(W){const be=this.stack[this.stack.length-1].children;let Le=be[be.length-1];(!Le||Le.type!=="text")&&(Le=tn(),Le.position={start:vs(W.start),end:void 0},be.push(Le)),this.stack.push(Le)}function P(W){const ee=this.stack.pop();ee.value+=this.sliceSerialize(W),ee.position.end=vs(W.end)}function D(W){const ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){const be=ee.children[ee.children.length-1];be.position.end=vs(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ee.type)&&(L.call(this,W),P.call(this,W))}function R(){this.data.atHardBreak=!0}function A(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function M(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function j(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.value=W}function z(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=ee,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function F(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=ee,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function $(W){const ee=this.sliceSerialize(W),be=this.stack[this.stack.length-2];be.label=VQ(ee),be.identifier=Yr(ee).toLowerCase()}function B(){const W=this.stack[this.stack.length-1],ee=this.resume(),be=this.stack[this.stack.length-1];if(this.data.inReference=!0,be.type==="link"){const Le=W.children;be.children=Le}else be.alt=ee}function I(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.url=W}function U(){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.title=W}function V(){this.data.inReference=void 0}function O(){this.data.referenceType="collapsed"}function ne(W){const ee=this.resume(),be=this.stack[this.stack.length-1];be.label=ee,be.identifier=Yr(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function ae(W){this.data.characterReferenceType=W.type}function Y(W){const ee=this.sliceSerialize(W),be=this.data.characterReferenceType;let Le;be?(Le=mR(ee,be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Le=J_(ee);const He=this.stack[this.stack.length-1];He.value+=Le}function ye(W){const ee=this.stack.pop();ee.position.end=vs(W.end)}function Ce(W){P.call(this,W);const ee=this.stack[this.stack.length-1];ee.url=this.sliceSerialize(W)}function oe(W){P.call(this,W);const ee=this.stack[this.stack.length-1];ee.url="mailto:"+this.sliceSerialize(W)}function je(){return{type:"blockquote",children:[]}}function Ae(){return{type:"code",lang:null,meta:null,value:""}}function De(){return{type:"inlineCode",value:""}}function xe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ke(){return{type:"emphasis",children:[]}}function rt(){return{type:"heading",depth:0,children:[]}}function Ze(){return{type:"break"}}function ht(){return{type:"html",value:""}}function Kt(){return{type:"image",title:null,url:"",alt:null}}function de(){return{type:"link",title:null,url:"",children:[]}}function ze(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function ke(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function Fe(){return{type:"paragraph",children:[]}}function yt(){return{type:"strong",children:[]}}function tn(){return{type:"text",value:""}}function hn(){return{type:"thematicBreak"}}}function vs(e){return{line:e.line,column:e.column,offset:e.offset}}function ER(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?ER(e,r):XQ(e,r)}}function XQ(e,t){let n;for(n in t)if(CR.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function LC(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Vc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Vc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Vc({start:t.start,end:t.end})+") is still open")}function ZQ(e){const t=this;t.parser=n;function n(r){return GQ(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function QQ(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function JQ(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
550
|
+
`}]}function eJ(e,t){const n=t.value?t.value+`
|
|
551
|
+
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function tJ(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nJ(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function rJ(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Vl(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function iJ(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sJ(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function IR(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function oJ(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return IR(e,t);const i={src:Vl(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function aJ(e,t){const n={src:Vl(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function lJ(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function cJ(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return IR(e,t);const i={href:Vl(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function uJ(e,t){const n={href:Vl(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function dJ(e,t,n){const r=e.all(t),i=n?hJ(n):NR(t),s={},o=[];if(typeof t.checked=="boolean"){const u=r[0];let d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const u=r[a];(i||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
|
|
552
|
+
`}),u.type==="element"&&u.tagName==="p"&&!i?o.push(...u.children):o.push(u)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
|
|
553
|
+
`});const c={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,c),e.applyData(t,c)}function hJ(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=NR(n[r])}return t}function NR(e){const t=e.spread;return t??e.children.length>1}function fJ(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function pJ(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mJ(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function gJ(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vJ(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),i.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=G_(t.children[1]),l=aR(t.children[t.children.length-1]);a&&l&&(o.position={start:a,end:l}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function xJ(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:t.children.length;let l=-1;const c=[];for(;++l<a;){const d=t.children[l],f={},p=o?o[l]:void 0;p&&(f.align=p);let m={type:"element",tagName:s,properties:f,children:[]};d&&(m.children=e.all(d),e.patch(d,m),m=e.applyData(d,m)),c.push(m)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,u),e.applyData(t,u)}function yJ(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const DC=9,OC=32;function _J(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(BC(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(BC(t.slice(i),i>0,!1)),s.join("")}function BC(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===DC||s===OC;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===DC||s===OC;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function bJ(e,t){const n={type:"text",value:_J(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function wJ(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const SJ={blockquote:QQ,break:JQ,code:eJ,delete:tJ,emphasis:nJ,footnoteReference:rJ,heading:iJ,html:sJ,imageReference:oJ,image:aJ,inlineCode:lJ,linkReference:cJ,link:uJ,listItem:dJ,list:fJ,paragraph:pJ,root:mJ,strong:gJ,table:vJ,tableCell:yJ,tableRow:xJ,text:bJ,thematicBreak:wJ,toml:nh,yaml:nh,definition:nh,footnoteDefinition:nh};function nh(){}const TR=-1,_m=0,Gc=1,Qf=2,tb=3,nb=4,rb=5,ib=6,PR=7,RR=8,$C=typeof self=="object"?self:globalThis,kJ=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case _m:case TR:return n(o,i);case Gc:{const a=n([],i);for(const l of o)a.push(r(l));return a}case Qf:{const a=n({},i);for(const[l,c]of o)a[r(l)]=r(c);return a}case tb:return n(new Date(o),i);case nb:{const{source:a,flags:l}=o;return n(new RegExp(a,l),i)}case rb:{const a=n(new Map,i);for(const[l,c]of o)a.set(r(l),r(c));return a}case ib:{const a=n(new Set,i);for(const l of o)a.add(r(l));return a}case PR:{const{name:a,message:l}=o;return n(new $C[a](l),i)}case RR:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new $C[s](o),i)};return r},zC=e=>kJ(new Map,e)(0),va="",{toString:CJ}={},{keys:EJ}=Object,hc=e=>{const t=typeof e;if(t!=="object"||!e)return[_m,t];const n=CJ.call(e).slice(8,-1);switch(n){case"Array":return[Gc,va];case"Object":return[Qf,va];case"Date":return[tb,va];case"RegExp":return[nb,va];case"Map":return[rb,va];case"Set":return[ib,va];case"DataView":return[Gc,n]}return n.includes("Array")?[Gc,n]:n.includes("Error")?[PR,n]:[Qf,n]},rh=([e,t])=>e===_m&&(t==="function"||t==="symbol"),IJ=(e,t,n,r)=>{const i=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},s=o=>{if(n.has(o))return n.get(o);let[a,l]=hc(o);switch(a){case _m:{let u=o;switch(l){case"bigint":a=RR,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([TR],o)}return i([a,u],o)}case Gc:{if(l){let f=o;return l==="DataView"?f=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(o)),i([l,[...f]],o)}const u=[],d=i([a,u],o);for(const f of o)u.push(s(f));return d}case Qf:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const u=[],d=i([a,u],o);for(const f of EJ(o))(e||!rh(hc(o[f])))&&u.push([s(f),s(o[f])]);return d}case tb:return i([a,o.toISOString()],o);case nb:{const{source:u,flags:d}=o;return i([a,{source:u,flags:d}],o)}case rb:{const u=[],d=i([a,u],o);for(const[f,p]of o)(e||!(rh(hc(f))||rh(hc(p))))&&u.push([s(f),s(p)]);return d}case ib:{const u=[],d=i([a,u],o);for(const f of o)(e||!rh(hc(f)))&&u.push(s(f));return d}}const{message:c}=o;return i([a,{name:l,message:c}],o)};return s},FC=(e,{json:t,lossy:n}={})=>{const r=[];return IJ(!(t||n),!!t,new Map,r)(e),r},Jf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?zC(FC(e,t)):structuredClone(e):(e,t)=>zC(FC(e,t));function NJ(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function TJ(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function PJ(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||NJ,r=e.options.footnoteBackLabel||TJ,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;const u=e.all(c),d=String(c.identifier).toUpperCase(),f=Vl(d.toLowerCase());let p=0;const m=[],x=e.footnoteCounts.get(d);for(;x!==void 0&&++p<=x;){m.length>0&&m.push({type:"text",value:" "});let _=typeof n=="string"?n:n(l,p);typeof _=="string"&&(_={type:"text",value:_}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,p),className:["data-footnote-backref"]},children:Array.isArray(_)?_:[_]})}const w=u[u.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const _=w.children[w.children.length-1];_&&_.type==="text"?_.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...m)}else u.push(...m);const v={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(u,!0)};e.patch(c,v),a.push(v)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Jf(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
554
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
555
|
+
`}]}}const bm=function(e){if(e==null)return jJ;if(typeof e=="function")return wm(e);if(typeof e=="object")return Array.isArray(e)?RJ(e):AJ(e);if(typeof e=="string")return MJ(e);throw new Error("Expected function, string, or object as test")};function RJ(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=bm(e[n]);return wm(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function AJ(e){const t=e;return wm(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function MJ(e){return wm(t);function t(n){return n&&n.type===e}}function wm(e){return t;function t(n,r,i){return!!(LJ(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function jJ(){return!0}function LJ(e){return e!==null&&typeof e=="object"&&"type"in e}const AR=[],DJ=!0,Ax=!1,OJ="skip";function MR(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=bm(i),o=r?-1:1;a(e,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=AR,m,x,w;if((!t||s(l,c,u[u.length-1]||void 0))&&(p=BJ(n(l,u)),p[0]===Ax))return p;if("children"in l&&l.children){const v=l;if(v.children&&p[0]!==OJ)for(x=(r?v.children.length:-1)+o,w=u.concat(v);x>-1&&x<v.children.length;){const _=v.children[x];if(m=a(_,x,w)(),m[0]===Ax)return m;x=typeof m[1]=="number"?m[1]:x+o}}return p}}}function BJ(e){return Array.isArray(e)?e:typeof e=="number"?[DJ,e]:e==null?AR:[e]}function sb(e,t,n,r){let i,s,o;typeof t=="function"&&typeof n!="function"?(s=void 0,o=t,i=n):(s=t,o=n,i=r),MR(e,s,a,i);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}const Mx={}.hasOwnProperty,$J={};function zJ(e,t){const n=t||$J,r=new Map,i=new Map,s=new Map,o={...SJ,...n.handlers},a={all:c,applyData:HJ,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:n,patch:FJ,wrap:WJ};return sb(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?r:i,f=String(u.identifier).toUpperCase();d.has(f)||d.set(f,u)}}),a;function l(u,d){const f=u.type,p=a.handlers[f];if(Mx.call(a.handlers,f)&&p)return p(a,u,d);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in u){const{children:x,...w}=u,v=Jf(w);return v.children=a.all(u),v}return Jf(u)}return(a.options.unknownHandler||UJ)(a,u,d)}function c(u){const d=[];if("children"in u){const f=u.children;let p=-1;for(;++p<f.length;){const m=a.one(f[p],u);if(m){if(p&&f[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=HC(m.value)),!Array.isArray(m)&&m.type==="element")){const x=m.children[0];x&&x.type==="text"&&(x.value=HC(x.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function FJ(e,t){e.position&&(t.position=TX(e))}function HJ(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&s&&Object.assign(n.properties,Jf(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function UJ(e,t){const n=t.data||{},r="value"in t&&!(Mx.call(n,"hProperties")||Mx.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function WJ(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
556
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
557
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
558
|
+
`}),n}function HC(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function UC(e,t){const n=zJ(e,t),r=n.one(e,void 0),i=PJ(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
559
|
+
`},i),s}function qJ(e,t){return e&&"run"in e?async function(n,r){const i=UC(n,{file:r,...t});await e.run(i,r)}:function(n,r){return UC(n,{file:r,...e||t})}}function WC(e){if(e)throw e}var Fh=Object.prototype.hasOwnProperty,jR=Object.prototype.toString,qC=Object.defineProperty,VC=Object.getOwnPropertyDescriptor,KC=function(t){return typeof Array.isArray=="function"?Array.isArray(t):jR.call(t)==="[object Array]"},GC=function(t){if(!t||jR.call(t)!=="[object Object]")return!1;var n=Fh.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Fh.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Fh.call(t,i)},YC=function(t,n){qC&&n.name==="__proto__"?qC(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},XC=function(t,n){if(n==="__proto__")if(Fh.call(t,n)){if(VC)return VC(t,n).value}else return;return t[n]},VJ=function e(){var t,n,r,i,s,o,a=arguments[0],l=1,c=arguments.length,u=!1;for(typeof a=="boolean"&&(u=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<c;++l)if(t=arguments[l],t!=null)for(n in t)r=XC(a,n),i=XC(t,n),a!==i&&(u&&i&&(GC(i)||(s=KC(i)))?(s?(s=!1,o=r&&KC(r)?r:[]):o=r&&GC(r)?r:{},YC(a,{name:n,newValue:e(u,o,i)})):typeof i<"u"&&YC(a,{name:n,newValue:i}));return a};const Hg=Du(VJ);function jx(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function KJ(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(l,...c){const u=e[++s];let d=-1;if(l){o(l);return}for(;++d<i.length;)(c[d]===null||c[d]===void 0)&&(c[d]=i[d]);i=c,u?GJ(u,a)(...c):o(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function GJ(e,t){let n;return r;function r(...o){const a=e.length>o.length;let l;a&&o.push(i);try{l=e.apply(this,o)}catch(c){const u=c;if(a&&n)throw u;return i(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){n||(n=!0,t(o,...a))}function s(o){i(null,o)}}const ui={basename:YJ,dirname:XJ,extname:ZJ,join:QJ,sep:"/"};function YJ(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');rd(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,a=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(e.codePointAt(i)===t.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function XJ(e){if(rd(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function ZJ(e){rd(e);let t=e.length,n=-1,r=0,i=-1,s=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function QJ(...e){let t=-1,n;for(;++t<e.length;)rd(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":JJ(n)}function JJ(e){rd(e);const t=e.codePointAt(0)===47;let n=eee(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function eee(e,t){let n="",r=0,i=-1,s=0,o=-1,a,l;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function rd(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const tee={cwd:nee};function nee(){return"/"}function Lx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ree(e){if(typeof e=="string")e=new URL(e);else if(!Lx(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return iee(e)}function iee(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Ug=["history","path","basename","stem","extname","dirname"];class LR{constructor(t){let n;t?Lx(t)?n={path:t}:typeof t=="string"||see(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":tee.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ug.length;){const s=Ug[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)Ug.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?ui.basename(this.path):void 0}set basename(t){qg(t,"basename"),Wg(t,"basename"),this.path=ui.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ui.dirname(this.path):void 0}set dirname(t){ZC(this.basename,"dirname"),this.path=ui.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ui.extname(this.path):void 0}set extname(t){if(Wg(t,"extname"),ZC(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ui.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Lx(t)&&(t=ree(t)),qg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ui.basename(this.path,this.extname):void 0}set stem(t){qg(t,"stem"),Wg(t,"stem"),this.path=ui.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new An(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Wg(e,t){if(e&&e.includes(ui.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ui.sep+"`")}function qg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ZC(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function see(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const oee=function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},aee={}.hasOwnProperty;class ob extends oee{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=KJ()}copy(){const t=new ob;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Hg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Gg("data",this.frozen),this.namespace[t]=n,this):aee.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Gg("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=ih(t),r=this.parser||this.Parser;return Vg("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Vg("process",this.parser||this.Parser),Kg("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const a=ih(t),l=r.parse(a);r.run(l,a,function(u,d,f){if(u||!d||!f)return c(u);const p=d,m=r.stringify(p,f);uee(m)?f.value=m:f.result=m,c(u,f)});function c(u,d){u||!d?o(u):s?s(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),Vg("processSync",this.parser||this.Parser),Kg("processSync",this.compiler||this.Compiler),this.process(t,i),JC("processSync","process",n),r;function i(s,o){n=!0,WC(s),r=o}}run(t,n,r){QC(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,a){const l=ih(n);i.run(t,l,c);function c(u,d,f){const p=d||t;u?a(u):o?o(p):r(void 0,p,f)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),JC("runSync","run",r),i;function s(o,a){WC(o),i=a,r=!0}}stringify(t,n){this.freeze();const r=ih(n),i=this.compiler||this.Compiler;return Kg("stringify",i),QC(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Gg("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...d]=c;l(u,d)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(i.settings=Hg(!0,i.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const d=c[u];s(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,f=-1;for(;++d<r.length;)if(r[d][0]===c){f=d;break}if(f===-1)r.push([c,...u]);else if(u.length>0){let[p,...m]=u;const x=r[f][1];jx(x)&&jx(p)&&(p=Hg(!0,x,p)),r[f]=[c,p,...m]}}}}const lee=new ob().freeze();function Vg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Kg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Gg(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function QC(e){if(!jx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function JC(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ih(e){return cee(e)?e:new LR(e)}function cee(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function uee(e){return typeof e=="string"||dee(e)}function dee(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const hee="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",e2=[],t2={allowDangerousHtml:!0},fee=/^(https?|ircs?|mailto|xmpp)$/i,pee=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function _l(e){const t=mee(e),n=gee(e);return vee(t.runSync(t.parse(n),n),e)}function mee(e){const t=e.rehypePlugins||e2,n=e.remarkPlugins||e2,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...t2}:t2;return lee().use(ZQ).use(n).use(qJ,r).use(t)}function gee(e){const t=e.children||"",n=new LR;return typeof t=="string"&&(n.value=t),n}function vee(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||DR;for(const u of pee)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+hee+u.id,void 0);return sb(e,c),jX(e,{Fragment:h.Fragment,components:i,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function c(u,d,f){if(u.type==="raw"&&f&&typeof d=="number")return o?f.children.splice(d,1):f.children[d]={type:"text",value:u.value},d;if(u.type==="element"){let p;for(p in $g)if(Object.hasOwn($g,p)&&Object.hasOwn(u.properties,p)){const m=u.properties[p],x=$g[p];(x===null||x.includes(u.tagName))&&(u.properties[p]=l(String(m||""),p,u))}}if(u.type==="element"){let p=n?!n.includes(u.tagName):s?s.includes(u.tagName):!1;if(!p&&r&&typeof d=="number"&&(p=!r(u,d,f)),p&&f&&typeof d=="number")return a&&u.children?f.children.splice(d,1,...u.children):f.children.splice(d,1),d}}}function DR(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||fee.test(e.slice(0,t))?e:""}function n2(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function xee(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function yee(e,t,n){const i=bm((n||{}).ignore||[]),s=_ee(t);let o=-1;for(;++o<s.length;)MR(e,"text",a);function a(c,u){let d=-1,f;for(;++d<u.length;){const p=u[d],m=f?f.children:void 0;if(i(p,m?m.indexOf(p):void 0,f))return;f=p}if(f)return l(c,u)}function l(c,u){const d=u[u.length-1],f=s[o][0],p=s[o][1];let m=0;const w=d.children.indexOf(c);let v=!1,_=[];f.lastIndex=0;let b=f.exec(c.value);for(;b;){const S=b.index,C={index:b.index,input:b.input,stack:[...u,c]};let k=p(...b,C);if(typeof k=="string"&&(k=k.length>0?{type:"text",value:k}:void 0),k===!1?f.lastIndex=S+1:(m!==S&&_.push({type:"text",value:c.value.slice(m,S)}),Array.isArray(k)?_.push(...k):k&&_.push(k),m=S+b[0].length,v=!0),!f.global)break;b=f.exec(c.value)}return v?(m<c.value.length&&_.push({type:"text",value:c.value.slice(m)}),d.children.splice(w,1,..._)):_=[c],w+_.length}}function _ee(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([bee(i[0]),wee(i[1])])}return t}function bee(e){return typeof e=="string"?new RegExp(xee(e),"g"):e}function wee(e){return typeof e=="function"?e:function(){return e}}const Yg="phrasing",Xg=["autolink","link","image","label"];function See(){return{transforms:[Pee],enter:{literalAutolink:Cee,literalAutolinkEmail:Zg,literalAutolinkHttp:Zg,literalAutolinkWww:Zg},exit:{literalAutolink:Tee,literalAutolinkEmail:Nee,literalAutolinkHttp:Eee,literalAutolinkWww:Iee}}}function kee(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Yg,notInConstruct:Xg},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Yg,notInConstruct:Xg},{character:":",before:"[ps]",after:"\\/",inConstruct:Yg,notInConstruct:Xg}]}}function Cee(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Zg(e){this.config.enter.autolinkProtocol.call(this,e)}function Eee(e){this.config.exit.autolinkProtocol.call(this,e)}function Iee(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Nee(e){this.config.exit.autolinkEmail.call(this,e)}function Tee(e){this.exit(e)}function Pee(e){yee(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Ree],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Aee]],{ignore:["link","linkReference"]})}function Ree(e,t,n,r,i){let s="";if(!OR(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!Mee(n)))return!1;const o=jee(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:s+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function Aee(e,t,n,r){return!OR(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Mee(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function jee(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=n2(e,"(");let s=n2(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function OR(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||qo(n)||ym(n))&&(!t||n!==47)}BR.peek=Uee;function Lee(){this.buffer()}function Dee(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Oee(){this.buffer()}function Bee(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function $ee(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Yr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function zee(e){this.exit(e)}function Fee(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Yr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Hee(e){this.exit(e)}function Uee(){return"["}function BR(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),a(),o(),s+=i.move("]"),s}function Wee(){return{enter:{gfmFootnoteCallString:Lee,gfmFootnoteCall:Dee,gfmFootnoteDefinitionLabelString:Oee,gfmFootnoteDefinition:Bee},exit:{gfmFootnoteCallString:$ee,gfmFootnoteCall:zee,gfmFootnoteDefinitionLabelString:Fee,gfmFootnoteDefinition:Hee}}}function qee(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:BR},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,o){const a=s.createTracker(o);let l=a.move("[^");const c=s.enter("footnoteDefinition"),u=s.enter("label");return l+=a.move(s.safe(s.associationId(r),{before:l,after:"]"})),u(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((t?`
|
|
560
|
+
`:" ")+s.indentLines(s.containerFlow(r,a.current()),t?$R:Vee))),c(),l}}function Vee(e,t,n){return t===0?e:$R(e,t,n)}function $R(e,t,n){return(n?"":" ")+e}const Kee=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];zR.peek=Qee;function Gee(){return{canContainEols:["delete"],enter:{strikethrough:Xee},exit:{strikethrough:Zee}}}function Yee(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Kee}],handlers:{delete:zR}}}function Xee(e){this.enter({type:"delete",children:[]},e)}function Zee(e){this.exit(e)}function zR(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function Qee(){return"~"}function Jee(e){return e.length}function ete(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Jee,s=[],o=[],a=[],l=[];let c=0,u=-1;for(;++u<e.length;){const x=[],w=[];let v=-1;for(e[u].length>c&&(c=e[u].length);++v<e[u].length;){const _=tte(e[u][v]);if(n.alignDelimiters!==!1){const b=i(_);w[v]=b,(l[v]===void 0||b>l[v])&&(l[v]=b)}x.push(_)}o[u]=x,a[u]=w}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)s[d]=r2(r[d]);else{const x=r2(r);for(;++d<c;)s[d]=x}d=-1;const f=[],p=[];for(;++d<c;){const x=s[d];let w="",v="";x===99?(w=":",v=":"):x===108?w=":":x===114&&(v=":");let _=n.alignDelimiters===!1?1:Math.max(1,l[d]-w.length-v.length);const b=w+"-".repeat(_)+v;n.alignDelimiters!==!1&&(_=w.length+_+v.length,_>l[d]&&(l[d]=_),p[d]=_),f[d]=b}o.splice(1,0,f),a.splice(1,0,p),u=-1;const m=[];for(;++u<o.length;){const x=o[u],w=a[u];d=-1;const v=[];for(;++d<c;){const _=x[d]||"";let b="",S="";if(n.alignDelimiters!==!1){const C=l[d]-(w[d]||0),k=s[d];k===114?b=" ".repeat(C):k===99?C%2?(b=" ".repeat(C/2+.5),S=" ".repeat(C/2-.5)):(b=" ".repeat(C/2),S=b):S=" ".repeat(C)}n.delimiterStart!==!1&&!d&&v.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&_==="")&&(n.delimiterStart!==!1||d)&&v.push(" "),n.alignDelimiters!==!1&&v.push(b),v.push(_),n.alignDelimiters!==!1&&v.push(S),n.padding!==!1&&v.push(" "),(n.delimiterEnd!==!1||d!==c-1)&&v.push("|")}m.push(n.delimiterEnd===!1?v.join("").replace(/ +$/,""):v.join(""))}return m.join(`
|
|
561
|
+
`)}function tte(e){return e==null?"":String(e)}function r2(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function nte(e,t,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const o=n.indentLines(n.containerFlow(e,s.current()),rte);return i(),o}function rte(e,t,n){return">"+(n?"":" ")+e}function ite(e,t){return i2(e,t.inConstruct,!0)&&!i2(e,t.notInConstruct,!1)}function i2(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function s2(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
562
|
+
`&&ite(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
563
|
+
`}function ste(e,t){const n=String(e);let r=n.indexOf(t),i=r,s=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+t.length,r=n.indexOf(t,i);return o}function ote(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function ate(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function lte(e,t,n,r){const i=ate(n),s=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(ote(e,n)){const d=n.enter("codeIndented"),f=n.indentLines(s,cte);return d(),f}const a=n.createTracker(r),l=i.repeat(Math.max(ste(s,i)+1,3)),c=n.enter("codeFenced");let u=a.move(l);if(e.lang){const d=n.enter(`codeFencedLang${o}`);u+=a.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...a.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${o}`);u+=a.move(" "),u+=a.move(n.safe(e.meta,{before:u,after:`
|
|
564
|
+
`,encode:["`"],...a.current()})),d()}return u+=a.move(`
|
|
565
|
+
`),s&&(u+=a.move(s+`
|
|
566
|
+
`)),u+=a.move(l),c(),u}function cte(e,t,n){return(n?"":" ")+e}function ab(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function ute(e,t,n,r){const i=ab(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":`
|
|
567
|
+
`,...l.current()}))),a(),e.title&&(a=n.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(n.safe(e.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),o(),c}function dte(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Pu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ep(e,t,n){const r=yl(e),i=yl(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}FR.peek=hte;function FR(e,t,n,r){const i=dte(n),s=n.enter("emphasis"),o=n.createTracker(r),a=o.move(i);let l=o.move(n.containerPhrasing(e,{after:i,before:a,...o.current()}));const c=l.charCodeAt(0),u=ep(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(l=Pu(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=ep(r.after.charCodeAt(0),d,i);f.inside&&(l=l.slice(0,-1)+Pu(d));const p=o.move(i);return s(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+p}function hte(e,t,n){return n.options.emphasis||"*"}function fte(e,t){let n=!1;return sb(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Ax}),!!((!e.depth||e.depth<3)&&Q_(e)&&(t.options.setext||n))}function pte(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(fte(e,n)){const u=n.enter("headingSetext"),d=n.enter("phrasing"),f=n.containerPhrasing(e,{...s.current(),before:`
|
|
568
|
+
`,after:`
|
|
569
|
+
`});return d(),u(),f+`
|
|
570
|
+
`+(i===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
|
|
571
|
+
`))+1))}const o="#".repeat(i),a=n.enter("headingAtx"),l=n.enter("phrasing");s.move(o+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
|
|
572
|
+
`,...s.current()});return/^[\t ]/.test(c)&&(c=Pu(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),a(),c}HR.peek=mte;function HR(e){return e.value||""}function mte(){return"<"}UR.peek=gte;function UR(e,t,n,r){const i=ab(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${s}`),c+=l.move(" "+i),c+=l.move(n.safe(e.title,{before:c,after:i,...l.current()})),c+=l.move(i),a()),c+=l.move(")"),o(),c}function gte(){return"!"}WR.peek=vte;function WR(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const c=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=u,s(),i==="full"||!c||c!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function vte(){return"!"}qR.peek=xte;function qR(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const o=n.unsafe[s],a=n.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return i+r+i}function xte(){return"`"}function VR(e,t){const n=Q_(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}KR.peek=yte;function KR(e,t,n,r){const i=ab(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(VR(e,n)){const u=n.stack;n.stack=[],a=n.enter("autolink");let d=o.move("<");return d+=o.move(n.containerPhrasing(e,{before:d,after:">",...o.current()})),d+=o.move(">"),a(),n.stack=u,d}a=n.enter("link"),l=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=n.enter("destinationRaw"),c+=o.move(n.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(n.safe(e.title,{before:c,after:i,...o.current()})),c+=o.move(i),l()),c+=o.move(")"),a(),c}function yte(e,t,n){return VR(e,n)?"<":"["}GR.peek=_te;function GR(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=u,s(),i==="full"||!c||c!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function _te(){return"["}function lb(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function bte(e){const t=lb(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function wte(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function YR(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Ste(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=e.ordered?wte(n):lb(n);const a=e.ordered?o==="."?")":".":bte(n);let l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const u=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),YR(n)===o&&u){let d=-1;for(;++d<e.children.length;){const f=e.children[d];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),n.bulletCurrent=o;const c=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=s,i(),c}function kte(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Cte(e,t,n,r){const i=kte(n);let s=n.bulletCurrent||lb(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(s+" ".repeat(o-s.length)),a.shift(o);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),u);return l(),c;function u(d,f,p){return f?(p?"":" ".repeat(o))+d:(p?s:s+" ".repeat(o-s.length))+d}}function Ete(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(e,r);return s(),i(),o}const Ite=bm(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Nte(e,t,n,r){return(e.children.some(function(o){return Ite(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Tte(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}XR.peek=Pte;function XR(e,t,n,r){const i=Tte(n),s=n.enter("strong"),o=n.createTracker(r),a=o.move(i+i);let l=o.move(n.containerPhrasing(e,{after:i,before:a,...o.current()}));const c=l.charCodeAt(0),u=ep(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(l=Pu(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=ep(r.after.charCodeAt(0),d,i);f.inside&&(l=l.slice(0,-1)+Pu(d));const p=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+p}function Pte(e,t,n){return n.options.strong||"*"}function Rte(e,t,n,r){return n.safe(e.value,r)}function Ate(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Mte(e,t,n){const r=(YR(n)+(n.options.ruleSpaces?" ":"")).repeat(Ate(n));return n.options.ruleSpaces?r.slice(0,-1):r}const ZR={blockquote:nte,break:s2,code:lte,definition:ute,emphasis:FR,hardBreak:s2,heading:pte,html:HR,image:UR,imageReference:WR,inlineCode:qR,link:KR,linkReference:GR,list:Ste,listItem:Cte,paragraph:Ete,root:Nte,strong:XR,text:Rte,thematicBreak:Mte};function jte(){return{enter:{table:Lte,tableData:o2,tableHeader:o2,tableRow:Ote},exit:{codeText:Bte,table:Dte,tableData:Qg,tableHeader:Qg,tableRow:Qg}}}function Lte(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Dte(e){this.exit(e),this.data.inTable=void 0}function Ote(e){this.enter({type:"tableRow",children:[]},e)}function Qg(e){this.exit(e)}function o2(e){this.enter({type:"tableCell",children:[]},e)}function Bte(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,$te));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function $te(e,t){return t==="|"?t:e}function zte(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
573
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:l,tableRow:a}};function o(p,m,x,w){return c(u(p,x,w),p.align)}function a(p,m,x,w){const v=d(p,x,w),_=c([v]);return _.slice(0,_.indexOf(`
|
|
574
|
+
`))}function l(p,m,x,w){const v=x.enter("tableCell"),_=x.enter("phrasing"),b=x.containerPhrasing(p,{...w,before:s,after:s});return _(),v(),b}function c(p,m){return ete(p,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function u(p,m,x){const w=p.children;let v=-1;const _=[],b=m.enter("table");for(;++v<w.length;)_[v]=d(w[v],m,x);return b(),_}function d(p,m,x){const w=p.children;let v=-1;const _=[],b=m.enter("tableRow");for(;++v<w.length;)_[v]=l(w[v],p,m,x);return b(),_}function f(p,m,x){let w=ZR.inlineCode(p,m,x);return x.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function Fte(){return{exit:{taskListCheckValueChecked:a2,taskListCheckValueUnchecked:a2,paragraph:Ute}}}function Hte(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Wte}}}function a2(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Ute(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let s=-1,o;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){o=a;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Wte(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let l=ZR.listItem(e,t,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+o}}function qte(){return[See(),Wee(),Gee(),jte(),Fte()]}function Vte(e){return{extensions:[kee(),qee(e),Yee(),zte(e),Hte()]}}const Kte={tokenize:Jte,partial:!0},QR={tokenize:ene,partial:!0},JR={tokenize:tne,partial:!0},eA={tokenize:nne,partial:!0},Gte={tokenize:rne,partial:!0},tA={name:"wwwAutolink",tokenize:Zte,previous:rA},nA={name:"protocolAutolink",tokenize:Qte,previous:iA},cs={name:"emailAutolink",tokenize:Xte,previous:sA},Ri={};function Yte(){return{text:Ri}}let mo=48;for(;mo<123;)Ri[mo]=cs,mo++,mo===58?mo=65:mo===91&&(mo=97);Ri[43]=cs;Ri[45]=cs;Ri[46]=cs;Ri[95]=cs;Ri[72]=[cs,nA];Ri[104]=[cs,nA];Ri[87]=[cs,tA];Ri[119]=[cs,tA];function Xte(e,t,n){const r=this;let i,s;return o;function o(d){return!Dx(d)||!sA.call(r,r.previous)||cb(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(d))}function a(d){return Dx(d)?(e.consume(d),a):d===64?(e.consume(d),l):n(d)}function l(d){return d===46?e.check(Gte,u,c)(d):d===45||d===95||In(d)?(s=!0,e.consume(d),l):u(d)}function c(d){return e.consume(d),i=!0,l}function u(d){return s&&i&&Ln(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function Zte(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!rA.call(r,r.previous)||cb(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Kte,e.attempt(QR,e.attempt(JR,s),n),n)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function Qte(e,t,n){const r=this;let i="",s=!1;return o;function o(d){return(d===72||d===104)&&iA.call(r,r.previous)&&!cb(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),e.consume(d),a):n(d)}function a(d){if(Ln(d)&&i.length<5)return i+=String.fromCodePoint(d),e.consume(d),a;if(d===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(d),l}return n(d)}function l(d){return d===47?(e.consume(d),s?c:(s=!0,l)):n(d)}function c(d){return d===null||Zf(d)||dt(d)||qo(d)||ym(d)?n(d):e.attempt(QR,e.attempt(JR,u),n)(d)}function u(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function Jte(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),s):n(o)}function s(o){return o===null?n(o):t(o)}}function ene(e,t,n){let r,i,s;return o;function o(c){return c===46||c===95?e.check(eA,l,a)(c):c===null||dt(c)||qo(c)||c!==45&&ym(c)?l(c):(s=!0,e.consume(c),o)}function a(c){return c===95?r=!0:(i=r,r=void 0),e.consume(c),o}function l(c){return i||r||!s?n(c):t(c)}}function tne(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(eA,t,s)(o):o===null||dt(o)||qo(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&r++,e.consume(o),i}}function nne(e,t,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),r):a===38?(e.consume(a),s):a===93?(e.consume(a),i):a===60||a===null||dt(a)||qo(a)?t(a):n(a)}function i(a){return a===null||a===40||a===91||dt(a)||qo(a)?t(a):r(a)}function s(a){return Ln(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):Ln(a)?(e.consume(a),o):n(a)}}function rne(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return In(s)?n(s):t(s)}}function rA(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||dt(e)}function iA(e){return!Ln(e)}function sA(e){return!(e===47||Dx(e))}function Dx(e){return e===43||e===45||e===46||e===95||In(e)}function cb(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const ine={tokenize:hne,partial:!0};function sne(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:cne,continuation:{tokenize:une},exit:dne}},text:{91:{name:"gfmFootnoteCall",tokenize:lne},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:one,resolveTo:ane}}}}function one(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const c=Yr(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function ane(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function lne(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return a;function a(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(d){if(s>999||d===93&&!o||d===null||d===91||dt(d))return n(d);if(d===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(Yr(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return dt(d)||(o=!0),s++,e.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(e.consume(d),s++,c):c(d)}}function cne(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,a;return l;function l(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):n(m)}function u(m){if(o>999||m===93&&!a||m===null||m===91||dt(m))return n(m);if(m===93){e.exit("chunkString");const x=e.exit("gfmFootnoteDefinitionLabelString");return s=Yr(r.sliceSerialize(x)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return dt(m)||(a=!0),o++,e.consume(m),m===92?d:u}function d(m){return m===91||m===92||m===93?(e.consume(m),o++,u):u(m)}function f(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(s)||i.push(s),Je(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function une(e,t,n){return e.check(nd,t,e.attempt(ine,t,n))}function dne(e){e.exit("gfmFootnoteDefinition")}function hne(e,t,n){const r=this;return Je(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):n(s)}}function fne(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let c=l;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[l][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},d={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",u,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",d,a]],p=a.parser.constructs.insideSpan.null;p&&yn(f,f.length,0,Kl(p,o.slice(c+1,l),a)),yn(f,f.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),yn(o,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function s(o,a,l){const c=this.previous,u=this.events;let d=0;return f;function f(m){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(m):(o.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const x=yl(c);if(m===126)return d>1?l(m):(o.consume(m),d++,p);if(d<2&&!n)return l(m);const w=o.exit("strikethroughSequenceTemporary"),v=yl(m);return w._open=!v||v===2&&!!x,w._close=!x||x===2&&!!v,a(m)}}}class pne{constructor(){this.map=[]}add(t,n,r){mne(this,t,n,r)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function mne(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function gne(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function vne(){return{flow:{null:{name:"table",tokenize:xne,resolveAll:yne}}}}function xne(e,t,n){const r=this;let i=0,s=0,o;return a;function a(P){let D=r.events.length-1;for(;D>-1;){const M=r.events[D][1].type;if(M==="lineEnding"||M==="linePrefix")D--;else break}const R=D>-1?r.events[D][1].type:null,A=R==="tableHead"||R==="tableRow"?k:l;return A===k&&r.parser.lazy[r.now().line]?n(P):A(P)}function l(P){return e.enter("tableHead"),e.enter("tableRow"),c(P)}function c(P){return P===124||(o=!0,s+=1),u(P)}function u(P){return P===null?n(P):Ee(P)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),p):n(P):Ge(P)?Je(e,u,"whitespace")(P):(s+=1,o&&(o=!1,i+=1),P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),o=!0,u):(e.enter("data"),d(P)))}function d(P){return P===null||P===124||dt(P)?(e.exit("data"),u(P)):(e.consume(P),P===92?f:d)}function f(P){return P===92||P===124?(e.consume(P),d):d(P)}function p(P){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(P):(e.enter("tableDelimiterRow"),o=!1,Ge(P)?Je(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):m(P))}function m(P){return P===45||P===58?w(P):P===124?(o=!0,e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),x):C(P)}function x(P){return Ge(P)?Je(e,w,"whitespace")(P):w(P)}function w(P){return P===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),v):P===45?(s+=1,v(P)):P===null||Ee(P)?S(P):C(P)}function v(P){return P===45?(e.enter("tableDelimiterFiller"),_(P)):C(P)}function _(P){return P===45?(e.consume(P),_):P===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),b):(e.exit("tableDelimiterFiller"),b(P))}function b(P){return Ge(P)?Je(e,S,"whitespace")(P):S(P)}function S(P){return P===124?m(P):P===null||Ee(P)?!o||i!==s?C(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(P)):C(P)}function C(P){return n(P)}function k(P){return e.enter("tableRow"),N(P)}function N(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),N):P===null||Ee(P)?(e.exit("tableRow"),t(P)):Ge(P)?Je(e,N,"whitespace")(P):(e.enter("data"),E(P))}function E(P){return P===null||P===124||dt(P)?(e.exit("data"),N(P)):(e.consume(P),P===92?L:E)}function L(P){return P===92||P===124?(e.consume(P),E):E(P)}}function yne(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,u,d;const f=new pne;for(;++n<e.length;){const p=e[n],m=p[1];p[0]==="enter"?m.type==="tableHead"?(a=!1,l!==0&&(l2(f,t,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",c,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,d=void 0,s=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",u,t]])),i=m.type==="tableDelimiterRow"?2:u?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],d=sh(f,t,s,i,void 0,d),s=[0,0,0,0]),o[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],d=sh(f,t,s,i,void 0,d)),s=o,o=[s[1],n,0,0])):m.type==="tableHead"?(a=!0,l=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=n,s[1]!==0?(o[0]=o[1],d=sh(f,t,s,i,n,d)):o[1]!==0&&(d=sh(f,t,o,i,n,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&l2(f,t,l,c,u),f.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=gne(t.events,n))}return e}function sh(e,t,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(s.end=Object.assign({},wa(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const l=wa(t.events,n[1]);if(s={type:o,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const c=wa(t.events,n[2]),u=wa(t.events,n[3]),d={type:a,start:Object.assign({},c),end:Object.assign({},u)};if(e.add(n[2],0,[["enter",d,t]]),r!==2){const f=t.events[n[2]],p=t.events[n[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,x=n[3]-n[2]-1;e.add(m,x,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return i!==void 0&&(s.end=Object.assign({},wa(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function l2(e,t,n,r,i){const s=[],o=wa(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function wa(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const _ne={name:"tasklistCheck",tokenize:wne};function bne(){return{text:{91:_ne}}}function wne(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),s)}function s(l){return dt(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return Ee(l)?t(l):Ge(l)?e.check({tokenize:Sne},t,n)(l):n(l)}}function Sne(e,t,n){return Je(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function kne(e){return pR([Yte(),sne(),fne(e),vne(),bne()])}const Cne={};function bl(e){const t=this,n=e||Cne,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(kne(n)),s.push(qte()),o.push(Vte(n))}const Ui={eof:null,asterisk:42,underscore:95,tilde:126},wl={attentionSideAfter:2,characterGroupPunctuation:2,characterGroupWhitespace:1},di={data:"data",characterEscape:"characterEscape",emphasis:"emphasis",emphasisSequence:"emphasisSequence",emphasisText:"emphasisText",strong:"strong",strongSequence:"strongSequence",strongText:"strongText"},Ene=161,Ine=1114109,Nne=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],Tne=12288,Pne=65510,Rne=[12288,12288,65281,65376,65504,65510],Ane=8361,Mne=65518,jne=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],Lne=32,Dne=10630,One=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],Bne=4352,$ne=262141,oA=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101594,101631,101664,101760,101874,101888,102801,102816,102866,110576,110579,110581,110587,110589,110590,110592,110888,110898,110898,110928,110930,110933,110933,110948,110952,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127406,127406,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128729,128732,128735,128747,128748,128756,128764,128986,128986,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129734,129736,129736,129740,129757,129759,129771,129775,129786,131072,196605,196608,262141],id=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){const i=Math.floor((n+r)/2),s=i*2;if(t<e[s])r=i-1;else if(t>e[s+1])n=i+1;else return!0}return!1},c2=19968,[zne,Fne]=Hne(oA);function Hne(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){const i=e[r],s=e[r+1];if(c2>=i&&c2<=s)return[i,s];s-i>n-t&&(t=i,n=s)}return[t,n]}const Une=e=>e<Ene||e>Ine?!1:id(Nne,e),Wne=e=>e<Tne||e>Pne?!1:id(Rne,e),qne=e=>e<Ane||e>Mne?!1:id(jne,e),Vne=e=>e<Lne||e>Dne?!1:id(One,e),Kne=e=>e>=zne&&e<=Fne?!0:e<Bne||e>$ne?!1:id(oA,e);function Gne(e){return Une(e)?"ambiguous":Wne(e)?"fullwidth":qne(e)?"halfwidth":Vne(e)?"narrow":Kne(e)?"wide":"neutral"}function Yne(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function Xne(e){return Yne(e),Gne(e)}function Zne(e){return new RegExp("^\\p{Emoji_Presentation}","u").test(String.fromCodePoint(e))}function Qne(e){if(!e||e<4352)return!1;switch(Xne(e)){case"fullwidth":case"halfwidth":return!0;case"wide":return!Zne(e);case"narrow":return!1;case"ambiguous":return 917760<=e&&e<=917999?null:!1;case"neutral":return new RegExp("^\\p{sc=Hangul}","u").test(String.fromCodePoint(e))}}function Jne(e,t){return t!==65025||!e||e<8216?!1:e===8216||e===8217||e===8220||e===8221}function ere(e){return e!==null&&e>=65024&&e<=65038}const tre=aA(new RegExp("\\p{P}|\\p{S}","u")),nre=aA(/\s/);function aA(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCodePoint(n))}}function Ru(e){return!!(e&wl.characterGroupWhitespace)}function tp(e){return(e&dr.cjkPunctuation)===wl.characterGroupPunctuation}function Ox(e){return!!(e&dr.cjk)}function rre(e){return e===dr.ivs}function ire(e){return!!(e&dr.cjkOrIvs)}function sre(e){return e===dr.nonEmojiGeneralUseVS}function u2(e){return!!(e&dr.spaceOrPunctuation)}let dr;(function(e){e.spaceOrPunctuation=3,e.cjk=4096,e.cjkPunctuation=4098,e.ivs=8192,e.cjkOrIvs=12288,e.nonEmojiGeneralUseVS=16384,e.variationSelector=24576,e.ivsToCjkRightShift=1})(dr||(dr={}));function Ja(e){if(e===Ui.eof||dt(e)||nre(e))return wl.characterGroupWhitespace;let t=0;if(e>=4352){if(ere(e))return dr.nonEmojiGeneralUseVS;switch(Qne(e)){case null:return dr.ivs;case!0:t|=dr.cjk;break}}return tre(e)&&(t|=wl.characterGroupPunctuation),t}function lA(e,t,n){if(!sre(e))return e;const r=t(),i=Ja(r);return!r||Ru(i)?e:Jne(r,n)?dr.cjkPunctuation:ore(i)}function ore(e){return e&~dr.ivs}function cA(e){return!!(e&&e>=55296&&e<=56319)}function uA(e){return!!(e&&e>=56320&&e<=57343)}function dA(e,t,n){if(t._bufferIndex<2)return e;const r=n({start:{...t,_bufferIndex:t._bufferIndex-2},end:t}).codePointAt(0);return r&&r>=65536?r:e}function are(e,t,n){const r=e>=65536?2:1;if(t._bufferIndex<1+r)return null;const i=t._bufferIndex-r-2,s=n({start:{...t,_bufferIndex:i>=0?i:0},end:{...t,_bufferIndex:t._bufferIndex-r}}),o=s.charCodeAt(s.length-1);if(Number.isNaN(o))return null;if(s.length<2||o<56320||57343<o)return o;const a=s.codePointAt(0);return a&&a>=65536?a:o}var hA=class{constructor(e,t,n){Lb(this,"cachedValue");this.previousCode=e,this.nowPoint=t,this.sliceSerialize=n}value(){return this.cachedValue===void 0&&(this.cachedValue=are(this.previousCode,this.nowPoint,this.sliceSerialize)),this.cachedValue}};function fA(e,t,n){const r=n({start:t,end:{...t,_bufferIndex:t._bufferIndex+2}}).codePointAt(0);return r&&r>=65536?r:e}const Jg={name:"attention",resolveAll:lre,tokenize:cre};function lre(e,t){let n=-1,r,i,s,o,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};d2(d,-l),d2(f,l),o={type:l>1?di.strongSequence:di.emphasisSequence,start:d,end:{...e[r][1].end}},a={type:l>1?di.strongSequence:di.emphasisSequence,start:{...e[n][1].start},end:f},s={type:l>1?di.strongText:di.emphasisText,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?di.strong:di.emphasis,start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=gn(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=gn(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),t.parser.constructs.insideSpan.null,c=gn(c,Kl(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=gn(c,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=gn(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,yn(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function cre(e,t){const n=this.parser.constructs.attentionMarkers.null,{now:r,sliceSerialize:i,previous:s}=this,o=uA(s)?dA(s,r(),i):s,a=Ja(o),l=new hA(o,r(),i),c=lA(a,l.value.bind(l),o);let u;return d;function d(p){return u=p,e.enter("attentionSequence"),f(p)}function f(p){if(p===u)return e.consume(p),f;const m=e.exit("attentionSequence"),x=Ja(cA(p)?fA(p,r(),i):p),w=tp(c),v=w||Ru(c),_=tp(x),b=_||Ru(x),S=ire(c),C=!b||_&&(v||S)||n.includes(p),k=!v||w&&(b||Ox(x))||n.includes(o);return m._open=!!(u===Ui.asterisk?C:C&&(u2(c)||!k)),m._close=!!(u===Ui.asterisk?k:k&&(u2(x)||!C)),t(p)}}function d2(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}function ure(){return{text:{[Ui.asterisk]:Jg,[Ui.underscore]:Jg},insideSpan:{null:[Jg]}}}function dre(){const e=this.data();(e.micromarkExtensions||(e.micromarkExtensions=[])).push(ure())}function hre(e){let t=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:i,resolveAll:r};return t==null&&(t=!0),{text:{[Ui.tilde]:n},insideSpan:{null:[n]},attentionMarkers:{null:[Ui.tilde]}};function r(s,o){let a=-1;for(;++a<s.length;)if(s[a][0]==="enter"&&s[a][1].type==="strikethroughSequenceTemporary"&&s[a][1]._close){let l=a;for(;l--;)if(s[l][0]==="exit"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._open&&s[a][1].end.offset-s[a][1].start.offset===s[l][1].end.offset-s[l][1].start.offset){s[a][1].type="strikethroughSequence",s[l][1].type="strikethroughSequence";const c={type:"strikethrough",start:Object.assign({},s[l][1].start),end:Object.assign({},s[a][1].end)},u={type:"strikethroughText",start:Object.assign({},s[l][1].end),end:Object.assign({},s[a][1].start)},d=[["enter",c,o],["enter",s[l][1],o],["exit",s[l][1],o],["enter",u,o]],f=o.parser.constructs.insideSpan.null;f&&yn(d,d.length,0,Kl(f,s.slice(l+1,a),o)),yn(d,d.length,0,[["exit",u,o],["enter",s[a][1],o],["exit",s[a][1],o],["exit",c,o]]),yn(s,l-1,a-l+3,d),a=l+d.length-2;break}}for(a=-1;++a<s.length;)s[a][1].type==="strikethroughSequenceTemporary"&&(s[a][1].type=di.data);return s}function i(s,o,a){const{now:l,sliceSerialize:c,previous:u}=this,d=uA(u)?dA(u,l(),c):u,f=Ja(d),p=new hA(d,l(),c),m=lA(f,p.value.bind(p),d),x=this.events;let w=0;return v;function v(b){return d===Ui.tilde&&x[x.length-1][1].type!==di.characterEscape?a(b):(s.enter("strikethroughSequenceTemporary"),_(b))}function _(b){const S=Ja(d);if(b===Ui.tilde)return w>1?a(b):(s.consume(b),w++,_);if(w<2&&!t)return a(b);const C=s.exit("strikethroughSequenceTemporary"),k=Ja(cA(b)?fA(b,l(),c):b),N=tp(m)||Ru(m),E=tp(k)||Ru(k),L=Ox(m)||rre(S);return C._open=!E||k===wl.attentionSideAfter&&(N||L),C._close=!N||S===wl.attentionSideAfter&&(E||Ox(k)),o(b)}}}function fre(e){const t=this.data();(t.micromarkExtensions||(t.micromarkExtensions=[])).push(hre(e))}function Sm(e){if(!e)return!1;const n=e.split("#")[0].split("?")[0].toLowerCase();return n.endsWith(".md")||n.endsWith(".markdown")}function pre(e){if(!e)return null;let t;if(e.startsWith("file://")){const n=e.slice(7);t=n.startsWith("/")?n:`/${n.split("/").slice(1).join("/")}`}else{if(/^[a-z][a-z0-9+.-]*:/i.test(e))return null;if(e.startsWith("/"))t=e;else return null}try{return decodeURIComponent(t)}catch{return t}}const mre=/\.(png|jpe?g|webp|gif|svg)$/i;function gre(e,t){if((typeof t=="string"?t:null)!==e)return!1;try{const r=new URL(e);return mre.test(r.pathname)}catch{return!1}}function vre(e){try{return new URL(e).pathname.split("/").filter(Boolean).pop()??""}catch{return""}}const Qs={a:({node:e,href:t,children:n,...r})=>typeof t=="string"&&gre(t,n)?h.jsxs("span",{className:"my-1 inline-flex flex-col items-start gap-1 align-top",children:[h.jsx("img",{src:t,alt:vre(t),className:"max-w-full h-auto rounded border border-border"}),h.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"max-w-full truncate text-[11px] text-text-300 underline decoration-dotted underline-offset-2 hover:text-text-100",children:t})]}):h.jsx("a",{...r,href:t,target:"_blank",rel:"noopener noreferrer",children:n})};function pA(e){return e.startsWith("file://")?e:DR(e)}function mA(e){return{...Qs,a:t=>{const{href:n,children:r}=t,i=typeof n=="string"?pre(n):null;if(i===null){const s=Qs.a;return h.jsx(s,{...t})}return h.jsx("a",{href:n,"data-testid":"assistant-file-link",title:i,onClick:s=>{s.preventDefault(),e(i)},children:r})}}}function xre({text:e,forkTarget:t,onOpenFilePath:n}){const{body:r}=vm(e),i=Qe.useMemo(()=>n?mA(n):Qs,[n]);return r?h.jsxs("div",{className:"group relative flex min-w-0 max-w-full flex-col items-start","data-testid":"msg-line-assistant-wrapper",children:[h.jsx("div",{"data-testid":"msg-line-assistant",className:"assistant-markdown w-full min-w-0 max-w-full py-1 break-words",children:h.jsx(_l,{remarkPlugins:[bl,dre,fre],components:i,...n?{urlTransform:pA}:{},children:r})}),t?h.jsxs("div",{className:"mt-1 flex flex-row items-center gap-1 md:absolute md:top-full md:mt-0 md:pt-0.5 md:z-10 md:rounded-md md:pointer-events-none md:group-hover:pointer-events-auto md:group-hover:bg-bg-100",children:[t.onFork?h.jsxs("button",{type:"button","data-testid":"assistant-msg-fork","aria-label":"fork from this message",title:"从这条消息派生新 session(截断之后的对话)",onClick:()=>t.onFork(t.messageUuid),className:"inline-flex items-center justify-start gap-1 h-7 w-7 md:h-6 md:w-auto md:px-1.5 rounded-md text-[11px] text-text-400/60 md:text-text-400 hover:bg-text-100/5 hover:text-text-200 md:opacity-0 md:group-hover:opacity-100 md:transition-opacity cursor-pointer",children:[h.jsx(pl,{className:"w-3 h-3",strokeWidth:2}),h.jsx("span",{className:"hidden md:inline",children:"Fork"})]}):null,t.onQuickAsk?h.jsxs("button",{type:"button","data-testid":"assistant-msg-quick-ask","aria-label":"quick ask from this message",title:"快速问答:从这条消息派生临时会话,关闭即删",onClick:()=>t.onQuickAsk(t.messageUuid),className:"inline-flex items-center justify-start gap-1 h-7 w-7 md:h-6 md:w-auto md:px-1.5 rounded-md text-[11px] text-text-400/60 md:text-text-400 hover:bg-text-100/5 hover:text-text-200 md:opacity-0 md:group-hover:opacity-100 md:transition-opacity cursor-pointer",children:[h.jsx(rF,{className:"w-3 h-3",strokeWidth:2}),h.jsx("span",{className:"hidden md:inline",children:"问一下"})]}):null]}):null]}):null}function yre({text:e}){const[t,n]=g.useState(!1);return e?h.jsxs("div",{"data-testid":"msg-line-thinking",className:"text-[12px] text-text-400",children:[h.jsxs("button",{type:"button",onClick:()=>n(r=>!r),className:"flex items-center gap-1 hover:text-text-300 transition-colors cursor-pointer","aria-expanded":t,"data-testid":"msg-line-thinking-toggle",children:[t?h.jsx(Pn,{className:"w-3 h-3"}):h.jsx(Fn,{className:"w-3 h-3"}),h.jsx("span",{children:"💭 Thinking"})]}),t?h.jsx("div",{className:"ml-4 mt-1 italic text-text-400 whitespace-pre-wrap break-words",children:e}):null]}):null}const _re=new Set(["Write","Edit","MultiEdit","NotebookEdit"]);function Bx(e){return _re.has(e)}function bre({tool:e,relPath:t,scope:n,onShareFile:r}){if(!Bx(e)||!t||!n||!r)return null;const i=Sm(t)?"md-rendered":"raw";return h.jsx("span",{"data-testid":"file-edit-hover-row",className:"inline-flex shrink-0 items-center gap-1",children:h.jsx("span",{role:"button",tabIndex:0,"data-testid":"file-edit-share-btn","aria-label":"Share link",title:"Share link",onClick:s=>{s.stopPropagation(),r(t,i)},onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.stopPropagation(),s.preventDefault(),r(t,i))},className:"inline-flex h-3.5 w-3.5 items-center justify-center text-text-400 hover:text-text-200 cursor-pointer",children:h.jsx(t_,{className:"h-3.5 w-3.5"})})})}function wre(e){if(!e||typeof e!="object")return null;const t=e;return typeof t.file_path=="string"&&t.file_path||typeof t.notebook_path=="string"&&t.notebook_path||typeof t.path=="string"&&t.path||null||null}function gA(e,t){const[n,r]=g.useState({kind:"idle"});return g.useEffect(()=>{let i=!1,s=null;r({kind:"loading"});const o={};return t&&(o.Authorization=`Bearer ${t}`),fetch(e,{headers:o,credentials:"omit"}).then(async a=>{if(!a.ok)throw new Error(`HTTP ${a.status}`);return a.blob()}).then(a=>{if(i)return;const l=URL.createObjectURL(a);s=l,r({kind:"ready",objectUrl:l})}).catch(a=>{i||r({kind:"error",message:a.message})}),()=>{i=!0,s&&URL.revokeObjectURL(s)}},[e,t]),n}function Sre({url:e,bearerToken:t,alt:n,className:r}){const i=gA(e,t);return h.jsxs("div",{"data-testid":"blob-image","data-state":i.kind,className:re("relative inline-flex items-center justify-center rounded-md border border-border bg-bg-0",r),children:[i.kind==="loading"?h.jsx("div",{className:"flex h-24 w-32 items-center justify-center",children:h.jsx(Tn,{className:"h-4 w-4 animate-spin text-text-400"})}):null,i.kind==="error"?h.jsxs("div",{className:"flex h-24 w-32 items-center justify-center gap-1 px-2 text-[11px] text-text-400",children:[h.jsx(Jo,{className:"h-3 w-3"}),h.jsx("span",{title:i.message,children:"加载失败"})]}):null,i.kind==="ready"?h.jsx("img",{src:i.objectUrl,alt:n,className:"block max-h-[180px] max-w-[420px] rounded-md object-contain"}):null]})}function kre({url:e,bearerToken:t,className:n}){const r=gA(e,t);return h.jsxs("div",{"data-testid":"blob-video","data-state":r.kind,className:re("relative inline-flex items-center justify-center rounded-md border border-border bg-bg-0",n),children:[r.kind==="loading"?h.jsx(Tn,{className:"h-4 w-4 animate-spin text-text-400"}):null,r.kind==="error"?h.jsx("span",{className:"px-2 text-[11px] text-text-400",children:"加载失败"}):null,r.kind==="ready"?h.jsx("video",{src:r.objectUrl,controls:!0,className:"block max-h-[240px] max-w-[420px] rounded-md"}):null]})}const Cre=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg"]),Ere=new Set([".mp4",".webm",".mov"]),Ire=new Set([".pdf"]);function Nre(e){const t=e.lastIndexOf("."),n=t>=0?e.slice(t).toLowerCase():"";return Cre.has(n)?"image":Ere.has(n)?"video":Ire.has(n)?"pdf":"binary"}function vA(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Tre({relPath:e,scope:t,size:n}){const r=Xp();if(r.actionsLevel==="none")return null;const i=xz(r,t,e);if(!i)return null;const s=Nre(e);return s==="image"?h.jsx("div",{"data-testid":"file-edit-inline-preview","data-kind":"image",className:"mt-2",children:h.jsx(Sre,{url:i,bearerToken:r.httpToken,alt:e})}):s==="video"?h.jsx("div",{"data-testid":"file-edit-inline-preview","data-kind":"video",className:"mt-2",children:h.jsx(kre,{url:i,bearerToken:r.httpToken})}):s==="pdf"?h.jsx(Pre,{relPath:e,url:i,size:n}):typeof n=="number"&&n>=1024*1024?h.jsxs("div",{"data-testid":"file-edit-inline-preview","data-kind":"binary",className:"mt-2 inline-flex items-center gap-1.5 rounded border border-border bg-bg-50 px-2 py-1 text-[11px] text-text-400",children:[h.jsx(Ei,{className:"h-3 w-3"}),h.jsx("span",{className:"font-mono",children:e.split("/").pop()}),h.jsx("span",{children:"·"}),h.jsx("span",{children:vA(n)})]}):null}function Pre({relPath:e,url:t,size:n}){return h.jsxs("a",{"data-testid":"file-edit-inline-preview","data-kind":"pdf",href:t,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1.5 rounded border border-border bg-bg-50 px-2 py-1 text-[11px] text-text-300 hover:bg-bg-100",children:[h.jsx(Ei,{className:"h-3 w-3"}),h.jsx("span",{className:"font-mono",children:e.split("/").pop()}),typeof n=="number"?h.jsxs(h.Fragment,{children:[h.jsx("span",{children:"·"}),h.jsx("span",{children:vA(n)})]}):null,h.jsx(fl,{className:"h-3 w-3"})]})}const Rre={Bash:c3,Read:Ei,Edit:ux,Write:L7,Grep:zf,Glob:zf};function Are(e){return Rre[e]??VF}function Mre(e){if(!e||typeof e!="object")return"";const t=e,n=t.command??t.file_path??t.path??t.pattern??t.query??t.url??t.description;if(typeof n=="string")return n;for(const r of Object.values(t))if(typeof r=="string"&&r)return r;return""}function xA({tool:e,input:t,output:n,error:r,pending:i=!1,expandedBody:s,fileScope:o,onOpenInTab:a,onPreviewMarkdown:l,onShareFile:c}){const[u,d]=g.useState(!1),f=!!r,p=Are(e),m=Mre(t),x=wre(t);return h.jsxs("div",{"data-testid":"msg-line-tool","data-tool":e,className:re("group min-w-0 max-w-full rounded-md border px-3 py-2 text-[13px]",f?"border-destructive/40 bg-destructive/5":"border-border bg-bg-50"),children:[h.jsxs("button",{type:"button",onClick:()=>d(w=>!w),"aria-expanded":u,"data-testid":"msg-line-tool-header",className:"flex w-full items-center gap-2 text-left cursor-pointer min-w-0",children:[f?h.jsx(Jo,{className:"w-4 h-4 text-destructive shrink-0"}):h.jsx(p,{className:re("w-4 h-4 shrink-0",i?"text-text-400":"text-text-300")}),h.jsx("span",{className:"font-medium text-text-100 shrink-0",children:e}),m?(()=>{if(f||!Bx(e)||!x)return null;const v=Sm(x)&&l?l:a;return v?h.jsx("span",{role:"button",tabIndex:0,"data-testid":"msg-line-tool-preview","data-clickable":"true",title:m,onClick:_=>{_.stopPropagation(),v(x)},onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.stopPropagation(),_.preventDefault(),v(x))},className:"text-[12px] text-accent font-mono truncate min-w-0 max-w-full cursor-pointer underline underline-offset-2 hover:opacity-80",children:m}):null})()??h.jsx("span",{"data-testid":"msg-line-tool-preview",className:"text-[12px] text-text-400 font-mono truncate min-w-0 max-w-full",title:m,children:m}):null,h.jsx("span",{"aria-hidden":"true","data-testid":"msg-line-tool-header-spacer",className:"flex-1 min-w-0 self-stretch"}),i?h.jsx(Tn,{"data-testid":"msg-line-tool-pending",className:"w-3 h-3 text-text-400 animate-spin shrink-0"}):null,!f&&o?h.jsx(bre,{tool:e,relPath:x,scope:o,...c?{onShareFile:c}:{}}):null]}),u?s!==void 0?h.jsxs("div",{"data-testid":"msg-line-tool-body",className:"mt-2 min-w-0 text-[12px]",children:[s,f?h.jsxs("div",{className:"mt-2",children:[h.jsx("div",{className:"text-destructive mb-0.5",children:"error"}),h.jsx("pre",{className:"min-w-0 max-w-full bg-bg-0 border border-destructive/40 rounded p-2 overflow-auto text-destructive",children:String(r)})]}):null]}):h.jsxs("div",{"data-testid":"msg-line-tool-body",className:"mt-2 min-w-0 space-y-1 text-[12px]",children:[h.jsxs("div",{children:[h.jsx("div",{className:"text-text-400 mb-0.5",children:"input"}),h.jsx("pre",{className:"min-w-0 max-w-full bg-bg-0 border border-border rounded p-2 overflow-auto text-text-200",children:JSON.stringify(t,null,2)})]}),n!==void 0?h.jsxs("div",{children:[h.jsx("div",{className:"text-text-400 mb-0.5",children:"output"}),h.jsx("pre",{className:"min-w-0 max-w-full bg-bg-0 border border-border rounded p-2 overflow-auto text-text-200",children:typeof n=="string"?n:JSON.stringify(n,null,2)})]}):null,f?h.jsxs("div",{children:[h.jsx("div",{className:"text-destructive mb-0.5",children:"error"}),h.jsx("pre",{className:"min-w-0 max-w-full bg-bg-0 border border-destructive/40 rounded p-2 overflow-auto text-destructive",children:String(r)})]}):null]}):null,!f&&o&&x&&Bx(e)?h.jsx(Tre,{relPath:x,scope:o}):null]})}var jre=Symbol.for("react.lazy"),np=Pl[" use ".trim().toString()];function Lre(e){return typeof e=="object"&&e!==null&&"then"in e}function yA(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===jre&&"_payload"in e&&Lre(e._payload)}function Dre(e){const t=Bre(e),n=g.forwardRef((r,i)=>{let{children:s,...o}=r;yA(s)&&typeof np=="function"&&(s=np(s._payload));const a=g.Children.toArray(s),l=a.find(zre);if(l){const c=l.props.children,u=a.map(d=>d===l?g.Children.count(c)>1?g.Children.only(null):g.isValidElement(c)?c.props.children:null:d);return h.jsx(t,{...o,ref:i,children:g.isValidElement(c)?g.cloneElement(c,void 0,u):null})}return h.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}var Ore=Dre("Slot");function Bre(e){const t=g.forwardRef((n,r)=>{let{children:i,...s}=n;if(yA(i)&&typeof np=="function"&&(i=np(i._payload)),g.isValidElement(i)){const o=Hre(i),a=Fre(s,i.props);return i.type!==g.Fragment&&(a.ref=r?qu(r,o):o),g.cloneElement(i,a)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $re=Symbol("radix.slottable");function zre(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$re}function Fre(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function Hre(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const h2=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,f2=f3,Ure=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return f2(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=t,o=Object.keys(i).map(c=>{const u=n==null?void 0:n[c],d=s==null?void 0:s[c];if(u===null)return null;const f=h2(u)||h2(d);return i[c][f]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,f]=u;return f===void 0||(c[d]=f),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:f,...p}=u;return Object.entries(p).every(m=>{let[x,w]=m;return Array.isArray(w)?w.includes({...s,...a}[x]):{...s,...a}[x]===w})?[...c,d,f]:c},[]);return f2(e,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},Wre=Ure("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-accent text-accent-contrast hover:bg-accent-hover",destructive:"bg-destructive text-white hover:bg-destructive-hover",outline:"border border-border bg-transparent text-text-100 hover:bg-bg-200",ghost:"bg-transparent text-text-200 hover:bg-bg-200 hover:text-text-100"},size:{sm:"h-8 px-3 text-xs",md:"h-9 px-4",lg:"h-11 px-6 text-base"}},defaultVariants:{variant:"default",size:"md"}}),el=g.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},s)=>{const o=r?Ore:"button";return h.jsx(o,{ref:s,className:re(Wre({variant:t,size:n}),e),...i})});el.displayName="Button";function qre({tool:e,input:t,onRespond:n,onInterrupt:r}){return h.jsxs("div",{"data-testid":"msg-line-permission",className:"min-w-0 max-w-full rounded-md border border-warning/40 bg-warning-dim/60 px-3 py-2.5 text-[13px]",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-2 mb-1.5",children:[h.jsx(PF,{className:"w-4 h-4 text-warning shrink-0"}),h.jsxs("span",{className:"min-w-0 font-medium text-text-100 truncate",children:["权限请求:",e]}),r?h.jsx("button",{type:"button",onClick:r,"data-testid":"msg-line-permission-interrupt","aria-label":"interrupt current turn",title:"中断当前轮次(不杀进程)",className:"ml-auto h-6 w-6 rounded-md flex items-center justify-center text-text-400 hover:bg-text-100/10 hover:text-text-200 transition-colors cursor-pointer",children:h.jsx(a3,{className:"w-3.5 h-3.5",strokeWidth:2})}):null]}),h.jsx("pre",{className:"min-w-0 max-w-full bg-bg-0 border border-border rounded p-2 mb-2 max-h-[140px] overflow-auto text-[12px] text-text-200",children:JSON.stringify(t,null,2)}),h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsx(el,{size:"sm",variant:"default",onClick:()=>n(!0,!1),"data-testid":"msg-line-permission-allow",children:"Allow"}),h.jsx(el,{size:"sm",variant:"outline",onClick:()=>n(!0,!0),"data-testid":"msg-line-permission-allow-always",children:"Allow Always"}),h.jsx(el,{size:"sm",variant:"destructive",onClick:()=>n(!1,!1),"data-testid":"msg-line-permission-deny",children:"Deny"})]})]})}function Vre({message:e}){return h.jsxs("div",{"data-testid":"msg-line-error",className:"flex min-w-0 max-w-full items-start gap-2 text-destructive text-[13px] rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2",children:[h.jsx(Ff,{className:"w-4 h-4 shrink-0 mt-0.5"}),h.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e})]})}const Kre=/\[skill:(.+?):(\/[^\]]+)\]/g;function Gre(e){const t=[],n=e.replace(Kre,(r,i)=>(t.push(i),""));return{skills:t,text:t.length>0?n.trim():e}}function Yre({text:e,senderDisplayName:t,senderPrincipal:n,rewindTarget:r}){const i=n==="guest",s=JP(e),{attachments:o,text:a}=Xf(s),{skills:l,text:c}=Gre(a),{commandName:u,body:d}=vm(c),f=d.length>0;return f||o.length>0||!!u||l.length>0?(u||l.length>0)&&!f&&o.length===0?h.jsxs("div",{className:"flex min-w-0 max-w-full justify-end gap-1.5 py-2 mt-2","data-testid":"msg-line-user","data-sender-principal":i?"guest":"owner",children:[l.map((m,x)=>h.jsxs("span",{"data-testid":"user-skill-chip",className:"inline-flex items-center rounded-md bg-bg-200/60 px-2 py-0.5 text-[11px] font-mono text-text-300",children:["/",m]},`${m}-${x}`)),u?h.jsx("span",{className:"inline-flex items-center rounded-md bg-bg-200/60 px-2 py-0.5 text-[11px] font-mono text-text-300",children:u}):null]}):h.jsxs("div",{className:"group flex min-w-0 max-w-full flex-col items-end py-2 mt-2","data-testid":"msg-line-user","data-sender-principal":i?"guest":"owner",children:[h.jsxs("div",{"data-testid":"user-msg-bubble",className:re("min-w-0 max-w-[85%] rounded-2xl rounded-br-sm px-3.5 py-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",i?"border border-border bg-bg-200":"bg-accent"),children:[o.length>0?h.jsx(Xre,{attachments:o}):null,l.length>0?h.jsx("div",{className:re("flex flex-wrap gap-1.5",(f||u)&&"mb-1.5"),children:l.map((m,x)=>h.jsxs("span",{"data-testid":"user-skill-chip",className:re("inline-flex items-center rounded-md px-2 py-0.5 text-[11px] font-mono",i?"bg-text-100/10 text-text-200":"bg-white/15 text-white/90"),children:["/",m]},`${m}-${x}`))}):null,u?h.jsx("div",{className:re("flex",f&&"mb-1.5"),children:h.jsx("span",{"data-testid":"user-command-chip",className:re("inline-flex items-center rounded-md px-2 py-0.5 text-[11px] font-mono",i?"bg-text-100/10 text-text-200":"bg-white/15 text-white/90"),children:u})}):null,f?h.jsx("div",{className:re("text-[14px] font-medium leading-relaxed",i?"text-text-100":"text-white"),children:d}):null]}),t?h.jsx("div",{"data-testid":"user-msg-sender-label",className:"mt-1 text-[11px] text-text-400",children:t}):null,r?h.jsxs("button",{type:"button","data-testid":"user-msg-rewind","aria-label":"rewind to this message",title:"回退到这条消息(会撤销之后 CC 的文件编辑)",onClick:()=>r.onRewind(r.userMessageId),className:"mt-1 inline-flex items-center gap-1 h-6 px-1.5 rounded-md text-[11px] text-text-400 hover:bg-text-100/5 hover:text-text-200 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",children:[h.jsx(u3,{className:"w-3 h-3",strokeWidth:2}),h.jsx("span",{children:"Rewind"})]}):null]}):null}function Xre({attachments:e}){return h.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5","data-testid":"user-attachment-row",children:e.map(t=>h.jsx(Zre,{attachment:t},t.url))})}function Zre({attachment:e}){return e.type==="image"?h.jsx("img",{src:e.url,alt:e.fileName,"data-testid":"user-attachment-image",className:"h-16 w-16 rounded object-cover shrink-0 border border-bg-300/50"}):h.jsxs("div",{"data-testid":"user-attachment-file",className:"flex items-center gap-1.5 rounded-md border border-bg-300 bg-bg-100/60 px-2 py-1 text-[12px] text-text-200",children:[h.jsx(Ei,{className:"h-3.5 w-3.5 text-text-400 shrink-0"}),h.jsx("span",{className:"max-w-[140px] truncate",children:e.fileName})]})}const Qre={"task-notification":"子任务通知","slash-command":"斜杠命令","local-command":"本地命令输出","system-reminder":"系统提醒","skill-hint":"Skill 注入","meta-text":"系统消息","attachment-skills":"技能列表","attachment-deferred-tools":"Deferred 工具变更","dispatch-task":"委派任务","dispatch-result":"委派回报"},Jre={"task-notification":tk,"slash-command":LF,"local-command":c3,"system-reminder":tk,"skill-hint":dx,"meta-text":o3,"attachment-skills":dx,"attachment-deferred-tools":xF,"dispatch-task":l3,"dispatch-result":s3};function _A({metaKind:e,text:t}){const[n,r]=g.useState(!1),i=Jre[e];if(e==="slash-command"){const{commandName:o,commandMessage:a,commandArgs:l,body:c}=vm(t),u=o??(a?`/${a}`:null),d=!!(l&&l.length>0),f=c.length>0;return!u&&!d&&!f?null:h.jsxs("div",{"data-testid":"msg-line-user-meta","data-meta-kind":e,className:"flex min-w-0 max-w-full flex-col items-end gap-0.5 py-1",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-2 max-w-full",children:[u?h.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-md bg-bg-200/60 px-2 py-0.5 text-[11px] font-mono text-text-300 shrink-0",children:[h.jsx(i,{className:"w-3 h-3 opacity-70"}),u]}):null,d?h.jsx("span",{"data-testid":"user-meta-command-args",className:"min-w-0 text-[12px] text-text-200 whitespace-pre-wrap break-words max-w-[70ch] [overflow-wrap:anywhere]",children:l}):null]}),f?h.jsx("span",{className:"ml-2 max-w-[60%] truncate text-[11px] text-text-400",children:c}):null]})}const s=t.replace(/\s+/g," ").trim().slice(0,80);return h.jsxs("div",{"data-testid":"msg-line-user-meta","data-meta-kind":e,className:"flex min-w-0 max-w-full flex-col items-start gap-1 py-1",children:[h.jsxs("button",{type:"button","aria-expanded":n,onClick:()=>r(o=>!o),className:re("group inline-flex items-center gap-1.5 rounded-md border border-bg-200/60 bg-bg-100/40","px-2 py-1 text-[11px] text-text-400 hover:bg-bg-200/40 transition-colors max-w-full"),children:[h.jsx(i,{className:"w-3 h-3 opacity-70 shrink-0"}),h.jsx("span",{className:"font-medium shrink-0",children:Qre[e]}),h.jsx("span",{className:"truncate text-text-400/80 max-w-[60ch]",children:s}),n?h.jsx(Pn,{className:"w-3 h-3 opacity-60 shrink-0"}):h.jsx(Fn,{className:"w-3 h-3 opacity-60 shrink-0"})]}),n?h.jsx("pre",{"data-testid":"user-meta-body",className:"w-full max-w-full whitespace-pre-wrap break-words text-[11px] text-text-400 bg-bg-50/60 rounded-md p-2 border border-bg-200/60 [overflow-wrap:anywhere]",children:t}):null]})}function eie(e){return e.ordinal===null?e.label:`#${e.ordinal} ${e.label}`}function tie({text:e,metaKind:t,resolveDispatchOrigin:n,onOpenSession:r,onOpenFilePath:i}){const s=g.useMemo(()=>F$(e),[e]);return s.length===0?h.jsx(_A,{metaKind:t,text:e}):h.jsx("div",{"data-testid":"msg-line-dispatch-group",className:"my-1 flex min-w-0 max-w-full flex-col gap-1.5",children:s.map((o,a)=>h.jsx(sie,{block:o,...n?{resolveDispatchOrigin:n}:{},...r?{onOpenSession:r}:{},...i?{onOpenFilePath:i}:{}},`${o.kind}-${o.dispatchId}-${a}`))})}function nie(e){return e.length<=24?e:`${e.slice(0,12)}…${e.slice(-6)}`}function p2({origin:e}){const t=[];if(e.line&&t.push(h.jsx("span",{"data-testid":"dispatch-origin-line","data-line-ordinal":e.line.ordinal??"",className:"min-w-0 truncate tabular-nums text-text-300",children:eie(e.line)},"line")),t.push(h.jsxs("span",{"data-testid":"dispatch-origin-persona","data-persona-id":e.persona.id,className:"inline-flex min-w-0 items-baseline gap-1",children:[e.persona.label?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"truncate text-text-200",children:e.persona.label})," "]}):null,h.jsx("span",{className:"truncate font-mono text-[10px] text-text-400",children:e.persona.id})]},"persona")),e.device){const n=e.device;t.push(h.jsxs("span",{"data-testid":"dispatch-origin-device","data-device-id":n.id,title:n.id,className:"inline-flex min-w-0 items-baseline gap-1",children:[h.jsx(Q7,{className:"h-3 w-3 shrink-0 translate-y-[2px] text-text-400"}),n.displayName?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"truncate text-text-200",children:n.displayName})," "]}):null,h.jsx("span",{className:"truncate font-mono text-[10px] text-text-400",children:nie(n.id)})]},"device"))}return h.jsxs("span",{className:"inline-flex min-w-0 flex-wrap items-baseline",children:[h.jsx("span",{className:"shrink-0 whitespace-pre text-text-400",children:"来自 "}),t.map((n,r)=>h.jsxs(Qe.Fragment,{children:[r>0?h.jsx("span",{className:"shrink-0 whitespace-pre text-text-400",children:" · "}):null,n]},r))]})}function rie({origin:e,onOpenSession:t,seam:n}){const r=re("flex w-full min-w-0 items-center gap-2 border-t bg-bg-200/35 px-3 py-1 text-left text-[10px] leading-relaxed",n),i=e.sessionId;return!i||!t?h.jsxs("div",{"data-testid":"dispatch-origin","data-openable":"false",className:r,children:[h.jsx(p2,{origin:e}),e.unreachable?h.jsx("span",{"data-testid":"dispatch-origin-unreachable",className:"ml-auto inline-flex shrink-0 items-center gap-1 text-text-400",children:e.unreachable==="remote-device"?"会话在对端设备":"会话已删除"}):null]}):h.jsxs("button",{type:"button","data-testid":"dispatch-origin","data-openable":"true","data-session-id":i,onClick:()=>t(i),title:"打开这条会话",className:re(r,"group cursor-pointer transition-colors hover:bg-bg-200/70"),children:[h.jsx("span",{className:"min-w-0 group-hover:underline group-hover:decoration-text-400 group-hover:underline-offset-2",children:h.jsx(p2,{origin:e})}),h.jsxs("span",{className:"ml-auto inline-flex shrink-0 items-center gap-0.5 text-text-400 transition-colors group-hover:text-text-100",children:["打开会话",h.jsx(cx,{className:"h-3 w-3"})]})]})}function iie(e){return e?{shell:"border-error/40 bg-error-dim",rail:"bg-error/55",hover:"hover:bg-error/10",icon:"text-error",title:"text-error",chevron:"text-error/70",seam:"border-error/25"}:{shell:"border-accent/35 bg-accent-dim",rail:"bg-accent/45",hover:"hover:bg-accent/10",icon:"text-accent",title:"text-accent",chevron:"text-accent/70",seam:"border-accent/20"}}function sie({block:e,resolveDispatchOrigin:t,onOpenSession:n,onOpenFilePath:r}){const[i,s]=g.useState(!1),o=g.useMemo(()=>r?mA(r):Qs,[r]),a=e.kind==="task",l=(t==null?void 0:t(e.dispatchId,e.from))??(e.from?{persona:{id:e.from}}:void 0),c=a&&typeof e.round=="number"&&e.round>=2,u=e.status==="failure",d=iie(u);return h.jsxs("div",{"data-testid":"msg-line-dispatch","data-dispatch-kind":e.kind,"data-dispatch-id":e.dispatchId,"data-round":e.round??"","data-status":e.status??"","data-open":i?"true":"false",className:re("flex min-w-0 max-w-full overflow-hidden rounded-lg border",d.shell),children:[h.jsx("span",{"data-testid":"dispatch-rail","aria-hidden":"true",className:re("w-[3px] shrink-0 self-stretch",d.rail)}),h.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[h.jsxs("button",{type:"button","aria-expanded":i,onClick:()=>s(f=>!f),className:re("flex w-full min-w-0 cursor-pointer items-start gap-2 px-3 py-2 text-left transition-colors",d.hover),children:[h.jsx("span",{className:re("mt-[2px] shrink-0",d.icon),children:a?h.jsx(l3,{className:"h-3.5 w-3.5"}):h.jsx(s3,{className:"h-3.5 w-3.5"})}),h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsxs("span",{"data-testid":"dispatch-header",className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[h.jsx("span",{className:re("text-[12px] font-semibold",d.title),children:a?"委派任务":"委派回报"}),c?h.jsxs("span",{"data-testid":"dispatch-round",className:"inline-flex items-center gap-1 rounded-md bg-bg-200/70 px-1.5 py-0.5 text-[10px] text-text-300",children:[h.jsx(SF,{className:"h-3 w-3"}),"续派第 ",e.round," 轮"]}):null,u?h.jsxs("span",{"data-testid":"dispatch-status",className:"inline-flex items-center gap-1 text-[11px] text-error",children:[h.jsx(Jo,{className:"h-3.5 w-3.5"}),"失败"]}):null,e.filePaths.length>0?h.jsxs("span",{"data-testid":"dispatch-file-count",className:"inline-flex items-center gap-1 text-[11px] text-text-400",children:[h.jsx(Ei,{className:"h-3 w-3"}),e.filePaths.length," 个产物"]}):null]}),h.jsx("span",{"data-testid":"dispatch-brief",className:"mt-1 block whitespace-pre-wrap break-words text-[12px] leading-relaxed text-text-200 [overflow-wrap:anywhere]",children:e.brief}),e.briefIsDerived?h.jsxs("span",{"data-testid":"dispatch-brief-derived",title:"发送方没写摘要,这段是从正文首段自动截取的",className:"mt-1 inline-flex items-center gap-1 text-[10px] text-text-400 italic",children:[h.jsx(AF,{className:"h-2.5 w-2.5"}),"自动摘要(发送方未填)"]}):null]}),h.jsx("span",{className:re("mt-[3px] shrink-0",d.chevron),children:i?h.jsx(Pn,{className:"h-3.5 w-3.5"}):h.jsx(Fn,{className:"h-3.5 w-3.5"})})]}),l?h.jsx(rie,{origin:l,...n?{onOpenSession:n}:{},seam:d.seam}):null,i?h.jsxs(h.Fragment,{children:[h.jsx("div",{"data-testid":"dispatch-body",className:re("min-w-0 space-y-2 border-t bg-bg-200/35 py-2.5 pl-4 pr-3",d.seam),children:h.jsxs("div",{"data-testid":"dispatch-detail-indent",className:"min-w-0 border-l border-border/70 pl-3",children:[h.jsx("div",{"data-testid":"dispatch-detail",className:"assistant-markdown markdown-attached min-w-0 break-words",children:h.jsx(_l,{remarkPlugins:[bl],components:o,...r?{urlTransform:pA}:{},children:e.detail})}),e.filePaths.length>0?h.jsxs("div",{"data-testid":"dispatch-files",className:"flex min-w-0 flex-col gap-1 pt-2",children:[h.jsx("span",{className:"text-[11px] text-text-400",children:"产物"}),e.filePaths.map(f=>h.jsx(oie,{path:f,...r?{onOpenFilePath:r}:{}},f))]}):null]})}),h.jsxs("button",{type:"button","data-testid":"dispatch-collapse-foot",onClick:()=>s(!1),className:re("flex w-full cursor-pointer items-center justify-between gap-2 border-t bg-bg-200/35 px-3 py-1 text-[10px] text-text-400 transition-colors hover:bg-bg-200/60",d.seam),children:[h.jsx("span",{className:"min-w-0 truncate",children:e.dispatchId?h.jsxs(h.Fragment,{children:[h.jsx("span",{children:"台账 "}),h.jsx("span",{"data-testid":"dispatch-id",className:"font-mono",children:e.dispatchId})]}):null}),h.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",children:["收起",h.jsx(r3,{className:"h-3 w-3"})]})]})]}):null]})]})}function oie({path:e,onOpenFilePath:t}){const n="inline-flex min-w-0 items-center gap-1.5 text-left text-[11px] font-mono text-text-300";return t?h.jsxs("button",{type:"button","data-testid":"dispatch-file-path",title:e,onClick:()=>t(e),className:re(n,"hover:text-text-100 hover:underline"),children:[h.jsx(Ei,{className:"h-3 w-3 shrink-0 text-text-400"}),h.jsx("span",{className:"truncate",children:e})]}):h.jsxs("span",{"data-testid":"dispatch-file-path",title:e,className:n,children:[h.jsx(Ei,{className:"h-3 w-3 shrink-0 text-text-400"}),h.jsx("span",{className:"truncate",children:e})]})}function aie({text:e,metaSource:t}){return t==="owner"?h.jsx("div",{className:"flex min-w-0 max-w-full flex-col items-start py-1.5","data-testid":"msg-line-owner-meta",children:h.jsxs("div",{className:re("inline-flex min-w-0 max-w-[85%] items-start gap-2 rounded-md","border-l-[3px] border-accent bg-accent-dim px-3 py-2"),children:[h.jsx(sF,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-accent","aria-label":"补充信息"}),h.jsx("span",{className:"min-w-0 text-[12px] leading-relaxed text-text-100 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e})]})}):h.jsxs("div",{className:"flex min-w-0 max-w-full items-start gap-1.5 py-1 text-[11px] text-text-400","data-testid":"msg-line-cc-meta",children:[h.jsx(o3,{className:"mt-0.5 h-3 w-3 shrink-0"}),h.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e})]})}function si(e,t){const r=new RegExp(`<${t}\\b[^>]*>([\\s\\S]*?)</${t}>`,"i").exec(e);if(!r)return;const i=r[1].trim();return i||void 0}function e0(e,t){const r=new RegExp(`${t}\\s*=\\s*"([^"]+)"`,"i").exec(e);if(!r)return;const i=Number(r[1]);return Number.isFinite(i)?i:void 0}function bA(e){var i,s,o;const t={};if(!e)return t;t.taskId=si(e,"task-id"),t.toolUseId=si(e,"tool-use-id"),t.outputFile=si(e,"output-file"),t.status=si(e,"status"),t.summary=si(e,"summary"),t.result=si(e,"result");const n=si(e,"usage");if(n){const a=(i=/<total_tokens>\s*(\d+)\s*<\/total_tokens>/i.exec(n))==null?void 0:i[1],l=(s=/<tool_uses>\s*(\d+)\s*<\/tool_uses>/i.exec(n))==null?void 0:s[1],c=(o=/<duration_ms>\s*(\d+)\s*<\/duration_ms>/i.exec(n))==null?void 0:o[1];a&&(t.totalTokens=Number(a)),l&&(t.toolUses=Number(l)),c&&(t.durationMs=Number(c))}const r=si(e,"worktree");if(r)t.worktreePath=si(r,"worktreePath"),t.worktreeBranch=si(r,"worktreeBranch");else{const a=/<worktree\b([^>]*)\/>/i.exec(e);if(a){const l=a[1],c=/worktreePath\s*=\s*"([^"]+)"/i.exec(l),u=/worktreeBranch\s*=\s*"([^"]+)"/i.exec(l);c&&(t.worktreePath=c[1]),u&&(t.worktreeBranch=u[1])}}if(t.totalTokens===void 0&&t.toolUses===void 0&&t.durationMs===void 0){const a=e0(e,"total_tokens"),l=e0(e,"tool_uses"),c=e0(e,"duration_ms");a!==void 0&&(t.totalTokens=a),l!==void 0&&(t.toolUses=l),c!==void 0&&(t.durationMs=c)}return t}function lie(e){if(!e||!Number.isFinite(e))return null;if(e<1e3)return`${e}ms`;const t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;const n=Math.floor(t/60),r=Math.round(t-n*60);return`${n}m${r.toString().padStart(2,"0")}s`}function cie({text:e,taskId:t,parentToolUseId:n}){const r=g.useMemo(()=>bA(e),[e]),[i,s]=g.useState(!1),o=t??r.taskId,a=n??r.toolUseId,l=r.status==="failed"?h.jsx(Jo,{className:"w-3.5 h-3.5 text-error"}):r.status==="completed"?h.jsx(Qy,{className:"w-3.5 h-3.5 text-success"}):h.jsx(Qp,{className:"w-3.5 h-3.5 text-text-400"}),c=r.status??"unknown",u=lie(r.durationMs);return h.jsxs("div",{"data-testid":"msg-line-agent-notification","data-task-id":o??"","data-parent-tool-use-id":a??"",className:"my-1 min-w-0 max-w-full rounded-md border border-bg-200/60 bg-bg-100/40",children:[h.jsxs("button",{type:"button","aria-expanded":i,onClick:()=>s(d=>!d),className:re("flex w-full min-w-0 items-start gap-2 px-2.5 py-1.5 text-left text-[12px]","hover:bg-bg-200/40 rounded-md transition-colors"),children:[h.jsx("span",{className:"mt-[2px] shrink-0",children:l}),h.jsxs("span",{className:"flex-1 min-w-0",children:[h.jsxs("span",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx("span",{className:"font-medium text-text-200",children:"子任务"}),h.jsx("span",{className:"text-text-400 text-[11px] font-mono",children:o?o.slice(0,12):"未知"}),h.jsx("span",{className:"text-text-400 text-[11px] uppercase tracking-wide",children:c}),u?h.jsxs("span",{className:"text-text-400 text-[11px] tabular-nums",children:["· ",u]}):null,r.totalTokens?h.jsxs("span",{className:"text-text-400 text-[11px] tabular-nums",children:["· ",r.totalTokens," tok"]}):null,r.toolUses?h.jsxs("span",{className:"text-text-400 text-[11px] tabular-nums",children:["· ",r.toolUses," tools"]}):null]}),r.summary?h.jsx("span",{className:"block truncate text-text-300 text-[12px] mt-0.5",children:r.summary}):null]}),i?h.jsx(Pn,{className:"w-3.5 h-3.5 mt-[3px] text-text-400 shrink-0"}):h.jsx(Fn,{className:"w-3.5 h-3.5 mt-[3px] text-text-400 shrink-0"})]}),i?h.jsxs("div",{"data-testid":"agent-notification-body",className:"min-w-0 border-t border-bg-200/60 px-3 py-2 text-[12px] text-text-300 space-y-2",children:[r.worktreePath||r.worktreeBranch?h.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-text-400",children:[h.jsx(pl,{className:"w-3 h-3"}),r.worktreeBranch?h.jsx("span",{className:"font-mono",children:r.worktreeBranch}):null,r.worktreePath?h.jsx("span",{className:"truncate font-mono",children:r.worktreePath}):null]}):null,r.outputFile?h.jsxs("div",{className:"text-[11px] text-text-400",children:[h.jsx("span",{children:"输出文件:"}),h.jsx("span",{className:"font-mono",children:r.outputFile})]}):null,a?h.jsxs("div",{className:"text-[11px] text-text-400",children:[h.jsx("span",{children:"父工具调用:"}),h.jsx("span",{className:"font-mono",children:a})]}):null,r.result?h.jsx("div",{"data-testid":"agent-notification-result",className:"assistant-markdown text-[12px] leading-relaxed break-words",children:h.jsx(_l,{remarkPlugins:[bl],components:Qs,children:r.result})}):h.jsx("div",{className:"text-[11px] text-text-400 italic",children:"无详细结果"})]}):null]})}const wA=g.createContext(null);function uie({children:e}){const[t,n]=g.useState({agentId:null}),r=g.useCallback((o,a)=>{n({agentId:o,agentType:a})},[]),i=g.useCallback(()=>{n(o=>({agentId:null,agentType:o.agentType}))},[]),s=g.useMemo(()=>({state:t,open:r,close:i}),[t,r,i]);return h.jsx(wA.Provider,{value:s,children:e})}function SA(){return g.useContext(wA)}function die(e){if(e==null)return null;if(typeof e=="string")return e;if(Array.isArray(e)){const t=[];for(const n of e)if(n&&typeof n=="object"){const r=n;r.type==="text"&&typeof r.text=="string"&&t.push(r.text)}else typeof n=="string"&&t.push(n);return t.length?t.join(`
|
|
575
|
+
`):null}if(typeof e=="object"){const t=e;if(typeof t.text=="string")return t.text}return null}function m2(e){if(!e||!Number.isFinite(e))return null;if(e<1e3)return`${e}ms`;const t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;const n=Math.floor(t/60),r=Math.round(t-n*60);return`${n}m${r.toString().padStart(2,"0")}s`}function hie(e){return!e||!Number.isFinite(e)?null:e<1e3?`${e} tok`:e<1e4?`${(e/1e3).toFixed(1)}k tok`:`${Math.round(e/1e3)}k tok`}const fie={readCount:"read",searchCount:"search",bashCount:"bash",editFileCount:"edit",linesAdded:"+lines",linesRemoved:"-lines",otherToolCount:"other"};function pie(e){if(!e)return[];const t=[];for(const[n,r]of Object.entries(e)){if(!r||r<=0)continue;const i=fie[n]??n;t.push(`${i}:${r}`)}return t}function mie({expandable:e,expanded:t,onToggle:n,children:r}){const i=re("flex w-full min-w-0 items-center gap-2 px-2.5 py-1.5 text-left text-[13px] rounded-md",e&&"hover:bg-bg-200/40 transition-colors");return e?h.jsx("button",{type:"button","aria-expanded":t,onClick:n,className:i,children:r}):h.jsx("div",{className:i,children:r})}function kA({description:e,input:t,output:n,error:r,pending:i,notifications:s,toolResultExtra:o,progress:a,expandable:l=!0}){const[c,u]=g.useState(!1),d=SA(),f=g.useMemo(()=>{if(!t||typeof t!="object")return null;const R=t;return typeof R.prompt=="string"?R.prompt:null},[t]),p=g.useMemo(()=>{if(!t||typeof t!="object")return;const R=t.agentId;return typeof R=="string"&&R.length>0?R:void 0},[t]),m=(o==null?void 0:o.prompt)??f,x=g.useMemo(()=>die(n),[n]),w=o==null?void 0:o.stats,v=a==null?void 0:a.stats,_=m2((w==null?void 0:w.durationMs)??(v==null?void 0:v.durationMs)),b=hie((w==null?void 0:w.tokens)??(v==null?void 0:v.tokens)),S=pie(w==null?void 0:w.toolStats),C=XP({pending:i,error:r,notifications:s,progress:a,input:t}),k=C&&(a!=null&&a.lastToolName)?`now:${a.lastToolName}`:null,N=!!(o!=null&&o.agentType||_||b||S.length>0||k),E=(o==null?void 0:o.agentId)??(a==null?void 0:a.agentId)??p,L=!!(r||(a==null?void 0:a.status)==="failed"),P=g.useMemo(()=>s.map(R=>({taskId:R.taskId,text:R.text,parsed:bA(R.text)})),[s]),D=L?h.jsx(Jo,{className:"w-3.5 h-3.5 text-error"}):C?h.jsx(Tn,{className:"w-3.5 h-3.5 text-blue-400 animate-spin"}):h.jsx(Qy,{className:"w-3.5 h-3.5 text-green-500"});return h.jsxs("div",{"data-testid":"msg-line-agent-call","data-pending":i?"true":"false","data-active":C?"true":"false","data-has-error":L?"true":"false","data-notification-count":s.length,"data-has-stats":N?"true":"false","data-agent-id":E??"",className:"my-1 min-w-0 max-w-full rounded-md border border-bg-200/60 bg-bg-100/30",children:[h.jsxs(mie,{expandable:l,expanded:c,onToggle:()=>u(R=>!R),children:[h.jsx("span",{className:"w-5 h-5 flex items-center justify-center text-[10px] rounded bg-violet-500/10 text-violet-500 shrink-0","aria-hidden":!0,children:h.jsx(YF,{className:"w-3 h-3"})}),h.jsx("span",{className:"shrink-0",children:D}),h.jsx("span",{className:"flex-1 min-w-0 truncate font-medium text-text-200",children:e}),N?null:s.length>0?h.jsxs("span",{className:"text-[11px] text-text-400 tabular-nums shrink-0",children:[s.length," 次通知"]}):null,E&&(d!=null&&d.open)?h.jsx("span",{role:"button",tabIndex:0,"data-testid":"open-subagent-btn-header","data-agent-id":E,"aria-label":"打开子 agent 对话",onClick:R=>{R.stopPropagation(),d.open(E,o==null?void 0:o.agentType)},onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.stopPropagation(),R.preventDefault(),d.open(E,o==null?void 0:o.agentType))},className:"shrink-0 inline-flex items-center justify-center w-3.5 h-3.5 text-text-400 hover:text-text-200",children:h.jsx(fl,{className:"w-3.5 h-3.5"})}):null,l?c?h.jsx(Pn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}):h.jsx(Fn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}):null]}),C&&(a!=null&&a.description)?h.jsx("div",{"data-testid":"agent-call-progress-desc",className:"px-3 pt-0 pb-1 text-[12px] text-text-300 truncate",children:a.description}):null,N?h.jsxs("div",{"data-testid":"agent-call-stats",className:"flex items-center gap-1.5 flex-wrap px-3 pb-1.5 pt-0 text-[11px] text-text-400",children:[o!=null&&o.agentType?h.jsx("span",{"data-testid":"agent-call-stats-type",className:"inline-flex items-center rounded-sm bg-violet-500/10 px-1.5 py-0.5 text-violet-400 font-medium",children:o.agentType}):null,_?h.jsx("span",{className:"tabular-nums",children:_}):null,b?h.jsx("span",{className:"tabular-nums",children:b}):null,k?h.jsx("span",{"data-testid":"agent-call-stats-now",className:"font-mono tabular-nums text-blue-400",children:k}):null,S.map(R=>h.jsx("span",{className:"font-mono tabular-nums text-text-400/80",children:R},R)),s.length>0?h.jsxs("span",{className:"tabular-nums text-text-400/70",children:["· ",s.length," 次通知"]}):null]}):null,c?h.jsxs("div",{"data-testid":"agent-call-body",className:"min-w-0 border-t border-bg-200/60 px-3 py-2 space-y-3",children:[r?h.jsx("div",{className:"text-[12px] text-error whitespace-pre-wrap",children:r}):null,P.map((R,A)=>{const M=R.parsed,j=m2(M.durationMs);return h.jsxs("div",{"data-testid":"agent-call-notification","data-task-id":R.taskId??"",className:"min-w-0 rounded-md border border-bg-200/60 bg-bg-0/40 p-2 space-y-1.5",children:[h.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-text-400 flex-wrap",children:[h.jsx("span",{className:"font-mono",children:(R.taskId??M.taskId??"未知").slice(0,12)}),h.jsx("span",{className:"uppercase tracking-wide",children:M.status??"unknown"}),j?h.jsxs("span",{className:"tabular-nums",children:["· ",j]}):null,M.totalTokens?h.jsxs("span",{className:"tabular-nums",children:["· ",M.totalTokens," tok"]}):null,M.toolUses?h.jsxs("span",{className:"tabular-nums",children:["· ",M.toolUses," tools"]}):null,M.worktreeBranch?h.jsxs("span",{className:"font-mono",children:["· ",M.worktreeBranch]}):null]}),M.summary?h.jsx("div",{className:"text-[12px] text-text-300",children:M.summary}):null,M.result?h.jsx("div",{"data-testid":"agent-call-notification-result",className:"assistant-markdown text-[12px] leading-relaxed break-words",children:h.jsx(_l,{remarkPlugins:[bl],components:Qs,children:M.result})}):null]},`${R.taskId??"n"}-${A}`)}),m?h.jsxs("div",{"data-testid":"agent-call-prompt-block",className:"min-w-0 space-y-1",children:[h.jsx("div",{className:"text-[11px] text-text-400 font-medium",children:"任务指令"}),h.jsx("pre",{"data-testid":"agent-call-prompt",className:"max-w-full whitespace-pre-wrap break-words text-[11px] text-text-300 bg-bg-50/60 rounded p-2 border border-bg-200/60 max-h-64 overflow-auto [overflow-wrap:anywhere]",children:m})]}):null,x?h.jsxs("div",{"data-testid":"agent-call-result-block",className:"min-w-0 space-y-1",children:[h.jsx("div",{className:"text-[11px] text-text-400 font-medium",children:"子 agent 报告"}),h.jsx("div",{"data-testid":"agent-call-result",className:"assistant-markdown text-[12px] leading-relaxed break-words",children:h.jsx(_l,{remarkPlugins:[bl],components:Qs,children:x})})]}):null,!x&&P.length===0&&!r&&!m?h.jsx("div",{className:"text-[11px] text-text-400 italic",children:"无详细信息"}):null,E&&(d!=null&&d.open)?h.jsx("div",{className:"flex justify-end",children:h.jsxs("button",{type:"button","data-testid":"open-subagent-btn","data-agent-id":E,onClick:()=>d.open(E,o==null?void 0:o.agentType),className:re("inline-flex items-center gap-1 rounded-md border border-bg-200/60","bg-bg-100/40 hover:bg-bg-200/40 transition-colors","px-2 py-1 text-[11px] text-text-300"),children:[h.jsx(fl,{className:"w-3 h-3"}),h.jsx("span",{children:"打开子 agent 对话"})]})}):null]}):null]})}function CA({title:e,items:t,progressColor:n="bg-green-500",listKind:r}){const[i,s]=g.useState(!1),o=t.length,a=t.filter(c=>c.status==="completed").length,l=o>0?Math.round(a/o*100):0;return h.jsxs("div",{"data-testid":"msg-line-checklist","data-list-kind":r,className:"min-w-0 max-w-full py-1",children:[h.jsxs("button",{type:"button",onClick:()=>s(c=>!c),"aria-expanded":i,className:"flex items-center gap-2.5 w-full text-left rounded-md px-1.5 py-1 hover:bg-text-100/5 cursor-pointer",children:[i?h.jsx(Pn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}):h.jsx(Fn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}),h.jsx("span",{className:"text-[13px] font-medium text-text-200",children:e}),h.jsxs("span",{className:"text-[11px] text-text-400 tabular-nums",children:[a,"/",o]}),h.jsx("div",{className:"flex-1 max-w-[120px] h-1.5 rounded-full bg-text-100/10 overflow-hidden",children:h.jsx("div",{className:re("h-full rounded-full transition-all duration-300",n),style:{width:`${l}%`}})})]}),i?h.jsx("div",{"data-testid":"checklist-body",className:"ml-6 mt-0.5",children:h.jsx("div",{className:"space-y-px",children:t.map((c,u)=>h.jsxs("div",{className:"flex min-w-0 items-start gap-2 py-0.5 px-1",children:[h.jsx("span",{className:"w-4 h-4 mt-0.5 flex items-center justify-center shrink-0",children:c.status==="completed"?h.jsx(Qo,{className:"w-3.5 h-3.5 text-green-500"}):h.jsx("span",{className:"w-2 h-2 rounded-full border border-text-400/40"})}),h.jsx("span",{className:re("min-w-0 text-[13px] leading-snug break-words [overflow-wrap:anywhere]",c.status==="completed"?"text-text-400 line-through":"text-text-200"),children:c.status==="in_progress"&&c.activeForm?c.activeForm:c.content})]},`${u}-${c.content}`))})}):null]})}function gie({todos:e}){return h.jsx(CA,{title:"Tasks",items:e,progressColor:"bg-green-500",listKind:"todo"})}function vie({tasks:e}){return h.jsx(CA,{title:"Plan",items:e,progressColor:"bg-blue-500",listKind:"plan"})}function xie(e){if(!e||!Number.isFinite(e))return null;const t=Date.now()-e;if(t<0)return null;const n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const i=Math.floor(r/60);if(i<24)return`${i}h ago`;const s=Math.floor(i/24);if(s<7)return`${s}d ago`;const o=Math.floor(s/7);return o<5?`${o}w ago`:new Date(e).toISOString().slice(0,10)}function yie(e){return(e.split("/").pop()??e)||e}function _ie({memories:e}){return!e||e.length===0?null:h.jsxs("div",{"data-testid":"memory-callout",className:"my-1 min-w-0 max-w-full rounded-md border border-bg-200/60 bg-bg-100/30",children:[h.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1.5 text-[12px] text-text-300 border-b border-bg-200/60",children:[h.jsx(s7,{className:"w-3.5 h-3.5 text-amber-500 shrink-0"}),h.jsx("span",{className:"font-medium",children:"项目记忆"}),h.jsxs("span",{className:"text-text-400 tabular-nums",children:["· ",e.length]})]}),h.jsx("ul",{className:"divide-y divide-bg-200/40",children:e.map(t=>h.jsx(bie,{memory:t},t.path))})]})}function bie({memory:e}){const[t,n]=g.useState(!1),r=xie(e.mtimeMs),i=e.content.replace(/\s+/g," ").trim().slice(0,80);return h.jsxs("li",{className:"px-2.5 py-1.5",children:[h.jsxs("button",{type:"button","aria-expanded":t,onClick:()=>n(s=>!s),className:re("flex w-full items-center gap-1.5 text-left text-[12px]","hover:bg-bg-200/30 rounded-sm py-0.5"),children:[t?h.jsx(Pn,{className:"w-3 h-3 text-text-400 shrink-0"}):h.jsx(Fn,{className:"w-3 h-3 text-text-400 shrink-0"}),h.jsx("span",{className:"font-mono text-text-300 shrink-0 max-w-[20ch] truncate",title:e.path,children:yie(e.path)}),h.jsx("span",{className:"flex-1 min-w-0 truncate text-text-400/80",children:i}),r?h.jsx("span",{className:"shrink-0 text-[11px] text-text-400 tabular-nums",children:r}):null]}),t?h.jsx("pre",{"data-testid":"memory-callout-body",className:"mt-1 max-w-full whitespace-pre-wrap break-words text-[12px] text-text-300 bg-bg-50/60 rounded-md p-2 border border-bg-200/60 [overflow-wrap:anywhere]",children:e.content}):null]})}function wie({toolUseId:e,questions:t,onSubmit:n,onCancel:r,submittedAnswers:i}){const[s,o]=g.useState({}),[a,l]=g.useState({}),[c,u]=g.useState({}),[d,f]=g.useState(!1),[p,m]=g.useState(!1),x=i!==void 0&&Object.keys(i).length>0,w=x||p,v=!n&&!x,_=(k,N)=>{const E={labels:new Set,freeText:""};if(!x||!i)return E;const L=i[k];if(typeof L!="string")return E;const P=L.split(",").map(M=>M.trim()).filter(Boolean),D=new Set(N.map(M=>M.label)),R=new Set,A=[];for(const M of P)D.has(M)?R.add(M):A.push(M);return{labels:R,freeText:A.join(", ")}},b=g.useMemo(()=>t.every(k=>{if((c[k.question]??"").trim().length>0)return!0;if(k.multiSelect){const E=a[k.question];return!!(E&&E.size>0)}return typeof s[k.question]=="string"&&s[k.question].length>0}),[t,s,a,c]),S=async()=>{if(!b||d||w||v||!n)return;const k={};for(const N of t){const E=(c[N.question]??"").trim();if(N.multiSelect){const L=a[N.question],P=L?N.options.filter(D=>L.has(D.label)).map(D=>D.label):[];if(E.length>0&&P.push(E),P.length===0)continue;k[N.question]=P.join(", ")}else if(E.length>0)k[N.question]=E;else{const L=s[N.question];typeof L=="string"&&(k[N.question]=L)}}f(!0);try{await n(k),m(!0)}finally{f(!1)}},C=Qu(()=>{S()});return h.jsxs("div",{"data-testid":"msg-line-question","data-tool-use-id":e,className:"min-w-0 max-w-full rounded-md border border-accent/40 bg-accent/5 px-3 py-2.5 text-[13px]",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-2 mb-2",children:[h.jsx(g7,{className:"w-4 h-4 text-accent shrink-0"}),h.jsx("span",{className:"min-w-0 font-medium text-text-100",children:"需要你的回答 / Need your answer"}),t.length>1?h.jsxs("span",{className:"ml-auto text-[12px] text-text-400","data-testid":"msg-line-question-count",children:[t.length," 个问题"]}):null]}),h.jsx("div",{className:"flex flex-col gap-3 mb-3",children:t.map((k,N)=>{const E=`q-${N}`,L=`${e}-${N}`,P=_(k.question,k.options),D=w||v,R=c[k.question]??"",A=x?P.freeText:p?(c[k.question]??"").trim():"";return h.jsxs("div",{"data-testid":"msg-line-question-item",children:[k.question?h.jsx("div",{className:"text-text-200 mb-1.5",children:k.question}):null,h.jsx("div",{className:"flex flex-col gap-1",children:k.options.map((M,j)=>{var $;const z=`${E}-${j}`,F=x?P.labels.has(M.label):k.multiSelect?!!(($=a[k.question])!=null&&$.has(M.label)):s[k.question]===M.label;return h.jsxs("label",{className:"flex min-w-0 items-start gap-2 cursor-pointer select-none py-1 px-2 rounded hover:bg-bg-100",children:[h.jsx("input",{type:k.multiSelect?"checkbox":"radio",name:L,value:M.label,checked:F,disabled:w||v,onChange:()=>{w||v||(k.multiSelect?l(B=>{const I=new Set(B[k.question]??[]);return I.has(M.label)?I.delete(M.label):I.add(M.label),{...B,[k.question]:I}}):o(B=>({...B,[k.question]:M.label})))},className:"mt-0.5","data-testid":"msg-line-question-option"}),h.jsxs("span",{className:"flex min-w-0 flex-col",children:[h.jsx("span",{className:"text-text-100 [overflow-wrap:anywhere]",children:M.label}),M.description?h.jsx("span",{className:"text-[12px] text-text-400 [overflow-wrap:anywhere]",children:M.description}):null]})]},z)})}),D?A.length>0?h.jsx("div",{className:"mt-2 rounded-lg border border-accent/15 bg-bg-100/60 px-3 py-2 text-[13px] leading-relaxed text-text-200 [overflow-wrap:anywhere]","data-testid":"msg-line-question-freetext-result",children:A}):null:h.jsx("textarea",{rows:3,value:R,placeholder:"或自行输入回答...",onChange:M=>{const j=M.target.value;u(z=>({...z,[k.question]:j}))},...C,className:"mt-2 w-full resize-y rounded-lg border border-accent/20 bg-bg-000/60 px-3 py-2 text-[13px] leading-relaxed text-text-100 placeholder:text-text-400 outline-none transition-colors focus:border-accent/60 focus:bg-bg-000","data-testid":"msg-line-question-freetext"})]},E)})}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(el,{size:"sm",variant:"default",onClick:()=>void S(),disabled:!b||d||w||v,"data-testid":"msg-line-question-submit",children:w?"已提交 / Submitted":v?"已结束 / Ended":"提交 / Submit"}),r&&!w&&!v?h.jsx(el,{size:"sm",variant:"ghost",onClick:()=>void r(),disabled:d,"data-testid":"msg-line-question-cancel",children:"跳过 / Skip"}):null]})]})}function Sie({toolUseId:e,questions:t,historicalAnswers:n,realtimeAnswers:r,onSubmit:i,onCancel:s}){const o=r??n,a=g.useCallback(async c=>{i&&await i(e,c)},[i,e]),l=g.useCallback(async()=>{s&&await s(e)},[s,e]);return h.jsx(wie,{toolUseId:e,questions:t,onSubmit:i?a:void 0,...s?{onCancel:l}:{},submittedAnswers:o})}function kie(){const e=new Map,t=(n,r)=>`${n}::${r}`;return{register(n,r,i){e.set(t(n,r),i)},resolve(n,r){return n?e.get(t(n,r))??null:null},reset(){e.clear()}}}const $a=kie();function EA({lines:e,onPermissionRespond:t,onPermissionInterrupt:n,topSlot:r,onRewind:i,rewindableUserMessageIds:s,onFork:o,onQuickAsk:a,forkByTurn:l=!1,realtimeQuestionAnswers:c,onSubmitQuestion:u,onCancelQuestion:d,liveQuestionToolUseIds:f,fileSharingScope:p,onShareFile:m,onOpenInTab:x,onPreviewMarkdown:w,onOpenFilePath:v,dispatchOrigin:_,turnCollapse:b,dockedAgentToolUseIds:S,codexHistory:C}){const k=g.useMemo(()=>ZP(e),[e]),N=g.useMemo(()=>{const P=new Map;let D;for(const R of k)R.kind==="user-text"&&R.continuesTurn!==!0&&(D=void 0),R.kind==="assistant-text"&&(D=R.seq),R.kind==="turn-end"&&(R.turnId&&R.reason!=="interrupted"&&D!==void 0&&P.set(D,R.turnId),D=void 0);return P},[k]),E=g.useMemo(()=>b?_Y(k,b):null,[k,b]),L={codexHistory:C,onRewind:i,rewindableUserMessageIds:s,onPermissionRespond:t,onPermissionInterrupt:n,onFork:o,onQuickAsk:a,forkByTurn:l,codexForkAnchors:N,realtimeQuestionAnswers:c,onSubmitQuestion:u,onCancelQuestion:d,liveQuestionToolUseIds:f,fileSharingScope:p,onShareFile:m,onOpenInTab:x,onPreviewMarkdown:w,onOpenFilePath:v,dispatchOrigin:_,dockedAgentToolUseIds:S};return h.jsxs("div",{"data-testid":"message-list",className:"flex w-full min-w-0 max-w-full flex-col gap-2 px-4 py-3",children:[r,E!==null?E.map(P=>Cie(P,L)):k.map(P=>rp(P,L))]})}function Cie(e,t){var l;const n=e.turnId?`turn-${e.turnId}`:`turn-${e.seq}`,r=e.turnId&&((l=t.codexHistory)!=null&&l.turnIds.has(e.turnId))?t.codexHistory:void 0,i=e.turnId?r==null?void 0:r.details[e.turnId]:void 0,s=e.query?rp(e.query,t):null,o=e.process.map(c=>Eie(c,t)),a=e.tail.map(c=>rp(c,t));return e.status==="running"?h.jsxs(Qe.Fragment,{children:[s,o,a]},n):h.jsxs("div",{"data-history-turn-id":e.turnId,className:"flex flex-col gap-2",children:[s,h.jsxs(AY,{status:e.status,onExpandedChange:r&&e.turnId?c=>{c&&r.loadDetails(e.turnId)}:void 0,...e.durationMs!==void 0?{durationMs:e.durationMs}:{},children:[o,r&&!i?h.jsx("span",{className:"text-text-400 text-xs",children:"展开后加载过程"}):null,i!=null&&i.loading?h.jsx("span",{className:"text-text-400 text-xs","data-testid":"turn-details-loading",children:"正在加载过程…"}):null,i!=null&&i.error?h.jsxs("div",{className:"text-destructive text-xs","data-testid":"turn-details-error",children:[i.error," ",h.jsx("button",{type:"button",onClick:()=>void(r==null?void 0:r.loadDetails(e.turnId)),children:"重试"})]}):null,i!=null&&i.nextCursor&&!i.loading&&!i.error?h.jsx("button",{type:"button",className:"text-accent text-xs",onClick:()=>void(r==null?void 0:r.loadDetails(e.turnId,!0)),children:"加载更多过程"}):null,i&&!i.loading&&!i.error&&i.items.length===0?h.jsx("span",{className:"text-text-400 text-xs",children:"没有更多过程"}):null]}),a]},n)}function Eie(e,t){return e.kind==="tool-group"?h.jsx(TY,{items:e.items,renderItemDetail:n=>Iie(n,t)},`tool-group-${e.seq}`):rp(e,t)}function Iie(e,t){const n=$a.resolve(e.toolKind,e.tool);return n?n.render({input:e.input,output:e.output,error:e.error,pending:e.pending,toolUseId:e.toolUseId,...t.fileSharingScope?{fileScope:t.fileSharingScope}:{},...t.onShareFile?{onShareFile:t.onShareFile}:{},...t.onOpenInTab?{onOpenInTab:t.onOpenInTab}:{},...t.onPreviewMarkdown?{onPreviewMarkdown:t.onPreviewMarkdown}:{}}):null}function rp(e,t){var b;const{onRewind:n,rewindableUserMessageIds:r,onPermissionRespond:i,onPermissionInterrupt:s,onFork:o,onQuickAsk:a,realtimeQuestionAnswers:l,onSubmitQuestion:c,onCancelQuestion:u,liveQuestionToolUseIds:d,fileSharingScope:f,onShareFile:p,onOpenInTab:m,onPreviewMarkdown:x,onOpenFilePath:w,dispatchOrigin:v}=t,_=`${e.kind}-${e.seq}`;switch(e.kind){case"session-init":return null;case"user-text":{const S=typeof e.uuid=="string"?e.uuid:void 0,C=!!(n&&S&&(!r||r.has(S)));return h.jsx(Yre,{text:e.text,senderDisplayName:e.senderDisplayName,senderPrincipal:e.senderPrincipal,rewindTarget:C&&S&&n?{userMessageId:S,onRewind:n}:void 0},_)}case"user-meta":return Yp(e.metaKind)?h.jsx(tie,{text:e.text,metaKind:e.metaKind,...v!=null&&v.resolve?{resolveDispatchOrigin:v.resolve}:{},...v!=null&&v.onOpenSession?{onOpenSession:v.onOpenSession}:{},...w?{onOpenFilePath:w}:{}},_):h.jsx(_A,{metaKind:e.metaKind,text:e.text},_);case"meta-text":return h.jsx(aie,{text:e.text,metaSource:e.metaSource},_);case"agent-notification":return h.jsx(cie,{text:e.text,taskId:e.taskId,parentToolUseId:e.parentToolUseId},_);case"assistant-text":{const S=t.forkByTurn?t.codexForkAnchors.get(e.seq):typeof e.uuid=="string"?e.uuid:void 0,C=S&&(o||a)?{messageUuid:S,onFork:o,onQuickAsk:a}:void 0;return h.jsx(xre,{text:OY(e.text),forkTarget:C,...w?{onOpenFilePath:w}:{}},_)}case"assistant-thinking":return h.jsx(yre,{text:e.text},_);case"permission-inline":return h.jsx(qre,{tool:e.tool,input:e.input,onRespond:i??(()=>{}),onInterrupt:s},_);case"error":return h.jsx(Vre,{message:e.message},_);case"turn-end":return null;case"merged-tool":return Nie(e,_,{fileSharingScope:f,onShareFile:p,onOpenInTab:m,onPreviewMarkdown:x});case"merged-agent":return(b=t.dockedAgentToolUseIds)!=null&&b.has(e.toolUseId)?null:h.jsx(kA,{description:e.description,input:e.input,output:e.output,error:e.error,pending:e.pending,notifications:e.notifications,toolResultExtra:e.toolResultExtra,progress:e.progress},_);case"plan-card":return h.jsx(vie,{tasks:e.tasks},_);case"todo-checklist":return h.jsx(gie,{todos:e.todos},_);case"memory-callout":return h.jsx(_ie,{memories:e.memories},_);case"question-card":{const S=d===void 0||d.has(e.toolUseId);return h.jsx(Sie,{toolUseId:e.toolUseId,questions:e.questions,historicalAnswers:e.submittedAnswers,realtimeAnswers:l==null?void 0:l[e.toolUseId],onSubmit:S?c:void 0,...S&&u?{onCancel:u}:{}},_)}default:return null}}function Nie(e,t,n){const r=$a.resolve(e.toolKind,e.tool),i=r?r.render({input:e.input,output:e.output,error:e.error,pending:e.pending,toolUseId:e.toolUseId,...n.fileSharingScope?{fileScope:n.fileSharingScope}:{},...n.onShareFile?{onShareFile:n.onShareFile}:{},...n.onOpenInTab?{onOpenInTab:n.onOpenInTab}:{},...n.onPreviewMarkdown?{onPreviewMarkdown:n.onPreviewMarkdown}:{}}):null;return h.jsx(Qe.Fragment,{children:i??h.jsx(xA,{tool:e.tool,input:e.input,output:e.output,error:e.error,pending:e.pending,...n.fileSharingScope?{fileScope:n.fileSharingScope}:{},...n.onShareFile?{onShareFile:n.onShareFile}:{},...n.onOpenInTab?{onOpenInTab:n.onOpenInTab}:{},...n.onPreviewMarkdown?{onPreviewMarkdown:n.onPreviewMarkdown}:{}})},t)}function g2(e){const t=e.getBoundingClientRect().top,n=[...e.querySelectorAll("[data-history-turn-id]")].find(r=>r.getBoundingClientRect().bottom>t);return n!=null&&n.dataset.historyTurnId?{turnId:n.dataset.historyTurnId,offset:n.getBoundingClientRect().top-t}:null}function Tie(e,t){const n=[...e.querySelectorAll("[data-history-turn-id]")].find(r=>r.dataset.historyTurnId===t.turnId);n&&(e.scrollTop+=n.getBoundingClientRect().top-e.getBoundingClientRect().top-t.offset)}const Pie={builtin:"Commands",global:"Global",project:"Project",plugin:"Plugin"},v2={builtin:0,global:1,project:2,plugin:3};function Rie({query:e,skills:t,activeIndex:n,onActiveIndexChange:r,onSelect:i}){const s=g.useRef(null),o=g.useMemo(()=>IA(t,e),[t,e]),a=g.useMemo(()=>{const l=new Set;let c=null;for(let u=0;u<o.length;u++)o[u].source!==c&&(l.add(u),c=o[u].source);return l},[o]);return g.useEffect(()=>{var l;try{(l=s.current)==null||l.scrollIntoView({block:"nearest"})}catch{}},[n]),o.length===0?null:h.jsx("div",{"data-testid":"cc-skill-selector",className:"absolute bottom-full left-0 right-0 z-50 mb-1.5 max-h-[320px] overflow-y-auto rounded-2xl border border-bg-300 bg-bg-50 shadow-lg",children:o.map((l,c)=>{const u=c===n,d=a.has(c);return h.jsxs(Qe.Fragment,{children:[d?h.jsx("div",{className:"sticky top-0 z-10 bg-bg-50/95 backdrop-blur-sm px-4 py-2 text-[10px] font-semibold uppercase tracking-wider text-text-400/70 border-b border-bg-200/60",children:Pie[l.source]}):null,h.jsxs("div",{ref:u?s:void 0,"data-testid":`cc-skill-item-${l.name}`,onMouseEnter:()=>r(c),onClick:()=>i(l),className:re("flex items-center gap-2.5 px-4 py-2 cursor-pointer transition-colors duration-75",u?"bg-[var(--text-100-dim)]":"hover:bg-bg-100/60"),children:[h.jsxs("code",{className:"text-[12px] font-mono font-semibold text-text-100 shrink-0",children:["/",l.name]}),l.description?h.jsx("span",{className:"text-[11px] text-text-300 truncate ml-auto",children:l.description}):null]})]},`${l.source}/${l.name}`)})})}function IA(e,t){const n=t.trim().toLowerCase(),r=n?e.filter(i=>i.name.toLowerCase().includes(n)||(i.description??"").toLowerCase().includes(n)):e.slice();return r.sort((i,s)=>(v2[i.source]??9)-(v2[s.source]??9)),r.slice(0,30)}const Aie=g.createContext(null);function Mie(){return g.useContext(Aie)}const jie={builtin:"Built-in",global:"Global",project:"Project",policy:"Policy",plugin:"Plugin",persona:"My personas",contact:"People","remote-persona":"Remote personas"},x2={builtin:0,global:1,project:2,policy:3,plugin:4,persona:5,contact:6,"remote-persona":7};function ip(e){switch(e.kind){case"persona":return"persona";case"contact":return"contact";case"remote-persona":return"remote-persona";case"cc-agent":return e.agent.source}}function Lie(e){switch(e.kind){case"persona":return`persona/${e.persona.personaId}`;case"contact":return`contact/${e.contact.deviceId}`;case"remote-persona":return`remote/${e.deviceId}/${e.persona.personaId}`;case"cc-agent":return`${e.agent.source}/${e.agent.name}`}}function Die(e){switch(e.kind){case"persona":return`${e.persona.personaId} ${e.persona.label}`.toLowerCase();case"contact":return`${e.contact.displayName} ${e.contact.deviceId}`.toLowerCase();case"remote-persona":return`${e.persona.personaId} ${e.persona.label}`.toLowerCase();case"cc-agent":{const t=e.agent;return`${t.name} ${t.description??""} ${t.whenToUse??""}`.toLowerCase()}}}function Oie(e){switch(e.kind){case"persona":return{displayName:`@persona/${e.persona.personaId}`,description:e.persona.label,testid:`cc-agent-item-persona-${e.persona.personaId}`};case"contact":return{displayName:`@${e.contact.displayName}`,description:e.contact.deviceId,testid:`cc-agent-item-contact-${e.contact.deviceId}`};case"remote-persona":return{displayName:`@persona/${e.persona.personaId}`,description:e.persona.label,testid:`cc-agent-item-remote-${e.deviceId}-${e.persona.personaId}`};case"cc-agent":return{displayName:`@${e.agent.name}`,description:e.agent.description,whenToUse:e.agent.whenToUse,plugin:e.agent.plugin,testid:`cc-agent-item-${e.agent.name}`}}}function NA(e,t){const n=t.trim().toLowerCase(),r=n?e.filter(i=>Die(i).includes(n)):e.slice();return r.sort((i,s)=>(x2[ip(i)]??9)-(x2[ip(s)]??9)),r.slice(0,30)}function y2({query:e,entries:t,activeIndex:n,onActiveIndexChange:r,onSelect:i}){const s=g.useRef(null),o=g.useMemo(()=>NA(t,e),[t,e]),a=g.useMemo(()=>{const l=new Set;let c=null;for(let u=0;u<o.length;u++){const d=ip(o[u]);d!==c&&(l.add(u),c=d)}return l},[o]);return g.useEffect(()=>{var l;try{(l=s.current)==null||l.scrollIntoView({block:"nearest"})}catch{}},[n]),o.length===0?null:h.jsx("div",{"data-testid":"cc-agent-selector",className:"absolute bottom-full left-0 right-0 z-50 mb-1.5 max-h-[320px] overflow-y-auto rounded-2xl border border-bg-300 bg-bg-50 shadow-lg",children:o.map((l,c)=>{const u=c===n,d=a.has(c),f=ip(l),p=Oie(l);return h.jsxs(Qe.Fragment,{children:[d?h.jsx("div",{"data-testid":`cc-agent-group-header-${f}`,"data-source":f,className:"sticky top-0 z-10 bg-bg-50/95 backdrop-blur-sm px-4 py-2 text-[10px] font-semibold uppercase tracking-wider text-text-400/70 border-b border-bg-200/60",children:jie[f]}):null,h.jsxs("div",{ref:u?s:void 0,"data-testid":p.testid,onMouseEnter:()=>r(c),onClick:()=>i(l),className:re("flex items-center gap-2.5 px-4 py-2 cursor-pointer transition-colors duration-75",u?"bg-[var(--text-100-dim)]":"hover:bg-bg-100/60"),children:[h.jsx("code",{className:"text-[12px] font-mono font-semibold text-text-100 shrink-0",children:p.displayName}),p.description?h.jsx("span",{className:"text-[11px] text-text-300 truncate ml-2",children:p.description}):null,p.whenToUse?h.jsx("span",{className:"text-[10px] text-text-400/70 italic truncate ml-auto",children:p.whenToUse}):null,p.plugin?h.jsx("span",{className:"text-[10px] text-text-400/70 ml-2 shrink-0",children:p.plugin}):null]})]},Lie(l))})})}function Bie({attachment:e,onRemove:t,onOpenPreview:n}){var l;const r=e.mimeType.startsWith("image/"),i=e.status==="error",s=e.status==="uploading",o=((l=e.error)==null?void 0:l.trim())||"附件上传失败,请移除后重试",a=r&&e.status==="done"&&!!e.previewUrl&&!!n;return h.jsxs("div",{"data-testid":`attachment-pill-${e.id}`,className:re("group relative flex items-center gap-1.5 rounded-lg border px-2 py-1.5 text-[12px] transition-colors",i?"border-red-400/40 bg-red-500/5":"border-bg-300 bg-bg-100"),children:[r&&e.previewUrl?h.jsxs("div",{className:"relative h-7 w-7 shrink-0",children:[h.jsx("img",{src:e.previewUrl,alt:e.fileName,onClick:a?n:void 0,"data-testid":`attachment-thumb-${e.id}`,className:re("h-7 w-7 rounded object-cover",a&&"cursor-pointer hover:opacity-80",s&&"opacity-40")}),s?h.jsx(Tn,{"data-testid":`attachment-spinner-${e.id}`,className:"absolute inset-0 m-auto h-3.5 w-3.5 animate-spin text-text-200"}):null]}):h.jsx("div",{className:"relative flex h-7 w-7 items-center justify-center rounded bg-text-100/5 shrink-0",children:s?h.jsx(Tn,{"data-testid":`attachment-spinner-${e.id}`,className:"h-3.5 w-3.5 animate-spin text-text-400"}):h.jsx(Ei,{className:"h-3.5 w-3.5 text-text-400"})}),h.jsx("span",{className:re("max-w-[120px] truncate text-text-200",s&&"text-text-400"),title:e.fileName,children:e.fileName}),i?h.jsx(Iu,{children:h.jsxs(Ju,{children:[h.jsx(ed,{asChild:!0,children:h.jsx("button",{type:"button","aria-label":`查看附件错误:${o}`,className:"flex h-4 w-4 items-center justify-center rounded text-red-400 shrink-0 cursor-help focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2",children:h.jsx(Jo,{className:"h-3 w-3","aria-hidden":"true"})})}),h.jsx(Wl,{side:"top",collisionPadding:8,className:"max-w-[min(24rem,calc(100vw-2rem))] whitespace-pre-wrap break-words",children:o})]})}):null,h.jsx("button",{type:"button",onClick:t,"data-testid":`attachment-remove-${e.id}`,className:"flex h-4 w-4 items-center justify-center rounded-full text-text-400 hover:text-text-100 hover:bg-text-100/10 transition-colors cursor-pointer shrink-0","aria-label":"remove",children:h.jsx(Jr,{className:"h-3 w-3"})})]})}function $ie({attachments:e,onRemove:t,onOpenPreview:n}){return e.length===0?null:h.jsx("div",{"data-testid":"attachment-row",className:"flex flex-wrap gap-1.5 mb-2 px-1",children:e.map(r=>h.jsx(Bie,{attachment:r,onRemove:()=>t(r.id),onOpenPreview:n?()=>n(r):void 0},r.id))})}class Sa extends Error{constructor(t,n,r){super(n),this.code=t,this.status=r,this.name="UploadAttachmentError"}}async function zie(e){if(!e.httpBaseUrl)throw new Sa("TUNNEL_NOT_READY","daemon httpBaseUrl unavailable");if(!e.httpToken)throw new Sa("NO_AUTH","daemon httpToken unavailable");const t=$T(e.file.name,e.file.type);if(!t)throw new Sa("UNSUPPORTED_MIME","不支持的文件类型");const n=new URLSearchParams({sessionId:e.sessionId,fileName:e.file.name,mimeType:t}),r=`${e.httpBaseUrl.replace(/\/$/,"")}/attachments/upload?${n.toString()}`;let i;try{i=await fetch(r,{method:"POST",headers:{Authorization:`Bearer ${e.httpToken}`,"Content-Type":t},body:e.file})}catch(s){throw new Sa("NETWORK_ERROR",s.message)}if(!i.ok){let s="UPLOAD_FAILED",o=`HTTP ${i.status}`;try{const a=await i.json();a.code&&(s=a.code),a.message&&(o=a.message)}catch{}throw new Sa(s,o,i.status)}return await i.json()}let Fie=0;const Hie=()=>`att-${++Fie}-${Date.now()}`;function Uie(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(typeof r.result=="string"?r.result:""),r.onerror=()=>n(r.error??new Error("read failed")),r.readAsDataURL(e)})}function Wie(e){const[t,n]=g.useState(e.initial??[]),r=g.useCallback(async o=>{const a=Array.from(o);if(a.length===0)return;const l=[],c=[],u=[];for(const d of a){const f=$T(d.name,d.type),p={id:Hie(),fileName:d.name,mimeType:f??(d.type||"application/octet-stream")};if(!f){c.push({...p,url:null,status:"error",error:"不支持的文件类型"});continue}if(d.size>FS){c.push({...p,url:null,status:"error",error:`超过 ${Math.round(FS/1024/1024)}MB 上限`});continue}if(e.sessionId==null){u.push({id:p.id,file:d,mimeType:p.mimeType}),c.push({...p,url:null,status:"uploading"});continue}const m=p.mimeType.startsWith("image/")?URL.createObjectURL(d):void 0;c.push({...p,url:null,status:"uploading",...m?{previewUrl:m}:{}}),l.push({id:p.id,file:d})}n(d=>[...d,...c]);for(const d of u)try{const f=await Uie(d.file.slice(0,d.file.size,d.mimeType));n(p=>p.map(m=>m.id===d.id?{...m,url:f,status:"done",...d.mimeType.startsWith("image/")?{previewUrl:f}:{}}:m))}catch(f){n(p=>p.map(m=>m.id===d.id?{...m,status:"error",error:f.message??"read failed"}:m))}l.length!==0&&await Promise.all(l.map(async d=>{try{const f=await zie({httpBaseUrl:e.httpBaseUrl,httpToken:e.httpToken,sessionId:e.sessionId,file:d.file});n(p=>p.map(m=>m.id===d.id?{...m,url:f.url,status:"done"}:m))}catch(f){const p=f instanceof Sa?f.code:"UPLOAD_FAILED",m=f.message??"upload failed";n(x=>x.map(w=>w.id===d.id?{...w,status:"error",error:`${p}: ${m}`}:w))}}))},[e.sessionId,e.httpBaseUrl,e.httpToken]),i=g.useCallback(o=>{n(a=>a.filter(l=>l.id!==o))},[]),s=g.useCallback(()=>{n([])},[]);return{attachments:t,setAttachments:n,addFiles:r,removeAttachment:i,clearAttachments:s}}function qie(e,t){return[...e.map(n=>n.text),t].map(n=>n.trim()).filter(Boolean).join(`
|
|
576
|
+
|
|
577
|
+
`)}function Vie(e){const t=Xf(e);return{text:t.text,attachments:t.attachments.map((n,r)=>({id:`queued-${r}-${n.fileName}`,fileName:n.fileName,mimeType:n.type==="image"?"image/*":"application/octet-stream",url:n.url,status:"done"}))}}const $x=new Map,Kie=[];function _2(e){if(e)return $x.get(e)}function b2(e,t){e&&(t.draft.length===0&&t.attachments.length===0?$x.delete(e):$x.set(e,t))}const w2=new Set;function Gie(e,t){return e.trim().length>0?`${e.trimEnd()}
|
|
578
|
+
|
|
579
|
+
${t}`:t}function Yie(e){return w2.add(e),()=>w2.delete(e)}function Xie(e,t){return e.replace(/(^|\s)\/(\S+)/g,(n,r,i)=>{const s=t.find(o=>o.name===i&&o.path);return s!=null&&s.path?`${r}[skill:${i}:${s.path}]`:n})}function Zie({api:e,cwd:t,sessionKey:n,onSend:r,disabled:i,onNewSession:s,onClearSession:o,tool:a,spawnableContacts:l=Kie,ensureRemotePersonas:c,remotePersonasByDeviceId:u}){const d=_2(n),[f,p]=g.useState((d==null?void 0:d.draft)??""),[m,x]=g.useState(!1),w=g.useRef(null),v=g.useRef(!1),_=g.useCallback(()=>{v.current=!0},[]),b=g.useCallback(()=>{v.current=!1},[]),S=Xp(),{attachments:C,setAttachments:k,addFiles:N,removeAttachment:E,clearAttachments:L}=Wie({httpBaseUrl:S.httpBaseUrl,httpToken:S.httpToken,sessionId:n,initial:(d==null?void 0:d.attachments)??[]}),[P,D]=g.useState([]),[R,A]=g.useState(!1),[M,j]=g.useState(0),[z,F]=g.useState(!1),[$,B]=g.useState([]),[I,U]=g.useState(!1),[V,O]=g.useState(0),[ne,ae]=g.useState(!1),[Y,ye]=g.useState([]),[Ce,oe]=g.useState(!1),[je,Ae]=g.useState(null),[De,xe]=g.useState(!1),Ke=g.useRef(null),rt=g.useMemo(()=>{const le=[];return s&&le.push({name:"new",source:"builtin",description:"在当前目录下新建会话"}),o&&n&&le.push({name:"clear",source:"builtin",description:"清除当前会话"}),le},[s,o,n]),Ze=g.useMemo(()=>[...rt,...P],[rt,P]),ht=g.useMemo(()=>{const le=f.match(/^\/(\S*)$/);return le?le[1]:null},[f]),Kt=ht!==null&&!z,de=g.useMemo(()=>ht!==null?IA(Ze,ht):[],[Ze,ht]),ze=g.useMemo(()=>{const le=f.match(/^@(\S*)$/);return le?le[1]:null},[f]),ke=ze!==null&&!ne,Fe=g.useMemo(()=>je?((u==null?void 0:u.get(je.deviceId))??[]).map(Se=>({kind:"remote-persona",persona:Se,deviceId:je.deviceId})):[...$.map(le=>({kind:"cc-agent",agent:le})),...Y.map(le=>({kind:"persona",persona:le})),...l.map(le=>({kind:"contact",contact:le}))],[je,u,$,Y,l]),yt=g.useMemo(()=>ze!==null?NA(Fe,ze):[],[Fe,ze]),tn=g.useRef(f);g.useEffect(()=>{f!==tn.current&&(F(!1),ae(!1),tn.current=f)},[f]);const hn=g.useCallback(()=>{F(!0)},[]),W=g.useCallback(()=>{ae(!0)},[]),ee=g.useRef(f),be=g.useRef(C);g.useEffect(()=>{ee.current=f},[f]),g.useEffect(()=>{be.current=C},[C]);const Le=g.useRef(n);g.useEffect(()=>{if(n!==null)return Yie((le,Se)=>{le===n&&(p(it=>Gie(it,Se)),queueMicrotask(()=>Hh(w.current)))})},[n]),g.useEffect(()=>{const le=Le.current;if(le===n)return;b2(le,{draft:ee.current,attachments:be.current});const Se=_2(n);p((Se==null?void 0:Se.draft)??""),k((Se==null?void 0:Se.attachments)??[]),j(0),O(0),F(!1),ae(!1),Ae(null),Ke.current=null,xe(!1),queueMicrotask(()=>{Se!=null&&Se.draft?Hh(w.current):xa(w.current)}),Le.current=n},[n,k]),g.useEffect(()=>()=>{b2(Le.current,{draft:ee.current,attachments:be.current})},[]),g.useEffect(()=>{j(0)},[ht]),g.useEffect(()=>{O(0)},[ze]),g.useEffect(()=>{ze===null&&je&&(Ae(null),Ke.current=null,xe(!1))},[ze,je]),g.useEffect(()=>{if(!Kt||R)return;if(!e){A(!0);return}let le=!1;return(async()=>{try{const Se=await e.skillsList(t,a);le||(D(Se.skills??[]),A(!0))}catch{le||A(!0)}})(),()=>{le=!0}},[Kt,R,e,t,a]),g.useEffect(()=>{if(!ke||I)return;if(!e){U(!0);return}let le=!1;return(async()=>{try{const Se=await e.agentsList(t,a);le||(B(Se.agents??[]),U(!0))}catch{le||U(!0)}})(),()=>{le=!0}},[ke,I,e,t,a]),g.useEffect(()=>{if(!ke||Ce)return;if(!e){oe(!0);return}let le=!1;return(async()=>{try{const Se=await e.personaList();le||(ye((Se.personas??[]).filter(it=>it.personaId!==CT).map(it=>({personaId:it.personaId,label:it.label}))),oe(!0))}catch{le||oe(!0)}})(),()=>{le=!0}},[ke,Ce,e]);const He=g.useCallback(le=>{switch(le.kind){case"persona":p(`@persona/${le.persona.personaId} `);break;case"cc-agent":p(`@"${le.agent.name} (agent)" `);break;case"contact":{const Se=le.contact.deviceId;Ae({deviceId:Se,displayName:le.contact.displayName}),Ke.current=Se,xe(!0),Promise.resolve(c==null?void 0:c(Se)).finally(()=>{Ke.current===Se&&xe(!1)}),p("@"),ae(!1),setTimeout(()=>{var it;return(it=w.current)==null?void 0:it.focus()},0);return}case"remote-persona":p(`@persona/${le.persona.personaId}@${le.deviceId} `),Ae(null);break}ae(!1),setTimeout(()=>{var Se;return(Se=w.current)==null?void 0:Se.focus()},0)},[c]),Mt=g.useCallback(()=>{Ae(null),Ke.current=null,xe(!1),p("@"),setTimeout(()=>{var le;return(le=w.current)==null?void 0:le.focus()},0)},[]),bn=g.useCallback(le=>{if(le.source==="builtin"&&le.name==="new"&&s){p(""),L(),xa(w.current),s(t);return}if(le.source==="builtin"&&le.name==="clear"&&o){p(""),L(),xa(w.current),o();return}p(`/${le.name} `),setTimeout(()=>{var Se;return(Se=w.current)==null?void 0:Se.focus()},0)},[s,t,L,o]),nn=g.useCallback(async()=>{const le=f.trim(),Se=C.filter(mt=>mt.status==="done");if(!le&&Se.length===0||m||i)return;if(le==="/new"&&s){x(!0);try{await s(t),p(""),L(),xa(w.current)}finally{x(!1)}return}if(le==="/clear"&&o){x(!0);try{await o(),p(""),L(),xa(w.current)}finally{x(!1)}return}const it=hT(a)||pT(a)?Xie(le,P):le;x(!0);try{const mt=RG(it,C);await r(mt,{queueWhileRunning:!0}),p(""),L(),xa(w.current)}finally{x(!1)}},[f,C,m,i,r,s,t,L,o,a,P]),fn=g.useCallback(le=>{const{text:Se,attachments:it}=Vie(le);if(p(Se),it.length>0){const mt=new Set(be.current.map(gr=>gr.id));k([...be.current,...it.filter(gr=>!mt.has(gr.id))])}queueMicrotask(()=>Hh(w.current))},[k]);return{draft:f,setDraft:p,sending:m,textareaRef:w,isComposingRef:v,onCompositionStart:_,onCompositionEnd:b,attachments:C,addFiles:N,removeAttachment:E,skillSelectorVisible:Kt,filteredSkills:de,slashQuery:ht??"",activeSkillIdx:M,setActiveSkillIdx:j,selectSkill:bn,dismissSkillSelector:hn,agentSelectorVisible:ke,filteredAgents:yt,mentionQuery:ze,activeAgentIdx:V,setActiveAgentIdx:O,selectAgent:He,dismissAgentSelector:W,drilldown:je,drilldownLoading:De,exitDrilldown:Mt,doSend:nn,restoreTextToDraft:fn}}const Qie=120;function Hh(e){e&&(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,Qie)}px`)}function xa(e){e&&(e.style.height="auto")}function Jie({items:e,restoreDisabled:t,onRestore:n,onRemove:r}){return e.length===0?null:h.jsxs("div",{"data-testid":"chat-input-queue",className:"flex flex-col",children:[h.jsx("div",{className:"px-1 pb-1 text-[11px] text-text-400",children:`排队中 · ${e.length} 条(这一轮跑完连起来一起发出)`}),e.map((i,s)=>h.jsxs("div",{"data-testid":`chat-input-queue-item-${i.id}`,className:"flex items-center gap-2 rounded-md px-1 py-1 transition-colors hover:bg-text-100/5",children:[h.jsx("span",{className:"shrink-0 w-4 text-center text-[11px] text-text-400 tabular-nums",children:s+1}),h.jsx("button",{type:"button","data-testid":`chat-input-queue-restore-${i.id}`,disabled:t,title:t?"先清空输入框再取回这条":"取回输入框继续改",onClick:()=>n(i.id),className:"flex-1 min-w-0 text-left text-[12.5px] text-text-200 truncate hover:text-text-100 disabled:cursor-not-allowed disabled:hover:text-text-200",children:i.text.trim()||"(空消息)"}),h.jsx("button",{type:"button","aria-label":"移出队列","data-testid":`chat-input-queue-remove-${i.id}`,onClick:()=>r(i.id),className:"shrink-0 p-0.5 rounded text-text-400 hover:text-text-100 hover:bg-text-100/10",children:h.jsx(Jr,{className:"w-3.5 h-3.5"})})]},i.id))]})}const ese="[--color-border:#E6E6E6] [--bg-300:#E6E6E6] dark:[--color-border:#424242] dark:[--bg-300:#424242]",tse={spawnableContacts:[],ensureRemotePersonas:()=>Promise.resolve(),remotePersonasByDeviceId:new Map},nse=g.createContext(tse);function rse(){return g.useContext(nse)}function ise({url:e,fileName:t,onClose:n}){const[r,i]=g.useState(!1);g.useEffect(()=>{const o=a=>{a.key==="Escape"&&n()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n]);const s=async()=>{try{const a=await(await fetch(e)).blob();await navigator.clipboard.write([new ClipboardItem({[a.type]:a})]),i(!0),setTimeout(()=>i(!1),2e3)}catch{S2(e,t)}};return h.jsx("div",{"data-testid":"image-lightbox",className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60",onClick:n,role:"dialog","aria-modal":"true",children:h.jsxs("div",{className:"relative",onClick:o=>o.stopPropagation(),children:[h.jsx("img",{src:e,alt:t,className:"max-h-[90vh] max-w-[92vw] rounded-lg object-contain shadow-2xl"}),h.jsxs("div",{className:"absolute right-2 top-2 flex items-center gap-1.5",children:[h.jsxs("button",{type:"button",onClick:s,"data-testid":"image-lightbox-copy",className:"flex cursor-pointer items-center gap-1 rounded-full border border-bg-300 bg-bg-50/95 px-2 py-0.5 text-[11px] font-medium text-text-200 shadow transition-colors hover:bg-bg-100",children:[h.jsx(Jy,{className:"h-3 w-3"}),r?"Copied":"Copy"]}),h.jsxs("button",{type:"button",onClick:()=>S2(e,t),"data-testid":"image-lightbox-save",className:"flex cursor-pointer items-center gap-1 rounded-full border border-bg-300 bg-bg-50/95 px-2 py-0.5 text-[11px] font-medium text-text-200 shadow transition-colors hover:bg-bg-100",children:[h.jsx(T7,{className:"h-3.5 w-3.5"}),"Save"]}),h.jsx("button",{type:"button",onClick:n,"data-testid":"image-lightbox-close","aria-label":"close",className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded-full border border-bg-300 bg-bg-50/95 text-text-300 transition-colors hover:bg-bg-100 hover:text-text-100",children:h.jsx(Jr,{className:"h-3 w-3"})})]})]})})}function S2(e,t){const n=document.createElement("a");n.href=e,n.download=t||"image",n.click()}const k2=1e3,TA=`bg-bg-50 ${ese}`,C2=`mx-2 -mb-3 rounded-t-xl border border-b-0 border-border px-3 pt-2 pb-4 ${TA}`,sse=5e3;function oh(e){if(!e)return"null";if(e===document.body)return"body";const t=e.getAttribute("data-testid"),n=typeof e.className=="string"&&e.className.trim()?`.${e.className.trim().split(/\s+/).slice(0,3).join(".")}`:"";return`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:""}${t?`[${t}]`:""}${n}`}function ose({meta:e,api:t,cwd:n,tool:r,onSend:i,sessionKey:s,queued:o,onDequeue:a,disabled:l=!1,placeholder:c,className:u,awaitingUser:d=!1,onAbort:f,onNewSession:p,onClearSession:m,configSlot:x,aboveSlot:w}){const v=(e==null?void 0:e.streamInProgress)??!1,_=(e==null?void 0:e.contextPct)??null,b=_==null?"":_>=80?"text-red-400":_>=50?"text-amber-400":"text-text-500",S=g.useRef(null),C=rse(),k=Zie({...t?{api:t}:{},cwd:n,...r?{tool:r}:{},sessionKey:s,onSend:i,disabled:l,...p?{onNewSession:p}:{},...m?{onClearSession:m}:{},spawnableContacts:C.spawnableContacts,ensureRemotePersonas:C.ensureRemotePersonas,remotePersonasByDeviceId:C.remotePersonasByDeviceId}),{draft:N,setDraft:E,sending:L,textareaRef:P,attachments:D,addFiles:R,removeAttachment:A,skillSelectorVisible:M,filteredSkills:j,slashQuery:z,activeSkillIdx:F,setActiveSkillIdx:$,selectSkill:B,dismissSkillSelector:I,agentSelectorVisible:U,filteredAgents:V,mentionQuery:O,activeAgentIdx:ne,setActiveAgentIdx:ae,selectAgent:Y,dismissAgentSelector:ye,drilldown:Ce,drilldownLoading:oe,exitDrilldown:je,doSend:Ae,restoreTextToDraft:De}=k,xe=g.useCallback(()=>{(async()=>{const se=await(f==null?void 0:f());se&&se.length>0&&De(qie(se,N))})()},[f,De,N]),Ke=g.useCallback(se=>{const nt=o==null?void 0:o.find(Bt=>Bt.id===se);!nt||!a||N.trim().length>0||(a(se),De(nt.text))},[o,a,N,De]),rt=Mie();g.useEffect(()=>{if(!rt||rt.signal===0||s===null||rt.sessionId!==s)return;const{signal:se}=rt;console.log("[chat-focus] 收到聚焦信号",{sessionKey:s,signal:se,delayMs:k2,activeElement:oh(document.activeElement)});let nt=null,Bt=null,ni=null;const oa=setTimeout(()=>{if(nt=P.current,!nt){console.warn("[chat-focus] textarea 已不在,放弃聚焦",{sessionKey:s,signal:se});return}nt.focus(),console.log("[chat-focus] focus() 已执行",{sessionKey:s,signal:se,landed:document.activeElement===nt,activeElement:oh(document.activeElement)}),Bt=aa=>{const hs=oh(aa.relatedTarget);setTimeout(()=>{console.warn("[chat-focus] STOLEN 输入框失焦",{sessionKey:s,signal:se,relatedTarget:hs,activeElementAfterTick:oh(document.activeElement)})},0)},nt.addEventListener("blur",Bt,{once:!0}),ni=setTimeout(()=>{nt&&Bt&&nt.removeEventListener("blur",Bt)},sse)},k2);return()=>{clearTimeout(oa),ni&&clearTimeout(ni),nt&&Bt&&nt.removeEventListener("blur",Bt)}},[rt==null?void 0:rt.signal]);const Ze=!!t,ht=L||l||v,de=(N.trim().length>0||D.some(se=>se.status==="done"))&&!l&&!L&&!d,ze=c??(d?"Answer the question above first...":ht?"Queue a message...":`Message ${s_(r)}...`),ke=g.useRef(!1),Fe=g.useCallback(()=>{ke.current=!0},[]),yt=g.useCallback(()=>{ke.current=!1},[]),tn=g.useCallback(se=>{if(M&&j.length>0){if(se.key==="ArrowDown")return se.preventDefault(),$(F>=j.length-1?0:F+1),!0;if(se.key==="ArrowUp")return se.preventDefault(),$(F<=0?j.length-1:F-1),!0;if(se.key==="Tab"||se.key==="Enter"&&!se.shiftKey){se.preventDefault();const nt=j[F];return nt&&B(nt),!0}if(se.key==="Escape")return se.preventDefault(),I(),!0}return!1},[M,j,F,$,B,I]),hn=g.useCallback(se=>{if(U&&V.length>0){if(se.key==="ArrowDown")return se.preventDefault(),ae(ne>=V.length-1?0:ne+1),!0;if(se.key==="ArrowUp")return se.preventDefault(),ae(ne<=0?V.length-1:ne-1),!0;if(se.key==="Tab"||se.key==="Enter"&&!se.shiftKey){se.preventDefault();const nt=V[ne];return nt&&Y(nt),!0}if(se.key==="Escape")return se.preventDefault(),Ce?je():ye(),!0}return!1},[U,V,ne,ae,Y,ye,Ce,je]),W=g.useCallback(se=>{const nt=se.nativeEvent;se.key==="Enter"&&pP({compositionActive:ke.current,nativeIsComposing:nt.isComposing,keyCode:nt.keyCode})||tn(se)||hn(se)||mP({key:se.key,shiftKey:se.shiftKey,compositionActive:ke.current,nativeIsComposing:nt.isComposing,keyCode:nt.keyCode})&&(se.preventDefault(),de&&Ae())},[tn,hn,de,Ae]),ee=g.useCallback(se=>{E(se.target.value),Hh(se.target)},[E]),be=g.useCallback(se=>{se.target.files&&R(se.target.files),se.target.value=""},[R]),Le=g.useCallback(se=>{if(!Ze)return;const nt=Array.from(se.clipboardData.items).map(Bt=>Bt.getAsFile()).filter(Bt=>!!(Bt&&Bt.type.startsWith("image/")));nt.length!==0&&(se.preventDefault(),R(nt))},[R,Ze]),[He,Mt]=g.useState(null),bn=g.useCallback(se=>{se.previewUrl&&Mt({url:se.previewUrl,name:se.fileName})},[]),[nn,fn]=g.useState(!1),le=g.useCallback(se=>{Ze&&(se.preventDefault(),fn(!0))},[Ze]),Se=g.useCallback(()=>fn(!1),[]),it=g.useCallback(se=>{Ze&&(se.preventDefault(),fn(!1),se.dataTransfer.files.length>0&&R(se.dataTransfer.files))},[R,Ze]),mt=v&&!d&&typeof f=="function",gr=l||d;return h.jsxs("div",{"data-testid":"chat-input",className:re("shrink-0 border-t border-bg-300/20 px-4 py-3",u),onDragOver:le,onDragLeave:Se,onDrop:it,children:[h.jsxs("div",{className:"max-w-3xl mx-auto relative",children:[Ze?h.jsx("input",{ref:S,type:"file",multiple:!0,accept:M$,hidden:!0,onChange:be,"data-testid":"chat-input-file"}):null,h.jsxs("div",{"data-testid":"chat-input-bare",className:re("flex flex-col gap-2"),children:[d||L||v?h.jsxs("div",{"data-testid":"chat-input-status-bar",className:"flex items-center gap-2 text-[12px] text-text-400",children:[h.jsxs("div",{className:"flex gap-1",children:[h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-400-dim-fg animate-bounce",style:{animationDelay:"0ms"}}),h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-400-dim-fg animate-bounce",style:{animationDelay:"150ms"}}),h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-text-400-dim-fg animate-bounce",style:{animationDelay:"300ms"}})]}),h.jsx("span",{children:d?"Waiting for your answer":`${hT(r)?"Codex":pT(r)?"pi":"Claude"} is working`})]}):null,M?h.jsx(Rie,{query:z,skills:j,activeIndex:F,onActiveIndexChange:$,onSelect:B}):null,U?Ce?!C.remotePersonasByDeviceId.has(Ce.deviceId)&&oe?h.jsx("div",{"data-testid":"cc-agent-remote-loading",className:"absolute bottom-full left-0 right-0 z-50 mb-1.5 rounded-2xl border border-bg-300 bg-bg-50 px-4 py-3 text-[12px] text-text-300 shadow-lg",children:`正在加载 @${Ce.displayName} 的 persona…`}):V.length>0?h.jsx(y2,{query:O??"",entries:V,activeIndex:ne,onActiveIndexChange:ae,onSelect:Y}):h.jsx("div",{"data-testid":"cc-agent-remote-empty",className:"absolute bottom-full left-0 right-0 z-50 mb-1.5 rounded-2xl border border-bg-300 bg-bg-50 px-4 py-3 text-[12px] text-text-300 shadow-lg",children:`@${Ce.displayName} 暂无可派活的 persona(可能离线或未公开)`}):h.jsx(y2,{query:O??"",entries:V,activeIndex:ne,onActiveIndexChange:ae,onSelect:Y}):null,o&&o.length>0?h.jsx("div",{"data-testid":"chat-input-queue-header",className:C2,children:h.jsx(Jie,{items:o,restoreDisabled:N.trim().length>0||!a,onRestore:Ke,onRemove:se=>void(a==null?void 0:a(se))})}):null,D.length>0?h.jsx($ie,{attachments:D,onRemove:A,onOpenPreview:bn}):null,w?h.jsx("div",{"data-testid":"chat-input-above-slot",className:C2,children:w}):null,h.jsxs("div",{"data-testid":"bare-chat-input-frame",className:re("relative flex flex-col gap-1 rounded-xl border border-border px-3 py-2 transition-colors duration-200",TA,gr?"opacity-60":null,nn?"border-accent/60 bg-accent/5":null),children:[h.jsx("textarea",{ref:P,"data-testid":"chat-input-textarea",value:N,onChange:ee,onKeyDown:W,onCompositionStart:Fe,onCompositionEnd:yt,onPaste:Le,placeholder:ze,disabled:gr,readOnly:gr,rows:1,className:"w-full resize-none bg-transparent border-0 outline-none text-[14px] text-text-100 placeholder:text-text-400 leading-relaxed py-1 min-h-[22px] max-h-[120px] overflow-y-auto disabled:cursor-not-allowed"}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[Ze?h.jsx("button",{type:"button",onClick:()=>{var se;return(se=S.current)==null?void 0:se.click()},disabled:ht,"data-testid":"chat-input-attach","aria-label":"attach files",className:re("flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition-colors",ht?"cursor-default text-text-400/50":"cursor-pointer text-text-400 hover:bg-text-100/5 hover:text-text-200"),children:h.jsx(hF,{className:"h-4 w-4"})}):null,h.jsx("div",{className:"flex-1 min-w-0"}),_!=null?h.jsxs("span",{"data-testid":"chat-input-ctx",className:re("shrink-0 text-[11px] tabular-nums",b),children:["ctx:",_,"%"]}):null,x,mt?h.jsx("button",{type:"button",onClick:xe,"data-testid":"chat-input-abort","aria-label":"interrupt",title:"中断当前轮次(不杀进程)",className:"h-8 w-8 rounded-full flex items-center justify-center border border-text-400/40 text-text-400 hover:bg-text-100/5 hover:text-text-100 transition-colors cursor-pointer",children:h.jsx(a3,{className:"w-3.5 h-3.5",strokeWidth:2.5})}):null,h.jsx("button",{type:"button",onClick:()=>{de&&Ae()},disabled:!de,"data-testid":"chat-input-send","aria-label":"send",className:re("h-8 w-8 rounded-full flex items-center justify-center transition-colors",de?"bg-accent text-white hover:bg-accent-hover cursor-pointer shadow-sm":"bg-[var(--text-400-dim)] text-[var(--text-400-dim-fg)] cursor-default"),children:h.jsx(e7,{className:"w-4 h-4",strokeWidth:2.5})})]})]})]})]}),He?h.jsx(ise,{url:He.url,fileName:He.name,onClose:()=>Mt(null)}):null]})}function ase(e){const t=e.replace(/\/+$/,""),n=t.lastIndexOf("/");return n>=0?t.slice(n+1):t}function lse({meta:e,tool:t,connState:n,variant:r="full",onOpenConfig:i,liveWorktreeRoot:s,ephemeral:o=!1,onPromote:a,cloudVolume:l,className:c}){const u=s??e.cwd??"",f=!!e.sessionLabel&&e.sessionLabel!==e.sessionId?e.sessionLabel:ase(u),p=u;return r==="quickask"?h.jsxs("div",{"data-testid":"chat-header","data-variant":"quickask",className:re("flex items-center shrink-0 px-3 py-2 gap-2",c),children:[a?h.jsx("button",{type:"button","data-testid":"chat-header-promote","data-promoted":o?"false":"true",disabled:!o,onClick:a,title:o?"保留为正式会话":"已保留为正式会话",className:re("shrink-0 inline-flex items-center justify-center h-5 w-5 rounded-md transition-colors",o?"text-text-500 hover:text-text-200 hover:bg-text-100/5 cursor-pointer":"text-amber-400"),children:h.jsx(a7,{className:re("w-3.5 h-3.5",!o&&"fill-current")})}):null,h.jsx("span",{className:"font-semibold text-text-100 truncate text-[13px]","data-testid":"chat-header-worktree",title:p,children:f})]}):h.jsxs("div",{"data-testid":"chat-header","data-variant":"full",className:re("relative flex items-center shrink-0 px-4 py-2.5",l?"pr-36 md:pr-32":"pr-[4.5rem] md:pr-4",c),children:[h.jsx("span",{className:"font-semibold text-text-100 truncate text-[13px]","data-testid":"chat-header-worktree",title:p,children:f}),h.jsxs("div",{className:"absolute right-4 top-1/2 -translate-y-1/2 z-10 flex items-center gap-1",children:[l,i?h.jsx("button",{type:"button","aria-label":"Session settings","data-testid":"chat-header-settings-mobile",onClick:i,title:"Session settings",className:"flex md:hidden h-7 w-7 items-center justify-center rounded-md bg-transparent text-text-300 transition-colors duration-150 hover:bg-bg-200 hover:text-text-100 cursor-pointer outline-none",children:h.jsx(i3,{className:"w-4 h-4"})}):null]})]})}function cse({testid:e,children:t}){return h.jsx("div",{"data-testid":e,className:"h-full min-w-0 border-l border-border bg-bg-100 flex flex-col",children:t})}function use({title:e,onBack:t,onCollapse:n,collapseLabel:r="collapse session info",collapseTitle:i="收起会话信息"}){const s=o=>h.jsx("button",{type:"button","data-testid":"session-info-collapse",onClick:n,"aria-label":r,title:i,className:`p-1 rounded text-text-400 hover:text-text-100 hover:bg-text-100/10 ${o}`,children:h.jsx(nk,{className:"w-4 h-4"})});return h.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border shrink-0",children:[t?h.jsx("button",{type:"button","data-testid":"session-info-back",onClick:t,"aria-label":"返回会话信息",className:"p-1 -ml-1 rounded text-text-400 hover:text-text-100 hover:bg-text-100/10",children:h.jsx(n3,{className:"w-4 h-4"})}):n?s("-ml-1"):h.jsx(nk,{className:"w-4 h-4 text-text-300"}),h.jsx("span",{className:"flex-1 text-[13px] font-medium text-text-100 truncate",children:e}),t&&n?s(""):null]})}function ah({icon:e,label:t,meta:n,onClick:r,testid:i,disabled:s}){return h.jsxs("button",{type:"button","data-testid":i,onClick:r,disabled:s,className:"w-full flex items-center gap-2.5 px-2 py-1.5 rounded-md cursor-pointer text-left hover:bg-text-100/5 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent",children:[h.jsx("span",{className:"w-4 h-4 shrink-0 text-text-300 inline-flex items-center justify-center",children:e}),h.jsx("span",{className:"flex-1 text-[12.5px] text-text-100",children:t}),n?h.jsx("span",{className:"shrink-0 text-[11px] text-text-400 font-mono",children:n}):null]})}let dse=null;function hse(){return dse}function Ic({label:e,labelTitle:t,children:n}){return h.jsxs("div",{className:"flex items-start gap-2 px-2 py-1",children:[h.jsx("span",{className:"w-14 shrink-0 truncate text-[11px] text-text-400 pt-0.5",...t?{title:t}:{},children:e}),h.jsx("span",{className:"flex-1 min-w-0 text-[12px] text-text-100",children:n})]})}function E2({label:e,labelTitle:t,value:n,testid:r}){const[i,s]=g.useState(!1),o=g.useRef(null);g.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const a=()=>{typeof navigator>"u"||!navigator.clipboard||navigator.clipboard.writeText(n).then(()=>{s(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>s(!1),2e3)},()=>{})};return h.jsx(Ic,{label:e,labelTitle:t,children:h.jsxs("button",{type:"button",onClick:a,"data-testid":r,title:i?"已复制":`复制:${n}`,className:"w-full flex items-center gap-1.5 text-left group cursor-pointer",children:[h.jsx("span",{className:"font-mono text-[11px] text-text-300 truncate flex-1 min-w-0",children:n}),i?h.jsx(Qo,{className:"w-3 h-3 shrink-0 text-accent"}):h.jsx(Jy,{className:"w-3 h-3 shrink-0 text-text-400 opacity-0 group-hover:opacity-100 transition-opacity"})]})})}function fse({session:e,meta:t,liveGitBranch:n,liveWorktreeRoot:r,personaName:i,onOpenPersona:s,onOpenFiles:o,cronActiveCount:a,onCronClick:l,onForceStop:c,onReloadFromCloud:u,reloadFromCloudDisabled:d=!1,viewerRole:f="owner",toolSessionIdLabel:p="tool session id",drill:m=null,onCollapse:x,title:w="会话信息",leadingEntries:v}){const _=n!==void 0?n:t.gitBranch??null,b=t.procAlive??!1,S=T3(e),C=S!=null&&e.originOwnerPrincipalId==null&&f!=="guest",[k,N]=g.useState(null),E=g.useRef(null);g.useEffect(()=>()=>{E.current&&clearTimeout(E.current)},[]);const L=async()=>{if(!C)return;const P=hse();let D;try{P||(await navigator.clipboard.writeText(S),D="命令已复制")}catch{D="操作失败"}N(D),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>N(null),2500)};return h.jsxs(cse,{testid:"session-info-panel",children:[h.jsx(use,{title:m?m.title:w,...m?{onBack:m.onBack}:{},...x?{onCollapse:x}:{},collapseTitle:`收起${w}`}),m?h.jsx("div",{"data-testid":"session-info-drill",className:"flex-1 min-h-0 overflow-y-auto",children:m.content}):h.jsxs("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:[_?h.jsx(Ic,{label:"分支",children:h.jsxs("span",{"data-testid":"session-info-branch",className:"inline-flex items-center gap-1 font-mono text-[11.5px] min-w-0",title:r??void 0,children:[h.jsx(pl,{className:"w-3 h-3 shrink-0 text-text-400"}),h.jsx("span",{className:"truncate",children:_})]})}):null,i&&s?h.jsx(Ic,{label:"persona",children:h.jsxs("button",{type:"button","data-testid":"session-info-persona",onClick:s,className:"inline-flex items-center gap-1 hover:text-accent cursor-pointer",children:[h.jsx(d3,{className:"w-3 h-3"}),h.jsx("span",{className:"truncate",children:i})]})}):null,h.jsx(Ic,{label:"引擎",children:h.jsxs("span",{className:"inline-flex items-center gap-1.5","data-testid":"session-info-engine",children:[h.jsx(Jp,{tool:e.tool,className:re("w-3.5 h-3.5 shrink-0",em(e.tool))}),h.jsxs("span",{className:"truncate",children:[s_(e.tool),t.model?` · ${t.model}`:""]})]})}),h.jsx(Ic,{label:"cwd",children:h.jsx("span",{"data-testid":"session-info-cwd",className:"font-mono text-[11px] text-text-300 truncate block",title:e.cwd,children:e.cwd})}),h.jsx(E2,{label:"session id",value:e.sessionId,testid:"session-info-session-id"}),e.toolSessionId?h.jsx(E2,{label:`${e.tool||"claude"} id`,labelTitle:p,value:e.toolSessionId,testid:"session-info-tool-session-id"}):null,h.jsx("div",{className:"my-2 border-t border-border"}),v,o?h.jsx(ah,{icon:h.jsx($7,{className:"w-3.5 h-3.5"}),label:"Edited Files",onClick:o,testid:"session-info-files"}):null,a&&a>0&&l?h.jsx(ah,{icon:h.jsx(_7,{className:"w-3.5 h-3.5"}),label:"定时任务",meta:String(a),onClick:l,testid:"session-info-cron"}):null,C?h.jsx(ah,{icon:h.jsx(OF,{className:"w-3.5 h-3.5"}),label:"终端",meta:k,onClick:()=>void L(),testid:"session-info-terminal"}):null,u?h.jsx(ah,{icon:h.jsx(w7,{className:"w-3.5 h-3.5"}),label:"从云端重新加载",...d?{meta:"运行中"}:{},onClick:u,disabled:d,testid:"session-info-reload-cloud"}):null]}),b&&c?h.jsx("div",{className:"shrink-0 border-t border-border px-3 py-2.5",children:h.jsxs("button",{type:"button","data-testid":"session-info-force-stop",onClick:c,title:e.tool==="codex"?"强制停止 Codex 进程":"强制停止 Claude Code 进程(会丢失 initialize / 预热缓存)",className:"inline-flex items-center gap-1.5 h-6 px-2.5 rounded-md text-text-400 hover:bg-red-500/10 hover:text-red-400 transition-colors text-[12px] cursor-pointer",children:[h.jsx(cF,{className:"w-3.5 h-3.5"}),h.jsx("span",{children:"强制停止"})]})}):null]})}const pse=g.createContext({container:null});function mse(){return g.useContext(pse)}const ub="fixed top-0 md:top-10 bottom-0 right-0";function gse({api:e,cwd:t,toolSessionId:n,toolKind:r="claude"}){const i=SA(),s=(i==null?void 0:i.state.agentId)??null,o=i==null?void 0:i.state.agentType,[a,l]=g.useState([]),[c,u]=g.useState(!1),[d,f]=g.useState(null);g.useEffect(()=>{if(!s)return;let m=!1;return u(!0),f(null),l([]),e.historySubagentRead({cwd:t,toolSessionId:n,subagentId:s}).then(x=>{m||l(x.messages??[])}).catch(x=>{m||f(x instanceof Error?x.message:String(x))}).finally(()=>{m||u(!1)}),()=>{m=!0}},[s,t,n,e]);const p=g.useMemo(()=>a.length>0?U_(a,0,r):[],[a,r]);return!i||!s?null:h.jsxs("div",{"data-testid":"subagent-drawer","data-agent-id":s,className:re(ub,"z-50 w-[min(560px,92vw)]","flex flex-col border-l border-bg-200/60 bg-bg-50 shadow-xl"),style:{paddingTop:"env(safe-area-inset-top)"},children:[h.jsxs("div",{className:"flex flex-col gap-0.5 px-3 py-2 border-b border-bg-200/60",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o?h.jsx("span",{className:"inline-flex items-center rounded-sm bg-violet-500/10 px-1.5 py-0.5 text-[11px] text-violet-400 font-medium",children:o}):null,h.jsx("span",{className:"font-mono text-[11px] text-text-400 truncate",title:s,children:s})]}),h.jsx("button",{type:"button","aria-label":"关闭",onClick:()=>i.close(),className:"p-1 rounded hover:bg-bg-200/50 text-text-400 hover:text-text-200",children:h.jsx(Jr,{className:"w-4 h-4"})})]}),!c&&!d&&a.length>0?h.jsxs("div",{className:"text-[11px] text-text-400",children:[a.length," 条消息 · 首条为主会话派发的任务指令"]}):null]}),h.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden px-3 py-2",children:c?h.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-text-400",children:[h.jsx(Tn,{className:"w-3.5 h-3.5 animate-spin"}),h.jsx("span",{children:"加载中…"})]}):d?h.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-error",children:[h.jsx(Jo,{className:"w-3.5 h-3.5"}),h.jsx("span",{children:d})]}):p.length===0?h.jsx("div",{className:"text-[12px] text-text-400 italic",children:"无消息"}):h.jsx(EA,{lines:p})})]})}function I2(e,t){let n=0;for(const r of e.lines)r.startsWith(t)&&n++;return n}function vse(e,t){const n=e.findIndex(c=>c.kind==="user-text"&&c.uuid===t);if(n<0)return{userMessageId:t,files:[],totalInsertions:0,totalDeletions:0,anchorFound:!1};let r=e.length;for(let c=n+1;c<e.length;c++)if(e[c].kind==="user-text"){r=c;break}const i=[],s=new Map;for(let c=n+1;c<r;c++){const u=e[c];if(u.kind!=="tool-result")continue;const d=u.toolResultExtra;if(!(d!=null&&d.filePath)||!d.structuredPatch||d.structuredPatch.length===0)continue;const f=d.filePath;let p=s.get(f);p||(p={filePath:f,hunks:[],insertions:0,deletions:0},s.set(f,p),i.push(f));for(const m of d.structuredPatch)p.hunks.push(m),p.insertions+=I2(m,"+"),p.deletions+=I2(m,"-")}const o=i.map(c=>s.get(c)),a=o.reduce((c,u)=>c+u.insertions,0),l=o.reduce((c,u)=>c+u.deletions,0);return{userMessageId:t,files:o,totalInsertions:a,totalDeletions:l,anchorFound:!0}}function xse({open:e,onOpenChange:t,api:n,sessionId:r,userMessageId:i,lines:s,procAlive:o,onApplied:a,onNoChanges:l}){const c=g.useMemo(()=>vse(s,i),[s,i]),[u,d]=g.useState(null),[f,p]=g.useState(!1),[m,x]=g.useState(!1),[w,v]=g.useState(null);g.useEffect(()=>{if(!e)return;let k=!1;return p(!0),d(null),(async()=>{try{const N=await n.sessionRewindDiff({sessionId:r,userMessageId:i});k||(d(N),!N.canRewind&&!N.error&&N.files.length===0&&(l==null||l(i)))}catch{k||d(null)}finally{k||p(!1)}})(),()=>{k=!0}},[e,n,r,i]);const _=g.useMemo(()=>{if(u){const k=!u.canRewind&&!u.error&&u.files.length===0;if(u.canRewind||k)return{source:"rpc",anchorFound:!0,files:u.files.map(N=>({filePath:N.filePath,hunks:N.hunks,insertions:N.insertions,deletions:N.deletions})),totalInsertions:u.totalInsertions,totalDeletions:u.totalDeletions}}return{source:"local",anchorFound:c.anchorFound,files:c.files,totalInsertions:c.totalInsertions,totalDeletions:c.totalDeletions,rpcError:u==null?void 0:u.error}},[u,c]),b=g.useCallback(async()=>{x(!0),v(null);try{const k=await n.sessionRewind({sessionId:r,userMessageId:i,dryRun:!1});if(!k.canRewind){v(k.error??"回退失败");return}a==null||a(),t(!1)}catch(k){v(k.message||"回退失败")}finally{x(!1)}},[n,r,i,a,t]);if(!e)return null;const S=_.files.length>0,C=!f&&!m&&_.anchorFound&&S&&!w;return h.jsxs("div",{"data-testid":"rewind-preview-drawer",className:`${ub} z-40 flex flex-col border-l border-bg-300/40 bg-bg-0 shadow-xl`,style:{width:480,minWidth:480},children:[h.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-bg-300/30 shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(u3,{className:"w-4 h-4 text-text-300"}),h.jsx("span",{className:"text-[14px] font-semibold text-text-100",children:"Rewind 预览"})]}),h.jsx("button",{type:"button",onClick:()=>t(!1),"data-testid":"rewind-drawer-close",className:"flex items-center justify-center w-7 h-7 rounded-md text-text-400 hover:bg-text-100/5 hover:text-text-200 cursor-pointer","aria-label":"close",children:h.jsx(Jr,{className:"w-4 h-4"})})]}),w?h.jsxs("div",{"data-testid":"rewind-error-banner",className:"mx-4 mt-3 flex items-start gap-2 rounded-md border border-red-400/40 bg-red-500/10 px-3 py-2 text-[12px] text-red-400",children:[h.jsx(Ff,{className:"w-4 h-4 shrink-0 mt-0.5"}),h.jsx("span",{children:w})]}):null,h.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:f?h.jsxs("div",{"data-testid":"rewind-loading",className:"flex items-center gap-2 text-[12px] text-text-400",children:[h.jsx(Tn,{className:"w-3.5 h-3.5 animate-spin"}),h.jsx("span",{children:"正在读取快照…"})]}):_.anchorFound?S?h.jsxs(h.Fragment,{children:[h.jsxs("div",{"data-testid":"rewind-summary",className:"rounded-md border border-bg-300 bg-bg-100/40 px-3 py-2 text-[12px] text-text-200",children:[h.jsxs("div",{children:["将回退 ",h.jsx("span",{className:"font-semibold text-text-100",children:_.files.length})," ","个文件,",h.jsxs("span",{className:"text-green-500 font-mono",children:["+",_.totalInsertions]})," / ",h.jsxs("span",{className:"text-red-400 font-mono",children:["-",_.totalDeletions]})]}),_.source==="local"?h.jsx("div",{"data-testid":"rewind-source-hint",className:"mt-1 text-text-400 text-[11px]",children:"基于对话里 tool_result 估算(未读到 CC 快照,数字可能与实际磁盘略有差异)"}):null]}),_.files.map(k=>h.jsx(_se,{file:k},k.filePath))]}):h.jsxs("div",{"data-testid":"rewind-no-changes",className:"rounded-md border border-bg-300 bg-bg-100/60 px-3 py-2 text-[12px] text-text-300 space-y-1",children:[h.jsx("div",{children:"磁盘上的文件已经和这个时刻的快照完全一致——没有需要回退的改动。"}),h.jsx("div",{className:"text-text-400 text-[11px]",children:"可能这条消息之后 Claude 没落盘编辑,或之前已经 rewind 过了。"})]}):h.jsx("div",{"data-testid":"rewind-no-anchor",className:"rounded-md border border-bg-300 bg-bg-100/60 px-3 py-2 text-[12px] text-text-300",children:"未能在当前消息流中找到对应的用户消息(可能已被历史裁剪)。"})}),h.jsxs("div",{className:"flex flex-col gap-2 px-4 py-3 border-t border-bg-300/30 shrink-0",children:[S&&_.anchorFound&&!o?h.jsxs("div",{"data-testid":"rewind-needs-cc",className:"flex items-start gap-2 rounded-md border border-bg-300 bg-bg-100/60 px-3 py-2 text-[12px] text-text-300",children:[h.jsx(Ff,{className:"w-4 h-4 shrink-0 mt-0.5 text-warning"}),h.jsx("span",{children:'Claude Code 进程当前未运行。点击"确认回退"时会自动启动它再执行 — 可能需要等一两秒。'})]}):null,h.jsxs("div",{className:"flex items-center justify-end gap-2",children:[h.jsx("button",{type:"button",onClick:()=>t(!1),className:"h-8 px-3 rounded-md text-[12px] text-text-300 hover:bg-text-100/5 cursor-pointer",children:"取消"}),h.jsx("button",{type:"button",disabled:!C,onClick:()=>void b(),"data-testid":"rewind-apply",className:re("h-8 px-3 rounded-md text-[12px] font-medium transition-colors",C?"bg-accent text-white hover:bg-accent-hover cursor-pointer":"bg-bg-200 text-text-400 cursor-not-allowed"),children:m?"回退中…":"确认回退"})]})]})]})}function yse(e){return e.replace(/^\/Users\/[^/]+/,"~")}function _se({file:e}){const[t,n]=g.useState(!0);return h.jsxs("div",{"data-testid":"rewind-file-block","data-file":e.filePath,className:"rounded-md border border-bg-300 overflow-hidden bg-bg-0",children:[h.jsxs("button",{type:"button",onClick:()=>n(r=>!r),className:"w-full flex items-center gap-1.5 px-3 py-2 text-[12px] hover:bg-text-100/5 cursor-pointer",children:[t?h.jsx(Pn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}):h.jsx(Fn,{className:"w-3.5 h-3.5 text-text-400 shrink-0"}),h.jsx("span",{className:"font-mono text-text-200 truncate flex-1 text-left",title:e.filePath,children:yse(e.filePath)}),h.jsxs("span",{className:"font-mono shrink-0 text-text-400",children:[h.jsxs("span",{className:"text-green-500",children:["+",e.insertions]})," ",h.jsxs("span",{className:"text-red-400",children:["-",e.deletions]})]})]}),t?h.jsx("div",{className:"border-t border-bg-300",children:e.hunks.map(r=>h.jsx(bse,{hunk:r},`${r.oldStart}-${r.oldLines}-${r.newStart}-${r.newLines}`))}):null]})}function bse({hunk:e}){const t=`@@ -${e.oldStart},${e.oldLines} +${e.newStart},${e.newLines} @@`;return h.jsxs("div",{className:"text-[11px] font-mono leading-relaxed",children:[h.jsx("div",{className:"px-3 py-1 text-text-400 bg-bg-100/40 border-b border-bg-300",children:t}),e.lines.map((n,r)=>{const i=n.charAt(0),s=i==="+"?"bg-green-500/10 text-green-300":i==="-"?"bg-red-500/10 text-red-300":"text-text-300";return h.jsx("div",{className:re("px-3 whitespace-pre",s),children:n.length>0?n:" "},r)})]})}function wse({jobs:e}){return e.length===0?h.jsx("div",{"data-testid":"cron-job-list-empty",className:"px-4 py-3 text-sm text-text-500",children:"当前会话暂无活跃 cron 任务"}):h.jsx("ul",{"data-testid":"cron-job-list",className:"flex flex-col gap-2",children:e.map(t=>h.jsxs("li",{"data-testid":`cron-job-${t.id}`,className:"flex flex-col gap-1 rounded-md border border-border px-3 py-2",children:[h.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[h.jsx("span",{className:"font-mono text-text-300",children:t.id}),h.jsx("span",{className:"text-text-500",children:"·"}),h.jsx("span",{className:"text-text-400",children:t.humanSchedule}),t.recurring?h.jsx("span",{"data-testid":`cron-job-${t.id}-recurring-badge`,className:"ml-auto rounded-md bg-accent-dim px-2 py-0.5 text-accent",children:"recurring"}):null]}),h.jsx("div",{className:"text-sm text-text-200 truncate",title:t.prompt,children:t.prompt})]},t.id))})}const Sse={idle:"还没启动","turn-running":"正在 run 中","turn-idle":"进程活着,等输入",exited:"进程已退出",crashed:"启动失败 / 异常退出"};function kse({sessionStatus:e}){switch(e){case"idle":return"idle";case"running":return"turn-running";case"running-idle":return"turn-idle";case"observing":return"turn-running";case"stopped":return"exited";case"error":return"crashed"}}/**
|
|
580
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
581
|
+
* @license MIT
|
|
582
|
+
*
|
|
583
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
584
|
+
* @license MIT
|
|
585
|
+
*
|
|
586
|
+
* Originally forked from (with the author's permission):
|
|
587
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
588
|
+
* http://bellard.org/jslinux/
|
|
589
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
590
|
+
*/var PA=Object.defineProperty,Cse=Object.getOwnPropertyDescriptor,Ese=(e,t)=>{for(var n in t)PA(e,n,{get:t[n],enumerable:!0})},At=(e,t,n,r)=>{for(var i=r>1?void 0:r?Cse(t,n):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&PA(t,n,i),i},he=(e,t)=>(n,r)=>t(n,r,e),N2="Terminal input",zx={get:()=>N2,set:e=>N2=e},T2="Too much output to announce, navigate to rows manually to read",Fx={get:()=>T2,set:e=>T2=e};function Ise(e){return e.replace(/\r?\n/g,"\r")}function Nse(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function Tse(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function Pse(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");RA(i,t,n,r)}}function RA(e,t,n,r){e=Ise(e),e=Nse(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function AA(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,s=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${i}px`,t.style.top=`${s}px`,t.style.zIndex="1000",t.focus()}function P2(e,t,n,r,i){AA(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Es(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function km(e,t=0,n=e.length){let r="";for(let i=t;i<n;++i){let s=e[i];s>65535?(s-=65536,r+=String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):r+=String.fromCharCode(s)}return r}var Rse=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let s=e.charCodeAt(i++);56320<=s&&s<=57343?t[r++]=(this._interim-55296)*1024+s-56320+65536:(t[r++]=this._interim,t[r++]=s),this._interim=0}for(let s=i;s<n;++s){let o=e.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=n)return this._interim=o,r;let a=e.charCodeAt(s);56320<=a&&a<=57343?t[r++]=(o-55296)*1024+a-56320+65536:(t[r++]=o,t[r++]=a);continue}o!==65279&&(t[r++]=o)}return r}},Ase=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,s,o,a,l=0,c=0;if(this.interim[0]){let f=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let m=0,x;for(;(x=this.interim[++m]&63)&&m<4;)p<<=6,p|=x;let w=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,v=w-m;for(;c<v;){if(c>=n)return 0;if(x=e[c++],(x&192)!==128){c--,f=!0;break}else this.interim[m++]=x,p<<=6,p|=x&63}f||(w===2?p<128?c--:t[r++]=p:w===3?p<2048||p>=55296&&p<=57343||p===65279||(t[r++]=p):p<65536||p>1114111||(t[r++]=p)),this.interim.fill(0)}let u=n-4,d=c;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((s=e[d+1])&128)&&!((o=e[d+2])&128)&&!((a=e[d+3])&128);)t[r++]=i,t[r++]=s,t[r++]=o,t[r++]=a,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)===192){if(d>=n)return this.interim[0]=i,r;if(s=e[d++],(s&192)!==128){d--;continue}if(l=(i&31)<<6|s&63,l<128){d--;continue}t[r++]=l}else if((i&240)===224){if(d>=n)return this.interim[0]=i,r;if(s=e[d++],(s&192)!==128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=s,r;if(o=e[d++],(o&192)!==128){d--;continue}if(l=(i&15)<<12|(s&63)<<6|o&63,l<2048||l>=55296&&l<=57343||l===65279)continue;t[r++]=l}else if((i&248)===240){if(d>=n)return this.interim[0]=i,r;if(s=e[d++],(s&192)!==128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=s,r;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=s,this.interim[2]=o,r;if(a=e[d++],(a&192)!==128){d--;continue}if(l=(i&7)<<18|(s&63)<<12|(o&63)<<6|a&63,l<65536||l>1114111)continue;t[r++]=l}}return r}},MA="",Ms=" ",sd=class jA{constructor(){this.fg=0,this.bg=0,this.extended=new sp}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new jA;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},sp=class LA{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new LA(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Pr=class DA extends sd{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new sp,this.combinedData=""}static fromCharData(t){let n=new DA;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Es(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(r-55296)*1024+i-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},R2="di$target",Hx="di$dependencies",t0=new Map;function Mse(e){return e[Hx]||[]}function dn(e){if(t0.has(e))return t0.get(e);let t=function(n,r,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");jse(t,n,i)};return t._id=e,t0.set(e,t),t}function jse(e,t,n){t[R2]===t?t[Hx].push({id:e,index:n}):(t[Hx]=[{id:e,index:n}],t[R2]=t)}var Hn=dn("BufferService"),OA=dn("CoreMouseService"),sa=dn("CoreService"),Lse=dn("CharsetService"),db=dn("InstantiationService"),BA=dn("LogService"),Un=dn("OptionsService"),$A=dn("OscLinkService"),Dse=dn("UnicodeService"),od=dn("DecorationService"),Ux=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var u;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,s=new Pr,o=n.getTrimmedLength(),a=-1,l=-1,c=!1;for(let d=0;d<o;d++)if(!(l===-1&&!n.hasContent(d))){if(n.loadCell(d,s),s.hasExtendedAttrs()&&s.extended.urlId)if(l===-1){l=d,a=s.extended.urlId;continue}else c=s.extended.urlId!==a;else l!==-1&&(c=!0);if(c||l!==-1&&d===o-1){let f=(u=this._oscLinkService.getLinkData(a))==null?void 0:u.uri;if(f){let p={start:{x:l+1,y:e},end:{x:d+(!c&&d===o-1?1:0),y:e}},m=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{let x=new URL(f);["http:","https:"].includes(x.protocol)||(m=!0)}catch{m=!0}m||r.push({text:f,range:p,activate:(x,w)=>i?i.activate(x,w,p):Ose(x,w),hover:(x,w)=>{var v;return(v=i==null?void 0:i.hover)==null?void 0:v.call(i,x,w,p)},leave:(x,w)=>{var v;return(v=i==null?void 0:i.leave)==null?void 0:v.call(i,x,w,p)}})}c=!1,s.hasExtendedAttrs()&&s.extended.urlId?(l=d,a=s.extended.urlId):(l=-1,a=-1)}}t(r)}};Ux=At([he(0,Hn),he(1,Un),he(2,$A)],Ux);function Ose(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
591
|
+
|
|
592
|
+
WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Cm=dn("CharSizeService"),us=dn("CoreBrowserService"),hb=dn("MouseService"),ds=dn("RenderService"),Bse=dn("SelectionService"),zA=dn("CharacterJoinerService"),Gl=dn("ThemeService"),FA=dn("LinkProviderService"),$se=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?A2.isErrorNoTelemetry(e)?new A2(e.message+`
|
|
593
|
+
|
|
594
|
+
`+e.stack):new Error(e.message+`
|
|
595
|
+
|
|
596
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},zse=new $se;function Uh(e){Fse(e)||zse.onUnexpectedError(e)}var Wx="Canceled";function Fse(e){return e instanceof Hse?!0:e instanceof Error&&e.name===Wx&&e.message===Wx}var Hse=class extends Error{constructor(){super(Wx),this.name=this.message}};function Use(e){return new Error(`Illegal argument: ${e}`)}var A2=class qx extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof qx)return t;let n=new qx;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Vx=class HA extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,HA.prototype)}};function rr(e,t=0){return e[e.length-(1+t)]}var Wse;(e=>{function t(s){return s<0}e.isLessThan=t;function n(s){return s<=0}e.isLessThanOrEqual=n;function r(s){return s>0}e.isGreaterThan=r;function i(s){return s===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Wse||(Wse={}));function qse(e,t){let n=this,r=!1,i;return function(){return r||(r=!0,t||(i=e.apply(n,arguments))),i}}var UA;(e=>{function t(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(S){yield S}e.single=i;function s(S){return t(S)?S:i(S)}e.wrap=s;function o(S){return S||n}e.from=o;function*a(S){for(let C=S.length-1;C>=0;C--)yield S[C]}e.reverse=a;function l(S){return!S||S[Symbol.iterator]().next().done===!0}e.isEmpty=l;function c(S){return S[Symbol.iterator]().next().value}e.first=c;function u(S,C){let k=0;for(let N of S)if(C(N,k++))return!0;return!1}e.some=u;function d(S,C){for(let k of S)if(C(k))return k}e.find=d;function*f(S,C){for(let k of S)C(k)&&(yield k)}e.filter=f;function*p(S,C){let k=0;for(let N of S)yield C(N,k++)}e.map=p;function*m(S,C){let k=0;for(let N of S)yield*C(N,k++)}e.flatMap=m;function*x(...S){for(let C of S)yield*C}e.concat=x;function w(S,C,k){let N=k;for(let E of S)N=C(N,E);return N}e.reduce=w;function*v(S,C,k=S.length){for(C<0&&(C+=S.length),k<0?k+=S.length:k>S.length&&(k=S.length);C<k;C++)yield S[C]}e.slice=v;function _(S,C=Number.POSITIVE_INFINITY){let k=[];if(C===0)return[k,S];let N=S[Symbol.iterator]();for(let E=0;E<C;E++){let L=N.next();if(L.done)return[k,e.empty()];k.push(L.value)}return[k,{[Symbol.iterator](){return N}}]}e.consume=_;async function b(S){let C=[];for await(let k of S)C.push(k);return Promise.resolve(C)}e.asyncToArray=b})(UA||(UA={}));function Vo(e){if(UA.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Vse(...e){return bt(()=>Vo(e))}function bt(e){return{dispose:qse(()=>{e()})}}var WA=class qA{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Vo(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?qA.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};WA.DISABLE_DISPOSED_WARNING=!1;var Ws=WA,qe=class{constructor(){this._store=new Ws,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};qe.None=Object.freeze({dispose(){}});var Sl=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Wi=typeof window=="object"?window:globalThis,Kx=class Gx{constructor(t){this.element=t,this.next=Gx.Undefined,this.prev=Gx.Undefined}};Kx.Undefined=new Kx(void 0);var St=Kx,M2=class{constructor(){this._first=St.Undefined,this._last=St.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===St.Undefined}clear(){let e=this._first;for(;e!==St.Undefined;){let t=e.next;e.prev=St.Undefined,e.next=St.Undefined,e=t}this._first=St.Undefined,this._last=St.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new St(e);if(this._first===St.Undefined)this._first=n,this._last=n;else if(t){let i=this._last;this._last=n,n.prev=i,i.next=n}else{let i=this._first;this._first=n,n.next=i,i.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==St.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==St.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==St.Undefined&&e.next!==St.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===St.Undefined&&e.next===St.Undefined?(this._first=St.Undefined,this._last=St.Undefined):e.next===St.Undefined?(this._last=this._last.prev,this._last.next=St.Undefined):e.prev===St.Undefined&&(this._first=this._first.next,this._first.prev=St.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==St.Undefined;)yield e.element,e=e.next}},Kse=globalThis.performance&&typeof globalThis.performance.now=="function",Gse=class VA{static create(t){return new VA(t)}constructor(t){this._now=Kse&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},vn;(e=>{e.None=()=>qe.None;function t(R,A){return d(R,()=>{},0,void 0,!0,void 0,A)}e.defer=t;function n(R){return(A,M=null,j)=>{let z=!1,F;return F=R($=>{if(!z)return F?F.dispose():z=!0,A.call(M,$)},null,j),z&&F.dispose(),F}}e.once=n;function r(R,A,M){return c((j,z=null,F)=>R($=>j.call(z,A($)),null,F),M)}e.map=r;function i(R,A,M){return c((j,z=null,F)=>R($=>{A($),j.call(z,$)},null,F),M)}e.forEach=i;function s(R,A,M){return c((j,z=null,F)=>R($=>A($)&&j.call(z,$),null,F),M)}e.filter=s;function o(R){return R}e.signal=o;function a(...R){return(A,M=null,j)=>{let z=Vse(...R.map(F=>F($=>A.call(M,$))));return u(z,j)}}e.any=a;function l(R,A,M,j){let z=M;return r(R,F=>(z=A(z,F),z),j)}e.reduce=l;function c(R,A){let M,j={onWillAddFirstListener(){M=R(z.fire,z)},onDidRemoveLastListener(){M==null||M.dispose()}},z=new te(j);return A==null||A.add(z),z.event}function u(R,A){return A instanceof Array?A.push(R):A&&A.add(R),R}function d(R,A,M=100,j=!1,z=!1,F,$){let B,I,U,V=0,O,ne={leakWarningThreshold:F,onWillAddFirstListener(){B=R(Y=>{V++,I=A(I,Y),j&&!U&&(ae.fire(I),I=void 0),O=()=>{let ye=I;I=void 0,U=void 0,(!j||V>1)&&ae.fire(ye),V=0},typeof M=="number"?(clearTimeout(U),U=setTimeout(O,M)):U===void 0&&(U=0,queueMicrotask(O))})},onWillRemoveListener(){z&&V>0&&(O==null||O())},onDidRemoveLastListener(){O=void 0,B.dispose()}},ae=new te(ne);return $==null||$.add(ae),ae.event}e.debounce=d;function f(R,A=0,M){return e.debounce(R,(j,z)=>j?(j.push(z),j):[z],A,void 0,!0,void 0,M)}e.accumulate=f;function p(R,A=(j,z)=>j===z,M){let j=!0,z;return s(R,F=>{let $=j||!A(F,z);return j=!1,z=F,$},M)}e.latch=p;function m(R,A,M){return[e.filter(R,A,M),e.filter(R,j=>!A(j),M)]}e.split=m;function x(R,A=!1,M=[],j){let z=M.slice(),F=R(I=>{z?z.push(I):B.fire(I)});j&&j.add(F);let $=()=>{z==null||z.forEach(I=>B.fire(I)),z=null},B=new te({onWillAddFirstListener(){F||(F=R(I=>B.fire(I)),j&&j.add(F))},onDidAddFirstListener(){z&&(A?setTimeout($):$())},onDidRemoveLastListener(){F&&F.dispose(),F=null}});return j&&j.add(B),B.event}e.buffer=x;function w(R,A){return(M,j,z)=>{let F=A(new _);return R(function($){let B=F.evaluate($);B!==v&&M.call(j,B)},void 0,z)}}e.chain=w;let v=Symbol("HaltChainable");class _{constructor(){this.steps=[]}map(A){return this.steps.push(A),this}forEach(A){return this.steps.push(M=>(A(M),M)),this}filter(A){return this.steps.push(M=>A(M)?M:v),this}reduce(A,M){let j=M;return this.steps.push(z=>(j=A(j,z),j)),this}latch(A=(M,j)=>M===j){let M=!0,j;return this.steps.push(z=>{let F=M||!A(z,j);return M=!1,j=z,F?z:v}),this}evaluate(A){for(let M of this.steps)if(A=M(A),A===v)break;return A}}function b(R,A,M=j=>j){let j=(...B)=>$.fire(M(...B)),z=()=>R.on(A,j),F=()=>R.removeListener(A,j),$=new te({onWillAddFirstListener:z,onDidRemoveLastListener:F});return $.event}e.fromNodeEventEmitter=b;function S(R,A,M=j=>j){let j=(...B)=>$.fire(M(...B)),z=()=>R.addEventListener(A,j),F=()=>R.removeEventListener(A,j),$=new te({onWillAddFirstListener:z,onDidRemoveLastListener:F});return $.event}e.fromDOMEventEmitter=S;function C(R){return new Promise(A=>n(R)(A))}e.toPromise=C;function k(R){let A=new te;return R.then(M=>{A.fire(M)},()=>{A.fire(void 0)}).finally(()=>{A.dispose()}),A.event}e.fromPromise=k;function N(R,A){return R(M=>A.fire(M))}e.forward=N;function E(R,A,M){return A(M),R(j=>A(j))}e.runAndSubscribe=E;class L{constructor(A,M){this._observable=A,this._counter=0,this._hasChanged=!1;let j={onWillAddFirstListener:()=>{A.addObserver(this)},onDidRemoveLastListener:()=>{A.removeObserver(this)}};this.emitter=new te(j),M&&M.add(this.emitter)}beginUpdate(A){this._counter++}handlePossibleChange(A){}handleChange(A,M){this._hasChanged=!0}endUpdate(A){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function P(R,A){return new L(R,A).emitter.event}e.fromObservable=P;function D(R){return(A,M,j)=>{let z=0,F=!1,$={beginUpdate(){z++},endUpdate(){z--,z===0&&(R.reportChanges(),F&&(F=!1,A.call(M)))},handlePossibleChange(){},handleChange(){F=!0}};R.addObserver($),R.reportChanges();let B={dispose(){R.removeObserver($)}};return j instanceof Ws?j.add(B):Array.isArray(j)&&j.push(B),B}}e.fromObservableLight=D})(vn||(vn={}));var Yx=class Xx{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Xx._idPool++}`,Xx.all.add(this)}start(t){this._stopWatch=new Gse,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Yx.all=new Set,Yx._idPool=0;var Yse=Yx,Xse=-1,KA=class GA{constructor(t,n,r=(GA._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)return;this._stacks||(this._stacks=new Map);let i=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,i+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[s,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(s);let l=new Jse(a,s);this._errorHandler(l)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,i]of this._stacks)(!t||n<i)&&(t=[r,i],n=i);return t}};KA._idPool=1;var Zse=KA,Qse=class YA{constructor(t){this.value=t}static create(){let t=new Error;return new YA(t.stack??"")}print(){console.warn(this.value.split(`
|
|
597
|
+
`).slice(2).join(`
|
|
598
|
+
`))}},Jse=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},eoe=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},toe=0,n0=class{constructor(e){this.value=e,this.id=toe++}},noe=2,roe,te=class{constructor(e){var t,n,r,i;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new Zse((e==null?void 0:e.onListenerError)??Uh,((n=this._options)==null?void 0:n.leakWarningThreshold)??Xse):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new Yse(this._options._profName):void 0,this._deliveryQueue=(i=this._options)==null?void 0:i.deliveryQueue}dispose(){var e,t,n,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(n=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||n.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,n)=>{var o,a,l,c,u;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new eoe(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((o=this._options)==null?void 0:o.onListenerError)||Uh)(p),qe.None}if(this._disposed)return qe.None;t&&(e=e.bind(t));let r=new n0(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Qse.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof n0?(this._deliveryQueue??(this._deliveryQueue=new ioe),this._listeners=[this._listeners,r]):this._listeners.push(r):((l=(a=this._options)==null?void 0:a.onWillAddFirstListener)==null||l.call(a,this),this._listeners=r,(u=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null||u.call(c,this)),this._size++;let s=bt(()=>{i==null||i(),this._removeListener(r)});return n instanceof Ws?n.add(s):Array.isArray(n)&&n.push(s),s}),this._event}_removeListener(e){var i,s,o,a;if((s=(i=this._options)==null?void 0:i.onWillRemoveListener)==null||s.call(i,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||a.call(o,this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*noe<=t.length){let l=0;for(let c=0;c<t.length;c++)t[c]?t[l++]=t[c]:r&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=l}}_deliver(e,t){var r;if(!e)return;let n=((r=this._options)==null?void 0:r.onListenerError)||Uh;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,n,r,i;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(n=this._perfMon)==null||n.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof n0)this._deliver(this._listeners,e);else{let s=this._deliveryQueue;s.enqueue(this,e,this._listeners.length),this._deliverQueue(s)}(i=this._perfMon)==null||i.stop()}hasListeners(){return this._size>0}},ioe=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Zx=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new te,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new te,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Zx.INSTANCE=new Zx;var fb=Zx;function soe(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}fb.INSTANCE.onDidChangeZoomLevel;function ooe(e){return fb.INSTANCE.getZoomFactor(e)}fb.INSTANCE.onDidChangeFullscreen;var Yl=typeof navigator=="object"?navigator.userAgent:"",Qx=Yl.indexOf("Firefox")>=0,aoe=Yl.indexOf("AppleWebKit")>=0,pb=Yl.indexOf("Chrome")>=0,loe=!pb&&Yl.indexOf("Safari")>=0;Yl.indexOf("Electron/")>=0;Yl.indexOf("Android")>=0;var r0=!1;if(typeof Wi.matchMedia=="function"){let e=Wi.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Wi.matchMedia("(display-mode: fullscreen)");r0=e.matches,soe(Wi,e,({matches:n})=>{r0&&t.matches||(r0=n)})}var za="en",Jx=!1,e1=!1,Wh=!1,XA=!1,lh,qh=za,j2=za,coe,$r,Ro=globalThis,mn,jE;typeof Ro.vscode<"u"&&typeof Ro.vscode.process<"u"?mn=Ro.vscode.process:typeof process<"u"&&typeof((jE=process==null?void 0:process.versions)==null?void 0:jE.node)=="string"&&(mn=process);var LE,uoe=typeof((LE=mn==null?void 0:mn.versions)==null?void 0:LE.electron)=="string",doe=uoe&&(mn==null?void 0:mn.type)==="renderer",DE;if(typeof mn=="object"){Jx=mn.platform==="win32",e1=mn.platform==="darwin",Wh=mn.platform==="linux",Wh&&mn.env.SNAP&&mn.env.SNAP_REVISION,mn.env.CI||mn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,lh=za,qh=za;let e=mn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);lh=t.userLocale,j2=t.osLocale,qh=t.resolvedLanguage||za,coe=(DE=t.languagePack)==null?void 0:DE.translationsConfigFile}catch{}XA=!0}else typeof navigator=="object"&&!doe?($r=navigator.userAgent,Jx=$r.indexOf("Windows")>=0,e1=$r.indexOf("Macintosh")>=0,($r.indexOf("Macintosh")>=0||$r.indexOf("iPad")>=0||$r.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Wh=$r.indexOf("Linux")>=0,($r==null?void 0:$r.indexOf("Mobi"))>=0,qh=globalThis._VSCODE_NLS_LANGUAGE||za,lh=navigator.language.toLowerCase(),j2=lh):console.error("Unable to resolve platform.");var ZA=Jx,ki=e1,hoe=Wh,L2=XA,Ni=$r,xs=qh,foe;(e=>{function t(){return xs}e.value=t;function n(){return xs.length===2?xs==="en":xs.length>=3?xs[0]==="e"&&xs[1]==="n"&&xs[2]==="-":!1}e.isDefaultVariant=n;function r(){return xs==="en"}e.isDefault=r})(foe||(foe={}));var poe=typeof Ro.postMessage=="function"&&!Ro.importScripts;(()=>{if(poe){let e=[];Ro.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,i=e.length;r<i;r++){let s=e[r];if(s.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),s.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Ro.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var moe=!!(Ni&&Ni.indexOf("Chrome")>=0);Ni&&Ni.indexOf("Firefox")>=0;!moe&&Ni&&Ni.indexOf("Safari")>=0;Ni&&Ni.indexOf("Edg/")>=0;Ni&&Ni.indexOf("Android")>=0;var ya=typeof navigator=="object"?navigator:{};L2||document.queryCommandSupported&&document.queryCommandSupported("copy")||ya&&ya.clipboard&&ya.clipboard.writeText,L2||ya&&ya.clipboard&&ya.clipboard.readText;var mb=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},i0=new mb,D2=new mb,O2=new mb,goe=new Array(230),QA;(e=>{function t(a){return i0.keyCodeToStr(a)}e.toString=t;function n(a){return i0.strToKeyCode(a)}e.fromString=n;function r(a){return D2.keyCodeToStr(a)}e.toUserSettingsUS=r;function i(a){return O2.keyCodeToStr(a)}e.toUserSettingsGeneral=i;function s(a){return D2.strToKeyCode(a)||O2.strToKeyCode(a)}e.fromUserSettings=s;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return i0.keyCodeToStr(a)}e.toElectronAccelerator=o})(QA||(QA={}));var voe=class JA{constructor(t,n,r,i,s){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=i,this.keyCode=s}equals(t){return t instanceof JA&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",i=this.metaKey?"1":"0";return`K${t}${n}${r}${i}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new xoe([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},xoe=class{constructor(e){if(e.length===0)throw Use("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function yoe(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return QA.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Qx)switch(t){case 59:return 85;case 60:if(hoe)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(ki)return 57;break}else if(aoe&&(ki&&t===93||!ki&&t===92))return 57;return goe[t]||0}var _oe=ki?256:2048,boe=512,woe=1024,Soe=ki?2048:256,B2=class{constructor(e){var n;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=yoe(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=_oe),this.altKey&&(t|=boe),this.shiftKey&&(t|=woe),this.metaKey&&(t|=Soe),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new voe(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},$2=new WeakMap;function koe(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var Coe=class{static getSameOriginWindowChain(e){let t=$2.get(e);if(!t){t=[],$2.set(e,t);let n=e,r;do r=koe(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let s of i){let o=s.window.deref();if(n+=(o==null?void 0:o.scrollY)??0,r+=(o==null?void 0:o.scrollX)??0,o===t||!s.iframeElement)break;let a=s.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},ch=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=Coe.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},z2=class{constructor(e,t=0,n=0){var i;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(pb){let s=navigator.userAgent.match(/Chrome\/(\d+)/);r=(s?parseInt(s[1]):123)<=122}if(e){let s=e,o=e,a=((i=e.view)==null?void 0:i.devicePixelRatio)||1;if(typeof s.wheelDeltaY<"u")r?this.deltaY=s.wheelDeltaY/(120*a):this.deltaY=s.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let l=e;l.deltaMode===l.DOM_DELTA_LINE?Qx&&!ki?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")loe&&ZA?this.deltaX=-(s.wheelDeltaX/120):r?this.deltaX=s.wheelDeltaX/(120*a):this.deltaX=s.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let l=e;l.deltaMode===l.DOM_DELTA_LINE?Qx&&!ki?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*a):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},eM=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),Eoe;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof Ioe?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:vn.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:eM})})(Eoe||(Eoe={}));var Ioe=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?eM:(this._emitter||(this._emitter=new te),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},gb=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Vx("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Vx("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Noe=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Vx("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=bt(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Toe;(e=>{async function t(r){let i,s=await Promise.all(r.map(o=>o.then(a=>a,a=>{i||(i=a)})));if(typeof i<"u")throw i;return s}e.settled=t;function n(r){return new Promise(async(i,s)=>{try{await r(i,s)}catch(o){s(o)}})}e.withAsyncBody=n})(Toe||(Toe={}));var F2=class Sr{static fromArray(t){return new Sr(n=>{n.emitMany(t)})}static fromPromise(t){return new Sr(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Sr(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new Sr(async n=>{await Promise.all(t.map(async r=>{for await(let i of r)n.emitOne(i)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new te,queueMicrotask(async()=>{let r={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(t(r)),this.resolve()}catch(i){this.reject(i)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await vn.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new Sr(async r=>{for await(let i of t)r.emitOne(n(i))})}map(t){return Sr.map(this,t)}static filter(t,n){return new Sr(async r=>{for await(let i of t)n(i)&&r.emitOne(i)})}filter(t){return Sr.filter(this,t)}static coalesce(t){return Sr.filter(t,n=>!!n)}coalesce(){return Sr.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return Sr.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};F2.EMPTY=F2.fromArray([]);var{getWindow:xi,getWindowId:Poe,onDidRegisterWindow:Roe}=function(){let e=new Map,t={window:Wi,disposables:new Ws};e.set(Wi.vscodeWindowId,t);let n=new te,r=new te,i=new te;function s(o,a){return(typeof o=="number"?e.get(o):void 0)??(a?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(o){if(e.has(o.vscodeWindowId))return qe.None;let a=new Ws,l={window:o,disposables:a.add(new Ws)};return e.set(o.vscodeWindowId,l),a.add(bt(()=>{e.delete(o.vscodeWindowId),r.fire(o)})),a.add(Te(o,sn.BEFORE_UNLOAD,()=>{i.fire(o)})),n.fire(l),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:s,getWindow(o){var c;let a=o;if((c=a==null?void 0:a.ownerDocument)!=null&&c.defaultView)return a.ownerDocument.defaultView.window;let l=o;return l!=null&&l.view?l.view.window:Wi},getDocument(o){return xi(o).document}}}(),Aoe=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Te(e,t,n,r){return new Aoe(e,t,n,r)}var H2=function(e,t,n,r){return Te(e,t,n,r)},vb,Moe=class extends Noe{constructor(e){super(),this.defaultTarget=e&&xi(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},U2=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Uh(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=s=>{n.set(s,!1);let o=e.get(s)??[];for(t.set(s,o),e.set(s,[]),r.set(s,!0);o.length>0;)o.sort(U2.sort),o.shift().execute();r.set(s,!1)};vb=(s,o,a=0)=>{let l=Poe(s),c=new U2(o,a),u=e.get(l);return u||(u=[],e.set(l,u)),u.push(c),n.get(l)||(n.set(l,!0),s.requestAnimationFrame(()=>i(l))),c}})();function joe(e){let t=e.getBoundingClientRect(),n=xi(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var sn={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},Loe=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Vn(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Vn(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Vn(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Vn(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Vn(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Vn(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Vn(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Vn(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Vn(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Vn(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Vn(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Vn(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Vn(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Vn(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Vn(e){return typeof e=="number"?`${e}px`:e}function Yc(e){return new Loe(e)}var tM=class{constructor(){this._hooks=new Ws,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let s=e;try{e.setPointerCapture(t),this._hooks.add(bt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=xi(e)}this._hooks.add(Te(s,sn.POINTER_MOVE,o=>{if(o.buttons!==n){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(Te(s,sn.POINTER_UP,o=>this.stopMonitoring(!0)))}};function Doe(e,t,n){let r=null,i=null;if(typeof n.value=="function"?(r="value",i=n.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",i=n.get),!i)throw new Error("not supported");let s=`$memoize$${t}`;n[r]=function(...o){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,o)}),this[s]}}var li;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(li||(li={}));var Nc=class kn extends qe{constructor(){super(),this.dispatched=!1,this.targets=new M2,this.ignoreTargets=new M2,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(vn.runAndSubscribe(Roe,({window:t,disposables:n})=>{n.add(Te(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(Te(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(Te(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:Wi,disposables:this._store}))}static addTarget(t){if(!kn.isTouchDevice())return qe.None;kn.INSTANCE||(kn.INSTANCE=new kn);let n=kn.INSTANCE.targets.push(t);return bt(n)}static ignoreTarget(t){if(!kn.isTouchDevice())return qe.None;kn.INSTANCE||(kn.INSTANCE=new kn);let n=kn.INSTANCE.ignoreTargets.push(t);return bt(n)}static isTouchDevice(){return"ontouchstart"in Wi||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,i=t.targetTouches.length;r<i;r++){let s=t.targetTouches.item(r);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:n,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[n],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let o=this.newGestureEvent(li.Start,s.target);o.pageX=s.pageX,o.pageY=s.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let s=0,o=n.changedTouches.length;s<o;s++){let a=n.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let l=this.activeTouches[a.identifier],c=Date.now()-l.initialTimeStamp;if(c<kn.HOLD_DELAY&&Math.abs(l.initialPageX-rr(l.rollingPageX))<30&&Math.abs(l.initialPageY-rr(l.rollingPageY))<30){let u=this.newGestureEvent(li.Tap,l.initialTarget);u.pageX=rr(l.rollingPageX),u.pageY=rr(l.rollingPageY),this.dispatchEvent(u)}else if(c>=kn.HOLD_DELAY&&Math.abs(l.initialPageX-rr(l.rollingPageX))<30&&Math.abs(l.initialPageY-rr(l.rollingPageY))<30){let u=this.newGestureEvent(li.Contextmenu,l.initialTarget);u.pageX=rr(l.rollingPageX),u.pageY=rr(l.rollingPageY),this.dispatchEvent(u)}else if(i===1){let u=rr(l.rollingPageX),d=rr(l.rollingPageY),f=rr(l.rollingTimestamps)-l.rollingTimestamps[0],p=u-l.rollingPageX[0],m=d-l.rollingPageY[0],x=[...this.targets].filter(w=>l.initialTarget instanceof Node&&w.contains(l.initialTarget));this.inertia(t,x,r,Math.abs(p)/f,p>0?1:-1,u,Math.abs(m)/f,m>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(li.End,l.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===li.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>kn.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===li.Change||t.type===li.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let i=0,s=t.initialTarget;for(;s&&s!==r;)i++,s=s.parentElement;n.push([i,r])}n.sort((r,i)=>r[0]-i[0]);for(let[r,i]of n)i.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,s,o,a,l,c){this.handle=vb(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=kn.SCROLL_FRICTION*d,a+=kn.SCROLL_FRICTION*d,i>0&&(m=!1,f=s*i*d),a>0&&(m=!1,p=l*a*d);let x=this.newGestureEvent(li.Change);x.translationX=f,x.translationY=p,n.forEach(w=>w.dispatchEvent(x)),m||this.inertia(t,n,u,i,s,o+f,a,l,c+p)})}onTouchMove(t){let n=Date.now();for(let r=0,i=t.changedTouches.length;r<i;r++){let s=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let o=this.activeTouches[s.identifier],a=this.newGestureEvent(li.Change,o.initialTarget);a.translationX=s.pageX-rr(o.rollingPageX),a.translationY=s.pageY-rr(o.rollingPageY),a.pageX=s.pageX,a.pageY=s.pageY,this.dispatchEvent(a),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(s.pageX),o.rollingPageY.push(s.pageY),o.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Nc.SCROLL_FRICTION=-.005,Nc.HOLD_DELAY=700,Nc.CLEAR_TAP_COUNT_TIME=400,At([Doe],Nc,"isTouchDevice",1);var Ooe=Nc,xb=class extends qe{onclick(e,t){this._register(Te(e,sn.CLICK,n=>t(new ch(xi(e),n))))}onmousedown(e,t){this._register(Te(e,sn.MOUSE_DOWN,n=>t(new ch(xi(e),n))))}onmouseover(e,t){this._register(Te(e,sn.MOUSE_OVER,n=>t(new ch(xi(e),n))))}onmouseleave(e,t){this._register(Te(e,sn.MOUSE_LEAVE,n=>t(new ch(xi(e),n))))}onkeydown(e,t){this._register(Te(e,sn.KEY_DOWN,n=>t(new B2(n))))}onkeyup(e,t){this._register(Te(e,sn.KEY_UP,n=>t(new B2(n))))}oninput(e,t){this._register(Te(e,sn.INPUT,t))}onblur(e,t){this._register(Te(e,sn.BLUR,t))}onfocus(e,t){this._register(Te(e,sn.FOCUS,t))}onchange(e,t){this._register(Te(e,sn.CHANGE,t))}ignoreGesture(e){return Ooe.ignoreTarget(e)}},W2=11,Boe=class extends xb{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=W2+"px",this.domNode.style.height=W2+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new tM),this._register(H2(this.bgDomNode,sn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(H2(this.domNode,sn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Moe),this._pointerdownScheduleRepeatTimer=this._register(new gb)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,xi(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},$oe=class t1{constructor(t,n,r,i,s,o,a){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,i=i|0,s=s|0,o=o|0,a=a|0),this.rawScrollLeft=i,this.rawScrollTop=a,n<0&&(n=0),i+n>r&&(i=r-n),i<0&&(i=0),s<0&&(s=0),a+s>o&&(a=o-s),a<0&&(a=0),this.width=n,this.scrollWidth=r,this.scrollLeft=i,this.height=s,this.scrollHeight=o,this.scrollTop=a}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new t1(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new t1(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let r=this.width!==t.width,i=this.scrollWidth!==t.scrollWidth,s=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,a=this.scrollHeight!==t.scrollHeight,l=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:i,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:l}}},zoe=class extends qe{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new te),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new $oe(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var r;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;t?r=new V2(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=V2.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},q2=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function s0(e,t){let n=t-e;return function(r){return e+n*Uoe(r)}}function Foe(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var V2=class n1{constructor(t,n,r,i){this.from=t,this.to=n,this.duration=i,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,r){if(Math.abs(t-n)>2.5*r){let i,s;return t<n?(i=t+.75*r,s=n-.75*r):(i=t-.75*r,s=n+.75*r),Foe(s0(t,i),s0(s,n),.33)}return s0(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),i=this.scrollTop(n);return new q2(r,i,!1)}return new q2(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return n1.start(t,n,r)}static start(t,n,r){r=r+10;let i=Date.now()-10;return new n1(t,n,i,r)}};function Hoe(e){return Math.pow(e,3)}function Uoe(e){return 1-Hoe(1-e)}var Woe=class extends qe{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new gb)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},qoe=140,nM=class extends xb{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new Woe(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new tM),this._shouldRender=!0,this.domNode=Yc(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Te(this.domNode.domNode,sn.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new Boe(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Yc(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Te(this.slider.domNode,sn.POINTER_DOWN,i=>{i.button===0&&(i.preventDefault(),this._sliderPointerDown(i))})),this.onclick(this.slider.domNode,i=>{i.leftButton&&i.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let i=joe(this.domNode.domNode);t=e.pageX-i.left,n=e.pageY-i.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{let s=this._sliderOrthogonalPointerPosition(i),o=Math.abs(s-n);if(ZA&&o>qoe){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let a=this._sliderPointerPosition(i)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(a))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},rM=class r1{constructor(t,n,r,i,s,o){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=i,this._scrollSize=s,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new r1(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,i,s){let o=Math.max(0,r-t),a=Math.max(0,o-2*n),l=i>0&&i>r;if(!l)return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(r*a/i))),u=(a-c)/(i-r),d=s*u;return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:u,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let t=r1._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},Voe=class extends nM{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new rM(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Koe=class extends nM{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new rM(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Goe=500,K2=50,Yoe=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},i1=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,r=1,i=this._rear;do{let s=i===this._front?t:Math.pow(2,-r);if(t-=s,n+=this._memory[i].score*s,i===this._front)break;i=(this._capacity+i-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(pb){let n=xi(t.browserEvent),r=ooe(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let i=null,s=new Yoe(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=s,this._front=0,this._rear=0):(i=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=s),s.score=this._computeScore(s,i)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let i=Math.abs(t.deltaX),s=Math.abs(t.deltaY),o=Math.abs(n.deltaX),a=Math.abs(n.deltaY),l=Math.max(Math.min(i,o),1),c=Math.max(Math.min(s,a),1),u=Math.max(i,o),d=Math.max(s,a);u%l===0&&d%c===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};i1.INSTANCE=new i1;var Xoe=i1,Zoe=class extends xb{constructor(e,t,n){super(),this._onScroll=this._register(new te),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new te),this.onWillScroll=this._onWillScroll.event,this._options=Joe(t),this._scrollable=n,this._register(this._scrollable.onScroll(i=>{this._onWillScroll.fire(i),this._onDidScroll(i),this._onScroll.fire(i)}));let r={onMouseWheel:i=>this._onMouseWheel(i),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Koe(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new Voe(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Yc(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Yc(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Yc(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,i=>this._onMouseOver(i)),this.onmouseleave(this._listenOnDomNode,i=>this._onMouseLeave(i)),this._hideTimeout=this._register(new gb),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Vo(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,ki&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new z2(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Vo(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new z2(n))};this._mouseWheelToDispose.push(Te(this._listenOnDomNode,sn.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=Xoe.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+s===0?o=s=0:Math.abs(s)>=Math.abs(o)?o=0:s=0),this._options.flipAxes&&([s,o]=[o,s]);let a=!ki&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!o&&(o=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);let l=this._scrollable.getFutureScrollPosition(),c={};if(s){let u=K2*s,d=l.scrollTop-(u<0?Math.floor(u):Math.ceil(u));this._verticalScrollbar.writeScrollPosition(c,d)}if(o){let u=K2*o,d=l.scrollLeft-(u<0?Math.floor(u):Math.ceil(u));this._horizontalScrollbar.writeScrollPosition(c,d)}c=this._scrollable.validateScrollPosition(c),(l.scrollLeft!==c.scrollLeft||l.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?" left":"",i=t?" top":"",s=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Goe)}},Qoe=class extends Zoe{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Joe(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,ki&&(t.className+=" mac"),t}var s1=class extends qe{constructor(e,t,n,r,i,s,o,a){super(),this._bufferService=n,this._optionsService=o,this._renderService=a,this._onRequestScrollLines=this._register(new te),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let l=this._register(new zoe({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>vb(r.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{l.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Qoe(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},l)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(vn.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(bt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(bt(()=>this._styleElement.remove())),this._register(vn.runAndSubscribe(s.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${s.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${s.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${s.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
599
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(c=>this._handleScroll(c)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};s1=At([he(2,Hn),he(3,us),he(4,OA),he(5,Gl),he(6,Un),he(7,ds)],s1);var o1=class extends qe{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(s=>this._removeDecoration(s))),this._register(bt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};o1=At([he(1,Hn),he(2,us),he(3,od),he(4,ds)],o1);var eae=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},oi={full:0,left:0,center:0,right:0},ys={full:0,left:0,center:0,right:0},fc={full:0,left:0,center:0,right:0},op=class extends qe{constructor(e,t,n,r,i,s,o,a){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=s,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new eae,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(c=this._viewportElement.parentElement)==null||c.insertBefore(this._canvas,this._viewportElement),this._register(bt(()=>{var u;return(u=this._canvas)==null?void 0:u.remove()}));let l=this._canvas.getContext("2d");if(l)this._ctx=l;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);ys.full=this._canvas.width,ys.left=e,ys.center=t,ys.right=e,this._refreshDrawHeightConstants(),fc.full=1,fc.left=1,fc.center=1+ys.left,fc.right=1+ys.left+ys.center}_refreshDrawHeightConstants(){oi.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);oi.left=t,oi.center=t,oi.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*oi.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*oi.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*oi.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*oi.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(fc[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-oi[e.position||"full"]/2),ys[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+oi[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};op=At([he(2,Hn),he(3,od),he(4,ds),he(5,Un),he(6,Gl),he(7,us)],op);var K;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
600
|
+
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(K||(K={}));var Vh;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(Vh||(Vh={}));var iM;(e=>e.ST=`${K.ESC}\\`)(iM||(iM={}));var a1=class{constructor(e,t,n,r,i,s){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${K.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,i=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};a1=At([he(2,Hn),he(3,Un),he(4,sa),he(5,ds)],a1);var an=0,ln=0,cn=0,Tt=0,G2={css:"#00000000",rgba:0},Wt;(e=>{function t(i,s,o,a){return a!==void 0?`#${go(i)}${go(s)}${go(o)}${go(a)}`:`#${go(i)}${go(s)}${go(o)}`}e.toCss=t;function n(i,s,o,a=255){return(i<<24|s<<16|o<<8|a)>>>0}e.toRgba=n;function r(i,s,o,a){return{css:e.toCss(i,s,o,a),rgba:e.toRgba(i,s,o,a)}}e.toColor=r})(Wt||(Wt={}));var vt;(e=>{function t(l,c){if(Tt=(c.rgba&255)/255,Tt===1)return{css:c.css,rgba:c.rgba};let u=c.rgba>>24&255,d=c.rgba>>16&255,f=c.rgba>>8&255,p=l.rgba>>24&255,m=l.rgba>>16&255,x=l.rgba>>8&255;an=p+Math.round((u-p)*Tt),ln=m+Math.round((d-m)*Tt),cn=x+Math.round((f-x)*Tt);let w=Wt.toCss(an,ln,cn),v=Wt.toRgba(an,ln,cn);return{css:w,rgba:v}}e.blend=t;function n(l){return(l.rgba&255)===255}e.isOpaque=n;function r(l,c,u){let d=Kh.ensureContrastRatio(l.rgba,c.rgba,u);if(d)return Wt.toColor(d>>24&255,d>>16&255,d>>8&255)}e.ensureContrastRatio=r;function i(l){let c=(l.rgba|255)>>>0;return[an,ln,cn]=Kh.toChannels(c),{css:Wt.toCss(an,ln,cn),rgba:c}}e.opaque=i;function s(l,c){return Tt=Math.round(c*255),[an,ln,cn]=Kh.toChannels(l.rgba),{css:Wt.toCss(an,ln,cn,Tt),rgba:Wt.toRgba(an,ln,cn,Tt)}}e.opacity=s;function o(l,c){return Tt=l.rgba&255,s(l,Tt*c/255)}e.multiplyOpacity=o;function a(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}e.toColorRGB=a})(vt||(vt={}));var kt;(e=>{let t,n;try{let i=document.createElement("canvas");i.width=1,i.height=1;let s=i.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return an=parseInt(i.slice(1,2).repeat(2),16),ln=parseInt(i.slice(2,3).repeat(2),16),cn=parseInt(i.slice(3,4).repeat(2),16),Wt.toColor(an,ln,cn);case 5:return an=parseInt(i.slice(1,2).repeat(2),16),ln=parseInt(i.slice(2,3).repeat(2),16),cn=parseInt(i.slice(3,4).repeat(2),16),Tt=parseInt(i.slice(4,5).repeat(2),16),Wt.toColor(an,ln,cn,Tt);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let s=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return an=parseInt(s[1]),ln=parseInt(s[2]),cn=parseInt(s[3]),Tt=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),Wt.toColor(an,ln,cn,Tt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[an,ln,cn,Tt]=t.getImageData(0,0,1,1).data,Tt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Wt.toRgba(an,ln,cn,Tt),css:i}}e.toColor=r})(kt||(kt={}));var Mn;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,i,s){let o=r/255,a=i/255,l=s/255,c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),u=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return c*.2126+u*.7152+d*.0722}e.relativeLuminance2=n})(Mn||(Mn={}));var Kh;(e=>{function t(o,a){if(Tt=(a&255)/255,Tt===1)return a;let l=a>>24&255,c=a>>16&255,u=a>>8&255,d=o>>24&255,f=o>>16&255,p=o>>8&255;return an=d+Math.round((l-d)*Tt),ln=f+Math.round((c-f)*Tt),cn=p+Math.round((u-p)*Tt),Wt.toRgba(an,ln,cn)}e.blend=t;function n(o,a,l){let c=Mn.relativeLuminance(o>>8),u=Mn.relativeLuminance(a>>8);if(Di(c,u)<l){if(u<c){let p=r(o,a,l),m=Di(c,Mn.relativeLuminance(p>>8));if(m<l){let x=i(o,a,l),w=Di(c,Mn.relativeLuminance(x>>8));return m>w?p:x}return p}let d=i(o,a,l),f=Di(c,Mn.relativeLuminance(d>>8));if(f<l){let p=r(o,a,l),m=Di(c,Mn.relativeLuminance(p>>8));return f>m?d:p}return d}}e.ensureContrastRatio=n;function r(o,a,l){let c=o>>24&255,u=o>>16&255,d=o>>8&255,f=a>>24&255,p=a>>16&255,m=a>>8&255,x=Di(Mn.relativeLuminance2(f,p,m),Mn.relativeLuminance2(c,u,d));for(;x<l&&(f>0||p>0||m>0);)f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),m-=Math.max(0,Math.ceil(m*.1)),x=Di(Mn.relativeLuminance2(f,p,m),Mn.relativeLuminance2(c,u,d));return(f<<24|p<<16|m<<8|255)>>>0}e.reduceLuminance=r;function i(o,a,l){let c=o>>24&255,u=o>>16&255,d=o>>8&255,f=a>>24&255,p=a>>16&255,m=a>>8&255,x=Di(Mn.relativeLuminance2(f,p,m),Mn.relativeLuminance2(c,u,d));for(;x<l&&(f<255||p<255||m<255);)f=Math.min(255,f+Math.ceil((255-f)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),m=Math.min(255,m+Math.ceil((255-m)*.1)),x=Di(Mn.relativeLuminance2(f,p,m),Mn.relativeLuminance2(c,u,d));return(f<<24|p<<16|m<<8|255)>>>0}e.increaseLuminance=i;function s(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=s})(Kh||(Kh={}));function go(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Di(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var tae=class extends sd{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ap=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Pr}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,s=0,o=0,a=t.getFg(0),l=t.getBg(0);for(let c=0;c<t.getTrimmedLength();c++)if(t.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==l){if(c-i>1){let u=this._getJoinedRanges(r,o,s,t,i);for(let d=0;d<u.length;d++)n.push(u[d])}i=c,o=s,a=this._workCell.fg,l=this._workCell.bg}s+=this._workCell.getChars().length||Ms.length}if(this._bufferService.cols-i>1){let c=this._getJoinedRanges(r,o,s,t,i);for(let u=0;u<c.length;u++)n.push(c[u])}return n}_getJoinedRanges(e,t,n,r,i){let s=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(s)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let l=this._characterJoiners[a].handler(s);for(let c=0;c<l.length;c++)ap._mergeRanges(o,l[c])}catch(l){console.error(l)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,s=0,o=e[r];if(o){for(let a=n;a<this._bufferService.cols;a++){let l=t.getWidth(a),c=t.getString(a).length||Ms.length;if(l!==0){if(!i&&o[0]<=s&&(o[0]=a,i=!0),o[1]<=s){if(o[1]=a,o=e[++r],!o)break;o[0]<=s?(o[0]=a,i=!0):i=!1}s+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};ap=At([he(0,Hn)],ap);function nae(e){return 57508<=e&&e<=57558}function rae(e){return 9472<=e&&e<=9631}function iae(e){return nae(e)||rae(e)}function sae(){return{css:{canvas:uh(),cell:uh()},device:{canvas:uh(),cell:uh(),char:{width:0,height:0,left:0,top:0}}}}function uh(){return{width:0,height:0}}var l1=class{constructor(e,t,n,r,i,s,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=s,this._themeService=o,this._workCell=new Pr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,o,a,l,c,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<s+1&&(m=s+1);let x,w=0,v="",_=0,b=0,S=0,C=0,k=!1,N=0,E=!1,L=0,P=0,D=[],R=c!==-1&&u!==-1;for(let A=0;A<m;A++){e.loadCell(A,this._workCell);let M=this._workCell.getWidth();if(M===0)continue;let j=!1,z=A>=P,F=A,$=this._workCell;if(f.length>0&&A===f[0][0]&&z){let xe=f.shift(),Ke=this._isCellInSelection(xe[0],t);for(_=xe[0]+1;_<xe[1];_++)z&&(z=Ke===this._isCellInSelection(_,t));z&&(z=!n||s<xe[0]||s>=xe[1]),z?(j=!0,$=new tae(this._workCell,e.translateToString(!0,xe[0],xe[1]),xe[1]-xe[0]),F=xe[1]-1,M=$.getWidth()):P=xe[1]}let B=this._isCellInSelection(A,t),I=n&&A===s,U=R&&A>=c&&A<=u,V=!1;this._decorationService.forEachDecorationAtCell(A,t,void 0,xe=>{V=!0});let O=$.getChars()||Ms;if(O===" "&&($.isUnderline()||$.isOverline())&&(O=" "),L=M*a-l.get(O,$.isBold(),$.isItalic()),!x)x=this._document.createElement("span");else if(w&&(B&&E||!B&&!E&&$.bg===b)&&(B&&E&&p.selectionForeground||$.fg===S)&&$.extended.ext===C&&U===k&&L===N&&!I&&!j&&!V&&z){$.isInvisible()?v+=Ms:v+=O,w++;continue}else w&&(x.textContent=v),x=this._document.createElement("span"),w=0,v="";if(b=$.bg,S=$.fg,C=$.extended.ext,k=U,N=L,E=B,j&&s>=A&&s<=F&&(s=A),!this._coreService.isCursorHidden&&I&&this._coreService.isCursorInitialized){if(D.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&D.push("xterm-cursor-blink"),D.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":D.push("xterm-cursor-outline");break;case"block":D.push("xterm-cursor-block");break;case"bar":D.push("xterm-cursor-bar");break;case"underline":D.push("xterm-cursor-underline");break}}if($.isBold()&&D.push("xterm-bold"),$.isItalic()&&D.push("xterm-italic"),$.isDim()&&D.push("xterm-dim"),$.isInvisible()?v=Ms:v=$.getChars()||Ms,$.isUnderline()&&(D.push(`xterm-underline-${$.extended.underlineStyle}`),v===" "&&(v=" "),!$.isUnderlineColorDefault()))if($.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${sd.toColorRGB($.getUnderlineColor()).join(",")})`;else{let xe=$.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&$.isBold()&&xe<8&&(xe+=8),x.style.textDecorationColor=p.ansi[xe].css}$.isOverline()&&(D.push("xterm-overline"),v===" "&&(v=" ")),$.isStrikethrough()&&D.push("xterm-strikethrough"),U&&(x.style.textDecoration="underline");let ne=$.getFgColor(),ae=$.getFgColorMode(),Y=$.getBgColor(),ye=$.getBgColorMode(),Ce=!!$.isInverse();if(Ce){let xe=ne;ne=Y,Y=xe;let Ke=ae;ae=ye,ye=Ke}let oe,je,Ae=!1;this._decorationService.forEachDecorationAtCell(A,t,void 0,xe=>{xe.options.layer!=="top"&&Ae||(xe.backgroundColorRGB&&(ye=50331648,Y=xe.backgroundColorRGB.rgba>>8&16777215,oe=xe.backgroundColorRGB),xe.foregroundColorRGB&&(ae=50331648,ne=xe.foregroundColorRGB.rgba>>8&16777215,je=xe.foregroundColorRGB),Ae=xe.options.layer==="top")}),!Ae&&B&&(oe=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,Y=oe.rgba>>8&16777215,ye=50331648,Ae=!0,p.selectionForeground&&(ae=50331648,ne=p.selectionForeground.rgba>>8&16777215,je=p.selectionForeground)),Ae&&D.push("xterm-decoration-top");let De;switch(ye){case 16777216:case 33554432:De=p.ansi[Y],D.push(`xterm-bg-${Y}`);break;case 50331648:De=Wt.toColor(Y>>16,Y>>8&255,Y&255),this._addStyle(x,`background-color:#${Y2((Y>>>0).toString(16),"0",6)}`);break;case 0:default:Ce?(De=p.foreground,D.push("xterm-bg-257")):De=p.background}switch(oe||$.isDim()&&(oe=vt.multiplyOpacity(De,.5)),ae){case 16777216:case 33554432:$.isBold()&&ne<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ne+=8),this._applyMinimumContrast(x,De,p.ansi[ne],$,oe,void 0)||D.push(`xterm-fg-${ne}`);break;case 50331648:let xe=Wt.toColor(ne>>16&255,ne>>8&255,ne&255);this._applyMinimumContrast(x,De,xe,$,oe,je)||this._addStyle(x,`color:#${Y2(ne.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(x,De,p.foreground,$,oe,je)||Ce&&D.push("xterm-fg-257")}D.length&&(x.className=D.join(" "),D.length=0),!I&&!j&&!V&&z?w++:x.textContent=v,L!==this.defaultSpacing&&(x.style.letterSpacing=`${L}px`),d.push(x),A=F}return x&&w&&(x.textContent=v),d}_applyMinimumContrast(e,t,n,r,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||iae(r.getCode()))return!1;let o=this._getContrastCache(r),a;if(!i&&!s&&(a=o.getColor(t.rgba,n.rgba)),a===void 0){let l=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);a=vt.ensureContrastRatio(i||t,s||n,l),o.setColor((i||t).rgba,(s||n).rgba,a??null)}return a?(this._addStyle(e,`color:${a.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};l1=At([he(1,zA),he(2,Un),he(3,us),he(4,sa),he(5,od),he(6,Gl)],l1);function Y2(e,t,n){for(;e.length<n;)e=t+e;return e}var oae=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontStyle="italic";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold",s.style.fontStyle="italic",this._measureElements=[n,r,i,s],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(s),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let o=this._measure(e,0);return o>0&&(this._flat[r]=o),o}let i=e;t&&(i+="B"),n&&(i+="I");let s=this._holey.get(i);if(s===void 0){let o=0;t&&(o|=1),n&&(o|=2),s=this._measure(e,o),s>0&&this._holey.set(i,s)}return s}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},aae=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,s=t[1]-i,o=n[1]-i,a=Math.max(s,0),l=Math.min(o,e.rows-1);if(a>=e.rows||l<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=s,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function lae(){return new aae}var o0="xterm-dom-renderer-owner-",wr="xterm-rows",dh="xterm-fg-",X2="xterm-bg-",pc="xterm-focus",hh="xterm-selection",cae=1,c1=class extends qe{constructor(e,t,n,r,i,s,o,a,l,c,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=o,this._charSizeService=l,this._optionsService=c,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=cae++,this._rowElements=[],this._selectionRenderModel=lae(),this.onRequestRedraw=this._register(new te).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(wr),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(hh),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=sae(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(m=>this._injectCss(m))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(l1,document),this._element.classList.add(o0+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(m=>this._handleLinkHover(m))),this._register(this._linkifier2.onHideLinkUnderline(m=>this._handleLinkLeave(m))),this._register(bt(()=>{this._element.classList.remove(o0+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new oae(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${wr} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${wr} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${wr} .xterm-dim { color: ${vt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${wr}.${pc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${wr}.${pc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${wr}.${pc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${wr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${wr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${wr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${wr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${wr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${hh} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${hh} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${hh} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${dh}${s} { color: ${o.css}; }${this._terminalSelector} .${dh}${s}.xterm-dim { color: ${vt.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${X2}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${dh}257 { color: ${vt.opaque(e.background).css}; }${this._terminalSelector} .${dh}257.xterm-dim { color: ${vt.multiplyOpacity(vt.opaque(e.background),.5).css}; }${this._terminalSelector} .${X2}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(pc),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(pc),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(n){let l=e[0]>t[0];a.appendChild(this._createSelectionElement(s,l?t[0]:e[0],l?e[0]:t[0],o-s+1))}else{let l=r===s?e[0]:0,c=s===i?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(s,l,c));let u=o-s-1;if(a.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,u)),s!==o){let d=i===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,d))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return s+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-s),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${s}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),s=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=t;l++){let c=l+n.ydisp,u=this._rowElements[l],d=n.lines.get(c);if(!u||!d)break;u.replaceChildren(...this._rowFactory.createRow(d,c,c===r,o,a,i,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${o0}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,s){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let a=this._bufferService.buffer,l=a.ybase+a.y,c=Math.min(a.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=n;p<=r;++p){let m=p+a.ydisp,x=this._rowElements[p],w=a.lines.get(m);if(!x||!w)break;x.replaceChildren(...this._rowFactory.createRow(w,m,m===l,d,f,c,u,this.dimensions.css.cell.width,this._widthCache,s?p===n?e:0:-1,s?(p===r?t:i)-1:-1))}}};c1=At([he(7,db),he(8,Cm),he(9,Un),he(10,Hn),he(11,sa),he(12,us),he(13,Gl)],c1);var u1=class extends qe{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new te),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new dae(this._optionsService))}catch{this._measureStrategy=this._register(new uae(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};u1=At([he(2,Un)],u1);var sM=class extends qe{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},uae=class extends sM{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},dae=class extends sM{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},hae=class extends qe{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new fae(this._window)),this._onDprChange=this._register(new te),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new te),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(vn.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Te(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Te(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},fae=class extends qe{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Sl),this._onDprChange=this._register(new te),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(bt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Te(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},pae=class extends qe{constructor(){super(),this.linkProviders=[],this._register(bt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function yb(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),s=parseInt(i.getPropertyValue("padding-left")),o=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-r.left-s,t.clientY-r.top-o]}function mae(e,t,n,r,i,s,o,a,l){if(!s)return;let c=yb(e,t,n);if(c)return c[0]=Math.ceil((c[0]+(l?o/2:0))/o),c[1]=Math.ceil(c[1]/a),c[0]=Math.min(Math.max(c[0],1),r+(l?1:0)),c[1]=Math.min(Math.max(c[1],1),i),c}var d1=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return mae(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=yb(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};d1=At([he(0,ds),he(1,Cm)],d1);var gae=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},oM={};Ese(oM,{getSafariVersion:()=>xae,isChromeOS:()=>uM,isFirefox:()=>aM,isIpad:()=>yae,isIphone:()=>_ae,isLegacyEdge:()=>vae,isLinux:()=>_b,isMac:()=>lp,isNode:()=>Em,isSafari:()=>lM,isWindows:()=>cM});var Em=typeof process<"u"&&"title"in process,ad=Em?"node":navigator.userAgent,ld=Em?"node":navigator.platform,aM=ad.includes("Firefox"),vae=ad.includes("Edge"),lM=/^((?!chrome|android).)*safari/i.test(ad);function xae(){if(!lM)return 0;let e=ad.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var lp=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(ld),yae=ld==="iPad",_ae=ld==="iPhone",cM=["Windows","Win16","Win32","WinCE"].includes(ld),_b=ld.indexOf("Linux")>=0,uM=/\bCrOS\b/.test(ad),dM=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},bae=class extends dM{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},wae=class extends dM{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},cp=!Em&&"requestIdleCallback"in window?wae:bae,Sae=class{constructor(){this._queue=new cp}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},h1=class extends qe{constructor(e,t,n,r,i,s,o,a,l){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=a,this._renderer=this._register(new Sl),this._pausedResizeTask=new Sae,this._observerDisposable=this._register(new Sl),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new te),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new te),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new te),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new te),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new gae((c,u)=>this._renderRows(c,u),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new kae(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(bt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(s.onDecorationRegistered(()=>this._fullRefresh())),this._register(s.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(l.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=bt(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var n;return(n=this._renderer.value)==null?void 0:n.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};h1=At([he(2,Un),he(3,Cm),he(4,sa),he(5,od),he(6,Hn),he(7,us),he(8,Gl)],h1);var kae=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Cae(e,t,n,r){let i=n.buffer.x,s=n.buffer.y;if(!n.buffer.hasScrollback)return Nae(i,s,e,t,n,r)+Im(s,t,n,r)+Tae(i,s,e,t,n,r);let o;if(s===t)return o=i>e?"D":"C",Mu(Math.abs(i-e),Au(o,r));o=s>t?"D":"C";let a=Math.abs(s-t),l=Iae(s>t?e:i,n)+(a-1)*n.cols+1+Eae(s>t?i:e);return Mu(l,Au(o,r))}function Eae(e,t){return e-1}function Iae(e,t){return t.cols-e}function Nae(e,t,n,r,i,s){return Im(t,r,i,s).length===0?"":Mu(fM(e,t,e,t-Ko(t,i),!1,i).length,Au("D",s))}function Im(e,t,n,r){let i=e-Ko(e,n),s=t-Ko(t,n),o=Math.abs(i-s)-Pae(e,t,n);return Mu(o,Au(hM(e,t),r))}function Tae(e,t,n,r,i,s){let o;Im(t,r,i,s).length>0?o=r-Ko(r,i):o=t;let a=r,l=Rae(e,t,n,r,i,s);return Mu(fM(e,o,n,a,l==="C",i).length,Au(l,s))}function Pae(e,t,n){var o;let r=0,i=e-Ko(e,n),s=t-Ko(t,n);for(let a=0;a<Math.abs(i-s);a++){let l=hM(e,t)==="A"?-1:1;(o=n.buffer.lines.get(i+l*a))!=null&&o.isWrapped&&r++}return r}function Ko(e,t){let n=0,r=t.buffer.lines.get(e),i=r==null?void 0:r.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r==null?void 0:r.isWrapped;return n}function Rae(e,t,n,r,i,s){let o;return Im(n,r,i,s).length>0?o=r-Ko(r,i):o=t,e<n&&o<=r||e>=n&&o<r?"C":"D"}function hM(e,t){return e>t?"A":"B"}function fM(e,t,n,r,i,s){let o=e,a=t,l="";for(;(o!==n||a!==r)&&a>=0&&a<s.buffer.lines.length;)o+=i?1:-1,i&&o>s.cols-1?(l+=s.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!i&&o<0&&(l+=s.buffer.translateBufferLineToString(a,!1,0,e+1),o=s.cols-1,e=o,a--);return l+s.buffer.translateBufferLineToString(a,!1,e,o)}function Au(e,t){let n=t?"O":"[";return K.ESC+n+e}function Mu(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var Aae=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Z2(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var a0=50,Mae=15,jae=50,Lae=500,Dae=" ",Oae=new RegExp(Dae,"g"),f1=class extends qe{constructor(e,t,n,r,i,s,o,a,l){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=s,this._optionsService=o,this._renderService=a,this._coreBrowserService=l,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Pr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new te),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new te),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new te),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new te),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new Aae(this._bufferService),this._activeSelectionMode=0,this._register(bt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let i=e[0]<t[0]?e[0]:t[0],s=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let a=n.translateBufferLineToString(o,!0,i,s);r.push(a)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let s=e[1]+1;s<=t[1]-1;s++){let o=n.lines.get(s),a=n.translateBufferLineToString(s,!0);o!=null&&o.isWrapped?r[r.length-1]+=a:r.push(a)}if(e[1]!==t[1]){let s=n.lines.get(t[1]),o=n.translateBufferLineToString(t[1],!0,0,t[0]);s&&s.isWrapped?r[r.length-1]+=o:r.push(o)}}return r.map(i=>i.replace(Oae," ")).join(cM?`\r
|
|
601
|
+
`:`
|
|
602
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),_b&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var i,s;let n=(s=(i=this._linkifier.currentLink)==null?void 0:i.link)==null?void 0:s.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Z2(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=yb(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-a0),a0),t/=a0,t/Math.abs(t)+Math.round(t*(Mae-1)))}shouldForceSelection(e){return lp?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),jae)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(lp&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let r=n.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<Lae&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=Cae(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,s=i.lines.get(e[1]);if(!s)return;let o=i.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(s,e[0]),l=a,c=e[0]-a,u=0,d=0,f=0,p=0;if(o.charAt(a)===" "){for(;a>0&&o.charAt(a-1)===" ";)a--;for(;l<o.length&&o.charAt(l+1)===" ";)l++}else{let w=e[0],v=e[0];s.getWidth(w)===0&&(u++,w--),s.getWidth(v)===2&&(d++,v++);let _=s.getString(v).length;for(_>1&&(p+=_-1,l+=_-1);w>0&&a>0&&!this._isCharWordSeparator(s.loadCell(w-1,this._workCell));){s.loadCell(w-1,this._workCell);let b=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,w--):b>1&&(f+=b-1,a-=b-1),a--,w--}for(;v<s.length&&l+1<o.length&&!this._isCharWordSeparator(s.loadCell(v+1,this._workCell));){s.loadCell(v+1,this._workCell);let b=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,v++):b>1&&(p+=b-1,l+=b-1),l++,v++}}l++;let m=a+c-u+f,x=Math.min(this._bufferService.cols,l-a+u+d-f-p);if(!(!t&&o.slice(a,l).trim()==="")){if(n&&m===0&&s.getCodePoint(0)!==32){let w=i.lines.get(e[1]-1);if(w&&s.isWrapped&&w.getCodePoint(this._bufferService.cols-1)!==32){let v=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(v){let _=this._bufferService.cols-v.start;m-=_,x+=_}}}if(r&&m+x===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let w=i.lines.get(e[1]+1);if(w!=null&&w.isWrapped&&w.getCodePoint(0)!==32){let v=this._getWordAt([0,e[1]+1],!1,!1,!0);v&&(x+=v.length)}}return{start:m,length:x}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Z2(n,this._bufferService.cols)}};f1=At([he(3,Hn),he(4,sa),he(5,hb),he(6,Un),he(7,ds),he(8,us)],f1);var Q2=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},J2=class{constructor(){this._color=new Q2,this._css=new Q2}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Xt=Object.freeze((()=>{let e=[kt.toColor("#2e3436"),kt.toColor("#cc0000"),kt.toColor("#4e9a06"),kt.toColor("#c4a000"),kt.toColor("#3465a4"),kt.toColor("#75507b"),kt.toColor("#06989a"),kt.toColor("#d3d7cf"),kt.toColor("#555753"),kt.toColor("#ef2929"),kt.toColor("#8ae234"),kt.toColor("#fce94f"),kt.toColor("#729fcf"),kt.toColor("#ad7fa8"),kt.toColor("#34e2e2"),kt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],s=t[n%6];e.push({css:Wt.toCss(r,i,s),rgba:Wt.toRgba(r,i,s)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:Wt.toCss(r,r,r),rgba:Wt.toRgba(r,r,r)})}return e})()),yo=kt.toColor("#ffffff"),Tc=kt.toColor("#000000"),eE=kt.toColor("#ffffff"),tE=Tc,mc={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Bae=yo,p1=class extends qe{constructor(e){super(),this._optionsService=e,this._contrastCache=new J2,this._halfContrastCache=new J2,this._onChangeColors=this._register(new te),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:yo,background:Tc,cursor:eE,cursorAccent:tE,selectionForeground:void 0,selectionBackgroundTransparent:mc,selectionBackgroundOpaque:vt.blend(Tc,mc),selectionInactiveBackgroundTransparent:mc,selectionInactiveBackgroundOpaque:vt.blend(Tc,mc),scrollbarSliderBackground:vt.opacity(yo,.2),scrollbarSliderHoverBackground:vt.opacity(yo,.4),scrollbarSliderActiveBackground:vt.opacity(yo,.5),overviewRulerBorder:yo,ansi:Xt.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=ct(e.foreground,yo),t.background=ct(e.background,Tc),t.cursor=vt.blend(t.background,ct(e.cursor,eE)),t.cursorAccent=vt.blend(t.background,ct(e.cursorAccent,tE)),t.selectionBackgroundTransparent=ct(e.selectionBackground,mc),t.selectionBackgroundOpaque=vt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ct(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=vt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ct(e.selectionForeground,G2):void 0,t.selectionForeground===G2&&(t.selectionForeground=void 0),vt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=vt.opacity(t.selectionBackgroundTransparent,.3)),vt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=vt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ct(e.scrollbarSliderBackground,vt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ct(e.scrollbarSliderHoverBackground,vt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ct(e.scrollbarSliderActiveBackground,vt.opacity(t.foreground,.5)),t.overviewRulerBorder=ct(e.overviewRulerBorder,Bae),t.ansi=Xt.slice(),t.ansi[0]=ct(e.black,Xt[0]),t.ansi[1]=ct(e.red,Xt[1]),t.ansi[2]=ct(e.green,Xt[2]),t.ansi[3]=ct(e.yellow,Xt[3]),t.ansi[4]=ct(e.blue,Xt[4]),t.ansi[5]=ct(e.magenta,Xt[5]),t.ansi[6]=ct(e.cyan,Xt[6]),t.ansi[7]=ct(e.white,Xt[7]),t.ansi[8]=ct(e.brightBlack,Xt[8]),t.ansi[9]=ct(e.brightRed,Xt[9]),t.ansi[10]=ct(e.brightGreen,Xt[10]),t.ansi[11]=ct(e.brightYellow,Xt[11]),t.ansi[12]=ct(e.brightBlue,Xt[12]),t.ansi[13]=ct(e.brightMagenta,Xt[13]),t.ansi[14]=ct(e.brightCyan,Xt[14]),t.ansi[15]=ct(e.brightWhite,Xt[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=ct(e.extendedAnsi[r],Xt[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};p1=At([he(0,Un)],p1);function ct(e,t){if(e!==void 0)try{return kt.toColor(e)}catch{}return t}var $ae=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},zae=class{constructor(){this._services=new $ae,this._services.set(db,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=Mse(e).sort((s,o)=>s.index-o.index),r=[];for(let s of n){let o=this._services.get(s.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);r.push(o)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},Fae={trace:0,debug:1,info:2,warn:3,error:4,off:5},Hae="xterm.js: ",m1=class extends qe{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Fae[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":Hae)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};m1=At([he(0,Un)],m1);var nE=class extends qe{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new te),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new te),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new te),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let i=t-1;i>=0;i--)this.set(e+i+n,this.get(e+i));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Ue=3,Ft=Object.freeze(new sd),fh=0,l0=2,Pc=class pM{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ue);let i=n||Pr.fromCharData([0,MA,1,0]);for(let s=0;s<t;++s)this.setCell(s,i);this.length=t}get(t){let n=this._data[t*Ue+0],r=n&2097151;return[this._data[t*Ue+1],n&2097152?this._combined[t]:r?Es(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*Ue+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Ue+0]=t|2097152|n[2]<<22):this._data[t*Ue+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Ue+0]>>22}hasWidth(t){return this._data[t*Ue+0]&12582912}getFg(t){return this._data[t*Ue+1]}getBg(t){return this._data[t*Ue+2]}hasContent(t){return this._data[t*Ue+0]&4194303}getCodePoint(t){let n=this._data[t*Ue+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Ue+0]&2097152}getString(t){let n=this._data[t*Ue+0];return n&2097152?this._combined[t]:n&2097151?Es(n&2097151):""}isProtected(t){return this._data[t*Ue+2]&536870912}loadCell(t,n){return fh=t*Ue,n.content=this._data[fh+0],n.fg=this._data[fh+1],n.bg=this._data[fh+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*Ue+0]=n.content,this._data[t*Ue+1]=n.fg,this._data[t*Ue+2]=n.bg}setCellFromCodepoint(t,n,r,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*Ue+0]=n|r<<22,this._data[t*Ue+1]=i.fg,this._data[t*Ue+2]=i.bg}addCodepointToCell(t,n,r){let i=this._data[t*Ue+0];i&2097152?this._combined[t]+=Es(n):i&2097151?(this._combined[t]=Es(i&2097151)+Es(n),i&=-2097152,i|=2097152):i=n|1<<22,r&&(i&=-12582913,i|=r<<22),this._data[t*Ue+0]=i}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let i=new Pr;for(let s=this.length-t-n-1;s>=0;--s)this.setCell(t+n+s,this.loadCell(t+s,i));for(let s=0;s<n;++s)this.setCell(t+s,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let i=new Pr;for(let s=0;s<this.length-t-n;++s)this.setCell(t+s,this.loadCell(t+n+s,i));for(let s=this.length-n;s<this.length;++s)this.setCell(s,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,i=!1){if(i){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*l0<this._data.buffer.byteLength;let r=t*Ue;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let i=new Uint32Array(r);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,n)}else{this._data=this._data.subarray(0,r);let i=Object.keys(this._combined);for(let o=0;o<i.length;o++){let a=parseInt(i[o],10);a>=t&&delete this._combined[a]}let s=Object.keys(this._extendedAttrs);for(let o=0;o<s.length;o++){let a=parseInt(s[o],10);a>=t&&delete this._extendedAttrs[a]}}return this.length=t,r*4*l0<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*l0<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new pM(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ue+0]&4194303)return t+(this._data[t*Ue+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ue+0]&4194303||this._data[t*Ue+2]&50331648)return t+(this._data[t*Ue+0]>>22);return 0}copyCellsFrom(t,n,r,i,s){let o=t._data;if(s)for(let l=i-1;l>=0;l--){for(let c=0;c<Ue;c++)this._data[(r+l)*Ue+c]=o[(n+l)*Ue+c];o[(n+l)*Ue+2]&268435456&&(this._extendedAttrs[r+l]=t._extendedAttrs[n+l])}else for(let l=0;l<i;l++){for(let c=0;c<Ue;c++)this._data[(r+l)*Ue+c]=o[(n+l)*Ue+c];o[(n+l)*Ue+2]&268435456&&(this._extendedAttrs[r+l]=t._extendedAttrs[n+l])}let a=Object.keys(t._combined);for(let l=0;l<a.length;l++){let c=parseInt(a[l],10);c>=n&&(this._combined[c-n+r]=t._combined[c])}}translateToString(t,n,r,i){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),i&&(i.length=0);let s="";for(;n<r;){let o=this._data[n*Ue+0],a=o&2097151,l=o&2097152?this._combined[n]:a?Es(a):Ms;if(s+=l,i)for(let c=0;c<l.length;++c)i.push(n);n+=o>>22||1}return i&&i.push(n),s}};function Uae(e,t,n,r,i,s){let o=[];for(let a=0;a<e.length-1;a++){let l=a,c=e.get(++l);if(!c.isWrapped)continue;let u=[e.get(a)];for(;l<e.length&&c.isWrapped;)u.push(c),c=e.get(++l);if(!s&&r>=a&&r<l){a+=u.length-1;continue}let d=0,f=ju(u,d,t),p=1,m=0;for(;p<u.length;){let w=ju(u,p,t),v=w-m,_=n-f,b=Math.min(v,_);u[d].copyCellsFrom(u[p],m,f,b,!1),f+=b,f===n&&(d++,f=0),m+=b,m===w&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let x=0;for(let w=u.length-1;w>0&&(w>d||u[w].getTrimmedLength()===0);w--)x++;x>0&&(o.push(a+u.length-x),o.push(x)),a+=u.length-1}return o}function Wae(e,t){let n=[],r=0,i=t[r],s=0;for(let o=0;o<e.length;o++)if(i===o){let a=t[++r];e.onDeleteEmitter.fire({index:o-s,amount:a}),o+=a-1,s+=a,i=t[++r]}else n.push(o);return{layout:n,countRemoved:s}}function qae(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function Vae(e,t,n){let r=[],i=e.map((l,c)=>ju(e,c,t)).reduce((l,c)=>l+c),s=0,o=0,a=0;for(;a<i;){if(i-a<n){r.push(i-a);break}s+=n;let l=ju(e,o,t);s>l&&(s-=l,o++);let c=e[o].getWidth(s-1)===2;c&&s--;let u=c?n-1:n;r.push(u),a+=u}return r}function ju(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var mM=class gM{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=gM._nextId++,this._onDispose=this.register(new te),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Vo(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};mM._nextId=1;var Kae=mM,en={},_o=en.B;en[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};en.A={"#":"£"};en.B=void 0;en[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};en.C=en[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};en.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};en.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};en.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};en.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};en.E=en[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};en.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};en.H=en[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};en["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var rE=4294967295,iE=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Ft.clone(),this.savedCharset=_o,this.markers=[],this._nullCell=Pr.fromCharData([0,MA,1,0]),this._whitespaceCell=Pr.fromCharData([0,Ms,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new cp,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new nE(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new sp),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new sp),this._whitespaceCell}getBlankLine(e,t){return new Pc(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>rE?rE:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Ft);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new nE(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Ft),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(e,n);let s=0;if(this._rows<t)for(let o=this._rows;o<t;o++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Pc(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new Pc(e,n)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let o=this.lines.length-i;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let s=0;s<this.lines.length;s++)r+=+this.lines.get(s).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=Uae(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Ft),n);if(r.length>0){let i=Wae(this.lines,r);qae(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(Ft),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Pc(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Ft),i=[],s=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let l=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),l.unshift(a);if(!n){let b=this.ybase+this.y;if(b>=o&&b<o+l.length)continue}let c=l[l.length-1].getTrimmedLength(),u=Vae(l,this._cols,e),d=u.length-l.length,f;this.ybase===0&&this.y!==this.lines.length-1?f=Math.max(0,this.y-this.lines.maxLength+d):f=Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let b=0;b<d;b++){let S=this.getBlankLine(Ft,!0);p.push(S)}p.length>0&&(i.push({start:o+l.length+s,newLines:p}),s+=p.length),l.push(...p);let m=u.length-1,x=u[m];x===0&&(m--,x=u[m]);let w=l.length-d-1,v=c;for(;w>=0;){let b=Math.min(v,x);if(l[m]===void 0)break;if(l[m].copyCellsFrom(l[w],v-b,x-b,b,!0),x-=b,x===0&&(m--,x=u[m]),v-=b,v===0){w--;let S=Math.max(w,0);v=ju(l,S,this._cols)}}for(let b=0;b<l.length;b++)u[b]<e&&l[b].setCell(u[b],r);let _=d-f;for(;_-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+s)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let o=[],a=[];for(let x=0;x<this.lines.length;x++)a.push(this.lines.get(x));let l=this.lines.length,c=l-1,u=0,d=i[u];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);let f=0;for(let x=Math.min(this.lines.maxLength-1,l+s-1);x>=0;x--)if(d&&d.start>c+f){for(let w=d.newLines.length-1;w>=0;w--)this.lines.set(x--,d.newLines[w]);x++,o.push({index:c+1,amount:d.newLines.length}),f+=d.newLines.length,d=i[++u]}else this.lines.set(x,a[c--]);let p=0;for(let x=o.length-1;x>=0;x--)o[x].index+=p,this.lines.onInsertEmitter.fire(o[x]),p+=o[x].amount;let m=Math.max(0,l+s-this.lines.maxLength);m>0&&this.lines.onTrimEmitter.fire(m)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new Kae(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},Gae=class extends qe{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new te),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new iE(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new iE(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},vM=2,xM=1,g1=class extends qe{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new te),this.onResize=this._onResize.event,this._onScroll=this._register(new te),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,vM),this.rows=Math.max(e.rawOptions.rows||0,xM),this.buffers=this._register(new Gae(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,s=n.ybase+n.scrollBottom;if(n.scrollTop===0){let o=n.lines.isFull;s===n.lines.length-1?o?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(s+1,0,r.clone()),o?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let o=s-i+1;n.lines.shiftElements(i+1,o-1,-1),n.lines.set(s,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};g1=At([he(0,Un)],g1);var _a={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:lp,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Yae=["normal","bold","100","200","300","400","500","600","700","800","900"],Xae=class extends qe{constructor(e){super(),this._onOptionChange=this._register(new te),this.onOptionChange=this._onOptionChange.event;let t={..._a};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(bt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in _a))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in _a))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=_a[e]),!Zae(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=_a[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=Yae.includes(t)?t:_a[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function Zae(e){return e==="block"||e==="underline"||e==="bar"}function Rc(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&Rc(e[r],t-1);return n}var sE=Object.freeze({insertMode:!1}),oE=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),v1=class extends qe{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new te),this.onData=this._onData.event,this._onUserInput=this._register(new te),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new te),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new te),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Rc(sE),this.decPrivateModes=Rc(oE)}reset(){this.modes=Rc(sE),this.decPrivateModes=Rc(oE)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};v1=At([he(0,Hn),he(1,BA),he(2,Un)],v1);var aE={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function c0(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var u0=String.fromCharCode,lE={DEFAULT:e=>{let t=[c0(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${u0(t[0])}${u0(t[1])}${u0(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${c0(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${c0(e,!0)};${e.x};${e.y}${t}`}},x1=class extends qe{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new te),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(aE))this.addProtocol(r,aE[r]);for(let r of Object.keys(lE))this.addEncoding(r,lE[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};x1=At([he(0,Hn),he(1,sa),he(2,Un)],x1);var d0=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],Qae=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],Zt;function Jae(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var ele=class{constructor(){if(this.version="6",!Zt){Zt=new Uint8Array(65536),Zt.fill(1),Zt[0]=0,Zt.fill(0,1,32),Zt.fill(0,127,160),Zt.fill(2,4352,4448),Zt[9001]=2,Zt[9002]=2,Zt.fill(2,11904,42192),Zt[12351]=1,Zt.fill(2,44032,55204),Zt.fill(2,63744,64256),Zt.fill(2,65040,65050),Zt.fill(2,65072,65136),Zt.fill(2,65280,65377),Zt.fill(2,65504,65511);for(let e=0;e<d0.length;++e)Zt.fill(0,d0[e][0],d0[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Zt[e]:Jae(e,Qae)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let i=Io.extractWidth(t);i===0?r=!1:i>n&&(n=i)}return Io.createPropertyValue(0,n,r)}},Io=class Gh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new te,this.onChange=this._onChange.event;let t=new ele;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let s=0;s<i;++s){let o=t.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=i)return n+this.wcwidth(o);let c=t.charCodeAt(s);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:n+=this.wcwidth(c)}let a=this.charProperties(o,r),l=Gh.extractWidth(a);Gh.extractShouldJoin(a)&&(l-=Gh.extractWidth(r)),n+=l,r=a}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},tle=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function cE(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var gc=2147483647,nle=256,yM=class y1{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>nle)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new y1;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let i=t[r];if(Array.isArray(i))for(let s=0;s<i.length;++s)n.addSubParam(i[s]);else n.addParam(i)}return n}clone(){let t=new y1(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,i))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>gc?gc:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>gc?gc:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&(t[n]=this._subParams.slice(r,i))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[n-1];r[n-1]=~i?Math.min(i*10+t,gc):t}},vc=[],rle=class{constructor(){this._state=0,this._active=vc,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=vc}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=vc,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||vc,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",km(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=vc,this._id=-1,this._state=0}}},ir=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=km(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},xc=[],ile=class{constructor(){this._handlers=Object.create(null),this._active=xc,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=xc}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=xc,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||xc,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",km(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=xc,this._ident=0}},Ac=new yM;Ac.addParam(0);var uE=class{constructor(e){this._handler=e,this._data="",this._params=Ac,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Ac,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=km(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=Ac,this._data="",this._hitLimit=!1,n));return this._params=Ac,this._data="",this._hitLimit=!1,t}},sle=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},kr=160,ole=function(){let e=new sle(4095),t=Array.apply(null,Array(256)).map((a,l)=>l),n=(a,l)=>t.slice(a,l),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let s=n(0,14),o;e.setDefault(1,0),e.addMany(r,0,2,0);for(o in s)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(kr,0,2,0),e.add(kr,8,5,8),e.add(kr,6,0,6),e.add(kr,11,0,11),e.add(kr,13,13,13),e}(),ale=class extends qe{constructor(e=ole){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new yM,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(bt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new rle),this._dcsParser=this._register(new ile),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let i=0;i<e.intermediates.length;++i){let s=e.intermediates.charCodeAt(i);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=s}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,s=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,l=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&l>-1){for(;l>=0&&(o=a[l](this._params),o!==!0);l--)if(o instanceof Promise)return this._parseStack.handlerPos=l,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&l>-1){for(;l>=0&&(o=a[l](),o!==!0);l--)if(o instanceof Promise)return this._parseStack.handlerPos=l,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=s;a<t;++a){switch(r=e[a],i=this._transitions.table[this.currentState<<8|(r<160?r:kr)],i>>4){case 2:for(let f=a+1;;++f){if(f>=t||(r=e[f])<32||r>126&&r<kr){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<kr){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<kr){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(r=e[f])<32||r>126&&r<kr){this._printHandler(e,a,f),a=f-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let l=this._csiHandlers[this._collect<<8|r],c=l?l.length-1:-1;for(;c>=0&&(o=l[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(3,l,c,i,a),o;c<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++a<t&&(r=e[a])>47&&r<60);a--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let u=this._escHandlers[this._collect<<8|r],d=u?u.length-1:-1;for(;d>=0&&(o=u[d](),o!==!0);d--)if(o instanceof Promise)return this._preserveStack(4,u,d,i,a),o;d<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let f=a+1;;++f)if(f>=t||(r=e[f])===24||r===26||r===27||r>127&&r<kr){this._dcsParser.put(e,a,f),a=f-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,a),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let f=a+1;;f++)if(f>=t||(r=e[f])<32||r>127&&r<kr){this._oscParser.put(e,a,f),a=f-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,a),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},lle=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,cle=/^[\da-f]+$/;function dE(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=lle.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),cle.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let i=0;i<3;++i){let s=parseInt(t.slice(n*i,n*i+n),16);r[i]=n===1?s<<4:n===2?s:n===3?s>>4:s>>8}return r}}function h0(e,t){let n=e.toString(16),r=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function ule(e,t=16){let[n,r,i]=e;return`rgb:${h0(n,t)}/${h0(r,t)}/${h0(i,t)}`}var dle={"(":0,")":1,"*":2,"+":3,"-":1,".":2},_s=131072,hE=10;function fE(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var pE=5e3,mE=0,hle=class extends qe{constructor(e,t,n,r,i,s,o,a,l=new ale){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=s,this._coreMouseService=o,this._unicodeService=a,this._parser=l,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Rse,this._utf8Decoder=new Ase,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Ft.clone(),this._eraseAttrDataInternal=Ft.clone(),this._onRequestBell=this._register(new te),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new te),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new te),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new te),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new te),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new te),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new te),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new te),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new te),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new te),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new te),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new te),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new te),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new _1(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,u)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:u.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,u,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:u,data:d})}),this._parser.setDcsHandlerFallback((c,u,d)=>{u==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:u,payload:d})}),this._parser.setPrintHandler((c,u,d)=>this.print(c,u,d)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(K.BEL,()=>this.bell()),this._parser.setExecuteHandler(K.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(K.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(K.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(K.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(K.BS,()=>this.backspace()),this._parser.setExecuteHandler(K.HT,()=>this.tab()),this._parser.setExecuteHandler(K.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(K.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Vh.IND,()=>this.index()),this._parser.setExecuteHandler(Vh.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Vh.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ir(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new ir(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new ir(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new ir(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new ir(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new ir(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new ir(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new ir(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new ir(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new ir(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new ir(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new ir(c=>this.restoreCursorColor(c))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let c in en)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new uE((c,u)=>this.requestStatusString(c,u)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),pE))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${pE} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,s=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>_s&&(s=this._parseStack.position+_s)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<_s&&(this._parseBuffer=new Uint32Array(Math.min(e.length,_s))),o||this._dirtyRowTracker.clearRange(),e.length>_s)for(let c=s;c<e.length;c+=_s){let u=c+_s<e.length?c+_s:e.length,d=typeof e=="string"?this._stringDecoder.decode(e.substring(c,u),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,u),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,d))return this._preserveStack(r,i,d,c),this._logSlowResolvingAsync(n),n}else if(!o){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,c))return this._preserveStack(r,i,c,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(l,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,n){let r,i,s=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&s){let v=s[String.fromCharCode(r)];v&&(r=v.charCodeAt(0))}let m=this._unicodeService.charProperties(r,f);i=Io.extractWidth(m);let x=Io.extractShouldJoin(m),w=x?Io.extractWidth(f):0;if(f=m,o&&this._onA11yChar.fire(Es(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-w>a){if(l){let v=d,_=this._activeBuffer.x-w;for(this._activeBuffer.x=w,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),w>0&&d instanceof Pc&&d.copyCellsFrom(v,_,0,w,!1);_<a;)v.setCellFromCodepoint(_++,0,1,u)}else if(this._activeBuffer.x=a-1,i===2)continue}if(x&&this._activeBuffer.x){let v=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-v,r,i);for(let _=i-w;--_>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(c&&(d.insertCells(this._activeBuffer.x,i-w,this._activeBuffer.getNullCell(u)),d.getWidth(a-1)===2&&d.setCellFromCodepoint(a-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<a&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>fE(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new uE(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ir(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(s.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&r.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Ft));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=Io.extractWidth(t),i=this._activeBuffer.x-r,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(s.length*n),a=0;for(let c=0;c<s.length;){let u=s.codePointAt(c)||0;o[a++]=u,c+=u>65535?2:1}let l=a;for(let c=1;c<n;++c)o.copyWithin(l,0,a),l+=a;return this.print(o,0,l),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(K.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(K.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(K.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(K.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(K.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,_o),this._charsetService.setgCharset(1,_o),this._charsetService.setgCharset(2,_o),this._charsetService.setgCharset(3,_o);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(x=>(x[x.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",x[x.SET=1]="SET",x[x.RESET=2]="RESET",x[x.PERMANENTLY_SET=3]="PERMANENTLY_SET",x[x.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:s}=this._coreMouseService,o=this._coreService,{buffers:a,cols:l}=this._bufferService,{active:c,alt:u}=a,d=this._optionsService.rawOptions,f=(x,w)=>(o.triggerDataEvent(`${K.ESC}[${t?"":"?"}${x};${w}$y`),!0),p=x=>x?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?l===80?2:l===132?1:0:0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i==="X10")):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i==="VT200")):m===1002?f(m,p(i==="DRAG")):m===1003?f(m,p(i==="ANY")):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(s==="SGR")):m===1015?f(m,4):m===1016?f(m,p(s==="SGR_PIXELS")):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(c===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=sd.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,s=0;do{if(r[s+i]=e.params[t+s],e.hasSubParams(t+s)){let o=e.getSubParams(t+s),a=0;do r[1]===5&&(i=1),r[s+a+1+i]=o[a];while(++a<o.length&&a+s+1+i<r.length);break}if(r[1]===5&&s+i>=2||r[1]===2&&s+i>=5)break;r[1]&&(i=1)}while(++s+t<e.length&&s+i<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return s}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Ft.fg,e.bg=Ft.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=Ft.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=Ft.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=Ft.fg&16777215,r.bg&=-67108864,r.bg|=Ft.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${K.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${K.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${K.ESC}[?${t};${n}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Ft.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!fE(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${K.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>hE&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>hE&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let r=n.shift(),i=n.shift();if(/^\d+$/.exec(r)){let s=parseInt(r);if(gE(s))if(i==="?")t.push({type:0,index:s});else{let o=dE(i);o&&t.push({type:1,index:s,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,i=n.findIndex(s=>s.startsWith("id="));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let i=dE(n[r]);i&&this._onColor.fire([{type:1,index:this._specialColors[t],color:i}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let i=parseInt(n[r]);gE(i)&&t.push({type:2,index:i})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,_o),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(dle[e[0]],en[e[1]]||_o),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Ft.clone(),this._eraseAttrDataInternal=Ft.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Pr;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=o=>(this._coreService.triggerDataEvent(`${K.ESC}${o}${K.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},_1=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(mE=e,e=t,t=mE),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};_1=At([he(0,Hn)],_1);function gE(e){return 0<=e&&e<256}var fle=5e7,vE=12,ple=50,mle=class extends qe{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new te),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>fle)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],i=this._action(r,t);if(i){let o=a=>performance.now()-n>=vE?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(n,a);i.catch(a=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(o);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-n>=vE)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>ple&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},b1=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let a=t.addMarker(t.ybase+t.y),l={data:e,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(l,a)),this._dataByLinkId.set(l.id,l),l.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let s=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(o,s)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};b1=At([he(0,Hn)],b1);var xE=!1,gle=class extends qe{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Sl),this._onBinary=this._register(new te),this.onBinary=this._onBinary.event,this._onData=this._register(new te),this.onData=this._onData.event,this._onLineFeed=this._register(new te),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new te),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new te),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new te),this._instantiationService=new zae,this.optionsService=this._register(new Xae(e)),this._instantiationService.setService(Un,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(g1)),this._instantiationService.setService(Hn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(m1)),this._instantiationService.setService(BA,this._logService),this.coreService=this._register(this._instantiationService.createInstance(v1)),this._instantiationService.setService(sa,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(x1)),this._instantiationService.setService(OA,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Io)),this._instantiationService.setService(Dse,this.unicodeService),this._charsetService=this._instantiationService.createInstance(tle),this._instantiationService.setService(Lse,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(b1),this._instantiationService.setService($A,this._oscLinkService),this._inputHandler=this._register(new hle(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(vn.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(vn.forward(this._bufferService.onResize,this._onResize)),this._register(vn.forward(this.coreService.onData,this._onData)),this._register(vn.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new mle((t,n)=>this._inputHandler.parse(t,n))),this._register(vn.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new te),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!xE&&(this._logService.warn("writeSync is unreliable and will be removed soon."),xE=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,vM),t=Math.max(t,xM),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(cE.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(cE(this._bufferService),!1))),this._windowsWrappingHeuristics.value=bt(()=>{for(let t of e)t.dispose()})}}},vle={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function xle(e,t,n,r){var o;let i={type:0,cancel:!1,key:void 0},s=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?i.key=K.ESC+"OA":i.key=K.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=K.ESC+"OD":i.key=K.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=K.ESC+"OC":i.key=K.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=K.ESC+"OB":i.key=K.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":K.DEL,e.altKey&&(i.key=K.ESC+i.key);break;case 9:if(e.shiftKey){i.key=K.ESC+"[Z";break}i.key=K.HT,i.cancel=!0;break;case 13:i.key=e.altKey?K.ESC+K.CR:K.CR,i.cancel=!0;break;case 27:i.key=K.ESC,e.altKey&&(i.key=K.ESC+K.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;s?i.key=K.ESC+"[1;"+(s+1)+"D":t?i.key=K.ESC+"OD":i.key=K.ESC+"[D";break;case 39:if(e.metaKey)break;s?i.key=K.ESC+"[1;"+(s+1)+"C":t?i.key=K.ESC+"OC":i.key=K.ESC+"[C";break;case 38:if(e.metaKey)break;s?i.key=K.ESC+"[1;"+(s+1)+"A":t?i.key=K.ESC+"OA":i.key=K.ESC+"[A";break;case 40:if(e.metaKey)break;s?i.key=K.ESC+"[1;"+(s+1)+"B":t?i.key=K.ESC+"OB":i.key=K.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=K.ESC+"[2~");break;case 46:s?i.key=K.ESC+"[3;"+(s+1)+"~":i.key=K.ESC+"[3~";break;case 36:s?i.key=K.ESC+"[1;"+(s+1)+"H":t?i.key=K.ESC+"OH":i.key=K.ESC+"[H";break;case 35:s?i.key=K.ESC+"[1;"+(s+1)+"F":t?i.key=K.ESC+"OF":i.key=K.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=K.ESC+"[5;"+(s+1)+"~":i.key=K.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=K.ESC+"[6;"+(s+1)+"~":i.key=K.ESC+"[6~";break;case 112:s?i.key=K.ESC+"[1;"+(s+1)+"P":i.key=K.ESC+"OP";break;case 113:s?i.key=K.ESC+"[1;"+(s+1)+"Q":i.key=K.ESC+"OQ";break;case 114:s?i.key=K.ESC+"[1;"+(s+1)+"R":i.key=K.ESC+"OR";break;case 115:s?i.key=K.ESC+"[1;"+(s+1)+"S":i.key=K.ESC+"OS";break;case 116:s?i.key=K.ESC+"[15;"+(s+1)+"~":i.key=K.ESC+"[15~";break;case 117:s?i.key=K.ESC+"[17;"+(s+1)+"~":i.key=K.ESC+"[17~";break;case 118:s?i.key=K.ESC+"[18;"+(s+1)+"~":i.key=K.ESC+"[18~";break;case 119:s?i.key=K.ESC+"[19;"+(s+1)+"~":i.key=K.ESC+"[19~";break;case 120:s?i.key=K.ESC+"[20;"+(s+1)+"~":i.key=K.ESC+"[20~";break;case 121:s?i.key=K.ESC+"[21;"+(s+1)+"~":i.key=K.ESC+"[21~";break;case 122:s?i.key=K.ESC+"[23;"+(s+1)+"~":i.key=K.ESC+"[23~";break;case 123:s?i.key=K.ESC+"[24;"+(s+1)+"~":i.key=K.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=K.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=K.DEL:e.keyCode===219?i.key=K.ESC:e.keyCode===220?i.key=K.FS:e.keyCode===221&&(i.key=K.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let a=(o=vle[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(a)i.key=K.ESC+a;else if(e.keyCode>=65&&e.keyCode<=90){let l=e.ctrlKey?e.keyCode-64:e.keyCode+32,c=String.fromCharCode(l);e.shiftKey&&(c=c.toUpperCase()),i.key=K.ESC+c}else if(e.keyCode===32)i.key=K.ESC+(e.ctrlKey?K.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let l=e.code.slice(3,4);e.shiftKey||(l=l.toLowerCase()),i.key=K.ESC+l,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(i.key=K.US),e.key==="@"&&(i.key=K.NUL));break}return i}var Lt=0,yle=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new cp,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new cp,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((i,s)=>this._getKey(i)-this._getKey(s)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Lt=this._search(t),Lt===-1)||this._getKey(this._array[Lt])!==t)return!1;do if(this._array[Lt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Lt),!0;while(++Lt<this._array.length&&this._getKey(this._array[Lt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,s)=>i-s),t=0,n=new Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Lt=this._search(e),!(Lt<0||Lt>=this._array.length)&&this._getKey(this._array[Lt])===e))do yield this._array[Lt];while(++Lt<this._array.length&&this._getKey(this._array[Lt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Lt=this._search(e),!(Lt<0||Lt>=this._array.length)&&this._getKey(this._array[Lt])===e))do t(this._array[Lt]);while(++Lt<this._array.length&&this._getKey(this._array[Lt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},f0=0,yE=0,_le=class extends qe{constructor(){super(),this._decorations=new yle(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new te),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new te),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(bt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new ble(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let s of this._decorations.getKeyIterator(t))r=s.options.x??0,i=r+(s.options.width??1),e>=r&&e<i&&(!n||(s.options.layer??"bottom")===n)&&(yield s)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,i=>{f0=i.options.x??0,yE=f0+(i.options.width??1),e>=f0&&e<yE&&(!n||(i.options.layer??"bottom")===n)&&r(i)})}},ble=class extends Ws{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new te),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new te),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=kt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=kt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},wle=1e3,Sle=class{constructor(e,t=wle){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let i=r-this._lastRefreshMs,s=this._debounceThresholdMS-i;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},_E=20,up=class extends qe{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=i.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);if(this._topBoundaryFocusListener=s=>this._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Sle(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(s=>this._handleResize(s.rows))),this._register(this._terminal.onRender(s=>this._refreshRows(s.start,s.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(s=>this._handleChar(s))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
603
|
+
`))),this._register(this._terminal.onA11yTab(s=>this._handleTab(s))),this._register(this._terminal.onKey(s=>this._handleKey(s.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Te(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(bt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<_E+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
604
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===_E+1&&(this._liveRegion.textContent+=Fx.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let s=n.lines.get(n.ydisp+i),o=[],a=(s==null?void 0:s.translateToString(!0,void 0,void 0,o))||"",l=(n.ydisp+i+1).toString(),c=this._rowElements[i];c&&(a.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=a,this._rowColumns.set(c,o)),c.setAttribute("aria-posinset",l),c.setAttribute("aria-setsize",r),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],i=n.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(i===s||e.relatedTarget!==r)return;let o,a;if(t===0?(o=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(o=this._rowElements.shift(),a=n,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let l=this._createAccessibilityTreeNode();this._rowElements.unshift(l),this._rowContainer.insertAdjacentElement("afterbegin",l)}else{let l=this._createAccessibilityTreeNode();this._rowElements.push(l),this._rowContainer.appendChild(l)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var a;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:((a=r.textContent)==null?void 0:a.length)??0}),!this._rowContainer.contains(n.node))return;let i=({node:l,offset:c})=>{let u=l instanceof Text?l.parentNode:l,d=parseInt(u==null?void 0:u.getAttribute("aria-posinset"),10)-1;if(isNaN(d))return console.warn("row is invalid. Race condition?"),null;let f=this._rowColumns.get(u);if(!f)return console.warn("columns is null. Race condition?"),null;let p=c<f.length?f[c]:f.slice(-1)[0]+1;return p>=this._terminal.cols&&(++d,p=0),{row:d,column:p}},s=i(t),o=i(n);if(!(!s||!o)){if(s.row>o.row||s.row===o.row&&s.column>=o.column)throw new Error("invalid range");this._terminal.select(s.column,s.row,(o.row-s.row)*this._terminal.cols-s.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var i,s;e.style.transform="";let t=e.getBoundingClientRect().width,n=(s=(i=this._rowColumns.get(e))==null?void 0:i.slice(-1))==null?void 0:s[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};up=At([he(1,db),he(2,us),he(3,ds)],up);var w1=class extends qe{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new te),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new te),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(bt(()=>{var s;Vo(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(s=this._activeProviderReplies)==null||s.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Te(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Te(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Te(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Te(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let r=0;r<n.length;r++){let i=n[r];if(i.classList.contains("xterm"))break;if(i.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var r,i;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(s=>{s==null||s.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[s,o]of this._linkProviderService.linkProviders.entries())t?(i=this._activeProviderReplies)!=null&&i.get(s)&&(n=this._checkLinkProviderResult(s,e,n)):o.provideLinks(e.y,a=>{var c,u;if(this._isMouseOut)return;let l=a==null?void 0:a.map(d=>({link:d}));(c=this._activeProviderReplies)==null||c.set(s,l),n=this._checkLinkProviderResult(s,e,n),((u=this._activeProviderReplies)==null?void 0:u.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let s=0;s<i.length;s++){let o=i[s],a=o.link.range.start.y<e?0:o.link.range.start.x,l=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let c=a;c<=l;c++){if(n.has(c)){i.splice(s--,1);break}n.add(c)}}}}_checkLinkProviderResult(e,t,n){var s;if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(i=!0);if(!i&&r){let o=r.find(a=>this._linkAtPosition(a.link,t));o&&(n=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let o=0;o<this._activeProviderReplies.size;o++){let a=(s=this._activeProviderReplies.get(o))==null?void 0:s.find(l=>this._linkAtPosition(l.link,t));if(a){n=!0,this._handleNewLink(a);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&kle(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Vo(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.pointerCursor},set:n=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.underline},set:n=>{var r,i,s;(r=this._currentLink)!=null&&r.state&&((s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(r,i),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!1)}})))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};w1=At([he(1,hb),he(2,ds),he(3,Hn),he(4,FA)],w1);function kle(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var Cle=class extends gle{constructor(e={}){super(e),this._linkifier=this._register(new Sl),this.browser=oM,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Sl),this._onCursorMove=this._register(new te),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new te),this.onKey=this._onKey.event,this._onRender=this._register(new te),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new te),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new te),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new te),this.onBell=this._onBell.event,this._onFocus=this._register(new te),this._onBlur=this._register(new te),this._onA11yCharEmitter=this._register(new te),this._onA11yTabEmitter=this._register(new te),this._onWillOpen=this._register(new te),this._setup(),this._decorationService=this._instantiationService.createInstance(_le),this._instantiationService.setService(od,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(pae),this._instantiationService.setService(FA,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Ux)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(vn.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(vn.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(vn.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(vn.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(bt(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let i=vt.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${K.ESC}]${r};${ule(i)}${iM.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=Wt.toColor(...t.color));else{let s=n;this._themeService.modifyColors(o=>o[s]=Wt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(up,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),s=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=s+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Te(this.element,"copy",t=>{this.hasSelection()&&Tse(t,this._selectionService)}));let e=t=>Pse(t,this.textarea,this.coreService,this.optionsService);this._register(Te(this.textarea,"paste",e)),this._register(Te(this.element,"paste",e)),aM?this._register(Te(this.element,"mousedown",t=>{t.button===2&&P2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Te(this.element,"contextmenu",t=>{P2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),_b&&this._register(Te(this.element,"auxclick",t=>{t.button===1&&AA(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Te(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Te(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Te(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Te(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Te(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Te(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Te(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var i;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((i=this.element)==null?void 0:i.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Te(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",zx.get()),uM||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(hae,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(us,this._coreBrowserService),this._register(Te(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(Te(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(u1,this._document,this._helperContainer),this._instantiationService.setService(Cm,this._charSizeService),this._themeService=this._instantiationService.createInstance(p1),this._instantiationService.setService(Gl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(ap),this._instantiationService.setService(zA,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(h1,this.rows,this.screenElement)),this._instantiationService.setService(ds,this._renderService),this._register(this._renderService.onRenderedViewportChange(s=>this._onRender.fire(s))),this.onResize(s=>this._renderService.resize(s.cols,s.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(a1,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(d1),this._instantiationService.setService(hb,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(w1,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(s1,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(s=>{super.scrollLines(s,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(f1,this.element,this.screenElement,r)),this._instantiationService.setService(Bse,this._selectionService),this._register(this._selectionService.onRequestScrollLines(s=>this.scrollLines(s.amount,s.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(s=>this._renderService.handleSelectionChanged(s.start,s.end,s.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(s=>{this.textarea.value=s,this.textarea.focus(),this.textarea.select()})),this._register(vn.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance(o1,this.screenElement)),this._register(Te(this.element,"mousedown",s=>this._selectionService.handleMouseDown(s))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(up,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(op,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(op,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(c1,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(s){var c,u,d,f,p;let o=e._mouseService.getMouseReportCoords(s,e.screenElement);if(!o)return!1;let a,l;switch(s.overrideType||s.type){case"mousemove":l=32,s.buttons===void 0?(a=3,s.button!==void 0&&(a=s.button<3?s.button:3)):a=s.buttons&1?0:s.buttons&4?1:s.buttons&2?2:3;break;case"mouseup":l=0,a=s.button<3?s.button:3;break;case"mousedown":l=1,a=s.button<3?s.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(s)===!1)return!1;let m=s.deltaY;if(m===0||e.coreMouseService.consumeWheelEvent(s,(f=(d=(u=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:u.device)==null?void 0:d.cell)==null?void 0:f.height,(p=e._coreBrowserService)==null?void 0:p.dpr)===0)return!1;l=m<0?0:1,a=4;break;default:return!1}return l===void 0||a===void 0||a>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:a,action:l,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:s=>(n(s),s.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(s)),wheel:s=>(n(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&n(s)},mousemove:s=>{s.buttons||n(s)}};this._register(this.coreMouseService.onProtocolChange(s=>{s?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(s)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),s&8?r.mousemove||(t.addEventListener("mousemove",i.mousemove),r.mousemove=i.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),s&16?r.wheel||(t.addEventListener("wheel",i.wheel,{passive:!1}),r.wheel=i.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),s&2?r.mouseup||(r.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),s&4?r.mousedrag||(r.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Te(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return n(s),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(s)})),this._register(Te(t,"wheel",s=>{var o,a,l,c,u;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(s)===!1)return!1;if(!this.buffer.hasScrollback){if(s.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(s,(c=(l=(a=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:a.device)==null?void 0:l.cell)==null?void 0:c.height,(u=e._coreBrowserService)==null?void 0:u.dpr)===0)return this.cancel(s,!0);let d=K.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(s,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){RA(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=xle(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===K.ETX||n.key===K.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Ele(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var n;(n=this._charSizeService)==null||n.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Ft));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(K.ESC+"[I"):this.coreService.triggerDataEvent(K.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${K.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${K.ESC}[6;${i};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Ele(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Ile=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},Nle=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Pr)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},bE=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new Nle(t)}getNullCell(){return new Pr}},Tle=class extends qe{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new te),this.onBufferChange=this._onBufferChange.event,this._normal=new bE(this._core.buffers.normal,"normal"),this._alternate=new bE(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},Ple=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},Rle=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},Ale=["cols","rows"],ai=0,Mle=class extends qe{constructor(e){super(),this._core=this._register(new Cle(e)),this._addonManager=this._register(new Ile),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,i)=>{this._checkReadonlyOptions(r),this._core.options[r]=i};for(let r in this._core.options){let i={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,i)}}_checkReadonlyOptions(e){if(Ale.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new Ple(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Rle(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new Tle(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
605
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return zx.get()},set promptLabel(e){zx.set(e)},get tooMuchOutput(){return Fx.get()},set tooMuchOutput(e){Fx.set(e)}}}_verifyIntegers(...e){for(ai of e)if(ai===1/0||isNaN(ai)||ai%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(ai of e)if(ai&&(ai===1/0||isNaN(ai)||ai%1!==0||ai<0))throw new Error("This API only accepts positive integers")}};/**
|
|
606
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
607
|
+
* @license MIT
|
|
608
|
+
*
|
|
609
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
610
|
+
* @license MIT
|
|
611
|
+
*
|
|
612
|
+
* Originally forked from (with the author's permission):
|
|
613
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
614
|
+
* http://bellard.org/jslinux/
|
|
615
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
616
|
+
*/var jle=2,Lle=1,Dle=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var d;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((d=this._terminal.options.overviewRuler)==null?void 0:d.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue("height")),i=Math.max(0,parseInt(n.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),o={top:parseInt(s.getPropertyValue("padding-top")),bottom:parseInt(s.getPropertyValue("padding-bottom")),right:parseInt(s.getPropertyValue("padding-right")),left:parseInt(s.getPropertyValue("padding-left"))},a=o.top+o.bottom,l=o.right+o.left,c=r-a,u=i-l-t;return{cols:Math.max(jle,Math.floor(u/e.css.cell.width)),rows:Math.max(Lle,Math.floor(c/e.css.cell.height))}}};let p0;function m0(){return{count:0,byteSum:0,firstT:null,lastT:null}}const g0=32,wE=320;function Ole({sessionId:e,client:t}){const n=g.useRef(null),r=g.useRef(null),i=g.useRef(null),s=g.useRef([]),o=g.useRef(m0()),a=g.useRef(!1),[l,c]=g.useState("collapsed"),[u,d]=g.useState(null);g.useEffect(()=>{const x=n.current;if(!x)return;let w=!1;const v=(N,E)=>getComputedStyle(document.documentElement).getPropertyValue(N).trim()||E,_=v("--bg-0","#1B1B1B"),b=v("--text-100","#ECECEC"),S=new Mle({fontFamily:"ui-monospace, SF Mono, Menlo, monospace",fontSize:12,lineHeight:1.2,theme:{background:_,foreground:b},minimumContrastRatio:4.5,cursorBlink:!0,convertEol:!1,scrollback:5e3,allowProposedApi:!0,cols:120,rows:40}),C=new Dle;S.loadAddon(C),Oe("xterm-mount",{sessionId:e,hostChildCount:x.childNodes.length}),p0!==e&&(Oe("xterm-trace",`===== SWITCH ${p0??"(initial)"} → ${e} =====`),p0=e),Oe("xterm-trace","effect-setup-start",{sessionId:e,t:performance.now()}),o.current=m0(),S.open(x);const k=S.onData(N=>{const E=btoa(unescape(encodeURIComponent(N)));t.request("session:pty:input",{sessionId:e,data:E}).catch(()=>{})});return(async()=>{var A;let N=0,E=null,L=null;try{Oe("xterm-trace","snapshot-rpc-start",{sessionId:e,t:performance.now()});const M=await t.request("session:pty:snapshot",{sessionId:e});if(Oe("xterm-trace","snapshot-rpc-resolved",{sessionId:e,cancelled:w,byteLen:((A=M==null?void 0:M.data)==null?void 0:A.length)??0,atSeq:M==null?void 0:M.atSeq,t:performance.now()}),w)return;if(M!=null&&M.ok&&typeof M.data=="string"&&M.data.length>0){const j=atob(M.data),z=new Uint8Array(j.length);for(let F=0;F<j.length;F++)z[F]=j.charCodeAt(F);E=z}M!=null&&M.ok&&typeof M.atSeq=="number"&&(N=M.atSeq),M!=null&&M.ok&&M.popupKind!=null&&(L=M.popupKind)}catch{}if(w)return;r.current=S,i.current=C;let P=!1,D;const R=S.onRender(()=>{if(!P){P=!0;try{C.fit(),E&&S.write(E),Oe("xterm-trace","snapshot-flush",{sessionId:e,atSeq:N,pendingFrameCount:s.current.length,frameStatsBeforeFlush:{...o.current},t:performance.now()}),o.current=m0();const M=s.current;s.current=[];let j=0;for(const z of M){if(z.seq!==void 0&&z.seq<=N){j++;continue}S.write(z.bytes)}j>0&&Oe("xterm-trace","snapshot-flush-dropped",{sessionId:e,dropped:j,atSeq:N}),a.current=!0,L!=null&&(d(L),c("expanded"),requestAnimationFrame(()=>S.focus())),t.request("session:pty:resize",{sessionId:e,cols:S.cols,rows:S.rows}).catch(()=>{})}catch{}S.scrollToBottom(),D?D():setTimeout(()=>D==null?void 0:D(),0)}});D=()=>R.dispose()})(),()=>{Oe("xterm-trace","cleanup-start",{sessionId:e,pendingFrameCount:s.current.length,termReady:a.current,frameStatsThisMount:{...o.current},t:performance.now()}),w=!0,k.dispose(),S.dispose(),r.current=null,i.current=null,a.current=!1,s.current=[],Oe("xterm-trace","cleanup-cleared-pending",{sessionId:e,t:performance.now()})}},[e,t]),g.useEffect(()=>{const x=t.on("session:pty",v=>{const _=v;if(_.sessionId!==e||typeof _.data!="string")return;const b=o.current;b.count++,b.byteSum+=_.data.length;const S=performance.now();b.firstT===null&&(b.firstT=S),b.lastT=S;try{const C=atob(_.data),k=new Uint8Array(C.length);for(let N=0;N<C.length;N++)k[N]=C.charCodeAt(N);a.current&&r.current?r.current.write(k):s.current.push({seq:_.seq,bytes:k})}catch{}}),w=t.on("session:control",v=>{const _=v;if(_.sessionId===e)switch(_.kind){case"popup_open":(_.popupKind==="permission"||_.popupKind==="question")&&(d(_.popupKind),c("expanded"),requestAnimationFrame(()=>{var b;return(b=r.current)==null?void 0:b.focus()}));break;case"popup_close":d(null),c("collapsed");break}});return()=>{x(),w(),Oe("xterm-trace","cleanup-off-listener",{sessionId:e,t:performance.now()})}},[e,t]),g.useEffect(()=>{const x=n.current;if(!x)return;let w=0,v=0;const _=()=>{const S=i.current,C=r.current;if(!(!S||!C)){try{S.fit()}catch{return}try{C.refresh(0,C.rows-1)}catch{}C.cols===w&&C.rows===v||(w=C.cols,v=C.rows,t.request("session:pty:resize",{sessionId:e,cols:C.cols,rows:C.rows}).catch(()=>{}))}},b=new ResizeObserver(()=>_());return b.observe(x),()=>b.disconnect()},[e,t]);const f=()=>{c(x=>{const w=x==="collapsed"?"expanded":"collapsed";return w==="expanded"&&requestAnimationFrame(()=>{var v;return(v=r.current)==null?void 0:v.focus()}),w})},p=l==="expanded"?wE:g0,m=wE-g0;return h.jsxs("div",{className:"border-t border-border bg-bg-0 overflow-hidden",style:{height:p},"data-testid":"xterm-panel","data-state":l,"data-mode":"tui","data-popup-kind":u??"",children:[h.jsxs("button",{type:"button",onClick:f,className:"flex items-center justify-between w-full px-3 py-1 text-xs text-text-200 bg-bg-200 hover:bg-bg-300 cursor-pointer border-b border-border",style:{height:g0,flexShrink:0},"data-testid":"xterm-panel-toggle",children:[h.jsxs("span",{className:"font-mono",children:[u==="permission"&&"⚠️ CC 需要权限确认 — 在下方终端按数字键 / Enter 选择",u==="question"&&"❓ CC 在问问题 — 在下方终端用 ↑/↓ + Enter 选择",u===null&&(l==="collapsed"?"▴ 展开原生 TUI 终端":"▾ 收起 TUI 终端")]}),h.jsx("span",{className:"text-text-200 text-[10px] opacity-60",children:l==="expanded"?"点击收起":"点击展开"})]}),h.jsx("div",{ref:n,className:"p-1",style:{height:m},"data-testid":"xterm-panel-host"})]})}function Nm(e){const t=ts(e?`capabilities/${e}`:"");return e?{capabilities:t??null,loading:!t}:{capabilities:null,loading:!1}}function Ble({api:e,scope:t,sessionId:n,onShareFile:r,onOpenInTab:i,onPreviewMarkdown:s}){const[o,a]=g.useState([]),[l,c]=g.useState(null);g.useEffect(()=>{let d=!1;return(async()=>{try{const f=await e.attachmentGroupList(n);if(d)return;a(f.entries)}catch(f){d||c(f.message)}})(),()=>{d=!0}},[e,n]);async function u(d){try{await e.attachmentGroupRemove(n,d.relPath),a(f=>d.from==="owner"?f.filter(p=>p.relPath!==d.relPath):f.map(p=>p.relPath===d.relPath?{...p,stale:!0}:p))}catch(f){c(f.message)}}return h.jsx(Iu,{delayDuration:120,children:h.jsx("div",{"data-testid":"files-panel-body",className:"flex h-full flex-col",children:h.jsxs("div",{className:"flex-1 overflow-y-auto",children:[h.jsx($le,{title:`Session files (${o.length})`,subtitle:"agent Write/Edit 自动入清单",children:o.length===0?h.jsx(Fle,{text:"还没有文件。agent Write/Edit 会自动加入清单。"}):o.map(d=>h.jsx(zle,{entry:d,onShareLink:()=>r(d.relPath),...i?{onOpenInTab:()=>i(d.relPath)}:{},...s&&!d.stale&&Sm(d.relPath)?{onPreview:()=>s(d.relPath)}:{},onRemove:()=>u(d)},d.id))}),l?h.jsx("div",{className:"border-t border-border bg-destructive/5 px-4 py-2 text-[11px] text-destructive",children:l}):null]})})})}function $le({title:e,subtitle:t,children:n}){return h.jsxs("div",{className:"border-b border-border last:border-b-0",children:[h.jsx("div",{className:"sticky top-0 z-10 flex items-start justify-between bg-bg-100 px-4 py-2",children:h.jsxs("div",{className:"flex-1",children:[h.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-text-300",children:e}),t?h.jsx("div",{className:"mt-0.5 text-[11px] text-text-400",children:t}):null]})}),h.jsx("div",{className:"flex flex-col",children:n})]})}function zle({entry:e,onShareLink:t,onOpenInTab:n,onPreview:r,onRemove:i}){var c;const s=(c=e.mime)!=null&&c.startsWith("image/")?G7:Ei,o=e.relPath.lastIndexOf("/"),a=o>=0?e.relPath.slice(0,o+1):"",l=o>=0?e.relPath.slice(o+1):e.relPath;return h.jsxs("div",{"data-testid":"files-panel-row",className:re("group flex items-center gap-2 px-4 py-2 hover:bg-bg-200",e.stale&&"opacity-50"),children:[h.jsx(s,{className:"h-4 w-4 shrink-0 text-text-400"}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsxs(Ju,{children:[h.jsx(ed,{asChild:!0,children:r?h.jsxs("button",{type:"button","data-testid":"files-panel-preview",onClick:r,className:"flex min-w-0 items-baseline text-left text-[13px] text-text-100 hover:text-accent hover:underline underline-offset-2 cursor-pointer",children:[a?h.jsx("span",{className:"truncate text-text-400",children:a}):null,h.jsx("span",{className:"shrink-0",children:l})]}):h.jsxs("span",{className:"flex min-w-0 items-baseline text-[13px] text-text-100",children:[a?h.jsx("span",{className:"truncate text-text-400",children:a}):null,h.jsx("span",{className:"shrink-0",children:l})]})}),h.jsx(Wl,{side:"top",align:"start",className:"max-w-[380px] break-all",children:e.relPath})]}),e.stale&&h.jsx("span",{className:"rounded bg-text-100/10 px-1 py-0 text-[10px] uppercase text-text-400",children:"stale"})]}),h.jsxs("div",{className:"flex items-center gap-1.5 truncate text-[11px] text-text-400",children:[h.jsx("span",{children:e.from}),h.jsx("span",{children:"·"}),h.jsx("span",{children:Hle(e.addedAt)})]})]}),!e.stale&&h.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100",children:[n?h.jsx(v0,{icon:h.jsx(fl,{className:"h-3.5 w-3.5"}),title:"Open in tab",onClick:n}):null,h.jsx(v0,{icon:h.jsx(t_,{className:"h-3.5 w-3.5"}),title:"Share link",onClick:t}),e.from==="owner"&&h.jsx(v0,{icon:h.jsx(n_,{className:"h-3.5 w-3.5"}),title:"Remove",onClick:i})]})]})}function v0({icon:e,title:t,onClick:n}){return h.jsx("button",{type:"button",onClick:n,title:t,"aria-label":t,className:"flex h-7 w-7 items-center justify-center rounded text-text-400 hover:bg-text-100/10 hover:text-text-100",children:e})}function Fle({text:e}){return h.jsx("div",{className:"px-4 py-3 text-[12px] italic text-text-400",children:e})}function Hle(e){const t=Date.now()-e;return t<6e4?`${Math.max(1,Math.floor(t/1e3))}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}var cd={},Ule=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},_M={},mr={};let bb;const Wle=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];mr.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};mr.getSymbolTotalCodewords=function(t){return Wle[t]};mr.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};mr.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');bb=t};mr.isKanjiModeEnabled=function(){return typeof bb<"u"};mr.toSJIS=function(t){return bb(t)};var Tm={};(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+n)}}e.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},e.from=function(r,i){if(e.isValid(r))return r;try{return t(r)}catch{return i}}})(Tm);function bM(){this.buffer=[],this.length=0}bM.prototype={get:function(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var qle=bM;function ud(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}ud.prototype.set=function(e,t,n,r){const i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)};ud.prototype.get=function(e,t){return this.data[e*this.size+t]};ud.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n};ud.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var Vle=ud,wM={};(function(e){const t=mr.getSymbolSize;e.getRowColCoords=function(r){if(r===1)return[];const i=Math.floor(r/7)+2,s=t(r),o=s===145?26:Math.ceil((s-13)/(2*i-2))*2,a=[s-7];for(let l=1;l<i-1;l++)a[l]=a[l-1]-o;return a.push(6),a.reverse()},e.getPositions=function(r){const i=[],s=e.getRowColCoords(r),o=s.length;for(let a=0;a<o;a++)for(let l=0;l<o;l++)a===0&&l===0||a===0&&l===o-1||a===o-1&&l===0||i.push([s[a],s[l]]);return i}})(wM);var SM={};const Kle=mr.getSymbolSize,SE=7;SM.getPositions=function(t){const n=Kle(t);return[[0,0],[n-SE,0],[0,n-SE]]};var kM={};(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(i){return i!=null&&i!==""&&!isNaN(i)&&i>=0&&i<=7},e.from=function(i){return e.isValid(i)?parseInt(i,10):void 0},e.getPenaltyN1=function(i){const s=i.size;let o=0,a=0,l=0,c=null,u=null;for(let d=0;d<s;d++){a=l=0,c=u=null;for(let f=0;f<s;f++){let p=i.get(d,f);p===c?a++:(a>=5&&(o+=t.N1+(a-5)),c=p,a=1),p=i.get(f,d),p===u?l++:(l>=5&&(o+=t.N1+(l-5)),u=p,l=1)}a>=5&&(o+=t.N1+(a-5)),l>=5&&(o+=t.N1+(l-5))}return o},e.getPenaltyN2=function(i){const s=i.size;let o=0;for(let a=0;a<s-1;a++)for(let l=0;l<s-1;l++){const c=i.get(a,l)+i.get(a,l+1)+i.get(a+1,l)+i.get(a+1,l+1);(c===4||c===0)&&o++}return o*t.N2},e.getPenaltyN3=function(i){const s=i.size;let o=0,a=0,l=0;for(let c=0;c<s;c++){a=l=0;for(let u=0;u<s;u++)a=a<<1&2047|i.get(c,u),u>=10&&(a===1488||a===93)&&o++,l=l<<1&2047|i.get(u,c),u>=10&&(l===1488||l===93)&&o++}return o*t.N3},e.getPenaltyN4=function(i){let s=0;const o=i.data.length;for(let l=0;l<o;l++)s+=i.data[l];return Math.abs(Math.ceil(s*100/o/5)-10)*t.N4};function n(r,i,s){switch(r){case e.Patterns.PATTERN000:return(i+s)%2===0;case e.Patterns.PATTERN001:return i%2===0;case e.Patterns.PATTERN010:return s%3===0;case e.Patterns.PATTERN011:return(i+s)%3===0;case e.Patterns.PATTERN100:return(Math.floor(i/2)+Math.floor(s/3))%2===0;case e.Patterns.PATTERN101:return i*s%2+i*s%3===0;case e.Patterns.PATTERN110:return(i*s%2+i*s%3)%2===0;case e.Patterns.PATTERN111:return(i*s%3+(i+s)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}e.applyMask=function(i,s){const o=s.size;for(let a=0;a<o;a++)for(let l=0;l<o;l++)s.isReserved(l,a)||s.xor(l,a,n(i,l,a))},e.getBestMask=function(i,s){const o=Object.keys(e.Patterns).length;let a=0,l=1/0;for(let c=0;c<o;c++){s(c),e.applyMask(c,i);const u=e.getPenaltyN1(i)+e.getPenaltyN2(i)+e.getPenaltyN3(i)+e.getPenaltyN4(i);e.applyMask(c,i),u<l&&(l=u,a=c)}return a}})(kM);var Pm={};const js=Tm,ph=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],mh=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Pm.getBlocksCount=function(t,n){switch(n){case js.L:return ph[(t-1)*4+0];case js.M:return ph[(t-1)*4+1];case js.Q:return ph[(t-1)*4+2];case js.H:return ph[(t-1)*4+3];default:return}};Pm.getTotalCodewordsCount=function(t,n){switch(n){case js.L:return mh[(t-1)*4+0];case js.M:return mh[(t-1)*4+1];case js.Q:return mh[(t-1)*4+2];case js.H:return mh[(t-1)*4+3];default:return}};var CM={},Rm={};const Xc=new Uint8Array(512),dp=new Uint8Array(256);(function(){let t=1;for(let n=0;n<255;n++)Xc[n]=t,dp[t]=n,t<<=1,t&256&&(t^=285);for(let n=255;n<512;n++)Xc[n]=Xc[n-255]})();Rm.log=function(t){if(t<1)throw new Error("log("+t+")");return dp[t]};Rm.exp=function(t){return Xc[t]};Rm.mul=function(t,n){return t===0||n===0?0:Xc[dp[t]+dp[n]]};(function(e){const t=Rm;e.mul=function(r,i){const s=new Uint8Array(r.length+i.length-1);for(let o=0;o<r.length;o++)for(let a=0;a<i.length;a++)s[o+a]^=t.mul(r[o],i[a]);return s},e.mod=function(r,i){let s=new Uint8Array(r);for(;s.length-i.length>=0;){const o=s[0];for(let l=0;l<i.length;l++)s[l]^=t.mul(i[l],o);let a=0;for(;a<s.length&&s[a]===0;)a++;s=s.slice(a)}return s},e.generateECPolynomial=function(r){let i=new Uint8Array([1]);for(let s=0;s<r;s++)i=e.mul(i,new Uint8Array([1,t.exp(s)]));return i}})(CM);const EM=CM;function wb(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}wb.prototype.initialize=function(t){this.degree=t,this.genPoly=EM.generateECPolynomial(this.degree)};wb.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const n=new Uint8Array(t.length+this.degree);n.set(t);const r=EM.mod(n,this.genPoly),i=this.degree-r.length;if(i>0){const s=new Uint8Array(this.degree);return s.set(r,i),s}return r};var Gle=wb,IM={},oo={},Sb={};Sb.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40};var Ai={};const NM="[0-9]+",Yle="[A-Z $%*+\\-./:]+";let Lu="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Lu=Lu.replace(/u/g,"\\u");const Xle="(?:(?![A-Z0-9 $%*+\\-./:]|"+Lu+`)(?:.|[\r
|
|
617
|
+
]))+`;Ai.KANJI=new RegExp(Lu,"g");Ai.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");Ai.BYTE=new RegExp(Xle,"g");Ai.NUMERIC=new RegExp(NM,"g");Ai.ALPHANUMERIC=new RegExp(Yle,"g");const Zle=new RegExp("^"+Lu+"$"),Qle=new RegExp("^"+NM+"$"),Jle=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Ai.testKanji=function(t){return Zle.test(t)};Ai.testNumeric=function(t){return Qle.test(t)};Ai.testAlphanumeric=function(t){return Jle.test(t)};(function(e){const t=Sb,n=Ai;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(s,o){if(!s.ccBits)throw new Error("Invalid mode: "+s);if(!t.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?s.ccBits[0]:o<27?s.ccBits[1]:s.ccBits[2]},e.getBestModeForData=function(s){return n.testNumeric(s)?e.NUMERIC:n.testAlphanumeric(s)?e.ALPHANUMERIC:n.testKanji(s)?e.KANJI:e.BYTE},e.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},e.isValid=function(s){return s&&s.bit&&s.ccBits};function r(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+i)}}e.from=function(s,o){if(e.isValid(s))return s;try{return r(s)}catch{return o}}})(oo);(function(e){const t=mr,n=Pm,r=Tm,i=oo,s=Sb,o=7973,a=t.getBCHDigit(o);function l(f,p,m){for(let x=1;x<=40;x++)if(p<=e.getCapacity(x,m,f))return x}function c(f,p){return i.getCharCountIndicator(f,p)+4}function u(f,p){let m=0;return f.forEach(function(x){const w=c(x.mode,p);m+=w+x.getBitsLength()}),m}function d(f,p){for(let m=1;m<=40;m++)if(u(f,m)<=e.getCapacity(m,p,i.MIXED))return m}e.from=function(p,m){return s.isValid(p)?parseInt(p,10):m},e.getCapacity=function(p,m,x){if(!s.isValid(p))throw new Error("Invalid QR Code version");typeof x>"u"&&(x=i.BYTE);const w=t.getSymbolTotalCodewords(p),v=n.getTotalCodewordsCount(p,m),_=(w-v)*8;if(x===i.MIXED)return _;const b=_-c(x,p);switch(x){case i.NUMERIC:return Math.floor(b/10*3);case i.ALPHANUMERIC:return Math.floor(b/11*2);case i.KANJI:return Math.floor(b/13);case i.BYTE:default:return Math.floor(b/8)}},e.getBestVersionForData=function(p,m){let x;const w=r.from(m,r.M);if(Array.isArray(p)){if(p.length>1)return d(p,w);if(p.length===0)return 1;x=p[0]}else x=p;return l(x.mode,x.getLength(),w)},e.getEncodedBits=function(p){if(!s.isValid(p)||p<7)throw new Error("Invalid QR Code version");let m=p<<12;for(;t.getBCHDigit(m)-a>=0;)m^=o<<t.getBCHDigit(m)-a;return p<<12|m}})(IM);var TM={};const S1=mr,PM=1335,ece=21522,kE=S1.getBCHDigit(PM);TM.getEncodedBits=function(t,n){const r=t.bit<<3|n;let i=r<<10;for(;S1.getBCHDigit(i)-kE>=0;)i^=PM<<S1.getBCHDigit(i)-kE;return(r<<10|i)^ece};var RM={};const tce=oo;function kl(e){this.mode=tce.NUMERIC,this.data=e.toString()}kl.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)};kl.prototype.getLength=function(){return this.data.length};kl.prototype.getBitsLength=function(){return kl.getBitsLength(this.data.length)};kl.prototype.write=function(t){let n,r,i;for(n=0;n+3<=this.data.length;n+=3)r=this.data.substr(n,3),i=parseInt(r,10),t.put(i,10);const s=this.data.length-n;s>0&&(r=this.data.substr(n),i=parseInt(r,10),t.put(i,s*3+1))};var nce=kl;const rce=oo,x0=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function Cl(e){this.mode=rce.ALPHANUMERIC,this.data=e}Cl.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};Cl.prototype.getLength=function(){return this.data.length};Cl.prototype.getBitsLength=function(){return Cl.getBitsLength(this.data.length)};Cl.prototype.write=function(t){let n;for(n=0;n+2<=this.data.length;n+=2){let r=x0.indexOf(this.data[n])*45;r+=x0.indexOf(this.data[n+1]),t.put(r,11)}this.data.length%2&&t.put(x0.indexOf(this.data[n]),6)};var ice=Cl;const sce=oo;function El(e){this.mode=sce.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}El.getBitsLength=function(t){return t*8};El.prototype.getLength=function(){return this.data.length};El.prototype.getBitsLength=function(){return El.getBitsLength(this.data.length)};El.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)};var oce=El;const ace=oo,lce=mr;function Il(e){this.mode=ace.KANJI,this.data=e}Il.getBitsLength=function(t){return t*13};Il.prototype.getLength=function(){return this.data.length};Il.prototype.getBitsLength=function(){return Il.getBitsLength(this.data.length)};Il.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=lce.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
|
|
618
|
+
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}};var cce=Il,AM={exports:{}};(function(e){var t={single_source_shortest_paths:function(n,r,i){var s={},o={};o[r]=0;var a=t.PriorityQueue.make();a.push(r,0);for(var l,c,u,d,f,p,m,x,w;!a.empty();){l=a.pop(),c=l.value,d=l.cost,f=n[c]||{};for(u in f)f.hasOwnProperty(u)&&(p=f[u],m=d+p,x=o[u],w=typeof o[u]>"u",(w||x>m)&&(o[u]=m,a.push(u,m),s[u]=c))}if(typeof i<"u"&&typeof o[i]>"u"){var v=["Could not find a path from ",r," to ",i,"."].join("");throw new Error(v)}return s},extract_shortest_path_from_predecessor_list:function(n,r){for(var i=[],s=r;s;)i.push(s),n[s],s=n[s];return i.reverse(),i},find_path:function(n,r,i){var s=t.single_source_shortest_paths(n,r,i);return t.extract_shortest_path_from_predecessor_list(s,i)},PriorityQueue:{make:function(n){var r=t.PriorityQueue,i={},s;n=n||{};for(s in r)r.hasOwnProperty(s)&&(i[s]=r[s]);return i.queue=[],i.sorter=n.sorter||r.default_sorter,i},default_sorter:function(n,r){return n.cost-r.cost},push:function(n,r){var i={value:n,cost:r};this.queue.push(i),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(AM);var uce=AM.exports;(function(e){const t=oo,n=nce,r=ice,i=oce,s=cce,o=Ai,a=mr,l=uce;function c(v){return unescape(encodeURIComponent(v)).length}function u(v,_,b){const S=[];let C;for(;(C=v.exec(b))!==null;)S.push({data:C[0],index:C.index,mode:_,length:C[0].length});return S}function d(v){const _=u(o.NUMERIC,t.NUMERIC,v),b=u(o.ALPHANUMERIC,t.ALPHANUMERIC,v);let S,C;return a.isKanjiModeEnabled()?(S=u(o.BYTE,t.BYTE,v),C=u(o.KANJI,t.KANJI,v)):(S=u(o.BYTE_KANJI,t.BYTE,v),C=[]),_.concat(b,S,C).sort(function(N,E){return N.index-E.index}).map(function(N){return{data:N.data,mode:N.mode,length:N.length}})}function f(v,_){switch(_){case t.NUMERIC:return n.getBitsLength(v);case t.ALPHANUMERIC:return r.getBitsLength(v);case t.KANJI:return s.getBitsLength(v);case t.BYTE:return i.getBitsLength(v)}}function p(v){return v.reduce(function(_,b){const S=_.length-1>=0?_[_.length-1]:null;return S&&S.mode===b.mode?(_[_.length-1].data+=b.data,_):(_.push(b),_)},[])}function m(v){const _=[];for(let b=0;b<v.length;b++){const S=v[b];switch(S.mode){case t.NUMERIC:_.push([S,{data:S.data,mode:t.ALPHANUMERIC,length:S.length},{data:S.data,mode:t.BYTE,length:S.length}]);break;case t.ALPHANUMERIC:_.push([S,{data:S.data,mode:t.BYTE,length:S.length}]);break;case t.KANJI:_.push([S,{data:S.data,mode:t.BYTE,length:c(S.data)}]);break;case t.BYTE:_.push([{data:S.data,mode:t.BYTE,length:c(S.data)}])}}return _}function x(v,_){const b={},S={start:{}};let C=["start"];for(let k=0;k<v.length;k++){const N=v[k],E=[];for(let L=0;L<N.length;L++){const P=N[L],D=""+k+L;E.push(D),b[D]={node:P,lastCount:0},S[D]={};for(let R=0;R<C.length;R++){const A=C[R];b[A]&&b[A].node.mode===P.mode?(S[A][D]=f(b[A].lastCount+P.length,P.mode)-f(b[A].lastCount,P.mode),b[A].lastCount+=P.length):(b[A]&&(b[A].lastCount=P.length),S[A][D]=f(P.length,P.mode)+4+t.getCharCountIndicator(P.mode,_))}}C=E}for(let k=0;k<C.length;k++)S[C[k]].end=0;return{map:S,table:b}}function w(v,_){let b;const S=t.getBestModeForData(v);if(b=t.from(_,S),b!==t.BYTE&&b.bit<S.bit)throw new Error('"'+v+'" cannot be encoded with mode '+t.toString(b)+`.
|
|
619
|
+
Suggested mode is: `+t.toString(S));switch(b===t.KANJI&&!a.isKanjiModeEnabled()&&(b=t.BYTE),b){case t.NUMERIC:return new n(v);case t.ALPHANUMERIC:return new r(v);case t.KANJI:return new s(v);case t.BYTE:return new i(v)}}e.fromArray=function(_){return _.reduce(function(b,S){return typeof S=="string"?b.push(w(S,null)):S.data&&b.push(w(S.data,S.mode)),b},[])},e.fromString=function(_,b){const S=d(_,a.isKanjiModeEnabled()),C=m(S),k=x(C,b),N=l.find_path(k.map,"start","end"),E=[];for(let L=1;L<N.length-1;L++)E.push(k.table[N[L]].node);return e.fromArray(p(E))},e.rawSplit=function(_){return e.fromArray(d(_,a.isKanjiModeEnabled()))}})(RM);const Am=mr,y0=Tm,dce=qle,hce=Vle,fce=wM,pce=SM,k1=kM,C1=Pm,mce=Gle,hp=IM,gce=TM,vce=oo,_0=RM;function xce(e,t){const n=e.size,r=pce.getPositions(t);for(let i=0;i<r.length;i++){const s=r[i][0],o=r[i][1];for(let a=-1;a<=7;a++)if(!(s+a<=-1||n<=s+a))for(let l=-1;l<=7;l++)o+l<=-1||n<=o+l||(a>=0&&a<=6&&(l===0||l===6)||l>=0&&l<=6&&(a===0||a===6)||a>=2&&a<=4&&l>=2&&l<=4?e.set(s+a,o+l,!0,!0):e.set(s+a,o+l,!1,!0))}}function yce(e){const t=e.size;for(let n=8;n<t-8;n++){const r=n%2===0;e.set(n,6,r,!0),e.set(6,n,r,!0)}}function _ce(e,t){const n=fce.getPositions(t);for(let r=0;r<n.length;r++){const i=n[r][0],s=n[r][1];for(let o=-2;o<=2;o++)for(let a=-2;a<=2;a++)o===-2||o===2||a===-2||a===2||o===0&&a===0?e.set(i+o,s+a,!0,!0):e.set(i+o,s+a,!1,!0)}}function bce(e,t){const n=e.size,r=hp.getEncodedBits(t);let i,s,o;for(let a=0;a<18;a++)i=Math.floor(a/3),s=a%3+n-8-3,o=(r>>a&1)===1,e.set(i,s,o,!0),e.set(s,i,o,!0)}function b0(e,t,n){const r=e.size,i=gce.getEncodedBits(t,n);let s,o;for(s=0;s<15;s++)o=(i>>s&1)===1,s<6?e.set(s,8,o,!0):s<8?e.set(s+1,8,o,!0):e.set(r-15+s,8,o,!0),s<8?e.set(8,r-s-1,o,!0):s<9?e.set(8,15-s-1+1,o,!0):e.set(8,15-s-1,o,!0);e.set(r-8,8,1,!0)}function wce(e,t){const n=e.size;let r=-1,i=n-1,s=7,o=0;for(let a=n-1;a>0;a-=2)for(a===6&&a--;;){for(let l=0;l<2;l++)if(!e.isReserved(i,a-l)){let c=!1;o<t.length&&(c=(t[o]>>>s&1)===1),e.set(i,a-l,c),s--,s===-1&&(o++,s=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function Sce(e,t,n){const r=new dce;n.forEach(function(l){r.put(l.mode.bit,4),r.put(l.getLength(),vce.getCharCountIndicator(l.mode,e)),l.write(r)});const i=Am.getSymbolTotalCodewords(e),s=C1.getTotalCodewordsCount(e,t),o=(i-s)*8;for(r.getLengthInBits()+4<=o&&r.put(0,4);r.getLengthInBits()%8!==0;)r.putBit(0);const a=(o-r.getLengthInBits())/8;for(let l=0;l<a;l++)r.put(l%2?17:236,8);return kce(r,e,t)}function kce(e,t,n){const r=Am.getSymbolTotalCodewords(t),i=C1.getTotalCodewordsCount(t,n),s=r-i,o=C1.getBlocksCount(t,n),a=r%o,l=o-a,c=Math.floor(r/o),u=Math.floor(s/o),d=u+1,f=c-u,p=new mce(f);let m=0;const x=new Array(o),w=new Array(o);let v=0;const _=new Uint8Array(e.buffer);for(let N=0;N<o;N++){const E=N<l?u:d;x[N]=_.slice(m,m+E),w[N]=p.encode(x[N]),m+=E,v=Math.max(v,E)}const b=new Uint8Array(r);let S=0,C,k;for(C=0;C<v;C++)for(k=0;k<o;k++)C<x[k].length&&(b[S++]=x[k][C]);for(C=0;C<f;C++)for(k=0;k<o;k++)b[S++]=w[k][C];return b}function Cce(e,t,n,r){let i;if(Array.isArray(e))i=_0.fromArray(e);else if(typeof e=="string"){let c=t;if(!c){const u=_0.rawSplit(e);c=hp.getBestVersionForData(u,n)}i=_0.fromString(e,c||40)}else throw new Error("Invalid data");const s=hp.getBestVersionForData(i,n);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(!t)t=s;else if(t<s)throw new Error(`
|
|
620
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
621
|
+
Minimum version required to store current data is: `+s+`.
|
|
622
|
+
`);const o=Sce(t,n,i),a=Am.getSymbolSize(t),l=new hce(a);return xce(l,t),yce(l),_ce(l,t),b0(l,n,0),t>=7&&bce(l,t),wce(l,o),isNaN(r)&&(r=k1.getBestMask(l,b0.bind(null,l,n))),k1.applyMask(r,l),b0(l,n,r),{modules:l,version:t,errorCorrectionLevel:n,maskPattern:r,segments:i}}_M.create=function(t,n){if(typeof t>"u"||t==="")throw new Error("No input text");let r=y0.M,i,s;return typeof n<"u"&&(r=y0.from(n.errorCorrectionLevel,y0.M),i=hp.from(n.version),s=k1.from(n.maskPattern),n.toSJISFunc&&Am.setToSJISFunction(n.toSJISFunc)),Cce(t,i,r,s)};var MM={},kb={};(function(e){function t(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let r=n.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+n);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(s){return[s,s]}))),r.length===6&&r.push("F","F");const i=parseInt(r.join(""),16);return{r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+r.slice(0,6).join("")}}e.getOptions=function(r){r||(r={}),r.color||(r.color={});const i=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,s=r.width&&r.width>=21?r.width:void 0,o=r.scale||4;return{width:s,scale:s?4:o,margin:i,color:{dark:t(r.color.dark||"#000000ff"),light:t(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},e.getScale=function(r,i){return i.width&&i.width>=r+i.margin*2?i.width/(r+i.margin*2):i.scale},e.getImageWidth=function(r,i){const s=e.getScale(r,i);return Math.floor((r+i.margin*2)*s)},e.qrToImageData=function(r,i,s){const o=i.modules.size,a=i.modules.data,l=e.getScale(o,s),c=Math.floor((o+s.margin*2)*l),u=s.margin*l,d=[s.color.light,s.color.dark];for(let f=0;f<c;f++)for(let p=0;p<c;p++){let m=(f*c+p)*4,x=s.color.light;if(f>=u&&p>=u&&f<c-u&&p<c-u){const w=Math.floor((f-u)/l),v=Math.floor((p-u)/l);x=d[a[w*o+v]?1:0]}r[m++]=x.r,r[m++]=x.g,r[m++]=x.b,r[m]=x.a}}})(kb);(function(e){const t=kb;function n(i,s,o){i.clearRect(0,0,s.width,s.height),s.style||(s.style={}),s.height=o,s.width=o,s.style.height=o+"px",s.style.width=o+"px"}function r(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(s,o,a){let l=a,c=o;typeof l>"u"&&(!o||!o.getContext)&&(l=o,o=void 0),o||(c=r()),l=t.getOptions(l);const u=t.getImageWidth(s.modules.size,l),d=c.getContext("2d"),f=d.createImageData(u,u);return t.qrToImageData(f.data,s,l),n(d,c,u),d.putImageData(f,0,0),c},e.renderToDataURL=function(s,o,a){let l=a;typeof l>"u"&&(!o||!o.getContext)&&(l=o,o=void 0),l||(l={});const c=e.render(s,o,l),u=l.type||"image/png",d=l.rendererOpts||{};return c.toDataURL(u,d.quality)}})(MM);var jM={};const Ece=kb;function CE(e,t){const n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function w0(e,t,n){let r=e+t;return typeof n<"u"&&(r+=" "+n),r}function Ice(e,t,n){let r="",i=0,s=!1,o=0;for(let a=0;a<e.length;a++){const l=Math.floor(a%t),c=Math.floor(a/t);!l&&!s&&(s=!0),e[a]?(o++,a>0&&l>0&&e[a-1]||(r+=s?w0("M",l+n,.5+c+n):w0("m",i,0),i=0,s=!1),l+1<t&&e[a+1]||(r+=w0("h",o),o=0)):i++}return r}jM.render=function(t,n,r){const i=Ece.getOptions(n),s=t.modules.size,o=t.modules.data,a=s+i.margin*2,l=i.color.light.a?"<path "+CE(i.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",c="<path "+CE(i.color.dark,"stroke")+' d="'+Ice(o,s,i.margin)+'"/>',u='viewBox="0 0 '+a+" "+a+'"',f='<svg xmlns="http://www.w3.org/2000/svg" '+(i.width?'width="'+i.width+'" height="'+i.width+'" ':"")+u+' shape-rendering="crispEdges">'+l+c+`</svg>
|
|
623
|
+
`;return typeof r=="function"&&r(null,f),f};const Nce=Ule,E1=_M,LM=MM,Tce=jM;function Cb(e,t,n,r,i){const s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!Nce())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(i=n,n=t,t=r=void 0):o===3&&(t.getContext&&typeof i>"u"?(i=r,r=void 0):(i=r,r=n,n=t,t=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(n=t,t=r=void 0):o===2&&!t.getContext&&(r=n,n=t,t=void 0),new Promise(function(l,c){try{const u=E1.create(n,r);l(e(u,t,r))}catch(u){c(u)}})}try{const l=E1.create(n,r);i(null,e(l,t,r))}catch(l){i(l)}}cd.create=E1.create;cd.toCanvas=Cb.bind(null,LM.render);cd.toDataURL=Cb.bind(null,LM.renderToDataURL);cd.toString=Cb.bind(null,function(e,t,n){return Tce.render(e,n)});var Mm="Dialog",[DM]=ro(Mm),[Pce,ti]=DM(Mm),OM=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=e,a=g.useRef(null),l=g.useRef(null),[c,u]=zl({prop:r,defaultProp:i??!1,onChange:s,caller:Mm});return h.jsx(Pce,{scope:t,triggerRef:a,contentRef:l,contentId:wi(),titleId:wi(),descriptionId:wi(),open:c,onOpenChange:u,onOpenToggle:g.useCallback(()=>u(d=>!d),[u]),modal:o,children:n})};OM.displayName=Mm;var BM="DialogTrigger",Rce=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ti(BM,n),s=Ot(t,i.triggerRef);return h.jsx(wt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Nb(i.open),...r,ref:s,onClick:Ie(e.onClick,i.onOpenToggle)})});Rce.displayName=BM;var Eb="DialogPortal",[Ace,$M]=DM(Eb,{forceMount:void 0}),zM=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,s=ti(Eb,t);return h.jsx(Ace,{scope:t,forceMount:n,children:g.Children.map(r,o=>h.jsx(ei,{present:n||s.open,children:h.jsx(lm,{asChild:!0,container:i,children:o})}))})};zM.displayName=Eb;var fp="DialogOverlay",FM=g.forwardRef((e,t)=>{const n=$M(fp,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,s=ti(fp,e.__scopeDialog);return s.modal?h.jsx(ei,{present:r||s.open,children:h.jsx(jce,{...i,ref:t})}):null});FM.displayName=fp;var Mce=ml("DialogOverlay.RemoveScroll"),jce=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ti(fp,n);return h.jsx(um,{as:Mce,allowPinchZoom:!0,shards:[i.contentRef],children:h.jsx(wt.div,{"data-state":Nb(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Go="DialogContent",HM=g.forwardRef((e,t)=>{const n=$M(Go,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,s=ti(Go,e.__scopeDialog);return h.jsx(ei,{present:r||s.open,children:s.modal?h.jsx(Lce,{...i,ref:t}):h.jsx(Dce,{...i,ref:t})})});HM.displayName=Go;var Lce=g.forwardRef((e,t)=>{const n=ti(Go,e.__scopeDialog),r=g.useRef(null),i=Ot(t,n.contentRef,r);return g.useEffect(()=>{const s=r.current;if(s)return x_(s)},[]),h.jsx(UM,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ie(e.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Ie(e.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:Ie(e.onFocusOutside,s=>s.preventDefault())})}),Dce=g.forwardRef((e,t)=>{const n=ti(Go,e.__scopeDialog),r=g.useRef(!1),i=g.useRef(!1);return h.jsx(UM,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),UM=g.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=e,a=ti(Go,n),l=g.useRef(null),c=Ot(t,l);return a_(),h.jsxs(h.Fragment,{children:[h.jsx(tm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:h.jsx(Vu,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Nb(a.open),...o,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),h.jsxs(h.Fragment,{children:[h.jsx(Oce,{titleId:a.titleId}),h.jsx($ce,{contentRef:l,descriptionId:a.descriptionId})]})]})}),Ib="DialogTitle",WM=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ti(Ib,n);return h.jsx(wt.h2,{id:i.titleId,...r,ref:t})});WM.displayName=Ib;var qM="DialogDescription",VM=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ti(qM,n);return h.jsx(wt.p,{id:i.descriptionId,...r,ref:t})});VM.displayName=qM;var KM="DialogClose",GM=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ti(KM,n);return h.jsx(wt.button,{type:"button",...r,ref:t,onClick:Ie(e.onClick,()=>i.onOpenChange(!1))})});GM.displayName=KM;function Nb(e){return e?"open":"closed"}var YM="DialogTitleWarning",[Pde,XM]=WH(YM,{contentName:Go,titleName:Ib,docsSlug:"dialog"}),Oce=({titleId:e})=>{const t=XM(YM),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
624
|
+
|
|
625
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
626
|
+
|
|
627
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Bce="DialogDescriptionWarning",$ce=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${XM(Bce).contentName}}.`;return g.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},zce=OM,Fce=zM,ZM=FM,QM=HM,JM=WM,ej=VM,Hce=GM;const tj=zce,Uce=Fce,nj=g.forwardRef(({className:e,...t},n)=>h.jsx(ZM,{ref:n,className:re("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",e),...t}));nj.displayName=ZM.displayName;const Tb=g.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(Uce,{children:[h.jsx(nj,{}),h.jsxs(QM,{ref:r,className:re("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2","gap-4 rounded-lg border border-border bg-elevated p-6 shadow-lg",e),...n,children:[t,h.jsxs(Hce,{className:"absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-accent",children:[h.jsx(Jr,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Tb.displayName=QM.displayName;const rj=({className:e,...t})=>h.jsx("div",{className:re("flex flex-col space-y-1.5 text-left",e),...t});rj.displayName="DialogHeader";const Pb=g.forwardRef(({className:e,...t},n)=>h.jsx(JM,{ref:n,className:re("text-lg font-semibold leading-none text-text-100",e),...t}));Pb.displayName=JM.displayName;const ij=g.forwardRef(({className:e,...t},n)=>h.jsx(ej,{ref:n,className:re("text-sm text-text-300",e),...t}));ij.displayName=ej.displayName;function Wce({persona:e,open:t,onClose:n,onDelete:r,embedded:i,onLoadPersonality:s,onSavePersonality:o,onLoadPersonalityLocal:a,onSavePersonalityLocal:l,hasPersonalityLocal:c=!1,onDirtyChange:u,initialPersonality:d,onShareCapability:f,readOnly:p=!1,larkBot:m}){const[x,w]=g.useState(!1),[v,_]=g.useState(!1),b=x||v,S=Qe.useRef(u);g.useEffect(()=>{S.current=u}),g.useEffect(()=>{var k;(k=S.current)==null||k.call(S,b)},[b]);const C=()=>{b&&!window.confirm("修改未保存,确定关闭?")||n()};return t?h.jsxs(h.Fragment,{children:[!i&&h.jsx("div",{className:"absolute inset-0 z-30 bg-black/30",onClick:C,"aria-hidden":"true"}),h.jsxs("aside",{className:i?"flex h-full w-full flex-col bg-bg-0":"absolute right-0 top-0 z-40 flex h-full w-[420px] flex-col bg-bg-0 border-l border-border shadow-xl","data-testid":"persona-settings-drawer",children:[h.jsxs("header",{className:"flex items-center justify-between border-b border-border px-4 py-3 shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx(IF,{className:"h-4 w-4 text-text-300"}),h.jsx("span",{className:"text-[13px] font-medium text-text-100 truncate",children:"Persona 设置"})]}),h.jsx("button",{type:"button",onClick:C,"aria-label":"关闭",className:"rounded-sm p-1.5 text-text-400 hover:bg-bg-200 hover:text-text-100",children:h.jsx(Jr,{className:"h-4 w-4"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-6 flex flex-col gap-4",children:[h.jsxs("header",{className:"flex items-start justify-between gap-3",children:[h.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h2",{className:"text-lg font-semibold text-text-100 truncate",children:e.label}),e.public?h.jsxs("span",{className:"inline-flex items-center gap-1 rounded-sm bg-bg-200 px-1.5 py-0.5 text-[10px] text-text-200",children:[h.jsx(V7,{className:"h-3 w-3"})," 公开"]}):h.jsxs("span",{className:"inline-flex items-center gap-1 rounded-sm bg-error-dim px-1.5 py-0.5 text-[10px] text-error",children:[h.jsx(W7,{className:"h-3 w-3"})," 已关闭"]})]}),h.jsx("span",{className:"font-mono text-[11px] text-text-400 truncate","data-testid":"persona-id-subtitle",children:e.personaId})]}),h.jsxs("div",{className:"flex items-center gap-1",children:[f?h.jsxs("button",{type:"button",onClick:f,"aria-label":"分享给他人",title:"分享给他人",className:"inline-flex items-center gap-1 rounded-sm px-2 py-1.5 text-xs text-text-200 hover:bg-bg-200 hover:text-text-100",children:[h.jsx(t_,{className:"h-3.5 w-3.5"}),"分享"]}):null,r?h.jsx("button",{type:"button",onClick:r,"aria-label":"删除 persona",className:"rounded-sm p-1.5 text-text-400 hover:bg-bg-200 hover:text-error",children:h.jsx(n_,{className:"h-4 w-4"})}):null]})]}),h.jsx("hr",{className:"border-border"}),m?h.jsxs(h.Fragment,{children:[h.jsx(Kce,{...m}),h.jsx("hr",{className:"border-border"})]}):null,s?h.jsxs(h.Fragment,{children:[h.jsx(IE,{onLoad:s,...o&&!e.personalityManaged?{onSave:o}:{},onDirtyChange:w,initialPersonality:d,readOnly:p||!!e.personalityManaged,title:e.personalityManaged?"内置人格":"人格 (Personality)",hint:e.personalityManaged?p?"这个 persona 自带的人格,随 clawd 版本更新。":"这个 persona 自带的人格,随 clawd 版本更新——在这里改不会保留,要加自己的规则请写下面的「你的补充」。":void 0,testIdPrefix:"persona-personality"}),(e.personalityManaged||c)&&a?h.jsx(IE,{onLoad:a,...l?{onSave:l}:{},onDirtyChange:_,readOnly:p,title:p?"补充设定":"你的补充",hint:p?"这个 persona 的补充设定,由它的主人维护。与内置人格叠加生效。":"写入 <persona-dir>/.clawd/personality.local.md,不会被更新覆盖。与内置人格叠加生效,冲突时以你写的为准;对 owner 和访客会话都生效,要区分对象请在正文里写明。只对新启动的会话生效。",placeholder:"例:回答一律先给结论,再展开。",testIdPrefix:"persona-personality-local"}):null,h.jsx("hr",{className:"border-border"})]}):null,h.jsx(Gce,{settings:e.sandboxSettings??null}),h.jsx("hr",{className:"border-border"}),h.jsx(Yce,{skills:e.skills??[]}),h.jsx("hr",{className:"border-border"}),h.jsx(Xce,{plugins:e.plugins??[]})]})]})]}):null}function EE({qrUrl:e,busy:t,onCancel:n,title:r="扫码关联飞书 Bot",hint:i="用手机飞书扫码,按页面提示创建应用。确认后自动完成关联。"}){const[s,o]=g.useState(null);return g.useEffect(()=>{let a=!1;return cd.toDataURL(e,{width:240,margin:1}).then(l=>{a||o(l)}).catch(()=>{a||o(null)}),()=>{a=!0}},[e]),h.jsx(tj,{open:!0,onOpenChange:a=>a||n==null?void 0:n(),children:h.jsxs(Tb,{className:"max-w-xs","data-testid":"lark-bot-qr-dialog",onInteractOutside:a=>a.preventDefault(),onEscapeKeyDown:a=>a.preventDefault(),children:[h.jsx(rj,{children:h.jsx(Pb,{children:r})}),h.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s?h.jsx("img",{src:s,alt:"飞书扫码创建应用二维码",className:"h-60 w-60 rounded bg-white p-2","data-testid":"lark-bot-qr-img"}):h.jsx("div",{className:"flex h-60 w-60 items-center justify-center text-[12px] text-text-400",children:"二维码生成中…"}),h.jsx("span",{className:"text-center text-[12px] text-text-300",children:i}),n?h.jsx("button",{type:"button",disabled:t,onClick:n,className:"rounded border border-border px-3 py-1.5 text-[12px] text-text-300 hover:bg-bg-200 disabled:opacity-50","data-testid":"lark-bot-provision-cancel",children:"取消"}):null]})]})})}const qce={expired:"二维码已过期,请重新扫码。",cancelled:"已取消。",access_denied:"你在飞书上取消了本次授权。",lark_protocol_error:"飞书返回了未预期的响应,请重试。",cloud_unreachable:"云端暂时不可达,请稍后重试。",internal_error:"关联失败。若飞书中已创建应用,可在开发者后台删除后重试,或改用手动绑定填入其凭证。"},Vce=new Set(["expired","access_denied","lark_protocol_error","cloud_unreachable","internal_error"]);function Kce({status:e,onProvision:t,onCancelProvision:n,onBindManual:r,onUnbind:i,onUpgrade:s,runtime:o="local"}){const[a,l]=g.useState(!1),[c,u]=g.useState(null),[d,f]=g.useState(""),[p,m]=g.useState(""),[x,w]=g.useState(null),v=N=>{N&&(l(!0),u(null),N().catch(E=>u(E instanceof Error?E.message:String(E))).finally(()=>l(!1)))},_=()=>{w(null),v(t)},b=!a&&!!d&&!!p,S=()=>{!b||!r||v(()=>r({appId:d,appSecret:p}))},C=Qu(S),k=h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(Qp,{className:"h-3.5 w-3.5 text-text-400","aria-hidden":!0}),h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"飞书 Bot"})]});return e?h.jsxs("section",{className:"flex flex-col gap-1.5","data-testid":"lark-bot-section",children:[k,e.state==="unbound"||e.state==="provisioning"?h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:"text-[11px] text-text-400",children:["关联一个飞书 bot 后,这个 persona 就是它:拉进群后群成员 @ 它提问、或直接私聊它,",o==="cloud"?"云 Persona 在云端处理消息,回复自动发回去。":"推理跑在你本机,回复自动发回去。"]}),t?h.jsx("button",{type:"button",disabled:a||e.state==="provisioning",onClick:_,className:"self-start rounded border border-border bg-bg-200 px-3 py-1.5 text-[12px] font-medium text-text-100 hover:bg-bg-300 disabled:opacity-50","data-testid":"lark-bot-provision",children:e.state==="provisioning"?"等待扫码…":"扫码关联飞书 Bot"}):null,e.state==="unbound"&&e.errorReason&&!x?h.jsxs("div",{className:"flex flex-col gap-1.5 rounded border border-error bg-error-dim px-2 py-1.5","data-testid":"lark-bot-provision-error",children:[h.jsx("span",{className:"text-[11px] text-error",children:qce[e.errorReason]}),h.jsxs("div",{className:"flex gap-1.5",children:[Vce.has(e.errorReason)&&t?h.jsx("button",{type:"button",disabled:a,onClick:_,className:"rounded border border-border px-2 py-1 text-[11px] text-text-100 hover:bg-bg-200 disabled:opacity-50","data-testid":"lark-bot-provision-retry",children:"重新扫码"}):null,h.jsx("button",{type:"button",onClick:()=>w(e.errorReason??null),className:"rounded border border-border px-2 py-1 text-[11px] text-text-300 hover:bg-bg-200","data-testid":"lark-bot-provision-error-dismiss",children:"知道了"})]})]}):null,e.state==="provisioning"&&e.qrUrl?h.jsx(EE,{qrUrl:e.qrUrl,busy:a,onCancel:n?()=>v(n):void 0}):null,r&&e.state==="unbound"?h.jsxs("details",{"data-testid":"lark-bot-manual-details",children:[h.jsx("summary",{className:"cursor-pointer text-[11px] text-text-400 hover:text-text-300",children:"已有飞书应用?手动填入凭证"}),h.jsxs("div",{className:"mt-1.5 flex flex-col gap-1.5","data-testid":"lark-bot-manual-form",children:[h.jsx("span",{className:"text-[11px] text-text-400",children:"先在飞书开放平台(open.feishu.cn)创建企业自建应用并启用机器人能力,再填入凭证:"}),h.jsx("input",{value:d,onChange:N=>f(N.target.value),...C,placeholder:"App ID(cli_ 开头)",className:"rounded border border-border bg-bg-100 px-2 py-1 text-[12px] text-text-200","data-testid":"lark-bot-manual-appid"}),h.jsx("input",{value:p,onChange:N=>m(N.target.value),...C,type:"password",placeholder:"App Secret",className:"rounded border border-border bg-bg-100 px-2 py-1 text-[12px] text-text-200","data-testid":"lark-bot-manual-secret"}),h.jsx("button",{type:"button",disabled:!b,onClick:S,className:"self-start rounded border border-border px-3 py-1.5 text-[12px] text-text-100 hover:bg-bg-200 disabled:opacity-50","data-testid":"lark-bot-manual-submit",children:a?"绑定中…":"绑定"})]})]}):null]}):null,e.state==="bound"||e.state==="broken"?h.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.state==="bound"&&e.needsUpgrade?h.jsxs("div",{className:"flex flex-col gap-1.5 rounded border border-warning/30 bg-warning-dim px-2 py-1.5","data-testid":"lark-bot-upgrade-notice",children:[h.jsx("span",{className:"text-[11px] text-warning",children:"这个 bot 的权限配置有更新,扫码重新授权后生效。在此之前,新增能力对它不起作用。"}),s?h.jsx("button",{type:"button",disabled:a,onClick:()=>v(s),className:"self-start rounded border border-warning/30 bg-warning/10 px-2 py-1 text-[11px] text-warning hover:bg-warning/20 disabled:opacity-50","data-testid":"lark-bot-upgrade",children:"更新授权"}):null]}):null,e.state==="bound"&&e.upgradeQrUrl?h.jsx(EE,{qrUrl:e.upgradeQrUrl,busy:a,onCancel:n?()=>v(n):void 0,title:"扫码更新授权",hint:"用手机飞书扫码,确认页会列出将要添加的权限。期间 bot 照常服务,不会中断。"}):null,e.state==="broken"?h.jsxs("div",{className:"rounded border border-error bg-error-dim px-2 py-1.5 text-[11px] text-error","data-testid":"lark-bot-broken",children:["Bot 凭证失效:",e.brokenReason??"未知原因","。请解绑后重新填入有效凭证绑定。"]}):null,h.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-text-200",children:[h.jsx("span",{className:"font-medium text-text-100",children:e.botName??"未命名 bot"}),e.appId?h.jsx("span",{className:"text-[11px] text-text-400",children:e.appId}):null]}),h.jsx("span",{className:"text-[11px] text-text-400",children:"把 bot 拉进任意飞书群,群成员 @ 它即可提问。"}),e.groups.length>0?h.jsx("ul",{className:"flex flex-col gap-0.5","data-testid":"lark-bot-groups",children:e.groups.map(N=>h.jsxs("li",{className:"text-[11px] text-text-300 truncate",children:["· ",N.chatName??N.chatId]},N.chatId))}):h.jsx("span",{className:"text-[11px] text-text-400","data-testid":"lark-bot-groups-empty",children:"还没有服务中的群。"}),i?h.jsx("button",{type:"button",disabled:a,onClick:()=>v(i),className:"self-start rounded border border-border px-3 py-1.5 text-[12px] text-error hover:bg-error-dim disabled:opacity-50","data-testid":"lark-bot-unbind",children:"解绑"}):null]}):null,c?h.jsx("div",{className:"rounded border border-error bg-error-dim px-2 py-1.5 text-[11px] text-error","data-testid":"lark-bot-error",children:c}):null]}):h.jsxs("section",{className:"flex flex-col gap-1.5","data-testid":"lark-bot-section",children:[k,h.jsx("span",{className:"text-[11px] text-text-400",children:"状态加载中…"})]})}function Gce({settings:e}){var t,n,r,i,s,o,a,l,c,u,d,f,p;return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":"persona-sandbox-setting-section",children:[h.jsxs("header",{className:"flex flex-col gap-0.5",children:[h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"Sandbox Setting"}),h.jsx("span",{className:"text-[11px] text-text-400",children:"约束此 persona 的沙箱权限(只读,需通过文件修改)。"})]}),e==null?h.jsx("span",{className:"text-[12px] text-text-300","data-testid":"persona-sandbox-setting-empty",children:"暂无 sandbox 配置"}):h.jsxs("div",{className:"flex flex-col gap-1.5 rounded-md border border-border bg-bg-100 px-3 py-2",children:[h.jsx(gh,{label:"权限默认模式",value:((t=e.permissions)==null?void 0:t.defaultMode)??"—"}),h.jsx(gh,{label:"沙箱启用",value:S0((n=e.sandbox)==null?void 0:n.enabled)}),h.jsx(gh,{label:"沙箱内自动放行 Bash",value:S0((r=e.sandbox)==null?void 0:r.autoAllowBashIfSandboxed)}),h.jsx(gh,{label:"允许非沙箱命令",value:S0((i=e.sandbox)==null?void 0:i.allowUnsandboxedCommands)}),h.jsxs("div",{className:"mt-1 flex flex-col gap-1.5 border-t border-border pt-1.5",children:[h.jsx(yc,{label:"沙箱外命令",paths:(s=e.sandbox)==null?void 0:s.excludedCommands}),h.jsx(yc,{label:"允许读取",paths:(a=(o=e.sandbox)==null?void 0:o.filesystem)==null?void 0:a.allowRead}),h.jsx(yc,{label:"拒绝读取",paths:(c=(l=e.sandbox)==null?void 0:l.filesystem)==null?void 0:c.denyRead}),h.jsx(yc,{label:"允许写入",paths:(d=(u=e.sandbox)==null?void 0:u.filesystem)==null?void 0:d.allowWrite}),h.jsx(yc,{label:"拒绝写入",paths:(p=(f=e.sandbox)==null?void 0:f.filesystem)==null?void 0:p.denyWrite})]})]})]})}function S0(e){return e===!0?"是":e===!1?"否":"—"}function gh({label:e,value:t}){return h.jsxs("div",{className:"flex items-center justify-between gap-3 text-[12px]",children:[h.jsx("span",{className:"text-text-300",children:e}),h.jsx("span",{className:"font-mono text-text-100",children:t})]})}function yc({label:e,paths:t}){const n=!t||t.length===0;return h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx("span",{className:"text-[11px] text-text-300",children:e}),n?h.jsx("span",{className:"text-[11px] text-text-400",children:"—"}):h.jsx("div",{className:"flex flex-wrap gap-1",children:t.map((r,i)=>h.jsx("span",{className:"rounded-sm border border-border bg-bg-0 px-1.5 py-0.5 font-mono text-[11px] text-text-200",children:r},`${e}-${i}-${r}`))})]})}function Yce({skills:e}){return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":"persona-skills-section",children:[h.jsxs("header",{className:"flex flex-col gap-0.5",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"Persona Skills"}),h.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 text-[10px] text-text-300",children:e.length})]}),h.jsxs("span",{className:"text-[11px] text-text-400",children:["此 persona 私有 skills(来自"," ",h.jsx("code",{className:"font-mono",children:"<persona-dir>/.claude/skills/"}),")。"]})]}),e.length===0?h.jsx("span",{className:"text-[12px] text-text-300","data-testid":"persona-skills-empty",children:"暂无 skills"}):h.jsx("ul",{className:"flex flex-col divide-y divide-border rounded-md border border-border bg-bg-100",children:e.map(t=>h.jsxs("li",{className:"flex flex-col gap-0.5 px-3 py-2","data-testid":"persona-skill-row",children:[h.jsx("span",{className:"font-mono text-[13px] text-text-100",children:t.name}),t.description?h.jsx("span",{className:"text-[12px] text-text-300",children:t.description}):h.jsx("span",{className:"text-[11px] text-text-400 italic",children:"无描述"})]},t.name))})]})}function Xce({plugins:e}){return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":"persona-plugins-section",children:[h.jsxs("header",{className:"flex flex-col gap-0.5",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-[13px] font-medium text-text-100",children:"Enabled Plugins"}),h.jsx("span",{className:"rounded-sm border border-border px-1.5 py-0.5 text-[10px] text-text-300",children:e.length})]}),h.jsxs("span",{className:"text-[11px] text-text-400",children:["此 persona 已启用的插件(来自"," ",h.jsx("code",{className:"font-mono",children:"<persona-dir>/.claude/settings.json"})," ","的 ",h.jsx("code",{className:"font-mono",children:"enabledPlugins"}),")。"]})]}),e.length===0?h.jsx("span",{className:"text-[12px] text-text-300","data-testid":"persona-plugins-empty",children:"暂无启用插件"}):h.jsx("ul",{className:"flex flex-col divide-y divide-border rounded-md border border-border bg-bg-100",children:e.map(t=>h.jsx("li",{className:"flex flex-col gap-0.5 px-3 py-2","data-testid":"persona-plugin-row",children:h.jsx("span",{className:"font-mono text-[13px] text-text-100",children:t.id})},t.id))})]})}function IE({onLoad:e,onSave:t,onDirtyChange:n,initialPersonality:r,readOnly:i=!1,title:s,hint:o,placeholder:a,testIdPrefix:l}){const c=r!==void 0,[u,d]=g.useState(c),[f,p]=g.useState(c?r:""),[m,x]=g.useState(c?r:""),[w,v]=g.useState(null),[_,b]=g.useState(!1),[S,C]=g.useState(null),k=Qe.useRef(e),N=Qe.useRef(t),E=Qe.useRef(n);Qe.useEffect(()=>{k.current=e,N.current=t,E.current=n});const L=Qe.useCallback(()=>{d(!1),v(null),k.current().then(M=>{p(M),x(M),d(!0)}).catch(M=>{v(M instanceof Error?M.message:String(M))})},[]);Qe.useEffect(()=>{c||L()},[c,L]);const P=!i&&u&&m!==f;Qe.useEffect(()=>{i||E.current(P)},[P,i]);const D=()=>{N.current&&(b(!0),C(null),N.current(m).then(()=>{p(m),b(!1)}).catch(M=>{C(M instanceof Error?M.message:String(M)),b(!1)}))},R=()=>{x(f),C(null)},A=Qu(()=>{!P||_||D()},()=>{!P||_||R()});return h.jsxs("section",{className:"flex flex-col gap-2","data-testid":`${l}-section`,children:[h.jsx("span",{className:"text-[12px] font-medium text-text-200",children:s}),w?h.jsxs("div",{"data-testid":`${l}-load-error`,className:"rounded-md border border-error bg-error-dim px-3 py-2 text-[12px] text-error flex items-center justify-between gap-2",children:[h.jsxs("span",{children:["加载失败:",w]}),h.jsx("button",{type:"button",onClick:L,className:"rounded-sm border border-error px-2 py-0.5 text-[11px] hover:bg-error/10",children:"重试"})]}):null,S?h.jsxs("div",{"data-testid":`${l}-save-error`,className:"rounded-md border border-error bg-error-dim px-3 py-2 text-[12px] text-error",children:["保存失败:",S]}):null,h.jsx("textarea",{"data-testid":`${l}-textarea`,value:m,onChange:M=>x(M.target.value),...A,readOnly:i,disabled:!i&&(!u||_),placeholder:u?a??"":"加载中…",rows:8,className:"min-h-[8rem] max-h-[18rem] resize-y rounded-md border border-border bg-bg-100 px-2 py-1.5 font-mono text-[11px] text-text-100 disabled:opacity-60"}),o?h.jsx("p",{className:"text-[10px] text-text-400",children:o}):i?null:h.jsx("p",{className:"text-[10px] text-text-400",children:"写入人格文件。修改只对新启动的会话生效。"}),u&&P?h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx("button",{type:"button",onClick:R,disabled:_,className:"rounded-sm border border-border px-2 py-1 text-[12px] text-text-200 hover:bg-bg-200 disabled:opacity-60",children:"放弃"}),h.jsx("button",{type:"button",onClick:D,disabled:_,"data-testid":`${l}-save-btn`,className:"rounded-sm bg-accent-dim px-2 py-1 text-[12px] text-text-100 hover:opacity-90 disabled:opacity-60",children:_?"保存中…":"保存"})]}):null]})}const Zce={state:"unbound",groups:[]};function Qce(e,t,n="local"){const[r,i]=g.useState(null),s=d=>`${n==="cloud"?"cloud:":""}larkBot:${d}`;g.useEffect(()=>{if(!e)return;let d=!1,f=0,p=!1;i(null);const m=async()=>{const _=++f;p=!0;try{const b=await e.request(s("status"),{personaId:t});if(d||_!==f)return;i(S=>n==="cloud"&&(S!=null&&S.upgradeQrUrl)&&b.state==="bound"&&b.needsUpgrade!==!1?{...b,upgradeQrUrl:S.upgradeQrUrl}:b.state==="unbound"&&!b.errorReason&&(S==null?void 0:S.state)==="unbound"&&S.errorReason?{...b,errorReason:S.errorReason}:b)}catch{!d&&_===f&&i(b=>b??Zce)}finally{_===f&&(p=!1)}};m();const x=e.on("larkBot:state",_=>{const b=_;if(b.personaId!==t)return;const{personaId:S,...C}=b;++f,p=!1,i(C)}),w=e.on("daemon:connected",()=>{m()}),v=n==="cloud"?setInterval(()=>{p||m()},5e3):null;return()=>{d=!0,v&&clearInterval(v),x(),w()}},[e,t,n]);const o=g.useCallback(async()=>{e&&await e.request(s("provision"),{personaId:t})},[e,t,n]),a=g.useCallback(async()=>{e&&await e.request(s("provisionCancel"),{personaId:t})},[e,t,n]),l=g.useCallback(async d=>{e&&await e.request(s("bindManual"),{personaId:t,...d})},[e,t,n]),c=g.useCallback(async()=>{e&&await e.request(s("upgrade"),{personaId:t})},[e,t,n]),u=g.useCallback(async()=>{e&&await e.request(s("unbind"),{personaId:t})},[e,t,n]);return{status:r,provision:o,cancelProvision:a,bindManual:l,unbind:u,upgrade:c}}function Jce(e,t="owner"){var N;const{persona:n}=JT(e),r=Dz(e),i=Oz(),s=Bz(),{httpBaseUrl:o}=Xp(),a=Ti(),l=Qce(t==="guest"?null:a,e),{capabilities:c}=Nm((n==null?void 0:n.tool)??"claude"),u=g.useMemo(()=>!(n!=null&&n.public)||!o||/^https?:\/\/(127\.0\.0\.1|localhost|0\.0\.0\.0|\[?::1\]?)([:/]|$)/i.test(o)?null:`${o}/s/${e}`,[n==null?void 0:n.public,o,e]),d=g.useCallback((E,L)=>{i(e,L).catch(P=>{Oe("persona",`${E} failed`,P)})},[i,e]),f=g.useCallback(E=>d("togglePublic",{public:E}),[d]),p=g.useCallback(async E=>{await i(e,{codexSandbox:{network:E}}),await r.refresh()},[i,e,r]),m=g.useCallback(E=>d("changeTool",{tool:E}),[d]),x=g.useCallback(E=>d("changeModel",{model:E}),[d]),w=g.useCallback(E=>d("changeEffort",{effort:E}),[d]),v=g.useCallback(E=>d("toggleFastMode",{serviceTier:E?Bf.fast:Bf.standard}),[d]),_=g.useCallback(()=>!n||!confirm(`删除 persona "${n.label}"?`)?!1:(s(e).catch(E=>{Oe("persona","delete failed",E)}),!0),[n,s,e]),b=g.useCallback(async()=>r.loaded?r.personality:(await r.refresh()).personality,[r]),S=g.useCallback(async E=>{await i(e,{personality:E}),await r.refresh()},[i,e,r]),C=g.useCallback(async()=>r.loaded?r.personalityLocal:(await r.refresh()).personalityLocal,[r]),k=g.useCallback(async E=>{await i(e,{personalityLocal:E}),await r.refresh()},[i,e,r]);return{persona:n,detail:r,configSchema:(c==null?void 0:c.configSchema)??[],larkBot:l,guestShareUrl:u,changeTool:m,changeModel:x,changeEffort:w,toggleFastMode:v,togglePublic:f,guestNetwork:((N=r.codexSandbox)==null?void 0:N.network)??!1,toggleGuestNetwork:p,remove:_,loadPersonality:b,savePersonality:S,loadPersonalityLocal:C,savePersonalityLocal:k}}function eue({personaId:e,open:t,onClose:n,api:r,embedded:i,onDirtyChange:s,onShareCapability:o,viewerRole:a="owner"}){const l=Jce(e,a),{persona:c,detail:u}=l,d=g.useCallback(()=>{l.remove()&&n()},[l,n]);if(!c)return null;const f=a==="guest";return h.jsx(Wce,{embedded:i,persona:{...c,skills:u.skills,plugins:u.plugins,sandboxSettings:u.sandboxSettings,personalityManaged:u.personalityManaged},open:t,onClose:n,onLoadPersonality:l.loadPersonality,onLoadPersonalityLocal:l.loadPersonalityLocal,hasPersonalityLocal:u.personalityLocal!=="",onDirtyChange:s,readOnly:f,...f?{}:{onTogglePublic:l.togglePublic,guestShareUrl:l.guestShareUrl,onChangeTool:l.changeTool,onChangeModel:l.changeModel,onChangeEffort:l.changeEffort,configSchema:l.configSchema,onDelete:d,onSavePersonality:l.savePersonality,onSavePersonalityLocal:l.savePersonalityLocal,larkBot:{status:l.larkBot.status,onProvision:l.larkBot.provision,onCancelProvision:l.larkBot.cancelProvision,onBindManual:l.larkBot.bindManual,onUnbind:l.larkBot.unbind,onUpgrade:l.larkBot.upgrade},...o?{onShareCapability:o}:{}}})}const tue={resolve:()=>{}},nue=g.createContext(tue);function rue(){return g.useContext(nue)}const iue={...Qs,h1:({node:e,...t})=>h.jsx("h1",{...t,className:"mt-4 mb-3 text-[18px] font-semibold leading-tight text-text-100"}),h2:({node:e,...t})=>h.jsx("h2",{...t,className:"mt-4 mb-2 text-[16px] font-semibold leading-tight text-text-100"}),h3:({node:e,...t})=>h.jsx("h3",{...t,className:"mt-3 mb-2 text-[14px] font-semibold leading-tight text-text-100"}),h4:({node:e,...t})=>h.jsx("h4",{...t,className:"mt-3 mb-1 text-[13px] font-semibold text-text-100"}),h5:({node:e,...t})=>h.jsx("h5",{...t,className:"mt-2 mb-1 text-[12px] font-semibold text-text-100"}),h6:({node:e,...t})=>h.jsx("h6",{...t,className:"mt-2 mb-1 text-[12px] font-semibold text-text-300"}),p:({node:e,...t})=>h.jsx("p",{...t,className:"my-2 leading-relaxed"}),ul:({node:e,...t})=>h.jsx("ul",{...t,className:"my-2 list-disc space-y-1 pl-5"}),ol:({node:e,...t})=>h.jsx("ol",{...t,className:"my-2 list-decimal space-y-1 pl-5"}),li:({node:e,...t})=>h.jsx("li",{...t,className:"leading-relaxed"}),blockquote:({node:e,...t})=>h.jsx("blockquote",{...t,className:"my-2 border-l-2 border-border pl-3 italic text-text-300"}),code:({node:e,className:t,children:n,...r})=>t?h.jsx("code",{...r,className:`${t} font-mono text-[12px]`,children:n}):h.jsx("code",{...r,className:"rounded bg-bg-50 px-1 py-0.5 font-mono text-[12px] text-text-100",children:n}),pre:({node:e,...t})=>h.jsx("pre",{...t,className:"my-2 overflow-auto rounded border border-border bg-bg-0 p-3 text-[12px] font-mono text-text-100"}),hr:({node:e,...t})=>h.jsx("hr",{...t,className:"my-3 border-border"}),table:({node:e,...t})=>h.jsx("table",{...t,className:"my-2 w-full border-collapse text-[12px]"}),thead:({node:e,...t})=>h.jsx("thead",{...t,className:"bg-bg-50"}),th:({node:e,...t})=>h.jsx("th",{...t,className:"border border-border px-2 py-1 text-left font-semibold"}),td:({node:e,...t})=>h.jsx("td",{...t,className:"border border-border px-2 py-1"}),strong:({node:e,...t})=>h.jsx("strong",{...t,className:"font-semibold text-text-100"}),em:({node:e,...t})=>h.jsx("em",{...t,className:"italic"})};function sue(e){const t=e.split("/");return t[t.length-1]||e}function sj({relPath:e,loadMarkdown:t,headerRight:n,showTitleBar:r=!1}){const[i,s]=g.useState(null),[o,a]=g.useState(null),[l,c]=g.useState(!1);return g.useEffect(()=>{if(!e)return;let u=!1;return c(!0),a(null),s(null),(async()=>{try{const d=await t(e);if(u)return;s(d)}catch(d){if(u)return;a(d.message||String(d))}finally{u||c(!1)}})(),()=>{u=!0}},[e,t]),h.jsxs("div",{className:"flex flex-col h-full",children:[r&&e?h.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[h.jsx("div",{"data-testid":"md-preview-title",className:"truncate text-[13px] font-medium text-text-100",title:e,children:sue(e)}),h.jsx("div",{className:"flex items-center gap-1",children:n})]}):null,h.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 text-[13px] text-text-100",children:l?h.jsx("div",{"data-testid":"md-preview-loading",className:"text-text-400",children:"Loading…"}):o?h.jsx("div",{"data-testid":"md-preview-error",className:"text-destructive whitespace-pre-wrap",children:o}):i!==null?h.jsx("div",{"data-testid":"md-preview-content",className:"max-w-none",children:h.jsx(_l,{remarkPlugins:[bl],components:iue,children:i})}):null})]})}function oue({open:e,onOpenChange:t,relPath:n,loadMarkdown:r,onShare:i}){return e?h.jsx("div",{"data-testid":"md-preview-drawer",className:`${ub} z-50 flex w-1/2 max-w-[900px] flex-col border-l border-border bg-elevated shadow-2xl`,children:h.jsx(sj,{relPath:n,loadMarkdown:r,showTitleBar:!0,headerRight:h.jsxs(h.Fragment,{children:[i?h.jsx("button",{type:"button","data-testid":"md-preview-share","aria-label":"Share rendered preview link",onClick:i,className:"inline-flex h-6 w-6 items-center justify-center rounded text-text-400 hover:bg-bg-50 hover:text-text-200",children:h.jsx(eF,{className:"h-4 w-4"})}):null,h.jsx("button",{type:"button","aria-label":"Close preview",onClick:()=>t(!1),className:"inline-flex h-6 w-6 items-center justify-center rounded text-text-400 hover:bg-bg-50 hover:text-text-200",children:h.jsx(Jr,{className:"h-4 w-4"})})]})})}):null}const NE=4;function aue({children:e,onHeightChange:t}){const n=g.useRef(null),[r,i]=g.useState(0);return g.useEffect(()=>{const s=n.current;if(!s)return;const o=()=>i(s.offsetHeight>0?s.offsetHeight+NE*2:0);if(o(),typeof ResizeObserver>"u")return;const a=new ResizeObserver(o);return a.observe(s),()=>a.disconnect()},[]),g.useEffect(()=>{t==null||t(r)},[r,t]),h.jsx("div",{"data-testid":"chat-floating-dock","data-height":r,className:"relative z-20 h-0 shrink-0",children:h.jsx("div",{ref:n,className:"absolute left-4 right-4 flex flex-col items-end gap-1",style:{bottom:NE},children:e})})}function lue(e,t,n,r,i){const[s,o]=g.useState(null),[a,l]=g.useState(null),[c,u]=g.useState(!1),[d,f]=g.useState(!1),[p,m]=g.useState(null),x=g.useRef({api:e,sessionId:t,enabled:n,epoch:0,read:null,again:!1,mutating:!1}),w=g.useRef({api:e,sessionId:t,enabled:n});w.current={api:e,sessionId:t,enabled:n};const v=g.useRef(async()=>{}),_=C=>{if(C.workspace!==void 0&&o(C.workspace),C.binding!==void 0)l(C.binding);else if(C.workspace){const{workspaceId:k,repoId:N,owner:E,name:L,sourceBranch:P,defaultBranch:D}=C.workspace;l({workspaceId:k,repoId:N,owner:E,name:L,sourceBranch:P,defaultBranch:D})}},b=g.useCallback(async()=>{const C=x.current;if(!n||C.sessionId!==t||C.api!==e)return;if(C.mutating){C.again=!0;return}if(C.read)return C.again=!0,C.read;const k=C.epoch;u(!0);const N=(async()=>{try{const E=await e.cloudWorkspace({sessionId:t,action:"status"});x.current===C&&C.epoch===k&&w.current.sessionId===t&&(_(E),m(null))}catch(E){x.current===C&&C.epoch===k&&m(E.message)}finally{x.current===C&&(C.read=null,u(!1),C.again&&!C.mutating&&(C.again=!1,v.current()))}})();return C.read=N,N},[e,t,n]);v.current=b;const S=g.useCallback(async C=>{const k=x.current;if(!n||k.sessionId!==t)throw new Error("Cloud workspace unavailable");const N=["bind","switch","publish"].includes(C.action);if(N&&k.mutating)throw new Error("工作区操作正在进行");N&&(k.mutating=!0,k.epoch++,k.again=!1,f(!0),m(null));try{const E=await e.cloudWorkspace({...C,sessionId:t});return x.current===k&&w.current.sessionId===t&&(_(E),m(null)),E}catch(E){throw x.current===k&&m(E.message),E}finally{N&&x.current===k&&(k.mutating=!1,f(!1),(C.action==="bind"||k.again)&&(k.again=!1,v.current()))}},[e,t,n]);return g.useEffect(()=>{const C={api:e,sessionId:t,enabled:n,epoch:0,read:null,again:!1,mutating:!1};return x.current=C,o(null),l(i??null),m(null),f(!1),u(!1),n&&v.current(),()=>{C.epoch++,x.current===C&&(x.current={...C,enabled:!1,again:!1})}},[e,t,n]),g.useEffect(()=>{if(!(!n||!r))return r.on("session:event",C=>{var N;const k=C;k.sessionId===t&&["tool_result","turn_end"].includes(((N=k.event)==null?void 0:N.kind)??"")&&v.current()})},[r,t,n]),{workspace:s,binding:a,loading:c,busy:d,error:p,refresh:b,run:S}}var jm="Popover",[oj]=ro(jm,[Ul]),dd=Ul(),[cue,ao]=oj(jm),aj=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=e,a=dd(t),l=g.useRef(null),[c,u]=g.useState(!1),[d,f]=zl({prop:r,defaultProp:i??!1,onChange:s,caller:jm});return h.jsx(om,{...a,children:h.jsx(cue,{scope:t,contentId:wi(),triggerRef:l,open:d,onOpenChange:f,onOpenToggle:g.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:c,onCustomAnchorAdd:g.useCallback(()=>u(!0),[]),onCustomAnchorRemove:g.useCallback(()=>u(!1),[]),modal:o,children:n})})};aj.displayName=jm;var lj="PopoverAnchor",uue=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=ao(lj,n),s=dd(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=i;return g.useEffect(()=>(o(),()=>a()),[o,a]),h.jsx(am,{...s,...r,ref:t})});uue.displayName=lj;var cj="PopoverTrigger",uj=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=ao(cj,n),s=dd(n),o=Ot(t,i.triggerRef),a=h.jsx(wt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":mj(i.open),...r,ref:o,onClick:Ie(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:h.jsx(am,{asChild:!0,...s,children:a})});uj.displayName=cj;var Rb="PopoverPortal",[due,hue]=oj(Rb,{forceMount:void 0}),dj=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,s=ao(Rb,t);return h.jsx(due,{scope:t,forceMount:n,children:h.jsx(ei,{present:n||s.open,children:h.jsx(lm,{asChild:!0,container:i,children:r})})})};dj.displayName=Rb;var Nl="PopoverContent",hj=g.forwardRef((e,t)=>{const n=hue(Nl,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,s=ao(Nl,e.__scopePopover);return h.jsx(ei,{present:r||s.open,children:s.modal?h.jsx(pue,{...i,ref:t}):h.jsx(mue,{...i,ref:t})})});hj.displayName=Nl;var fue=ml("PopoverContent.RemoveScroll"),pue=g.forwardRef((e,t)=>{const n=ao(Nl,e.__scopePopover),r=g.useRef(null),i=Ot(t,r),s=g.useRef(!1);return g.useEffect(()=>{const o=r.current;if(o)return x_(o)},[]),h.jsx(um,{as:fue,allowPinchZoom:!0,children:h.jsx(fj,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ie(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Ie(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Ie(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),mue=g.forwardRef((e,t)=>{const n=ao(Nl,e.__scopePopover),r=g.useRef(!1),i=g.useRef(!1);return h.jsx(fj,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),fj=g.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=e,f=ao(Nl,n),p=dd(n);return a_(),h.jsx(tm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:h.jsx(Vu,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>f.onOpenChange(!1),children:h.jsx(g_,{"data-state":mj(f.open),role:"dialog",id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),pj="PopoverClose",gue=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=ao(pj,n);return h.jsx(wt.button,{type:"button",...r,ref:t,onClick:Ie(e.onClick,()=>i.onOpenChange(!1))})});gue.displayName=pj;var vue="PopoverArrow",xue=g.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=dd(n);return h.jsx(v_,{...i,...r,ref:t})});xue.displayName=vue;function mj(e){return e?"open":"closed"}var yue=aj,_ue=uj,bue=dj,gj=hj;const vj=yue,xj=_ue,Ab=g.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},i)=>h.jsx(bue,{children:h.jsx(gj,{ref:i,align:t,sideOffset:n,className:re("z-50 w-72 rounded-md border border-border bg-elevated p-4 text-text-100 shadow-md outline-none",e),...r})}));Ab.displayName=gj.displayName;const qr="flex w-full min-w-0 items-center gap-2.5 rounded-md px-1.5 py-2 text-left text-[13px] hover:bg-text-100/5 disabled:opacity-40";function TE({title:e,children:t,trailing:n}){const[r,i]=g.useState(!0);return h.jsxs("section",{className:"rounded-xl border border-border bg-bg-0 p-3.5",children:[h.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[h.jsxs("button",{onClick:()=>i(!r),className:"flex items-center gap-1.5 py-0.5 text-[12px] font-medium text-text-200","aria-expanded":r,children:[e,h.jsx(Pn,{className:`h-3 w-3 text-text-400 ${r?"":"-rotate-90"}`})]}),n]}),r&&t]})}function yj({controller:e,compact:t=!1}){const{binding:n,workspace:r,run:i,busy:s}=e,[o,a]=g.useState(!1),[l,c]=g.useState(""),[u,d]=g.useState([]),[f,p]=g.useState(null),[m,x]=g.useState([]),[w,v]=g.useState(1),[_,b]=g.useState(!1),[S,C]=g.useState(!1);return g.useEffect(()=>{if(!o||n)return;let k=!1;C(!0);const N=f?{action:"branches",repoId:f.repoId,page:w}:{action:"repositories",page:w,search:l};return i(N).then(E=>{k||(b(E.hasMore??!1),f?x(L=>w===1?E.branches??[]:[...L,...E.branches??[]]):d(L=>w===1?E.repositories??[]:[...L,...E.repositories??[]]))}).catch(()=>{}).finally(()=>{k||C(!1)}),()=>{k=!0}},[o,n,f,w,l,i]),n?h.jsxs("button",{className:t?"flex min-w-0 items-center gap-1.5 text-[11px] text-text-300 hover:text-text-100":qr,title:n.owner+"/"+n.name,"aria-label":"在 GitHub 查看仓库",onClick:()=>window.open(`https://github.com/${n.owner}/${n.name}`,"_blank","noopener"),children:[h.jsx(Sg,{className:"h-4 w-4 shrink-0 text-text-400"}),h.jsx("span",{className:"truncate",children:n.name}),!t&&h.jsx(fl,{className:"ml-auto h-3 w-3 text-text-400"})]}):h.jsxs(vj,{open:o,onOpenChange:k=>{a(k),k||(p(null),v(1),c(""))},children:[h.jsx(xj,{asChild:!0,children:h.jsxs("button",{disabled:s,className:t?"flex items-center gap-1.5 text-[11px] text-text-300":qr,"aria-label":"添加或选择仓库",children:[h.jsx(Sg,{className:"h-4 w-4 text-text-400"}),h.jsx("span",{className:"flex-1",children:"添加 repo"}),!t&&h.jsx(e_,{className:"h-3.5 w-3.5 text-text-400"})]})}),h.jsxs(Ab,{align:"end",className:"w-[330px] p-1.5",children:[f?h.jsxs("div",{className:"flex items-center gap-2 border-b border-border p-2 text-[12px]",children:[h.jsx("button",{"aria-label":"返回仓库列表",onClick:()=>{p(null),v(1)},children:h.jsx(n3,{className:"h-3.5 w-3.5"})}),h.jsxs("span",{className:"truncate",children:["选择分支 · ",f.name]})]}):h.jsxs("div",{className:"flex items-center gap-2 border-b border-border p-2",children:[h.jsx(zf,{className:"h-3.5 w-3.5 text-text-400"}),h.jsx("input",{autoFocus:!0,"aria-label":"搜索仓库",placeholder:"搜索 GitHub 仓库…",value:l,onChange:k=>{c(k.target.value),v(1)},className:"w-full bg-transparent text-[12px] outline-none"})]}),h.jsxs("div",{className:"max-h-[340px] overflow-y-auto py-1",children:[f?m.map(k=>h.jsxs("button",{disabled:s,className:qr,onClick:()=>{i({action:"bind",repoId:f.repoId,branch:k}).then(()=>a(!1)).catch(()=>{})},children:[h.jsx(pl,{className:"h-3.5 w-3.5 text-text-400"}),h.jsx("span",{className:"flex-1 truncate",children:k}),k===f.defaultBranch&&h.jsx("span",{className:"text-[10px] text-text-400",children:"默认"})]},k)):u.map(k=>h.jsxs("button",{className:qr,onClick:()=>{p(k),v(1),x([])},children:[h.jsx(Sg,{className:"h-4 w-4 shrink-0 text-text-400"}),h.jsxs("span",{className:"truncate text-[12px]",children:[k.owner,"/",k.name]})]},k.repoId)),!S&&!(f?m:u).length&&h.jsx("p",{className:"p-3 text-[12px] text-text-400",children:f?"仓库尚无分支或提交":"没有找到仓库"}),S&&h.jsxs("div",{className:"flex items-center gap-2 p-3 text-[12px] text-text-400",children:[h.jsx(Tn,{className:"h-3 w-3 animate-spin"}),"正在读取…"]}),_&&!S&&h.jsx("button",{className:qr,onClick:()=>v(k=>k+1),children:"加载更多"})]})]})]})}function _j({controller:e,compact:t=!1,disabled:n=!1}){const{binding:r,workspace:i,run:s,busy:o}=e,[a,l]=g.useState(!1),[c,u]=g.useState(""),[d,f]=g.useState([]),[p,m]=g.useState(1),[x,w]=g.useState(!1);g.useEffect(()=>{if(!a||!r)return;let S=!1;return s({action:"branches",repoId:r.repoId,page:p}).then(C=>{S||(f(k=>p===1?C.branches??[]:[...k,...C.branches??[]]),w(C.hasMore??!1))}).catch(()=>{}),()=>{S=!0}},[a,r==null?void 0:r.repoId,p,s]);const v=(i==null?void 0:i.actualBranch)??(i?"HEAD · "+i.head.slice(0,7):(r==null?void 0:r.sourceBranch)??"选择 branch"),_=[...new Set([...i!=null&&i.actualBranch?[i.actualBranch]:[],...(i==null?void 0:i.branches)??[],...d])],b=(S,C=!1)=>{s({action:"switch",branch:S,create:C}).then(()=>{l(!1),u("")}).catch(()=>{})};return h.jsxs(vj,{open:a,onOpenChange:l,children:[h.jsx(xj,{asChild:!0,children:h.jsxs("button",{className:t?"flex min-w-0 items-center gap-1.5 text-[11px] text-text-300 disabled:opacity-40":qr,"aria-label":`选择分支,当前 ${v}`,disabled:o||n||!i,children:[h.jsx(pl,{className:"h-3.5 w-3.5 shrink-0 text-text-400"}),h.jsx("span",{className:"truncate",children:v}),h.jsx(Pn,{className:"ml-auto h-3 w-3 shrink-0 text-text-400"})]})}),h.jsxs(Ab,{align:"end",className:"w-[280px] p-1.5",children:[h.jsxs("div",{className:"flex items-center gap-2 border-b border-border p-2",children:[h.jsx(zf,{className:"h-3.5 w-3.5 text-text-400"}),h.jsx("input",{autoFocus:!0,"aria-label":"搜索或创建分支",placeholder:"搜索或创建分支…",value:c,onChange:S=>u(S.target.value),className:"w-full bg-transparent text-[12px] outline-none"})]}),h.jsxs("div",{className:"max-h-[300px] overflow-y-auto",children:[_.filter(S=>S.includes(c)).map(S=>h.jsxs("button",{className:qr,onClick:()=>b(S),children:[h.jsx(pl,{className:"h-3.5 w-3.5 text-text-400"}),h.jsx("span",{className:"flex-1 truncate",children:S}),S===v&&h.jsx(Qo,{className:"h-3.5 w-3.5"})]},S)),c&&!_.includes(c)&&h.jsxs("button",{className:qr,onClick:()=>b(c,!0),children:[h.jsx(e_,{className:"h-3.5 w-3.5"}),h.jsxs("span",{className:"truncate",children:["从当前分支创建 ",c]})]}),x&&h.jsx("button",{className:qr,onClick:()=>m(S=>S+1),children:"加载更多分支"})]})]})]})}function wue({controller:e,disabled:t=!1}){return h.jsxs("div",{"data-testid":"workspace-input-chip",className:"flex min-w-0 items-center gap-3 px-1 pb-2 text-text-300",children:[h.jsx("div",{className:"max-w-[200px] min-w-0",children:h.jsx(yj,{controller:e,compact:!0})}),e.binding&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"h-3 w-px bg-border"}),h.jsx("div",{className:"min-w-0 max-w-[230px]",children:h.jsx(_j,{controller:e,compact:!0,disabled:t})})]}),e.loading&&h.jsx(Tn,{className:"h-3 w-3 shrink-0 animate-spin text-text-400"})]})}function Sue({controller:e,disabled:t=!1}){var _;const{binding:n,workspace:r,loading:i,busy:s,error:o,refresh:a,run:l}=e,[c,u]=g.useState(null),[d,f]=g.useState(),[p,m]=g.useState(null),x=g.useState(()=>({id:crypto.randomUUID(),version:""}))[0];g.useEffect(()=>{if(!c){f(void 0);return}let b=!1;return f(void 0),l({action:"diff",filePath:c}).then(S=>{b||f(S.diff)}).catch(()=>{}),()=>{b=!0}},[c,l]);const w=(_=r==null?void 0:r.files.find(b=>b.path===c))==null?void 0:_.comparison,v=async()=>{if(r){r.pendingPublication?(x.id=r.pendingPublication.operationId,x.version=r.pendingPublication.expectedVersion):x.version!==r.version&&(x.id=crypto.randomUUID(),x.version=r.version);try{await QG(async()=>{const b=await l({action:"publish",operationId:x.id,expectedVersion:x.version});if(!b.pr)throw new Error("PR 未创建");return b.pr.url})}catch{m("若 PR 已创建,可点击链接在浏览器中打开。")}}};return h.jsxs("div",{className:"space-y-3",children:[h.jsxs(TE,{title:"环境",trailing:h.jsx("button",{"aria-label":"刷新工作区",title:"刷新工作区",disabled:s||i,onClick:()=>void a(),className:"p-1 text-text-400 disabled:opacity-40",children:h.jsx(bF,{className:`h-3 w-3 ${i?"animate-spin":""}`})}),children:[h.jsxs("div",{className:"flex items-center gap-2.5 px-1.5 py-2 text-[13px]",children:[h.jsx(k7,{className:"h-4 w-4 text-text-400"}),h.jsx("span",{children:"云端"}),h.jsx("span",{className:"ml-auto text-[11px] text-text-400",children:i&&n&&!r?"准备工作区…":n?"已关联":"待关联"})]}),h.jsx(yj,{controller:e}),n&&h.jsx(_j,{controller:e,disabled:t}),r&&h.jsxs("p",{className:"mt-1 px-1.5 text-[10px] text-text-400",children:[r.savedAt?"工作现场已保存":"工作现场保存在当前会话"," ·"," ",r.head.slice(0,7)]}),!n&&h.jsx("p",{className:"mt-2 px-1.5 text-[11px] leading-relaxed text-text-400",children:"关联仓库和分支,在这个会话的独立工作区里开发。"}),o&&h.jsxs("div",{role:"alert",className:"mt-2 rounded-md bg-error/5 p-2 text-[11px] leading-relaxed text-error",children:[o,h.jsx("button",{className:"ml-2 underline",onClick:()=>void a(),children:"重试读取"})]})]}),!!(r!=null&&r.files.length)&&h.jsxs(TE,{title:"Changes",trailing:h.jsxs("span",{className:"text-[10px] text-text-400",children:[r.totalFiles??r.files.length," 个文件"]}),children:[h.jsxs("button",{"aria-label":"查看全部改动",className:qr,onClick:()=>u(r.files[0].path),children:[h.jsx(M7,{className:"h-4 w-4 text-text-400"}),h.jsxs("span",{className:"tabular-nums text-success",children:["+",r.added]}),h.jsxs("span",{className:"tabular-nums text-error",children:["−",r.removed]}),h.jsx(cx,{className:"ml-auto h-3 w-3 text-text-400"})]}),h.jsx("div",{className:"mb-2",children:r.files.map(b=>h.jsxs("button",{className:"flex w-full min-w-0 items-center gap-2 rounded-md px-1.5 py-1.5 text-left text-[11px] hover:bg-text-100/5",onClick:()=>u(b.path),children:[h.jsx("span",{className:"w-4 shrink-0 text-[10px] text-text-400",children:b.status}),h.jsx("span",{title:b.path,className:"min-w-0 flex-1 truncate text-text-300",children:b.path.split("/").at(-1)}),h.jsxs("span",{className:"text-success",children:["+",b.added]}),h.jsxs("span",{className:"text-error",children:["−",b.removed]})]},b.path))}),r.filesTruncated&&h.jsx("p",{className:"mb-2 px-1 text-[11px] text-text-400",children:"仅展示前 200 个改动文件,完整改动保留在工作区。"}),h.jsxs("button",{className:"flex h-8 w-full items-center justify-center gap-2 rounded-md border border-border text-[12px] font-medium text-text-200 hover:bg-text-100/5 disabled:opacity-40",disabled:s||t||r.conflicted,onClick:()=>void v(),children:[s?h.jsx(Tn,{className:"h-3.5 w-3.5 animate-spin"}):h.jsx(H7,{className:"h-3.5 w-3.5"}),s?"正在发布…":r.pr?"更新并打开 PR":"Create PR",h.jsx(cx,{className:"h-3 w-3 text-text-400"})]}),r.pr&&h.jsxs("a",{href:r.pr.url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 flex items-center gap-1 px-1 text-[11px] text-success",children:["PR #",r.pr.number,h.jsx(fl,{className:"h-3 w-3"})]}),p&&h.jsx("p",{className:"mt-2 text-[11px] text-text-400",children:p})]}),h.jsx(tj,{open:c!==null,onOpenChange:b=>{b||u(null)},children:h.jsxs(Tb,{className:"flex h-[min(680px,84vh)] w-[min(1080px,94vw)] max-w-none flex-col gap-0 overflow-hidden p-0",children:[h.jsxs("div",{className:"border-b border-border px-5 py-4",children:[h.jsx(Pb,{className:"text-[14px]",children:"代码改动"}),h.jsxs(ij,{className:"mt-2 text-[11px]",children:[(r==null?void 0:r.actualBranch)??"HEAD"," ·"," ",w==="index"?"暂存区相对当前提交的改动":w==="head"?"尚未提交的改动":"相对起始提交 "+(r==null?void 0:r.initialCommit.slice(0,7))+" 的累计改动"]})]}),h.jsxs("div",{className:"flex min-h-0 flex-1",children:[h.jsx("nav",{"aria-label":"改动文件",className:"w-[225px] shrink-0 overflow-auto border-r border-border bg-bg-50 p-2 max-[700px]:hidden",children:r==null?void 0:r.files.map(b=>h.jsx("button",{className:qr+" text-[11px]",onClick:()=>u(b.path),children:h.jsx("span",{className:"truncate",children:b.path.split("/").at(-1)})},b.path))}),h.jsxs("div",{className:"min-w-0 flex-1 overflow-auto",children:[h.jsx("div",{className:"sticky top-0 border-b border-border bg-bg-50 px-4 py-3 font-mono text-[11px]",children:c}),d?d.binary?h.jsx("p",{className:"p-5 text-[12px] text-text-400",children:"二进制文件发生变化"}):h.jsxs("pre",{className:"min-w-fit py-2 font-mono text-[11px] leading-6",children:[d.patch.split(`
|
|
628
|
+
`).map((b,S)=>h.jsx("div",{className:`px-4 ${b.startsWith("+")?"bg-success/8 text-success":b.startsWith("-")?"bg-error/8 text-error":"text-text-300"}`,children:b||" "},S)),d.truncated&&h.jsx("div",{className:"px-4 text-text-400",children:"Diff 较大,已截断显示。"})]}):h.jsx("div",{className:"p-5 text-[12px] text-text-400",children:o??"正在读取 diff…"})]})]})]})})]})}const kue=250;function Cue(e){if(!e||!Number.isFinite(e))return null;const t=e/1e3;if(t<60)return`${t.toFixed(0)}s`;const n=Math.floor(t/60);return`${n}m${Math.round(t-n*60).toString().padStart(2,"0")}s`}function Eue({agents:e}){var l,c,u;const[t,n]=g.useState(!1),r=g.useRef(null);if(g.useEffect(()=>{if(!t)return;const d=f=>{const p=r.current;p&&f.target instanceof Node&&p.contains(f.target)||n(!1)};return window.addEventListener("pointerdown",d,!0),()=>window.removeEventListener("pointerdown",d,!0)},[t]),e.length===0)return null;const i=e.length===1?e[0]:null,s=i?i.description:`${e.length} 个后台任务`,o=i?Cue((c=(l=i.progress)==null?void 0:l.stats)==null?void 0:c.durationMs):null,a=i?(u=i.progress)==null?void 0:u.lastToolName:null;return h.jsxs("div",{ref:r,"data-testid":"running-agents-chip","data-agent-count":e.length,className:"relative",children:[t?h.jsx("div",{"data-testid":"running-agents-popover",className:"absolute bottom-full right-0 z-20 mb-1 w-[min(560px,80vw)]",children:h.jsx("div",{className:"min-w-0 overflow-y-auto rounded-lg border border-bg-200/60 bg-bg-100 px-2 py-1 shadow-lg",style:{maxHeight:kue},children:e.map(d=>h.jsx(kA,{expandable:!1,description:d.description,input:d.input,output:d.output,...d.error!==void 0?{error:d.error}:{},pending:d.pending,notifications:d.notifications,...d.toolResultExtra?{toolResultExtra:d.toolResultExtra}:{},...d.progress?{progress:d.progress}:{}},d.toolUseId))})}):null,h.jsxs("button",{type:"button","data-testid":"running-agents-chip-toggle","aria-expanded":t,onClick:()=>n(d=>!d),className:re("flex max-w-[min(560px,80vw)] min-w-0 items-center gap-2 rounded-full","border border-bg-200/60 bg-bg-100/95 px-3 py-1 text-[12px] shadow-md backdrop-blur","hover:bg-bg-200/95 transition-colors"),children:[h.jsx(Tn,{className:"w-3 h-3 shrink-0 animate-spin text-blue-400"}),h.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-text-200",children:s}),o?h.jsx("span",{className:"shrink-0 tabular-nums text-text-400",children:o}):null,a?h.jsxs("span",{className:"shrink-0 font-mono tabular-nums text-blue-400",children:["now:",a]}):null,h.jsx(r3,{className:re("w-3.5 h-3.5 shrink-0 text-text-400 transition-transform",t&&"rotate-180")})]})]})}const Iue={closeTrailing:!1},Nue={closeTrailing:!0};function Tue(e){return e?Iue:Nue}function Pue({session:e,api:t,onPromoteQuickAsk:n}){const r=GP(e.sessionId);return h.jsx(bj,{state:r,extras:{session:e,api:t,...n?{onPromoteQuickAsk:n}:{}}})}function Rue({headerMeta:e,connState:t,liveWorktreeRoot:n,onOpenConfig:r,variant:i="full",ephemeral:s,onPromote:o,hideHeader:a=!1,flatProcess:l=!1,lines:c,pendingPermissions:u,procAlive:d,rewindableUserMessageIds:f,onPermissionRespond:p,onPermissionInterrupt:m,onRewind:x,onFork:w,onQuickAsk:v,topSlot:_,codexHistory:b,realtimeQuestionAnswers:S,onSubmitQuestion:C,onCancelQuestion:k,liveQuestionToolUseIds:N,api:E,cwd:L,tool:P,cloudVolume:D,sessionKey:R,onSend:A,awaitingUser:M,queued:j,onDequeue:z,onAbort:F,onNewSession:$,onClearSession:B,configSlot:I,workspaceInput:U,workspaceInputDisabled:V,chatRootRef:O,chatBodyRef:ne,drawers:ae,xtermSlot:Y,fileSharingScope:ye,onShareFile:Ce,onOpenInTab:oe,onPreviewMarkdown:je,onOpenFilePath:Ae,dispatchOrigin:De}){const[xe,Ke]=g.useState(0),rt=g.useMemo(()=>i==="full"?gY(ZP(c)):[],[c,i]),Ze=g.useMemo(()=>new Set(rt.map(ht=>ht.toolUseId)),[rt]);return h.jsx(uie,{children:h.jsxs("div",{ref:O,"data-cc-chat-root":"",className:"flex flex-col h-full bg-bg-100",children:[a?null:h.jsx(lse,{meta:e,...P?{tool:P}:{},...D?{cloudVolume:D}:{},connState:t,variant:i,...n!==void 0?{liveWorktreeRoot:n}:{},...i==="full"&&r?{onOpenConfig:r}:{},...i==="quickask"?{ephemeral:s??!1,...o?{onPromote:o}:{}}:{}}),h.jsx("div",{ref:ne,"data-testid":"chat-body",className:"flex-1 overflow-y-auto min-h-0",style:{overflowAnchor:"none",paddingBottom:xe},children:h.jsx(EA,{lines:c,forkByTurn:P==="codex",...p?{onPermissionRespond:p}:{},...m&&d?{onPermissionInterrupt:m}:{},topSlot:_,codexHistory:b,...x?{onRewind:x}:{},rewindableUserMessageIds:f,...w?{onFork:w}:{},...v?{onQuickAsk:v}:{},realtimeQuestionAnswers:S,onSubmitQuestion:C,...k?{onCancelQuestion:k}:{},liveQuestionToolUseIds:N,...ye?{fileSharingScope:ye}:{},...Ce?{onShareFile:Ce}:{},...oe?{onOpenInTab:oe}:{},...je?{onPreviewMarkdown:je}:{},...Ae?{onOpenFilePath:Ae}:{},...De?{dispatchOrigin:De}:{},...i==="full"&&!l?{turnCollapse:Tue(d)}:{},dockedAgentToolUseIds:Ze})}),Y,h.jsx(aue,{onHeightChange:Ke,children:h.jsx(Eue,{agents:rt})}),e.larkChatName?h.jsx("div",{className:"mx-3 mb-3 rounded-lg border border-border bg-bg-200 px-3 py-2 text-[12px] text-text-400","data-testid":"lark-readonly-notice",children:e.larkChatType==="p2p"?`此会话由与「${e.larkChatName}」的飞书私聊驱动——对方消息触发,这里仅供观察。`:`此会话由飞书群「${e.larkChatName}」驱动——群成员 @ bot 提问触发,这里仅供观察。`}):h.jsx(ose,{meta:e,aboveSlot:U,disabled:V,...E?{api:E}:{},cwd:L,...P?{tool:P}:{},sessionKey:R,onSend:A,awaitingUser:M,...j?{queued:j}:{},...z?{onDequeue:z}:{},...F?{onAbort:F}:{},...$?{onNewSession:$}:{},...B?{onClearSession:B}:{},...I?{configSlot:I}:{}}),ae]})})}function bj({state:e,extras:t,onQuickAskInternal:n,onPreviewMdInternal:r}){var xr;const{session:i,api:s,liveGitBranch:o,liveWorktreeRoot:a,cloudVolume:l,onNewSession:c,onTurnEnd:u,onOpenConfig:d,onFork:f,onQuickAsk:p,viewerRole:m,onPromoteQuickAsk:x,configSlot:w,hideHeader:v,flatProcess:_}=t,{capabilities:b}=Nm(i.tool||"claude"),S=(b==null?void 0:b.features)??GT(i.tool),[C,k]=g.useState(null),[N,E]=g.useState(null),L=Xp(),P=!!s&&L.actionsLevel==="owner"&&S.fileSharing,D=JT(i.ownerPersonaId??null).persona,R=(D==null?void 0:D.label)??null,A=!!R&&!!i.ownerPersonaId,M=rue(),j=g.useMemo(()=>({resolve:(Z,we)=>M.resolve(Z,we,i.sessionId),...M.onOpenSession?{onOpenSession:M.onOpenSession}:{}}),[M,i.sessionId]),z=g.useCallback((Z,we)=>{k({kind:Z,text:we}),setTimeout(()=>{k(Me=>(Me==null?void 0:Me.text)===we?null:Me)},2e3)},[]),F=Ti(),$=ax(i.tool)&&m!=="guest"&&!i.larkChatId&&!x,B=lue(s,i.sessionId,$&&t.focused!==!1,F,i.cloudWorkspace),I=hz(),U=UP(i.sessionId,i.toolSessionId),{events:V,pendingQuestions:O,clearQuestion:ne,markQuestionSubmitted:ae,status:Y}=U,ye=e.historyLoading,Ce=KP(Y);g.useEffect(()=>{Oe("chat-panel","sessionStatus",{sessionId:i.sessionId,sessionStatus:Y,procAlive:Ce})},[Y,Ce,i.sessionId]);const oe=e.lines,je=e.pendingPermissions,Ae=je[0]??null,De=g.useMemo(()=>pY(V),[V]),[xe,Ke]=g.useState(null),[rt,Ze]=g.useState(()=>new Set);dY(s,i.sessionId,i.toolSessionId,S.observe);const ht=g.useRef(i.sessionId);g.useEffect(()=>{if(ht.current=i.sessionId,!S.rewind){Ke(null);return}let Z=!1;return Ke(null),(async()=>{try{const we=await s.sessionRewindableMessageIds(i.sessionId);if(Z)return;Ke(new Set(we.userMessageIds))}catch{Z||Ke(null)}})(),()=>{Z=!0}},[s,i.sessionId,S.rewind]);const Kt=g.useCallback(()=>{const Z=i.sessionId;s.sessionRewindableMessageIds(Z).then(we=>{ht.current===Z&&Ke(new Set(we.userMessageIds))}).catch(()=>{})},[s,i.sessionId]),de=g.useMemo(()=>{if(xe!==null){const lt=new Set(xe);for(const Or of rt)lt.delete(Or);return lt}const Z=new Set(["Edit","Write","MultiEdit","NotebookEdit"]),we=new Set;let Me=null;for(const lt of oe)lt.kind==="user-text"?Me=lt.uuid??null:Me&<.kind==="tool-call"&&Z.has(lt.tool)&&!rt.has(Me)&&we.add(Me);return we},[oe,rt,xe]),ze=g.useRef(u);ze.current=u,hY(i.sessionId,i.toolSessionId,()=>{hn(null),Ze(new Set)});const ke=kse({sessionStatus:Y}),Fe=g.useRef(null);g.useEffect(()=>{var Me;const Z=Fe.current,we=(Z==null?void 0:Z.sid)===i.sessionId;we&&Z.phase===ke||(Fe.current={sid:i.sessionId,phase:ke},Oe("session-phase",ke,{sid:i.sessionId,phase:ke,prev:we?Z.phase:null,desc:Sse[ke]}),we&&Z.phase==="turn-running"&&ke!=="turn-running"&&((Me=ze.current)==null||Me.call(ze),Kt()))},[ke,i.sessionId,Kt]);const yt=g.useCallback(async()=>{const Z=await s.sessionInterrupt(i.sessionId).catch(()=>{});return(Z==null?void 0:Z.queued)??[]},[s,i.sessionId]),[tn,hn]=g.useState(null),W=g.useCallback(Z=>{hn(Z)},[]),[ee,be]=g.useState(!1),Le=g.useCallback(()=>{s.sessionStop(i.sessionId).catch(()=>{}),be(!1)},[s,i.sessionId]);g.useCallback(Z=>{s.pinSession(i.sessionId,Z).catch(we=>{Oe("chat-panel","pinSession failed",{err:we==null?void 0:we.message})})},[s,i.sessionId]);const He=x?"quickask":"full",{container:Mt,workspaceContainer:bn,onCollapse:nn,hostExtras:fn}=mse(),le=g.useRef(0),Se=g.useRef(null);g.useEffect(()=>{const Z=we=>{if(we.key!=="Escape")return;if(!Ce){le.current=0;return}if(we.isComposing)return;const lt=we.target;if(lt&<.closest("[data-cc-chat-root]")!==Se.current)return;const Or=Date.now();Or-le.current<2e3?(le.current=0,be(!0)):(le.current=Or,yt())};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[yt,Ce]);const it=g.useRef(null),mt=g.useRef(null),gr=g.useRef(!!e.codexHistory);gr.current=!!e.codexHistory;const se=g.useRef(!0),nt=g.useRef(void 0),Bt=g.useRef(0),ni=g.useRef(0),oa=g.useRef(void 0);g.useEffect(()=>{E(null)},[i.sessionId]),g.useEffect(()=>{const Z=it.current;if(!Z)return;const we=150,Me=lt=>{gr.current||Date.now()<ni.current&&(lt.preventDefault(),ni.current=Date.now()+we)};return Z.addEventListener("wheel",Me,{passive:!1}),()=>Z.removeEventListener("wheel",Me)},[]),g.useEffect(()=>{const Z=it.current;if(!Z)return;const we=32,Me=()=>{var Or;const lt=Z.scrollHeight-Z.scrollTop-Z.clientHeight;se.current=lt<=we,e.codexHistory&&(mt.current=g2(Z)),Z.scrollTop<=24&&e.historyHasMore&&!e.historyLoadingOlder&&!e.historyError&&!ye&&((Or=e.loadOlderHistory)==null||Or.call(e))};return Z.addEventListener("scroll",Me,{passive:!0}),()=>Z.removeEventListener("scroll",Me)},[e.codexHistory,e.historyHasMore,e.historyLoadingOlder,e.historyError,e.loadOlderHistory,ye]),g.useLayoutEffect(()=>{var Mb;const Z=it.current;if(!Z)return;const we=oa.current!==i.sessionId;we&&(oa.current=i.sessionId,se.current=!0,nt.current=void 0,Bt.current=0,ni.current=0,mt.current=null);const Me=nt.current,lt=(Mb=oe[0])==null?void 0:Mb.seq;if(nt.current=lt,e.codexHistory){!we&&mt.current&&!se.current?Tie(Z,mt.current):se.current&&(Z.scrollTop=Z.scrollHeight),mt.current=g2(Z),Bt.current=Z.scrollHeight-Z.scrollTop;return}!we&&Me!==void 0&<!==void 0&<<Me?(Z.scrollTop=Z.scrollHeight-Bt.current,ni.current=Date.now()+200):se.current&&(Z.scrollTop=Z.scrollHeight),Bt.current=Z.scrollHeight-Z.scrollTop},[oe,Ae==null?void 0:Ae.requestId,i.sessionId]);const aa=g.useMemo(()=>{const Z={};for(const[we,Me]of Object.entries(O))Me.submittedAnswers&&(Z[we]=Me.submittedAnswers);return Z},[O]),hs=g.useMemo(()=>new Set(Object.keys(O)),[O]),la=g.useCallback(async(Z,we)=>{try{await s.answerQuestion({sessionId:i.sessionId,toolUseId:Z,answers:we}),ae(Z,we)}catch{}},[s,i.sessionId,ae]),Xl=g.useCallback(async Z=>{try{await s.cancelQuestion({sessionId:i.sessionId,toolUseId:Z}),ne(Z)}catch{}},[s,i.sessionId,ne]),Zl=g.useCallback(async(Z,we)=>{var Me;if(Ae)try{await((Me=e.respondPermission)==null?void 0:Me.call(e,Ae.requestId,Z?"allow":"deny"))}catch{}},[e,Ae]),fs=g.useCallback(async()=>{const Z=i.sessionId;try{await s.sessionStop(Z)}catch{}e.clearSession?await e.clearSession():await s.sessionNew(Z)},[e,s,i.sessionId]),ri=e.meta.streamInProgress??!1,hd=g.useMemo(()=>{if(e.codexHistory)return h.jsxs("div",{className:"flex flex-col items-center gap-2 py-2 text-xs text-text-400","data-testid":"codex-history-top",children:[e.historySyncError?h.jsx("span",{children:e.historySyncError}):null,e.historyError?h.jsx("span",{"data-testid":"history-error",children:e.historyError}):null,ye||e.historyLoadingOlder?h.jsx("span",{"data-testid":"history-loading",children:"正在加载历史…"}):e.historyHasMore?h.jsx("button",{type:"button",onClick:()=>{var we;return void((we=e.loadOlderHistory)==null?void 0:we.call(e))},children:e.historyError?"重试更早记录":"加载更早记录"}):e.historyLoaded&&!e.historyError&&!e.historySyncError?h.jsx("span",{children:"已加载全部轮次摘要"}):null,e.historyError||e.historySyncError?h.jsx("button",{type:"button",onClick:()=>{var we;return void((we=e.refreshHistory)==null?void 0:we.call(e))},children:"刷新历史"}):null]});const Z=e.historySyncError?h.jsxs("div",{className:"flex justify-center items-center gap-2 py-2 text-[12px] text-text-400","data-testid":"history-sync-error",children:[h.jsx("span",{children:e.historySyncError}),e.reloadFromCloud?h.jsx("button",{type:"button","data-testid":"history-sync-reload",disabled:ri,onClick:e.reloadFromCloud,className:"text-accent hover:underline cursor-pointer disabled:cursor-not-allowed disabled:opacity-50 disabled:no-underline",children:"从云端重新加载"}):null]}):null;return e.historyError?h.jsxs(h.Fragment,{children:[Z,h.jsxs("div",{className:"flex justify-center py-2 text-[12px] text-text-400","data-testid":"history-error",children:["历史未加载完(",e.historyError,");切走再切回可重试"]})]}):Z||(ye&&oe.length===0?h.jsx("div",{className:"flex justify-center py-4","data-testid":"history-loading",children:h.jsx(Tn,{className:"w-4 h-4 text-text-400 animate-spin"})}):null)},[ye,oe.length,e.historyError,e.historySyncError,e.reloadFromCloud,ri,e.codexHistory,e.historyHasMore,e.historyLoaded,e.historyLoadingOlder,e.loadOlderHistory,e.refreshHistory]),ca=e.meta,Gt=h.jsxs(h.Fragment,{children:[i.toolSessionId&&S.subagents?h.jsx(gse,{api:s,cwd:i.cwd,toolSessionId:i.toolSessionId,toolKind:i.tool??"claude"}):null,tn&&S.rewind?h.jsx(xse,{open:!0,onOpenChange:Z=>{Z||hn(null)},api:s,sessionId:i.sessionId,userMessageId:tn,lines:oe,procAlive:Ce,onNoChanges:Z=>{Ze(we=>{if(we.has(Z))return we;const Me=new Set(we);return Me.add(Z),Me})}}):null,ee?h.jsx(Aue,{onConfirm:Le,onCancel:()=>be(!1)}):null]}),Ql={kind:"session",sessionId:i.sessionId},fd=g.useCallback(async Z=>{if(s)try{await fC(s,F,i.sessionId,Z)}catch(we){const Me=we.message;Oe("chat-panel","open-in-tab failed",{err:Me}),z("err",`Open in tab 失败:${Me}`)}},[s,F,i.sessionId,z]),[jt,$t]=g.useState(!1),[Wn,vr]=g.useState(null),Mi=g.useCallback(Z=>{if(r){r(Z);return}vr(Z),$t(!0)},[r]),Lm=g.useCallback(Z=>{if(!s)return;const we=async()=>{try{await s.attachmentGroupAdd(i.sessionId,Z)}catch(lt){Oe("chat-panel","file-link groupAdd skipped",{err:lt.message})}},Me=lt=>{const Or=lt.message;Oe("chat-panel","file-link open failed",{err:Or}),z("err",`打开文件失败:${Or}`)};if(Sm(Z)){we().then(()=>Mi(Z),Me);return}fC(s,F,i.sessionId,Z,60,we).catch(Me)},[s,F,i.sessionId,Mi,z]),pd=g.useCallback(async Z=>{if(!s)throw new Error("daemon api not ready");const we=await W_(s,F,i.sessionId,Z,60),Me=await fetch(we);if(!Me.ok)throw new Error(`fetch ${Me.status} ${Me.statusText}`);return await Me.text()},[s,F,i.sessionId]),lo=g.useCallback(async(Z,we)=>{if(s)try{const{url:Me}=await s.attachmentSignUrl({sessionId:i.sessionId,relPath:Z,...we?{view:we}:{}}),lt=await JG(Me);z(lt?"ok":"err",lt?"分享链接已复制到剪贴板":"复制失败:请手动复制")}catch(Me){const lt=Me.message;Oe("chat-panel","share-file failed",{err:lt}),z("err",`生成分享链接失败:${lt}`)}},[s,i.sessionId,z]),co=g.useCallback(()=>E(null),[]),Dm=N==="files"&&P&&s?{title:"Edited Files",onBack:co,content:h.jsx(Ble,{api:s,scope:Ql,sessionId:i.sessionId,onShareFile:lo,onOpenInTab:fd,onPreviewMarkdown:Mi})}:N==="cron"?{title:`定时任务${De.length?` (${De.length})`:""}`,onBack:co,content:h.jsx("div",{className:"p-3",children:h.jsx(wse,{jobs:De})})}:N==="persona"&&A&&s&&i.ownerPersonaId?{title:`Persona · ${R??""}`,onBack:co,content:h.jsx(eue,{personaId:i.ownerPersonaId,open:!0,onClose:co,api:s,embedded:!0,...m?{viewerRole:m}:{}},i.ownerPersonaId)}:null,md=He==="full"?h.jsx(fse,{session:i,meta:ca,...$&&B.binding?{liveGitBranch:((xr=B.workspace)==null?void 0:xr.actualBranch)??null}:o!==void 0?{liveGitBranch:o}:{},...a!==void 0?{liveWorktreeRoot:a}:{},...A?{personaName:R}:{},...A?{onOpenPersona:()=>E("persona")}:{},...P?{onOpenFiles:()=>E("files")}:{},cronActiveCount:De.length,onCronClick:()=>E("cron"),onForceStop:()=>be(!0),...ax(i.tool)&&e.reloadFromCloud?{onReloadFromCloud:e.reloadFromCloud,reloadFromCloudDisabled:ri}:{},...m?{viewerRole:m}:{},...b!=null&&b.toolSessionIdLabel?{toolSessionIdLabel:b.toolSessionIdLabel}:{},drill:Dm,...nn?{onCollapse:nn}:{},...fn?{title:fn.title,leadingEntries:fn.leadingEntries}:{}}):null;return h.jsxs(h.Fragment,{children:[$&&bn?Oo.createPortal(h.jsx(Sue,{controller:B,disabled:ca.streamInProgress}),bn):null,Mt&&md?Oo.createPortal(md,Mt):null,h.jsx(Rue,{headerMeta:ca,workspaceInput:$?h.jsx(wue,{controller:B,disabled:ca.streamInProgress}):void 0,workspaceInputDisabled:$&&(B.busy||!!(B.binding&&!B.workspace&&B.loading)),connState:e.connState,...a!==void 0?{liveWorktreeRoot:a}:{},...d?{onOpenConfig:d}:{},variant:He,...v||$?{hideHeader:!0}:{},..._?{flatProcess:_}:{},...He==="quickask"?{ephemeral:i.ephemeral!==!1,onPromote:()=>void(x==null?void 0:x(i.sessionId))}:{},lines:oe,pendingPermissions:je,procAlive:Ce,rewindableUserMessageIds:de,onPermissionRespond:Zl,onPermissionInterrupt:yt,onRewind:S.rewind?W:void 0,...f&&S.fork?{onFork:f}:{},...n&&S.fork?{onQuickAsk:n}:p&&S.fork?{onQuickAsk:p}:{},topSlot:hd,codexHistory:e.codexHistory,realtimeQuestionAnswers:aa,onSubmitQuestion:la,onCancelQuestion:Xl,liveQuestionToolUseIds:hs,api:s,cwd:i.cwd,...i.tool?{tool:i.tool}:{},...l?{cloudVolume:l}:{},sessionKey:i.sessionId,onSend:e.sendText,queued:e.queued,onDequeue:e.dequeue,awaitingUser:je.length>0||Object.values(O).some(Z=>!Z.submittedAnswers),onAbort:yt,...c?{onNewSession:c}:{},onClearSession:fs,...w?{configSlot:w}:{},chatRootRef:Se,chatBodyRef:it,drawers:Gt,xtermSlot:I==="tui"&&Ce&&S.tui?h.jsx(Ole,{sessionId:i.sessionId,client:F},i.sessionId):null,fileSharingScope:Ql,...s?{onShareFile:lo}:{},...s?{onOpenInTab:fd}:{},...s?{onPreviewMarkdown:Mi}:{},...s?{onOpenFilePath:Lm}:{},dispatchOrigin:j}),s?h.jsx(oue,{open:jt,onOpenChange:$t,relPath:Wn,loadMarkdown:pd,onShare:Wn?()=>void lo(Wn,"md-rendered"):void 0}):null,C?h.jsx("div",{"data-testid":"share-toast",role:"status","aria-live":"polite",className:C.kind==="ok"?"fixed left-1/2 top-4 z-50 -translate-x-1/2 rounded-md border border-emerald-500/40 bg-emerald-500/10 px-3 py-2 text-[12px] text-emerald-700 shadow-md dark:text-emerald-300":"fixed left-1/2 top-4 z-50 -translate-x-1/2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive shadow-md",children:C.text}):null]})}function Aue({onConfirm:e,onCancel:t}){return h.jsx("div",{role:"dialog","aria-modal":"true","data-testid":"force-stop-confirm",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:t,children:h.jsxs("div",{className:"max-w-sm w-[92%] rounded-lg border border-red-400/40 bg-bg-0 p-4 shadow-xl",onClick:n=>n.stopPropagation(),children:[h.jsxs("div",{className:"flex items-start gap-2 mb-3",children:[h.jsx(Ff,{className:"w-5 h-5 text-red-500 shrink-0 mt-0.5"}),h.jsx("div",{className:"text-[14px] text-text-100",children:"强制停止会话进程?会丢失 initialize / 预热缓存,下一次发送需要重新 spawn。"})]}),h.jsxs("div",{className:"flex justify-end gap-2",children:[h.jsx("button",{type:"button",onClick:t,className:"h-8 px-3 rounded-md text-[12px] text-text-300 hover:bg-text-100/5 cursor-pointer",children:"取消"}),h.jsx("button",{type:"button","data-testid":"force-stop-confirm-ok",onClick:e,className:"h-8 px-3 rounded-md bg-red-500 text-white text-[12px] font-medium hover:bg-red-600 cursor-pointer",children:"强制停止"})]})]})})}function Mue(e){return e.split("/").pop()||e}function jue({state:e,api:t,onSwitchTab:n,onCloseQuickAsk:r,onCloseMd:i,loadMarkdown:s,quickAskSession:o,onPromoteQuickAsk:a}){if(!YP(e))return null;const l=[];e.quickAsk&&l.push({id:"quick-ask",label:"问一下",title:"问一下",icon:h.jsx(dx,{className:"w-3.5 h-3.5"})});for(const c of e.mds)l.push({id:{kind:"md",relPath:c},label:Mue(c),title:c,icon:h.jsx(Ei,{className:"w-3.5 h-3.5"})});return h.jsxs("div",{className:"flex flex-col h-full bg-bg-50/60 border-l border-border-strong",children:[h.jsx(Iu,{delayDuration:200,skipDelayDuration:100,children:h.jsx("div",{className:["flex items-stretch h-9 border-b border-text-100/10 shrink-0 overflow-x-auto","[scrollbar-width:none] [-ms-overflow-style:none]","[&::-webkit-scrollbar]:hidden"].join(" "),role:"tablist",children:l.map(c=>{const u=uY(e.active,c.id),d=c.id==="quick-ask"?"quick-ask":`md:${c.id.relPath}`;return h.jsxs(Ju,{children:[h.jsx(ed,{asChild:!0,children:h.jsxs("div",{role:"tab","aria-selected":u,"data-tab-title":c.title,onClick:()=>n(c.id),className:["group relative flex items-center gap-2 px-3 h-full cursor-pointer select-none","text-[12px] max-w-[180px] shrink-0 transition-colors duration-100",u?"text-text-100":"text-text-400 hover:text-text-100 hover:bg-text-100/[0.04]"].join(" "),children:[c.icon,h.jsx("span",{className:"truncate",children:c.label}),h.jsx("button",{type:"button","aria-label":`关闭 ${c.label}`,className:["ml-1 rounded p-0.5 shrink-0 transition-opacity","hover:bg-text-100/10",u?"opacity-70 hover:opacity-100":"opacity-0 group-hover:opacity-70"].join(" "),onClick:f=>{f.stopPropagation(),c.id==="quick-ask"?r():i(c.id.relPath)},children:h.jsx(Jr,{className:"w-3 h-3"})}),u?h.jsx("span",{"aria-hidden":"true",className:"absolute left-2 right-2 -bottom-px h-[2px] rounded-full bg-accent"}):null]})}),h.jsx(Wl,{side:"bottom",align:"start",className:"max-w-sm break-all",children:c.title})]},d)})})}),h.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden relative",children:[e.quickAsk&&o?h.jsx("div",{className:"absolute inset-0",style:{display:e.active==="quick-ask"?"block":"none"},children:h.jsx(Pue,{session:o,api:t,...a?{onPromoteQuickAsk:a}:{}})}):null,e.mds.map(c=>{const u=e.active!==null&&e.active!=="quick-ask"&&e.active.relPath===c;return h.jsx("div",{className:"absolute inset-0",style:{display:u?"block":"none"},children:h.jsx(sj,{relPath:c,loadMarkdown:s,showTitleBar:!1})},`md-body:${c}`)})]})]})}function Lue(e){const t=e instanceof Error?e.message:String(e);return t.length>200?`${t.slice(0,200)}…`:t}function Due({state:e,extras:t}){const{api:n,session:r}=t,i=Ti(),[s,o]=g.useState(rY()),[a,l]=g.useState(null),c=r.ownerPersonaId!==CT,u=g.useRef(s);u.current=s;const d=g.useRef(!1),f=g.useCallback(async E=>{const L=u.current.quickAsk;l(null);let P;try{P=await GG(n,r,E)}catch(D){Oe("quick-ask","fork failed",D),d.current||l(Lue(D));return}if(!P){d.current||l("这条会话还没准备好(没有可派生的对话记录),稍后再试");return}if(d.current){n.sessionDelete(P.sessionId).catch(()=>{});return}th(L)&&n.sessionDelete(L.sessionId).catch(()=>{}),o(D=>iY(D,{sessionId:P.sessionId}))},[n,r]),p=g.useCallback(async E=>{const L=u.current.quickAsk,P=(L==null?void 0:L.sessionId)===E;try{await YG(n,{sessionId:E,stillEphemeral:P&&th(L)})&&o(R=>aY(R))}catch(D){Oe("quick-ask","promote failed",D)}},[n]),m=g.useCallback(E=>{o(L=>sY(L,E))},[]),x=g.useCallback(E=>{o(L=>cY(L,E))},[]),w=g.useCallback(()=>{const E=u.current.quickAsk;th(E)&&n.sessionDelete(E.sessionId).catch(()=>{}),o(L=>oY(L))},[n]),v=g.useCallback(E=>{o(L=>lY(L,E))},[]);g.useEffect(()=>()=>{d.current=!0;const E=u.current.quickAsk;th(E)&&n.sessionDelete(E.sessionId).catch(()=>{})},[]);const _=ts("sessions")??[],b=s.quickAsk?_.find(E=>E.sessionId===s.quickAsk.sessionId)??{sessionId:s.quickAsk.sessionId,cwd:r.cwd,tool:r.tool}:null,S=g.useCallback(async E=>{const L=await W_(n,i,r.sessionId,E,60),P=await fetch(L);if(!P.ok)throw new Error(`fetch ${P.status} ${P.statusText}`);return P.text()},[n,i,r.sessionId]),C=h.jsx(bj,{state:e,extras:t,onQuickAskInternal:f,onPreviewMdInternal:m}),{initialSize:k,setSize:N}=nY("chat-panel-right-slot-width",480);return h.jsxs(F_,{orientation:"horizontal",className:"flex-1 flex min-w-0 min-h-0",children:[h.jsx(Yf,{id:"chat",minSize:"400px",children:h.jsxs("div",{className:"relative flex flex-col min-w-0 min-h-0 h-full",children:[C,a?h.jsxs("div",{"data-testid":"quick-ask-error",className:"absolute bottom-24 left-1/2 z-10 -translate-x-1/2 max-w-[90%] rounded-md border border-border bg-bg-200 px-3 py-2 text-[12px] text-text-300 shadow-lg",children:[h.jsxs("span",{className:"mr-2",children:["问一下没能打开:",a]}),h.jsx("button",{type:"button","aria-label":"关闭提示",onClick:()=>l(null),className:"text-text-400 hover:text-text-200 cursor-pointer",children:"✕"})]}):null]})}),YP(s)?h.jsxs(h.Fragment,{children:[h.jsx(HP,{className:"w-1 bg-text-100/10 hover:bg-text-100/25 transition-colors cursor-col-resize"}),h.jsx(Yf,{id:"right-slot",defaultSize:`${k}px`,minSize:"360px",maxSize:"800px",onResize:E=>N(E.inPixels),children:h.jsx(jue,{state:s,api:n,onSwitchTab:x,onCloseQuickAsk:w,onCloseMd:v,loadMarkdown:S,quickAskSession:b,...c?{onPromoteQuickAsk:p}:{}})})]}):null]})}function Oue({extras:e}){const t=GP(e.session.sessionId,e.focused);return h.jsx(Due,{state:t,extras:e})}function Bue(e,t,n){const r=e?t.find(s=>s.id===e):void 0;if(r!=null&&r.efforts&&r.efforts.length>0)return{options:r.efforts,defaultValue:r.defaultEffort??""};const i=n.find(s=>s.name==="effort");return{options:(i==null?void 0:i.options)??[],defaultValue:typeof(i==null?void 0:i.default)=="string"?i.default:""}}function $ue(e,t,n){var l;if(!t)return((l=(e??[]).find(c=>c.id===""))==null?void 0:l.label)??"未指定";const r=t.toLowerCase(),i=[["opus","Opus"],["fable","Fable"],["sonnet","Sonnet"],["haiku","Haiku"]];for(const[c,u]of i){if(!r.includes(c))continue;const d=r.match(new RegExp(`${c}-(\\d+)(?:-(\\d+))?`));return d?d[2]?`${u} ${d[1]}.${d[2]}`:`${u} ${d[1]}`:u}const s=e??[],o=s.find(c=>c.id===t);if(o)return o.label;const a=s.find(c=>c.id&&t.toLowerCase().includes(c.id.toLowerCase()));return a?a.label:t}function zue(e,t){var m,x,w,v;const{models:n,modes:r,configSchema:i}=t,s=e.resolvedModel??e.model,o=Bue(s,n,i),a=o.options,l=a.some(_=>_.value===e.effort)?e.effort:o.defaultValue,c=e.effort===""&&e.resolvedEffort?((m=a.find(_=>_.value===e.resolvedEffort))==null?void 0:m.label)??e.resolvedEffort:((x=a.find(_=>_.value===l))==null?void 0:x.label)??null,u=((w=i.find(_=>_.name==="permissionMode"))==null?void 0:w.default)??"",d=r.some(_=>_.id===e.permissionMode)?e.permissionMode:u,p=d===u?null:((v=r.find(_=>_.id===d))==null?void 0:v.label)??null;return{modelLabel:$ue(n,s),effortOptions:a,effortValue:l,effortLabel:c,modeValue:d,modeLabel:p,modeTone:p===null?null:d==="bypassPermissions"?"danger":"info"}}function wj(e){let t;return e.map(n=>{const r=n.group&&n.group!==t?n.group:null;return n.group&&(t=n.group),{...n,groupHeading:r}})}function Fue(e){return e.map(t=>({value:t.id,label:t.label,...t.description?{description:t.description}:{},...t.group?{group:t.group}:{}}))}function Hue({testid:e,list:t,options:n,current:r,onSelect:i}){if(t.loading)return h.jsx(Wr,{disabled:!0,"data-testid":`${e}-loading`,className:"text-[12px] text-text-400",children:"正在读取最新模型…"});if(t.error)return h.jsxs(h.Fragment,{children:[h.jsx("div",{"data-testid":`${e}-error`,className:"px-2 py-1.5 text-[11px] text-warning",children:t.error}),h.jsx(Wr,{"data-testid":`${e}-retry`,className:"text-[12px]",onSelect:o=>{o.preventDefault(),t.load()},children:"重试"})]});const s=n??Fue(t.models);return s.length===0?h.jsx(Wr,{disabled:!0,"data-testid":`${e}-empty`,className:"text-[12px] text-text-400",children:"没有可选模型"}):h.jsx(h.Fragment,{children:wj(s).map((o,a)=>{const l=o.value===r;return h.jsxs(Qe.Fragment,{children:[o.groupHeading?h.jsxs(h.Fragment,{children:[a>0?h.jsx(fm,{}):null,h.jsx(P_,{"data-testid":`${e}-group`,children:o.groupHeading})]}):null,h.jsxs(Wr,{"data-testid":`${e}-option-${o.value||"default"}`,onSelect:()=>i(o.value),className:"items-start gap-2",children:[h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:re("block text-[12px]",l?"font-medium text-text-100":"text-text-300"),children:o.label}),o.description?h.jsx("span",{className:"mt-0.5 block text-[11px] text-text-400",children:o.description}):null]}),l?h.jsx(Qo,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-accent"}):null]})]},o.value||"default")})})}function Uue(e,t={}){return{models:e,loading:!1,error:null,load:()=>{},...t}}const Wue=e=>e instanceof Error?e.message:String(e);function que(e,t){const[n,r]=g.useState({key:e,loading:!1,error:null,data:t}),i=g.useRef(0),s=g.useCallback((a,l)=>{const c=++i.current;r(u=>({key:e,loading:!0,error:null,data:u.key===e?u.data:t})),a().then(u=>{i.current===c&&(l==null||l(u),r({key:e,loading:!1,error:null,data:u}))},u=>{i.current===c&&r(d=>({key:e,loading:!1,error:Wue(u),data:d.key===e?d.data:t}))})},[e]);return{...n.key===e?n:{loading:!1,error:null,data:t},run:s}}const Vue=[];function Kue(e){const t=Ti(),n=g.useMemo(()=>new Zp(t),[t]),r=as(),{capabilities:i}=Nm(e),s=que(e??"",null),{run:o}=s,a=g.useCallback(()=>{e&&o(()=>n.capabilitiesGet(e,{refresh:!0}),l=>{l&&r.setData(`capabilities/${e}`,()=>l)})},[n,r,e,o]);return{models:(i==null?void 0:i.models)??Vue,loading:s.loading,error:s.error,load:a}}function Gue({models:e,modelList:t,modes:n=[],configSchema:r=[],model:i,resolvedModel:s,resolvedEffort:o,effort:a,permissionMode:l,onPatch:c}){var w;const u=t??Uue(e??[]),d=u.models,f=zue({model:i,resolvedModel:s,resolvedEffort:o,effort:a,permissionMode:l},{models:d,modes:n,configSchema:r}),p=s??i,m=d.map(v=>{const _=v.id===""&&s?`${v.description?`${v.description};`:""}当前:${s}`:v.description;return{value:v.id,label:v.label,..._?{description:_}:{},...v.group?{group:v.group}:{}}}),x=n.map(v=>({value:v.id,label:v.label,...v.description?{description:v.description}:{}}));return h.jsxs(dP,{children:[h.jsx(hP,{asChild:!0,children:h.jsxs("button",{type:"button","data-testid":"session-config-chip",title:"Model / reasoning effort / permission mode",className:"inline-flex items-center gap-1 h-7 px-2.5 rounded-full text-[11px] text-text-400 transition-colors outline-none cursor-pointer hover:bg-text-100/5 hover:text-text-200 data-[state=open]:bg-text-100/5",children:[h.jsx("span",{className:"truncate max-w-[120px]","data-testid":"session-config-chip-model",children:p||f.modelLabel}),f.effortLabel?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-500",children:"·"}),h.jsx("span",{className:"truncate max-w-[80px]","data-testid":"session-config-chip-effort",children:f.effortLabel})]}):null,f.modeLabel?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-text-500",children:"·"}),h.jsx("span",{"data-testid":"session-config-chip-mode","data-tone":f.modeTone,className:re("font-semibold",f.modeTone==="danger"?"text-red-400":"text-blue-400"),children:f.modeLabel})]}):null]})}),h.jsxs(I_,{side:"top",align:"end",className:"w-[230px]","data-testid":"session-config-menu",children:[h.jsx(Yue,{list:u,current:i,currentLabel:f.modelLabel,options:m,onSelect:v=>c({model:v})}),h.jsx(PE,{testid:"session-config-effort",label:"Reasoning effort",current:f.effortValue,currentLabel:f.effortLabel??"—",options:f.effortOptions,onSelect:v=>c({effort:v})}),x.length>0?h.jsx(PE,{testid:"session-config-mode",label:"Permission mode",current:f.modeValue,currentLabel:((w=n.find(v=>v.id===f.modeValue))==null?void 0:w.label)??"—",currentTone:f.modeTone,options:x,onSelect:v=>c({permissionMode:v})}):null]})]})}function Sj({label:e,currentLabel:t,currentTone:n}){return h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"flex-1 text-text-200",children:e}),h.jsx("span",{className:re("truncate max-w-[100px]",n==="danger"?"text-red-400 font-semibold":n==="info"?"text-blue-400 font-semibold":"text-text-400"),children:t}),h.jsx(Fn,{className:"w-3.5 h-3.5 shrink-0 text-text-500"})]})}function Yue({list:e,current:t,currentLabel:n,options:r,onSelect:i}){const[s,o]=g.useState(!1),a=l=>{l&&!s&&e.load(),o(l)};return h.jsxs(fP,{open:s,onOpenChange:a,children:[h.jsx(N_,{"data-testid":"session-config-model",className:"gap-2 text-[12px]",children:h.jsx(Sj,{label:"Model",currentLabel:n})}),h.jsx(T_,{className:"w-[220px] max-h-[320px] overflow-y-auto",children:h.jsx(Hue,{testid:"session-config-model",list:e,options:r,current:t,onSelect:i})})]})}function PE({testid:e,label:t,current:n,currentLabel:r,currentTone:i,options:s,onSelect:o}){const a=s.length===0;return h.jsxs(fP,{children:[h.jsx(N_,{"data-testid":e,disabled:a,className:"gap-2 text-[12px]",children:h.jsx(Sj,{label:t,currentLabel:r,currentTone:i??null})}),h.jsx(T_,{className:"w-[220px] max-h-[320px] overflow-y-auto",children:wj(s).map((l,c)=>{const u=l.value===n;return h.jsxs(Qe.Fragment,{children:[l.groupHeading?h.jsxs(h.Fragment,{children:[c>0?h.jsx(fm,{}):null,h.jsx(P_,{"data-testid":`${e}-group`,children:l.groupHeading})]}):null,h.jsxs(Wr,{"data-testid":`${e}-option-${l.value||"default"}`,onSelect:()=>o(l.value),className:"items-start gap-2",children:[h.jsxs("span",{className:"flex-1 min-w-0",children:[h.jsx("span",{className:re("block text-[12px]",u?"text-text-100 font-medium":"text-text-300"),children:l.label}),l.description?h.jsx("span",{className:"block text-[11px] text-text-400 mt-0.5",children:l.description}):null]}),u?h.jsx(Qo,{className:"w-3.5 h-3.5 shrink-0 text-accent mt-0.5"}):null]})]},l.value||"default")})})]})}function Xue(e,t,n=0){const[r,i]=g.useState(null),[s,o]=g.useState(!1),a=g.useCallback(async()=>{if(!t){i(null);return}o(!0);try{const l=await e.getGitBranch(t);i(l.branch??null)}catch{i(null)}finally{o(!1)}},[e,t]);return g.useEffect(()=>{a()},[a,n]),{branch:r,loading:s,refresh:()=>void a()}}function Zue(e,t,n=0){const[r,i]=g.useState(null),[s,o]=g.useState(!1),a=g.useCallback(async()=>{if(!t){i(null);return}o(!0);try{const l=await e.getGitRoot(t);i(l.gitRoot??null)}catch{i(null)}finally{o(!1)}},[e,t]);return g.useEffect(()=>{a()},[a,n]),{worktreeRoot:r,loading:s,refresh:()=>void a()}}const Que=5e3;function Jue(e,t,n=0){const[r,i]=g.useState(null);return g.useEffect(()=>{if(!t){i(null);return}let s=!1;const o=async()=>{try{const l=await e.cloudVolumeGet();s||i(l.volume??null)}catch{s||i(null)}},a=n>0?setTimeout(()=>void o(),Que):null;return a||o(),()=>{s=!0,a&&clearTimeout(a)}},[e,t,n]),{volume:r}}const ede=90;function tde(e){return e.sizeBytes>0?Math.min(100,Math.max(0,Math.round(e.usedBytes/e.sizeBytes*100))):0}function RE(e){const t=e/1073741824;return t>=.1?`${t.toFixed(1)} GB`:`${Math.max(1,Math.round(e/1024**2))} MB`}function nde({volume:e}){if(!e)return null;const t=tde(e),n=t>=ede?"warn":"ok",r=new Date(e.measuredAt).toLocaleString(),i=n==="ok"?"上一次任务结束时量的。":"盘快满了:在会话里说「清理一下云盘」,persona 会分析工作区里哪些能删、列给你确认后清掉。";return h.jsxs("span",{"data-testid":"chat-header-cloud-volume","data-tone":n,title:`云盘已用 ${RE(e.usedBytes)} / ${RE(e.sizeBytes)}(${r})。${i}`,className:re("ml-1.5 inline-flex items-center gap-1.5 px-1.5 py-0.5 rounded text-[11px] tabular-nums",n==="ok"&&"bg-text-100/10 text-text-400",n==="warn"&&"bg-warning-dim text-warning"),children:[h.jsx("span",{className:"relative inline-block w-8 h-1 rounded-full bg-current/20 overflow-hidden","aria-hidden":!0,children:h.jsx("span",{className:"absolute inset-y-0 left-0 rounded-full bg-current",style:{width:`${t}%`}})}),"云盘 ",t,"%"]})}function rde({api:e,session:t,focused:n,totalPanes:r,onFocus:i,onClose:s,onNewSession:o,onOpenConfig:a,onFork:l,onQuickAsk:c,className:u,viewerRole:d="owner",hideHeader:f}){const{capabilities:p}=Nm(t.tool),m=Kue(t.tool),[x,w]=g.useState(0),[v,_]=g.useState(n);Qe.useEffect(()=>{n&&_(!0)},[n]);const b=ax(t.tool),S=b?void 0:t.cwd,{branch:C}=Xue(e,S,x),{worktreeRoot:k}=Zue(e,S,x),{volume:N}=Jue(e,b,x),E=r>1,L=P=>{e.sessionUpdate(t.sessionId,P).catch(D=>{console.error("[session-config] session:update failed",t.sessionId,D)})};return h.jsxs("div",{className:`group/pane relative flex-1 ${u??"flex"} flex-row min-w-0 min-h-0 overflow-hidden ${E?`rounded-md border transition-colors ${n?"border-accent ring-1 ring-accent":"border-border"}`:""}`,onMouseDown:i,"data-testid":`session-pane-${t.sessionId}`,children:[h.jsx(F_,{orientation:"horizontal",className:"flex-1 flex min-w-0 min-h-0",children:h.jsx(Yf,{id:"chat",minSize:"400px",children:h.jsx("div",{className:"flex flex-col min-w-0 min-h-0 h-full",children:(n||v)&&h.jsx(ide,{api:e,session:t,focused:n,liveGitBranch:C,liveWorktreeRoot:k,...b&&N?{cloudVolume:h.jsx(nde,{volume:N})}:{},onNewSession:o,onTurnEnd:()=>w(P=>P+1),onOpenConfig:a,onFork:l,onQuickAsk:c,viewerRole:d,hideHeader:f,configSlot:p?h.jsx(Gue,{modelList:m,modes:p.permissionModes,configSchema:p.configSchema,model:t.model??"",...t.resolvedModel?{resolvedModel:t.resolvedModel}:{},...t.resolvedEffort?{resolvedEffort:t.resolvedEffort}:{},effort:t.effort??"",permissionMode:t.permissionMode??"",onPatch:L}):null})})})}),E&&h.jsx("button",{type:"button",onClick:P=>{P.stopPropagation(),s()},className:"absolute top-1.5 right-1.5 z-10 p-1 rounded-md bg-bg-100/80 backdrop-blur-sm border border-border opacity-0 group-hover/pane:opacity-100 transition-opacity text-text-400 hover:text-text-100 hover:bg-bg-200","aria-label":"close pane","data-testid":`session-pane-close-${t.sessionId}`,children:h.jsx(Jr,{className:"w-3.5 h-3.5"})})]})}function ide({api:e,session:t,focused:n,liveGitBranch:r,liveWorktreeRoot:i,cloudVolume:s,onNewSession:o,onTurnEnd:a,onOpenConfig:l,onFork:c,onQuickAsk:u,viewerRole:d,configSlot:f,hideHeader:p}){return h.jsx(Oue,{extras:{session:t,api:e,focused:n,...r!==void 0?{liveGitBranch:r}:{},...i!==void 0?{liveWorktreeRoot:i}:{},...s!==void 0?{cloudVolume:s}:{},onNewSession:o,onTurnEnd:a,onOpenConfig:l,...c?{onFork:m=>{c(m)}}:{},...u?{onQuickAsk:m=>{u(m)}}:{},...d?{viewerRole:d}:{},...f?{configSlot:f}:{},...p?{hideHeader:p}:{}}})}function sde({personas:e,sessions:t,api:n,selfPrincipalId:r,selectedPersonaId:i,selectedSessionId:s,selectedSession:o,onSelectPersona:a,onSelectSession:l,onCreateSession:c,onDeleteSession:u,onEditSession:d,onCloseSession:f}){return h.jsxs("div",{className:"flex h-screen min-h-0 bg-bg-50","data-testid":"guest-share-page",children:[h.jsx("aside",{className:"w-[280px] shrink-0 overflow-y-auto border-r border-border bg-bg-50",children:h.jsx(AK,{personas:e,sessions:t,activePersonaId:i,activeSessionId:s,onSelectPersona:a,onSelectSession:l,onCreateSession:c,onDeleteSession:u,onEditSession:d,showCopyResume:!1,treatSessionsAsRoots:!0,...r?{ownerPrincipalId:r}:{},isPersonaExpanded:()=>!0})}),h.jsx("main",{className:"flex-1 min-w-0 min-h-0 flex",children:o?h.jsx(rde,{api:n,session:o,focused:!0,totalPanes:1,onFocus:()=>{},onClose:f,onNewSession:()=>{},onOpenConfig:()=>{},viewerRole:"guest"}):h.jsx("div",{className:"flex flex-1 items-center justify-center p-6 text-xs text-text-400","data-testid":"guest-share-empty",children:"选择左侧 persona 开始对话"})})]})}function ode(){const e=Ti(),t=g.useMemo(()=>new Zp(e),[e]),n=jz(e),{sessions:r,refresh:i}=Lz(n),{personas:s}=QT(),o=Fz(),a=g.useMemo(()=>{const S=window.location.pathname.match(/^\/s\/([^/]+)/);return S?decodeURIComponent(S[1]):null},[]),l=g.useMemo(()=>r.filter(S=>!S.ephemeral&&S.larkChatId==null),[r]),c=g.useMemo(()=>a?s.filter(S=>S.personaId===a):s,[s,a]),[u,d]=g.useState(null),[f,p]=g.useState(null),[m,x]=g.useState(null);g.useEffect(()=>{let S=!1;return e.request("whoami",{}).then(C=>{S||d(C.capability.id)}).catch(()=>{}),()=>{S=!0}},[e]),g.useEffect(()=>{a&&p(a)},[a]);const w=g.useCallback(async(S,C)=>{const k=await t.sessionCreate({ownerPersonaId:S,...C.trim()?{label:C.trim()}:{}});await i(),p(S),x(k.sessionId)},[t,i]),v=g.useCallback(async S=>{await t.sessionDelete(S),await i(),x(C=>C===S?null:C)},[t,i]),_=g.useCallback(async(S,C)=>{await t.sessionUpdate(S,{label:C.label}),await i()},[t,i]),b=g.useMemo(()=>l.find(S=>S.sessionId===m)??null,[l,m]);return h.jsx(Zy.Provider,{value:o,children:h.jsx(sde,{personas:c,sessions:l,api:t,selfPrincipalId:u,selectedPersonaId:f,selectedSessionId:m,selectedSession:b,onSelectPersona:p,onSelectSession:x,onCreateSession:(S,C)=>void w(S,C),onDeleteSession:S=>void v(S),onEditSession:(S,C)=>void _(S,C),onCloseSession:()=>x(null)})})}const AE="https://app.ttcadvisory.com";function ade({onAuthed:e}){const[t,n]=g.useState(!1),[r,i]=g.useState(null),s=g.useRef(null);g.useEffect(()=>()=>{s.current&&window.removeEventListener("message",s.current)},[]);const o=g.useCallback(()=>{s.current&&(window.removeEventListener("message",s.current),s.current=null),n(!0),i(null);const a=window.location.origin,l=`${AE}/auth/authorize?callback_url=${encodeURIComponent(a)}&auto=1`,c=async d=>{if(d.origin!==AE)return;const f=d.data;if((f==null?void 0:f.type)==="AUTH_CANCEL"){u(),n(!1);return}if(!((f==null?void 0:f.type)!=="AUTH_SUCCESS"||!f.token)){u();try{const p=await fetch(`${window.location.origin}/share/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ttcToken:f.token})});if(!p.ok){const x=await p.json().catch(()=>({}));throw new Error(x.code??`exchange failed (${p.status})`)}const m=await p.json();if(!m.visitorToken)throw new Error("no visitorToken in response");e(m.visitorToken)}catch(p){i(p instanceof Error?p.message:String(p)),n(!1)}}},u=()=>{window.removeEventListener("message",c),s.current=null};s.current=d=>void c(d),window.addEventListener("message",s.current),window.open(l,"ttc-login","width=480,height=640")},[e]);return h.jsx("div",{className:"flex min-h-screen items-center justify-center bg-bg-50 p-6 font-sans text-text-100","data-testid":"guest-login",children:h.jsxs("div",{className:"flex w-full max-w-xs flex-col gap-3 rounded-lg border border-border bg-bg-100 px-5 py-6",children:[h.jsx("h1",{className:"text-base font-semibold",children:"登录后进入分享"}),h.jsx("p",{className:"text-[11px] leading-snug text-text-400",children:"使用飞书账号登录,即可在浏览器里与分享给你的 persona 交互,无需安装。"}),r?h.jsxs("p",{className:"text-[11px] leading-snug text-error","data-testid":"guest-login-error",children:["登录失败:",r]}):null,h.jsx("button",{type:"button",disabled:t,onClick:()=>o(),"data-testid":"guest-login-button",className:"w-full rounded border border-border bg-bg-50 px-2 py-1.5 text-xs text-text-200 transition-colors hover:bg-text-100/5 hover:text-text-100 disabled:opacity-50",children:t?"请在弹窗中完成授权…":"飞书登录"})]})})}const I1="clawd-visitor:token";function lde(e,t){const r=`${e.protocol==="https:"?"wss:":"ws:"}//${e.host}`;return t!=null&&t.devPath?`${r}${t.devPath}`:r}function cde(){return{async getUrl(e){const t=localStorage.getItem(I1);if(!t)throw new Error("NO_VISITOR_TOKEN");const n=lde(window.location,{});return await UT(e).upsert({id:"guest",name:"访客",mode:"remote",url:n,token:t}),{url:n}}}}function ude(e){const t=n=>{document.documentElement.classList.toggle("dark",n==="dark")};return t(e.theme.mode),e.onThemeChange(n=>t(n.mode))}function dde(){const e=Ti(),t=g.useMemo(()=>Mz(e),[e]);return h.jsx(pz,{cache:t.cache,children:h.jsx(vz,{children:h.jsx(ode,{})})})}function hde({host:e}){const[t]=g.useState(()=>localStorage.getItem(I1)),[n,r]=g.useState(!1),[i,s]=g.useState(null);return g.useEffect(()=>ude(e),[e]),g.useEffect(()=>{if(!t)return;let o=!1;return cde().getUrl(e).then(()=>{o||r(!0)}).catch(a=>{o||s(a instanceof Error?a.message:String(a))}),()=>{o=!0}},[e,t]),t?h.jsx(Yw,{host:e,children:h.jsx(NS,{children:i?h.jsxs("div",{className:"flex min-h-screen items-center justify-center bg-bg-50 p-6 text-center text-xs text-error","data-testid":"guest-share-connect-error",children:["连接失败:",i]}):n?h.jsx(dz,{host:e,children:h.jsx(dde,{})}):h.jsx("div",{className:"flex min-h-screen items-center justify-center bg-bg-50 p-6 text-xs text-text-400",children:"正在连接…"})})}):h.jsx(Yw,{host:e,children:h.jsx(NS,{children:h.jsx(ade,{onAuthed:o=>{localStorage.setItem(I1,o),window.location.reload()}})})})}function fde({filePath:e,oldString:t,newString:n,content:r}){const i=g.useMemo(()=>r!=null?r.split(/\r?\n/).map(s=>({type:"add",text:s})):pde(t??"",n??""),[t,n,r]);return h.jsxs("div",{"data-testid":"inline-diff",className:"min-w-0 max-w-full rounded-lg border border-bg-300/60 bg-bg-50 overflow-hidden text-[12px] font-mono",children:[h.jsx("div",{className:"flex min-w-0 items-center gap-2 px-3 py-1.5 border-b border-bg-300/40 bg-bg-100/30",children:h.jsx("span",{className:"min-w-0 text-text-400 truncate",title:e,children:e})}),h.jsx("div",{className:"max-h-[320px] max-w-full overflow-auto",children:i.map((s,o)=>h.jsxs("div",{"data-testid":`diff-line-${s.type}`,className:re("flex min-w-max gap-2 px-3 py-0.5 whitespace-pre",s.type==="add"?"bg-success/10 text-success":s.type==="remove"?"bg-error/10 text-error":"text-text-300"),children:[h.jsx("span",{className:"w-3 shrink-0 select-none opacity-60",children:s.type==="add"?"+":s.type==="remove"?"-":" "}),h.jsx("span",{className:"flex-1",children:s.text||" "})]},o))})]})}function pde(e,t){const n=e.split(/\r?\n/),r=t.split(/\r?\n/),i=n.length,s=r.length,o=Array.from({length:i+1},()=>new Array(s+1).fill(0));for(let u=i-1;u>=0;u--)for(let d=s-1;d>=0;d--)o[u][d]=n[u]===r[d]?o[u+1][d+1]+1:Math.max(o[u+1][d],o[u][d+1]);const a=[];let l=0,c=0;for(;l<i&&c<s;)n[l]===r[c]?(a.push({type:"equal",text:n[l]}),l++,c++):o[l+1][c]>=o[l][c+1]?(a.push({type:"remove",text:n[l]}),l++):(a.push({type:"add",text:r[c]}),c++);for(;l<i;)a.push({type:"remove",text:n[l++]});for(;c<s;)a.push({type:"add",text:r[c++]});return a}function mde({items:e}){return e.length===0?null:h.jsxs("div",{"data-testid":"todo-checklist",className:"rounded-lg border border-bg-300/60 bg-bg-50 px-3 py-2 text-[13px]",children:[h.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-text-400/70 mb-1.5",children:"Todos"}),h.jsx("ul",{className:"flex flex-col gap-1",children:e.map((t,n)=>{const r=t.status==="in_progress"&&t.activeForm||t.content;return h.jsxs("li",{"data-testid":`todo-item-${t.status}`,className:"flex items-start gap-2",children:[h.jsx(gde,{status:t.status}),h.jsx("span",{className:re("flex-1 leading-snug",t.status==="completed"?"text-text-400 line-through":t.status==="in_progress"?"text-text-100 font-medium":"text-text-200"),children:r})]},n)})})]})}function gde({status:e}){return e==="completed"?h.jsx(Qy,{className:"w-3.5 h-3.5 text-success mt-0.5 shrink-0"}):e==="in_progress"?h.jsx(Tn,{className:"w-3.5 h-3.5 text-warning mt-0.5 shrink-0 animate-spin"}):h.jsx(x7,{className:"w-3.5 h-3.5 text-text-400 mt-0.5 shrink-0"})}function vde(e){const t=e??{};return Array.isArray(t.todos)?t.todos.map(n=>{if(!n||typeof n!="object")return null;const r=n,i=typeof r.content=="string"?r.content:"",s=r.status==="pending"||r.status==="in_progress"||r.status==="completed"?r.status:"pending",o=typeof r.activeForm=="string"?r.activeForm:void 0;return{content:i,status:s,activeForm:o}}).filter(n=>n!==null):[]}function xde({description:e,prompt:t,subagentType:n}){return h.jsxs("div",{"data-testid":"task-checklist",className:"rounded-lg border border-bg-300/60 bg-bg-50 px-3 py-2 text-[13px]",children:[h.jsxs("div",{className:"flex items-center gap-2 text-text-200 font-medium",children:[h.jsx(Qp,{className:"w-3.5 h-3.5 text-accent shrink-0"}),h.jsx("span",{className:"truncate",children:e||"subagent task"}),n?h.jsx("span",{className:"shrink-0 px-1.5 py-0.5 rounded-md text-[10px] font-mono bg-accent/10 text-accent",children:n}):null]}),t?h.jsx("div",{className:"mt-1 text-[12px] text-text-400 leading-snug line-clamp-3",children:t}):null]})}function yde(e){const t=e??{};return{description:typeof t.description=="string"?t.description:"",prompt:typeof t.prompt=="string"?t.prompt:void 0,subagentType:typeof t.subagent_type=="string"?t.subagent_type:void 0}}const _de={render:({input:e})=>Qe.createElement(mde,{items:vde(e)})},bde={render:({input:e})=>{const{description:t,prompt:n,subagentType:r}=yde(e);return Qe.createElement(xde,{description:t,prompt:n,subagentType:r})}},ME={render:({input:e,output:t,error:n,pending:r,fileScope:i,onShareFile:s,onOpenInTab:o,onPreviewMarkdown:a})=>{const l=Sde(e),c=l?Qe.createElement(fde,{filePath:l.filePath,oldString:l.oldString,newString:l.newString,content:l.content}):void 0;return Qe.createElement(xA,{tool:wde(e),input:e,output:t,error:n,pending:r,expandedBody:c,...i?{fileScope:i}:{},...s?{onShareFile:s}:{},...o?{onOpenInTab:o}:{},...a?{onPreviewMarkdown:a}:{}})}};function wde(e){const t=e??{};return"content"in t&&t.content!==void 0?"Write":("old_string"in t&&t.old_string!==void 0,"Edit")}function Sde(e){const t=e??{},n=typeof t.file_path=="string"?t.file_path:null;if(!n)return null;const r=typeof t.old_string=="string"?t.old_string:void 0,i=typeof t.new_string=="string"?t.new_string:void 0,s=typeof t.content=="string"?t.content:void 0;return r==null&&i==null&&s==null?null:{filePath:n,oldString:r,newString:i,content:s}}for(const e of["claude",n9])$a.register(e,"TodoWrite",_de),$a.register(e,"Task",bde),$a.register(e,"Edit",ME),$a.register(e,"Write",ME);const kj=document.getElementById("root");if(!kj)throw new Error("guest-main: #root not found");const kde=iO({});k0.createRoot(kj).render(h.jsx(Qe.StrictMode,{children:h.jsx(hde,{host:kde})}));
|