@idl3/claude-control 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/codex.js +496 -0
- package/lib/config.js +36 -3
- package/lib/sessions.js +70 -10
- package/lib/transcript.js +5 -4
- package/package.json +1 -1
- package/server.js +124 -13
- package/web/dist/assets/{core-CEtbx-dx.js → core-CpT6tRRG.js} +1 -1
- package/web/dist/assets/index-CjOcrKRX.css +1 -0
- package/web/dist/assets/index-CxhR0MPg.js +103 -0
- package/web/dist/index.html +2 -2
- package/web/dist/assets/index-CjJtW-Kv.css +0 -1
- package/web/dist/assets/index-DFru8Gzx.js +0 -103
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
var wC=Object.defineProperty;var _C=(e,t,n)=>t in e?wC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var N=(e,t,n)=>_C(e,typeof t!="symbol"?t+"":t,n);function bC(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}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 s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var tu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Va(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ux={exports:{}},ec={},Vx={exports:{}},we={};/**
|
|
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 Ha=Symbol.for("react.element"),SC=Symbol.for("react.portal"),kC=Symbol.for("react.fragment"),CC=Symbol.for("react.strict_mode"),EC=Symbol.for("react.profiler"),TC=Symbol.for("react.provider"),IC=Symbol.for("react.context"),RC=Symbol.for("react.forward_ref"),PC=Symbol.for("react.suspense"),jC=Symbol.for("react.memo"),AC=Symbol.for("react.lazy"),Um=Symbol.iterator;function NC(e){return e===null||typeof e!="object"?null:(e=Um&&e[Um]||e["@@iterator"],typeof e=="function"?e:null)}var Hx={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Wx=Object.assign,qx={};function ho(e,t,n){this.props=e,this.context=t,this.refs=qx,this.updater=n||Hx}ho.prototype.isReactComponent={};ho.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")};ho.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Kx(){}Kx.prototype=ho.prototype;function Ih(e,t,n){this.props=e,this.context=t,this.refs=qx,this.updater=n||Hx}var Rh=Ih.prototype=new Kx;Rh.constructor=Ih;Wx(Rh,ho.prototype);Rh.isPureReactComponent=!0;var Vm=Array.isArray,Gx=Object.prototype.hasOwnProperty,Ph={current:null},Yx={key:!0,ref:!0,__self:!0,__source:!0};function Qx(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)Gx.call(t,r)&&!Yx.hasOwnProperty(r)&&(s[r]=t[r]);var a=arguments.length-2;if(a===1)s.children=n;else if(1<a){for(var l=Array(a),u=0;u<a;u++)l[u]=arguments[u+2];s.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)s[r]===void 0&&(s[r]=a[r]);return{$$typeof:Ha,type:e,key:i,ref:o,props:s,_owner:Ph.current}}function MC(e,t){return{$$typeof:Ha,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function jh(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ha}function DC(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Hm=/\/+/g;function Oc(e,t){return typeof e=="object"&&e!==null&&e.key!=null?DC(""+e.key):t.toString(36)}function Dl(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Ha:case SC:o=!0}}if(o)return o=e,s=s(o),e=r===""?"."+Oc(o,0):r,Vm(s)?(n="",e!=null&&(n=e.replace(Hm,"$&/")+"/"),Dl(s,t,n,"",function(u){return u})):s!=null&&(jh(s)&&(s=MC(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(Hm,"$&/")+"/")+e)),t.push(s)),1;if(o=0,r=r===""?".":r+":",Vm(e))for(var a=0;a<e.length;a++){i=e[a];var l=r+Oc(i,a);o+=Dl(i,t,n,l,s)}else if(l=NC(e),typeof l=="function")for(e=l.call(e),a=0;!(i=e.next()).done;)i=i.value,l=r+Oc(i,a++),o+=Dl(i,t,n,l,s);else if(i==="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 rl(e,t,n){if(e==null)return e;var r=[],s=0;return Dl(e,r,"","",function(i){return t.call(n,i,s++)}),r}function LC(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 Vt={current:null},Ll={transition:null},OC={ReactCurrentDispatcher:Vt,ReactCurrentBatchConfig:Ll,ReactCurrentOwner:Ph};function Xx(){throw Error("act(...) is not supported in production builds of React.")}we.Children={map:rl,forEach:function(e,t,n){rl(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return rl(e,function(){t++}),t},toArray:function(e){return rl(e,function(t){return t})||[]},only:function(e){if(!jh(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};we.Component=ho;we.Fragment=kC;we.Profiler=EC;we.PureComponent=Ih;we.StrictMode=CC;we.Suspense=PC;we.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=OC;we.act=Xx;we.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=Wx({},e.props),s=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=Ph.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)Gx.call(t,l)&&!Yx.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 u=0;u<l;u++)a[u]=arguments[u+2];r.children=a}return{$$typeof:Ha,type:e.type,key:s,ref:i,props:r,_owner:o}};we.createContext=function(e){return e={$$typeof:IC,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:TC,_context:e},e.Consumer=e};we.createElement=Qx;we.createFactory=function(e){var t=Qx.bind(null,e);return t.type=e,t};we.createRef=function(){return{current:null}};we.forwardRef=function(e){return{$$typeof:RC,render:e}};we.isValidElement=jh;we.lazy=function(e){return{$$typeof:AC,_payload:{_status:-1,_result:e},_init:LC}};we.memo=function(e,t){return{$$typeof:jC,type:e,compare:t===void 0?null:t}};we.startTransition=function(e){var t=Ll.transition;Ll.transition={};try{e()}finally{Ll.transition=t}};we.unstable_act=Xx;we.useCallback=function(e,t){return Vt.current.useCallback(e,t)};we.useContext=function(e){return Vt.current.useContext(e)};we.useDebugValue=function(){};we.useDeferredValue=function(e){return Vt.current.useDeferredValue(e)};we.useEffect=function(e,t){return Vt.current.useEffect(e,t)};we.useId=function(){return Vt.current.useId()};we.useImperativeHandle=function(e,t,n){return Vt.current.useImperativeHandle(e,t,n)};we.useInsertionEffect=function(e,t){return Vt.current.useInsertionEffect(e,t)};we.useLayoutEffect=function(e,t){return Vt.current.useLayoutEffect(e,t)};we.useMemo=function(e,t){return Vt.current.useMemo(e,t)};we.useReducer=function(e,t,n){return Vt.current.useReducer(e,t,n)};we.useRef=function(e){return Vt.current.useRef(e)};we.useState=function(e){return Vt.current.useState(e)};we.useSyncExternalStore=function(e,t,n){return Vt.current.useSyncExternalStore(e,t,n)};we.useTransition=function(){return Vt.current.useTransition()};we.version="18.3.1";Vx.exports=we;var m=Vx.exports;const Jt=Va(m),zC=bC({__proto__:null,default:Jt},[m]);/**
|
|
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 FC=m,BC=Symbol.for("react.element"),$C=Symbol.for("react.fragment"),UC=Object.prototype.hasOwnProperty,VC=FC.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,HC={key:!0,ref:!0,__self:!0,__source:!0};function Jx(e,t,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)UC.call(t,r)&&!HC.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:BC,type:e,key:i,ref:o,props:s,_owner:VC.current}}ec.Fragment=$C;ec.jsx=Jx;ec.jsxs=Jx;Ux.exports=ec;var d=Ux.exports,Zx={exports:{}},In={},ew={exports:{}},tw={};/**
|
|
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,z){var b=B.length;B.push(z);e:for(;0<b;){var H=b-1>>>1,X=B[H];if(0<s(X,z))B[H]=z,B[b]=X,b=H;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var z=B[0],b=B.pop();if(b!==z){B[0]=b;e:for(var H=0,X=B.length,I=X>>>1;H<I;){var de=2*(H+1)-1,Se=B[de],me=de+1,nt=B[me];if(0>s(Se,b))me<X&&0>s(nt,Se)?(B[H]=nt,B[me]=b,H=me):(B[H]=Se,B[de]=b,H=de);else if(me<X&&0>s(nt,b))B[H]=nt,B[me]=b,H=me;else break e}}return z}function s(B,z){var b=B.sortIndex-z.sortIndex;return b!==0?b:B.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],u=[],c=1,f=null,h=3,p=!1,g=!1,y=!1,_=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(B){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=B)r(u),z.sortIndex=z.expirationTime,t(l,z);else break;z=n(u)}}function C(B){if(y=!1,w(B),!g)if(n(l)!==null)g=!0,J(S);else{var z=n(u);z!==null&&te(C,z.startTime-B)}}function S(B,z){g=!1,y&&(y=!1,x(R),R=-1),p=!0;var b=h;try{for(w(z),f=n(l);f!==null&&(!(f.expirationTime>z)||B&&!M());){var H=f.callback;if(typeof H=="function"){f.callback=null,h=f.priorityLevel;var X=H(f.expirationTime<=z);z=e.unstable_now(),typeof X=="function"?f.callback=X:f===n(l)&&r(l),w(z)}else r(l);f=n(l)}if(f!==null)var I=!0;else{var de=n(u);de!==null&&te(C,de.startTime-z),I=!1}return I}finally{f=null,h=b,p=!1}}var k=!1,T=null,R=-1,P=5,E=-1;function M(){return!(e.unstable_now()-E<P)}function D(){if(T!==null){var B=e.unstable_now();E=B;var z=!0;try{z=T(!0,B)}finally{z?$():(k=!1,T=null)}}else k=!1}var $;if(typeof v=="function")$=function(){v(D)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,V=U.port2;U.port1.onmessage=D,$=function(){V.postMessage(null)}}else $=function(){_(D,0)};function J(B){T=B,k||(k=!0,$())}function te(B,z){R=_(function(){B(e.unstable_now())},z)}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(B){B.callback=null},e.unstable_continueExecution=function(){g||p||(g=!0,J(S))},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(B){switch(h){case 1:case 2:case 3:var z=3;break;default:z=h}var b=h;h=z;try{return B()}finally{h=b}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(B,z){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var b=h;h=B;try{return z()}finally{h=b}},e.unstable_scheduleCallback=function(B,z,b){var H=e.unstable_now();switch(typeof b=="object"&&b!==null?(b=b.delay,b=typeof b=="number"&&0<b?H+b:H):b=H,B){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=b+X,B={id:c++,callback:z,priorityLevel:B,startTime:b,expirationTime:X,sortIndex:-1},b>H?(B.sortIndex=b,t(u,B),n(l)===null&&B===n(u)&&(y?(x(R),R=-1):y=!0,te(C,b-H))):(B.sortIndex=X,t(l,B),g||p||(g=!0,J(S))),B},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(B){var z=h;return function(){var b=h;h=z;try{return B.apply(this,arguments)}finally{h=b}}}})(tw);ew.exports=tw;var WC=ew.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 qC=m,kn=WC;function W(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 nw=new Set,da={};function ai(e,t){Yi(e,t),Yi(e+"Capture",t)}function Yi(e,t){for(da[e]=t,e=0;e<t.length;e++)nw.add(t[e])}var Br=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Vd=Object.prototype.hasOwnProperty,KC=/^[: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]*$/,Wm={},qm={};function GC(e){return Vd.call(qm,e)?!0:Vd.call(Wm,e)?!1:KC.test(e)?qm[e]=!0:(Wm[e]=!0,!1)}function YC(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 QC(e,t,n,r){if(t===null||typeof t>"u"||YC(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 Ht(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var Ct={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ct[e]=new Ht(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ct[t]=new Ht(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ct[e]=new Ht(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ct[e]=new Ht(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){Ct[e]=new Ht(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ct[e]=new Ht(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ct[e]=new Ht(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ct[e]=new Ht(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ct[e]=new Ht(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ah=/[\-:]([a-z])/g;function Nh(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(Ah,Nh);Ct[t]=new Ht(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(Ah,Nh);Ct[t]=new Ht(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(Ah,Nh);Ct[t]=new Ht(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ct[e]=new Ht(e,1,!1,e.toLowerCase(),null,!1,!1)});Ct.xlinkHref=new Ht("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ct[e]=new Ht(e,1,!1,e.toLowerCase(),null,!0,!0)});function Mh(e,t,n,r){var s=Ct.hasOwnProperty(t)?Ct[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(QC(t,n,s,r)&&(n=null),r||s===null?GC(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):s.mustUseProperty?e[s.propertyName]=n===null?s.type===3?!1:"":n:(t=s.attributeName,r=s.attributeNamespace,n===null?e.removeAttribute(t):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var qr=qC.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,sl=Symbol.for("react.element"),ki=Symbol.for("react.portal"),Ci=Symbol.for("react.fragment"),Dh=Symbol.for("react.strict_mode"),Hd=Symbol.for("react.profiler"),rw=Symbol.for("react.provider"),sw=Symbol.for("react.context"),Lh=Symbol.for("react.forward_ref"),Wd=Symbol.for("react.suspense"),qd=Symbol.for("react.suspense_list"),Oh=Symbol.for("react.memo"),Jr=Symbol.for("react.lazy"),iw=Symbol.for("react.offscreen"),Km=Symbol.iterator;function Eo(e){return e===null||typeof e!="object"?null:(e=Km&&e[Km]||e["@@iterator"],typeof e=="function"?e:null)}var Je=Object.assign,zc;function zo(e){if(zc===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);zc=t&&t[1]||""}return`
|
|
34
|
+
`+zc+e}var Fc=!1;function Bc(e,t){if(!e||Fc)return"";Fc=!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(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(`
|
|
35
|
+
`),i=r.stack.split(`
|
|
36
|
+
`),o=s.length-1,a=i.length-1;1<=o&&0<=a&&s[o]!==i[a];)a--;for(;1<=o&&0<=a;o--,a--)if(s[o]!==i[a]){if(o!==1||a!==1)do if(o--,a--,0>a||s[o]!==i[a]){var l=`
|
|
37
|
+
`+s[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{Fc=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?zo(e):""}function XC(e){switch(e.tag){case 5:return zo(e.type);case 16:return zo("Lazy");case 13:return zo("Suspense");case 19:return zo("SuspenseList");case 0:case 2:case 15:return e=Bc(e.type,!1),e;case 11:return e=Bc(e.type.render,!1),e;case 1:return e=Bc(e.type,!0),e;default:return""}}function Kd(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 Ci:return"Fragment";case ki:return"Portal";case Hd:return"Profiler";case Dh:return"StrictMode";case Wd:return"Suspense";case qd:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case sw:return(e.displayName||"Context")+".Consumer";case rw:return(e._context.displayName||"Context")+".Provider";case Lh:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Oh:return t=e.displayName||null,t!==null?t:Kd(e.type)||"Memo";case Jr:t=e._payload,e=e._init;try{return Kd(e(t))}catch{}}return null}function JC(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 Kd(t);case 8:return t===Dh?"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 ws(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ow(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ZC(e){var t=ow(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 s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.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 il(e){e._valueTracker||(e._valueTracker=ZC(e))}function aw(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ow(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function nu(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 Gd(e,t){var n=t.checked;return Je({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Gm(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ws(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 lw(e,t){t=t.checked,t!=null&&Mh(e,"checked",t,!1)}function Yd(e,t){lw(e,t);var n=ws(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")?Qd(e,t.type,n):t.hasOwnProperty("defaultValue")&&Qd(e,t.type,ws(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ym(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 Qd(e,t,n){(t!=="number"||nu(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Fo=Array.isArray;function zi(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ws(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Xd(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(W(91));return Je({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Qm(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(W(92));if(Fo(n)){if(1<n.length)throw Error(W(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ws(n)}}function uw(e,t){var n=ws(t.value),r=ws(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 Xm(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function cw(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 Jd(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?cw(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ol,dw=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(ol=ol||document.createElement("div"),ol.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ol.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function fa(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ho={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},eE=["Webkit","ms","Moz","O"];Object.keys(Ho).forEach(function(e){eE.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ho[t]=Ho[e]})});function fw(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ho.hasOwnProperty(e)&&Ho[e]?(""+t).trim():t+"px"}function hw(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=fw(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var tE=Je({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 Zd(e,t){if(t){if(tE[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(W(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(W(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(W(61))}if(t.style!=null&&typeof t.style!="object")throw Error(W(62))}}function ef(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 tf=null;function zh(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var nf=null,Fi=null,Bi=null;function Jm(e){if(e=Ka(e)){if(typeof nf!="function")throw Error(W(280));var t=e.stateNode;t&&(t=ic(t),nf(e.stateNode,e.type,t))}}function pw(e){Fi?Bi?Bi.push(e):Bi=[e]:Fi=e}function mw(){if(Fi){var e=Fi,t=Bi;if(Bi=Fi=null,Jm(e),t)for(e=0;e<t.length;e++)Jm(t[e])}}function gw(e,t){return e(t)}function yw(){}var $c=!1;function vw(e,t,n){if($c)return e(t,n);$c=!0;try{return gw(e,t,n)}finally{$c=!1,(Fi!==null||Bi!==null)&&(yw(),mw())}}function ha(e,t){var n=e.stateNode;if(n===null)return null;var r=ic(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(W(231,t,typeof n));return n}var rf=!1;if(Br)try{var To={};Object.defineProperty(To,"passive",{get:function(){rf=!0}}),window.addEventListener("test",To,To),window.removeEventListener("test",To,To)}catch{rf=!1}function nE(e,t,n,r,s,i,o,a,l){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(c){this.onError(c)}}var Wo=!1,ru=null,su=!1,sf=null,rE={onError:function(e){Wo=!0,ru=e}};function sE(e,t,n,r,s,i,o,a,l){Wo=!1,ru=null,nE.apply(rE,arguments)}function iE(e,t,n,r,s,i,o,a,l){if(sE.apply(this,arguments),Wo){if(Wo){var u=ru;Wo=!1,ru=null}else throw Error(W(198));su||(su=!0,sf=u)}}function li(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 xw(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 Zm(e){if(li(e)!==e)throw Error(W(188))}function oE(e){var t=e.alternate;if(!t){if(t=li(e),t===null)throw Error(W(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return Zm(s),e;if(i===r)return Zm(s),t;i=i.sibling}throw Error(W(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,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){for(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)throw Error(W(189))}}if(n.alternate!==r)throw Error(W(190))}if(n.tag!==3)throw Error(W(188));return n.stateNode.current===n?e:t}function ww(e){return e=oE(e),e!==null?_w(e):null}function _w(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=_w(e);if(t!==null)return t;e=e.sibling}return null}var bw=kn.unstable_scheduleCallback,eg=kn.unstable_cancelCallback,aE=kn.unstable_shouldYield,lE=kn.unstable_requestPaint,at=kn.unstable_now,uE=kn.unstable_getCurrentPriorityLevel,Fh=kn.unstable_ImmediatePriority,Sw=kn.unstable_UserBlockingPriority,iu=kn.unstable_NormalPriority,cE=kn.unstable_LowPriority,kw=kn.unstable_IdlePriority,tc=null,vr=null;function dE(e){if(vr&&typeof vr.onCommitFiberRoot=="function")try{vr.onCommitFiberRoot(tc,e,void 0,(e.current.flags&128)===128)}catch{}}var tr=Math.clz32?Math.clz32:pE,fE=Math.log,hE=Math.LN2;function pE(e){return e>>>=0,e===0?32:31-(fE(e)/hE|0)|0}var al=64,ll=4194304;function Bo(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 ou(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~s;a!==0?r=Bo(a):(i&=o,i!==0&&(r=Bo(i)))}else o=n&~s,o!==0?r=Bo(o):i!==0&&(r=Bo(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-tr(t),s=1<<n,r|=e[n],t&=~s;return r}function mE(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 gE(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-tr(i),a=1<<o,l=s[o];l===-1?(!(a&n)||a&r)&&(s[o]=mE(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}}function of(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Cw(){var e=al;return al<<=1,!(al&4194240)&&(al=64),e}function Uc(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Wa(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-tr(t),e[t]=n}function yE(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 s=31-tr(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function Bh(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-tr(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var Re=0;function Ew(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Tw,$h,Iw,Rw,Pw,af=!1,ul=[],us=null,cs=null,ds=null,pa=new Map,ma=new Map,ts=[],vE="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 tg(e,t){switch(e){case"focusin":case"focusout":us=null;break;case"dragenter":case"dragleave":cs=null;break;case"mouseover":case"mouseout":ds=null;break;case"pointerover":case"pointerout":pa.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ma.delete(t.pointerId)}}function Io(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=Ka(t),t!==null&&$h(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function xE(e,t,n,r,s){switch(t){case"focusin":return us=Io(us,e,t,n,r,s),!0;case"dragenter":return cs=Io(cs,e,t,n,r,s),!0;case"mouseover":return ds=Io(ds,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return pa.set(i,Io(pa.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,ma.set(i,Io(ma.get(i)||null,e,t,n,r,s)),!0}return!1}function jw(e){var t=$s(e.target);if(t!==null){var n=li(t);if(n!==null){if(t=n.tag,t===13){if(t=xw(n),t!==null){e.blockedOn=t,Pw(e.priority,function(){Iw(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 Ol(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=lf(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);tf=r,n.target.dispatchEvent(r),tf=null}else return t=Ka(n),t!==null&&$h(t),e.blockedOn=n,!1;t.shift()}return!0}function ng(e,t,n){Ol(e)&&n.delete(t)}function wE(){af=!1,us!==null&&Ol(us)&&(us=null),cs!==null&&Ol(cs)&&(cs=null),ds!==null&&Ol(ds)&&(ds=null),pa.forEach(ng),ma.forEach(ng)}function Ro(e,t){e.blockedOn===t&&(e.blockedOn=null,af||(af=!0,kn.unstable_scheduleCallback(kn.unstable_NormalPriority,wE)))}function ga(e){function t(s){return Ro(s,e)}if(0<ul.length){Ro(ul[0],e);for(var n=1;n<ul.length;n++){var r=ul[n];r.blockedOn===e&&(r.blockedOn=null)}}for(us!==null&&Ro(us,e),cs!==null&&Ro(cs,e),ds!==null&&Ro(ds,e),pa.forEach(t),ma.forEach(t),n=0;n<ts.length;n++)r=ts[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<ts.length&&(n=ts[0],n.blockedOn===null);)jw(n),n.blockedOn===null&&ts.shift()}var $i=qr.ReactCurrentBatchConfig,au=!0;function _E(e,t,n,r){var s=Re,i=$i.transition;$i.transition=null;try{Re=1,Uh(e,t,n,r)}finally{Re=s,$i.transition=i}}function bE(e,t,n,r){var s=Re,i=$i.transition;$i.transition=null;try{Re=4,Uh(e,t,n,r)}finally{Re=s,$i.transition=i}}function Uh(e,t,n,r){if(au){var s=lf(e,t,n,r);if(s===null)Jc(e,t,r,lu,n),tg(e,r);else if(xE(s,e,t,n,r))r.stopPropagation();else if(tg(e,r),t&4&&-1<vE.indexOf(e)){for(;s!==null;){var i=Ka(s);if(i!==null&&Tw(i),i=lf(e,t,n,r),i===null&&Jc(e,t,r,lu,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Jc(e,t,r,null,n)}}var lu=null;function lf(e,t,n,r){if(lu=null,e=zh(r),e=$s(e),e!==null)if(t=li(e),t===null)e=null;else if(n=t.tag,n===13){if(e=xw(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 lu=e,null}function Aw(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(uE()){case Fh:return 1;case Sw:return 4;case iu:case cE:return 16;case kw:return 536870912;default:return 16}default:return 16}}var ss=null,Vh=null,zl=null;function Nw(){if(zl)return zl;var e,t=Vh,n=t.length,r,s="value"in ss?ss.value:ss.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===s[i-r];r++);return zl=s.slice(e,1<r?1-r:void 0)}function Fl(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 cl(){return!0}function rg(){return!1}function Rn(e){function t(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?cl:rg,this.isPropagationStopped=rg,this}return Je(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=cl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=cl)},persist:function(){},isPersistent:cl}),t}var po={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hh=Rn(po),qa=Je({},po,{view:0,detail:0}),SE=Rn(qa),Vc,Hc,Po,nc=Je({},qa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wh,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!==Po&&(Po&&e.type==="mousemove"?(Vc=e.screenX-Po.screenX,Hc=e.screenY-Po.screenY):Hc=Vc=0,Po=e),Vc)},movementY:function(e){return"movementY"in e?e.movementY:Hc}}),sg=Rn(nc),kE=Je({},nc,{dataTransfer:0}),CE=Rn(kE),EE=Je({},qa,{relatedTarget:0}),Wc=Rn(EE),TE=Je({},po,{animationName:0,elapsedTime:0,pseudoElement:0}),IE=Rn(TE),RE=Je({},po,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),PE=Rn(RE),jE=Je({},po,{data:0}),ig=Rn(jE),AE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},NE={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"},ME={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function DE(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ME[e])?!!t[e]:!1}function Wh(){return DE}var LE=Je({},qa,{key:function(e){if(e.key){var t=AE[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Fl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?NE[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wh,charCode:function(e){return e.type==="keypress"?Fl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Fl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),OE=Rn(LE),zE=Je({},nc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),og=Rn(zE),FE=Je({},qa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wh}),BE=Rn(FE),$E=Je({},po,{propertyName:0,elapsedTime:0,pseudoElement:0}),UE=Rn($E),VE=Je({},nc,{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}),HE=Rn(VE),WE=[9,13,27,32],qh=Br&&"CompositionEvent"in window,qo=null;Br&&"documentMode"in document&&(qo=document.documentMode);var qE=Br&&"TextEvent"in window&&!qo,Mw=Br&&(!qh||qo&&8<qo&&11>=qo),ag=" ",lg=!1;function Dw(e,t){switch(e){case"keyup":return WE.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lw(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ei=!1;function KE(e,t){switch(e){case"compositionend":return Lw(t);case"keypress":return t.which!==32?null:(lg=!0,ag);case"textInput":return e=t.data,e===ag&&lg?null:e;default:return null}}function GE(e,t){if(Ei)return e==="compositionend"||!qh&&Dw(e,t)?(e=Nw(),zl=Vh=ss=null,Ei=!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 Mw&&t.locale!=="ko"?null:t.data;default:return null}}var YE={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 ug(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!YE[e.type]:t==="textarea"}function Ow(e,t,n,r){pw(r),t=uu(t,"onChange"),0<t.length&&(n=new Hh("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Ko=null,ya=null;function QE(e){Gw(e,0)}function rc(e){var t=Ri(e);if(aw(t))return e}function XE(e,t){if(e==="change")return t}var zw=!1;if(Br){var qc;if(Br){var Kc="oninput"in document;if(!Kc){var cg=document.createElement("div");cg.setAttribute("oninput","return;"),Kc=typeof cg.oninput=="function"}qc=Kc}else qc=!1;zw=qc&&(!document.documentMode||9<document.documentMode)}function dg(){Ko&&(Ko.detachEvent("onpropertychange",Fw),ya=Ko=null)}function Fw(e){if(e.propertyName==="value"&&rc(ya)){var t=[];Ow(t,ya,e,zh(e)),vw(QE,t)}}function JE(e,t,n){e==="focusin"?(dg(),Ko=t,ya=n,Ko.attachEvent("onpropertychange",Fw)):e==="focusout"&&dg()}function ZE(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return rc(ya)}function eT(e,t){if(e==="click")return rc(t)}function tT(e,t){if(e==="input"||e==="change")return rc(t)}function nT(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var sr=typeof Object.is=="function"?Object.is:nT;function va(e,t){if(sr(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 s=n[r];if(!Vd.call(t,s)||!sr(e[s],t[s]))return!1}return!0}function fg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function hg(e,t){var n=fg(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=fg(n)}}function Bw(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Bw(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $w(){for(var e=window,t=nu();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=nu(e.document)}return t}function Kh(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 rT(e){var t=$w(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Bw(n.ownerDocument.documentElement,n)){if(r!==null&&Kh(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 s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=hg(n,i);var o=hg(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>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 sT=Br&&"documentMode"in document&&11>=document.documentMode,Ti=null,uf=null,Go=null,cf=!1;function pg(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;cf||Ti==null||Ti!==nu(r)||(r=Ti,"selectionStart"in r&&Kh(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}),Go&&va(Go,r)||(Go=r,r=uu(uf,"onSelect"),0<r.length&&(t=new Hh("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Ti)))}function dl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ii={animationend:dl("Animation","AnimationEnd"),animationiteration:dl("Animation","AnimationIteration"),animationstart:dl("Animation","AnimationStart"),transitionend:dl("Transition","TransitionEnd")},Gc={},Uw={};Br&&(Uw=document.createElement("div").style,"AnimationEvent"in window||(delete Ii.animationend.animation,delete Ii.animationiteration.animation,delete Ii.animationstart.animation),"TransitionEvent"in window||delete Ii.transitionend.transition);function sc(e){if(Gc[e])return Gc[e];if(!Ii[e])return e;var t=Ii[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Uw)return Gc[e]=t[n];return e}var Vw=sc("animationend"),Hw=sc("animationiteration"),Ww=sc("animationstart"),qw=sc("transitionend"),Kw=new Map,mg="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 Ts(e,t){Kw.set(e,t),ai(t,[e])}for(var Yc=0;Yc<mg.length;Yc++){var Qc=mg[Yc],iT=Qc.toLowerCase(),oT=Qc[0].toUpperCase()+Qc.slice(1);Ts(iT,"on"+oT)}Ts(Vw,"onAnimationEnd");Ts(Hw,"onAnimationIteration");Ts(Ww,"onAnimationStart");Ts("dblclick","onDoubleClick");Ts("focusin","onFocus");Ts("focusout","onBlur");Ts(qw,"onTransitionEnd");Yi("onMouseEnter",["mouseout","mouseover"]);Yi("onMouseLeave",["mouseout","mouseover"]);Yi("onPointerEnter",["pointerout","pointerover"]);Yi("onPointerLeave",["pointerout","pointerover"]);ai("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ai("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ai("onBeforeInput",["compositionend","keypress","textInput","paste"]);ai("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ai("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ai("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var $o="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(" "),aT=new Set("cancel close invalid load scroll toggle".split(" ").concat($o));function gg(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,iE(r,t,void 0,e),e.currentTarget=null}function Gw(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,u=a.currentTarget;if(a=a.listener,l!==i&&s.isPropagationStopped())break e;gg(s,a,u),i=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,u=a.currentTarget,a=a.listener,l!==i&&s.isPropagationStopped())break e;gg(s,a,u),i=l}}}if(su)throw e=sf,su=!1,sf=null,e}function $e(e,t){var n=t[mf];n===void 0&&(n=t[mf]=new Set);var r=e+"__bubble";n.has(r)||(Yw(t,e,2,!1),n.add(r))}function Xc(e,t,n){var r=0;t&&(r|=4),Yw(n,e,r,t)}var fl="_reactListening"+Math.random().toString(36).slice(2);function xa(e){if(!e[fl]){e[fl]=!0,nw.forEach(function(n){n!=="selectionchange"&&(aT.has(n)||Xc(n,!1,e),Xc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[fl]||(t[fl]=!0,Xc("selectionchange",!1,t))}}function Yw(e,t,n,r){switch(Aw(t)){case 1:var s=_E;break;case 4:s=bE;break;default:s=Uh}n=s.bind(null,t,n,e),s=void 0,!rf||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function Jc(e,t,n,r,s){var i=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===s||a.nodeType===8&&a.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===s||l.nodeType===8&&l.parentNode===s))return;o=o.return}for(;a!==null;){if(o=$s(a),o===null)return;if(l=o.tag,l===5||l===6){r=i=o;continue e}a=a.parentNode}}r=r.return}vw(function(){var u=i,c=zh(n),f=[];e:{var h=Kw.get(e);if(h!==void 0){var p=Hh,g=e;switch(e){case"keypress":if(Fl(n)===0)break e;case"keydown":case"keyup":p=OE;break;case"focusin":g="focus",p=Wc;break;case"focusout":g="blur",p=Wc;break;case"beforeblur":case"afterblur":p=Wc;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=sg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=CE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=BE;break;case Vw:case Hw:case Ww:p=IE;break;case qw:p=UE;break;case"scroll":p=SE;break;case"wheel":p=HE;break;case"copy":case"cut":case"paste":p=PE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=og}var y=(t&4)!==0,_=!y&&e==="scroll",x=y?h!==null?h+"Capture":null:h;y=[];for(var v=u,w;v!==null;){w=v;var C=w.stateNode;if(w.tag===5&&C!==null&&(w=C,x!==null&&(C=ha(v,x),C!=null&&y.push(wa(v,C,w)))),_)break;v=v.return}0<y.length&&(h=new p(h,g,null,n,c),f.push({event:h,listeners:y}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",h&&n!==tf&&(g=n.relatedTarget||n.fromElement)&&($s(g)||g[$r]))break e;if((p||h)&&(h=c.window===c?c:(h=c.ownerDocument)?h.defaultView||h.parentWindow:window,p?(g=n.relatedTarget||n.toElement,p=u,g=g?$s(g):null,g!==null&&(_=li(g),g!==_||g.tag!==5&&g.tag!==6)&&(g=null)):(p=null,g=u),p!==g)){if(y=sg,C="onMouseLeave",x="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(y=og,C="onPointerLeave",x="onPointerEnter",v="pointer"),_=p==null?h:Ri(p),w=g==null?h:Ri(g),h=new y(C,v+"leave",p,n,c),h.target=_,h.relatedTarget=w,C=null,$s(c)===u&&(y=new y(x,v+"enter",g,n,c),y.target=w,y.relatedTarget=_,C=y),_=C,p&&g)t:{for(y=p,x=g,v=0,w=y;w;w=wi(w))v++;for(w=0,C=x;C;C=wi(C))w++;for(;0<v-w;)y=wi(y),v--;for(;0<w-v;)x=wi(x),w--;for(;v--;){if(y===x||x!==null&&y===x.alternate)break t;y=wi(y),x=wi(x)}y=null}else y=null;p!==null&&yg(f,h,p,y,!1),g!==null&&_!==null&&yg(f,_,g,y,!0)}}e:{if(h=u?Ri(u):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var S=XE;else if(ug(h))if(zw)S=tT;else{S=ZE;var k=JE}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(S=eT);if(S&&(S=S(e,u))){Ow(f,S,n,c);break e}k&&k(e,h,u),e==="focusout"&&(k=h._wrapperState)&&k.controlled&&h.type==="number"&&Qd(h,"number",h.value)}switch(k=u?Ri(u):window,e){case"focusin":(ug(k)||k.contentEditable==="true")&&(Ti=k,uf=u,Go=null);break;case"focusout":Go=uf=Ti=null;break;case"mousedown":cf=!0;break;case"contextmenu":case"mouseup":case"dragend":cf=!1,pg(f,n,c);break;case"selectionchange":if(sT)break;case"keydown":case"keyup":pg(f,n,c)}var T;if(qh)e:{switch(e){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else Ei?Dw(e,n)&&(R="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(R="onCompositionStart");R&&(Mw&&n.locale!=="ko"&&(Ei||R!=="onCompositionStart"?R==="onCompositionEnd"&&Ei&&(T=Nw()):(ss=c,Vh="value"in ss?ss.value:ss.textContent,Ei=!0)),k=uu(u,R),0<k.length&&(R=new ig(R,e,null,n,c),f.push({event:R,listeners:k}),T?R.data=T:(T=Lw(n),T!==null&&(R.data=T)))),(T=qE?KE(e,n):GE(e,n))&&(u=uu(u,"onBeforeInput"),0<u.length&&(c=new ig("onBeforeInput","beforeinput",null,n,c),f.push({event:c,listeners:u}),c.data=T))}Gw(f,t)})}function wa(e,t,n){return{instance:e,listener:t,currentTarget:n}}function uu(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=ha(e,n),i!=null&&r.unshift(wa(e,i,s)),i=ha(e,t),i!=null&&r.push(wa(e,i,s))),e=e.return}return r}function wi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function yg(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,u=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&u!==null&&(a=u,s?(l=ha(n,i),l!=null&&o.unshift(wa(n,l,a))):s||(l=ha(n,i),l!=null&&o.push(wa(n,l,a)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var lT=/\r\n?/g,uT=/\u0000|\uFFFD/g;function vg(e){return(typeof e=="string"?e:""+e).replace(lT,`
|
|
38
|
+
`).replace(uT,"")}function hl(e,t,n){if(t=vg(t),vg(e)!==t&&n)throw Error(W(425))}function cu(){}var df=null,ff=null;function hf(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 pf=typeof setTimeout=="function"?setTimeout:void 0,cT=typeof clearTimeout=="function"?clearTimeout:void 0,xg=typeof Promise=="function"?Promise:void 0,dT=typeof queueMicrotask=="function"?queueMicrotask:typeof xg<"u"?function(e){return xg.resolve(null).then(e).catch(fT)}:pf;function fT(e){setTimeout(function(){throw e})}function Zc(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),ga(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);ga(t)}function fs(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 wg(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 mo=Math.random().toString(36).slice(2),pr="__reactFiber$"+mo,_a="__reactProps$"+mo,$r="__reactContainer$"+mo,mf="__reactEvents$"+mo,hT="__reactListeners$"+mo,pT="__reactHandles$"+mo;function $s(e){var t=e[pr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[$r]||n[pr]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=wg(e);e!==null;){if(n=e[pr])return n;e=wg(e)}return t}e=n,n=e.parentNode}return null}function Ka(e){return e=e[pr]||e[$r],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ri(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(W(33))}function ic(e){return e[_a]||null}var gf=[],Pi=-1;function Is(e){return{current:e}}function Ue(e){0>Pi||(e.current=gf[Pi],gf[Pi]=null,Pi--)}function Oe(e,t){Pi++,gf[Pi]=e.current,e.current=t}var _s={},Mt=Is(_s),en=Is(!1),Zs=_s;function Qi(e,t){var n=e.type.contextTypes;if(!n)return _s;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function tn(e){return e=e.childContextTypes,e!=null}function du(){Ue(en),Ue(Mt)}function _g(e,t,n){if(Mt.current!==_s)throw Error(W(168));Oe(Mt,t),Oe(en,n)}function Qw(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(W(108,JC(e)||"Unknown",s));return Je({},n,r)}function fu(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||_s,Zs=Mt.current,Oe(Mt,e),Oe(en,en.current),!0}function bg(e,t,n){var r=e.stateNode;if(!r)throw Error(W(169));n?(e=Qw(e,t,Zs),r.__reactInternalMemoizedMergedChildContext=e,Ue(en),Ue(Mt),Oe(Mt,e)):Ue(en),Oe(en,n)}var Nr=null,oc=!1,ed=!1;function Xw(e){Nr===null?Nr=[e]:Nr.push(e)}function mT(e){oc=!0,Xw(e)}function Rs(){if(!ed&&Nr!==null){ed=!0;var e=0,t=Re;try{var n=Nr;for(Re=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Nr=null,oc=!1}catch(s){throw Nr!==null&&(Nr=Nr.slice(e+1)),bw(Fh,Rs),s}finally{Re=t,ed=!1}}return null}var ji=[],Ai=0,hu=null,pu=0,Dn=[],Ln=0,ei=null,Lr=1,Or="";function Os(e,t){ji[Ai++]=pu,ji[Ai++]=hu,hu=e,pu=t}function Jw(e,t,n){Dn[Ln++]=Lr,Dn[Ln++]=Or,Dn[Ln++]=ei,ei=e;var r=Lr;e=Or;var s=32-tr(r)-1;r&=~(1<<s),n+=1;var i=32-tr(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,Lr=1<<32-tr(t)+s|n<<s|r,Or=i+e}else Lr=1<<i|n<<s|r,Or=e}function Gh(e){e.return!==null&&(Os(e,1),Jw(e,1,0))}function Yh(e){for(;e===hu;)hu=ji[--Ai],ji[Ai]=null,pu=ji[--Ai],ji[Ai]=null;for(;e===ei;)ei=Dn[--Ln],Dn[Ln]=null,Or=Dn[--Ln],Dn[Ln]=null,Lr=Dn[--Ln],Dn[Ln]=null}var _n=null,vn=null,Ve=!1,Zn=null;function Zw(e,t){var n=zn(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 Sg(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,_n=e,vn=fs(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,_n=e,vn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ei!==null?{id:Lr,overflow:Or}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=zn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,_n=e,vn=null,!0):!1;default:return!1}}function yf(e){return(e.mode&1)!==0&&(e.flags&128)===0}function vf(e){if(Ve){var t=vn;if(t){var n=t;if(!Sg(e,t)){if(yf(e))throw Error(W(418));t=fs(n.nextSibling);var r=_n;t&&Sg(e,t)?Zw(r,n):(e.flags=e.flags&-4097|2,Ve=!1,_n=e)}}else{if(yf(e))throw Error(W(418));e.flags=e.flags&-4097|2,Ve=!1,_n=e}}}function kg(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;_n=e}function pl(e){if(e!==_n)return!1;if(!Ve)return kg(e),Ve=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!hf(e.type,e.memoizedProps)),t&&(t=vn)){if(yf(e))throw e_(),Error(W(418));for(;t;)Zw(e,t),t=fs(t.nextSibling)}if(kg(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(W(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){vn=fs(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}vn=null}}else vn=_n?fs(e.stateNode.nextSibling):null;return!0}function e_(){for(var e=vn;e;)e=fs(e.nextSibling)}function Xi(){vn=_n=null,Ve=!1}function Qh(e){Zn===null?Zn=[e]:Zn.push(e)}var gT=qr.ReactCurrentBatchConfig;function jo(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(W(309));var r=n.stateNode}if(!r)throw Error(W(147,e));var s=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var a=s.refs;o===null?delete a[i]:a[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(W(284));if(!n._owner)throw Error(W(290,e))}return e}function ml(e,t){throw e=Object.prototype.toString.call(t),Error(W(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Cg(e){var t=e._init;return t(e._payload)}function t_(e){function t(x,v){if(e){var w=x.deletions;w===null?(x.deletions=[v],x.flags|=16):w.push(v)}}function n(x,v){if(!e)return null;for(;v!==null;)t(x,v),v=v.sibling;return null}function r(x,v){for(x=new Map;v!==null;)v.key!==null?x.set(v.key,v):x.set(v.index,v),v=v.sibling;return x}function s(x,v){return x=gs(x,v),x.index=0,x.sibling=null,x}function i(x,v,w){return x.index=w,e?(w=x.alternate,w!==null?(w=w.index,w<v?(x.flags|=2,v):w):(x.flags|=2,v)):(x.flags|=1048576,v)}function o(x){return e&&x.alternate===null&&(x.flags|=2),x}function a(x,v,w,C){return v===null||v.tag!==6?(v=ad(w,x.mode,C),v.return=x,v):(v=s(v,w),v.return=x,v)}function l(x,v,w,C){var S=w.type;return S===Ci?c(x,v,w.props.children,C,w.key):v!==null&&(v.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Jr&&Cg(S)===v.type)?(C=s(v,w.props),C.ref=jo(x,v,w),C.return=x,C):(C=ql(w.type,w.key,w.props,null,x.mode,C),C.ref=jo(x,v,w),C.return=x,C)}function u(x,v,w,C){return v===null||v.tag!==4||v.stateNode.containerInfo!==w.containerInfo||v.stateNode.implementation!==w.implementation?(v=ld(w,x.mode,C),v.return=x,v):(v=s(v,w.children||[]),v.return=x,v)}function c(x,v,w,C,S){return v===null||v.tag!==7?(v=qs(w,x.mode,C,S),v.return=x,v):(v=s(v,w),v.return=x,v)}function f(x,v,w){if(typeof v=="string"&&v!==""||typeof v=="number")return v=ad(""+v,x.mode,w),v.return=x,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case sl:return w=ql(v.type,v.key,v.props,null,x.mode,w),w.ref=jo(x,null,v),w.return=x,w;case ki:return v=ld(v,x.mode,w),v.return=x,v;case Jr:var C=v._init;return f(x,C(v._payload),w)}if(Fo(v)||Eo(v))return v=qs(v,x.mode,w,null),v.return=x,v;ml(x,v)}return null}function h(x,v,w,C){var S=v!==null?v.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return S!==null?null:a(x,v,""+w,C);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case sl:return w.key===S?l(x,v,w,C):null;case ki:return w.key===S?u(x,v,w,C):null;case Jr:return S=w._init,h(x,v,S(w._payload),C)}if(Fo(w)||Eo(w))return S!==null?null:c(x,v,w,C,null);ml(x,w)}return null}function p(x,v,w,C,S){if(typeof C=="string"&&C!==""||typeof C=="number")return x=x.get(w)||null,a(v,x,""+C,S);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case sl:return x=x.get(C.key===null?w:C.key)||null,l(v,x,C,S);case ki:return x=x.get(C.key===null?w:C.key)||null,u(v,x,C,S);case Jr:var k=C._init;return p(x,v,w,k(C._payload),S)}if(Fo(C)||Eo(C))return x=x.get(w)||null,c(v,x,C,S,null);ml(v,C)}return null}function g(x,v,w,C){for(var S=null,k=null,T=v,R=v=0,P=null;T!==null&&R<w.length;R++){T.index>R?(P=T,T=null):P=T.sibling;var E=h(x,T,w[R],C);if(E===null){T===null&&(T=P);break}e&&T&&E.alternate===null&&t(x,T),v=i(E,v,R),k===null?S=E:k.sibling=E,k=E,T=P}if(R===w.length)return n(x,T),Ve&&Os(x,R),S;if(T===null){for(;R<w.length;R++)T=f(x,w[R],C),T!==null&&(v=i(T,v,R),k===null?S=T:k.sibling=T,k=T);return Ve&&Os(x,R),S}for(T=r(x,T);R<w.length;R++)P=p(T,x,R,w[R],C),P!==null&&(e&&P.alternate!==null&&T.delete(P.key===null?R:P.key),v=i(P,v,R),k===null?S=P:k.sibling=P,k=P);return e&&T.forEach(function(M){return t(x,M)}),Ve&&Os(x,R),S}function y(x,v,w,C){var S=Eo(w);if(typeof S!="function")throw Error(W(150));if(w=S.call(w),w==null)throw Error(W(151));for(var k=S=null,T=v,R=v=0,P=null,E=w.next();T!==null&&!E.done;R++,E=w.next()){T.index>R?(P=T,T=null):P=T.sibling;var M=h(x,T,E.value,C);if(M===null){T===null&&(T=P);break}e&&T&&M.alternate===null&&t(x,T),v=i(M,v,R),k===null?S=M:k.sibling=M,k=M,T=P}if(E.done)return n(x,T),Ve&&Os(x,R),S;if(T===null){for(;!E.done;R++,E=w.next())E=f(x,E.value,C),E!==null&&(v=i(E,v,R),k===null?S=E:k.sibling=E,k=E);return Ve&&Os(x,R),S}for(T=r(x,T);!E.done;R++,E=w.next())E=p(T,x,R,E.value,C),E!==null&&(e&&E.alternate!==null&&T.delete(E.key===null?R:E.key),v=i(E,v,R),k===null?S=E:k.sibling=E,k=E);return e&&T.forEach(function(D){return t(x,D)}),Ve&&Os(x,R),S}function _(x,v,w,C){if(typeof w=="object"&&w!==null&&w.type===Ci&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case sl:e:{for(var S=w.key,k=v;k!==null;){if(k.key===S){if(S=w.type,S===Ci){if(k.tag===7){n(x,k.sibling),v=s(k,w.props.children),v.return=x,x=v;break e}}else if(k.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Jr&&Cg(S)===k.type){n(x,k.sibling),v=s(k,w.props),v.ref=jo(x,k,w),v.return=x,x=v;break e}n(x,k);break}else t(x,k);k=k.sibling}w.type===Ci?(v=qs(w.props.children,x.mode,C,w.key),v.return=x,x=v):(C=ql(w.type,w.key,w.props,null,x.mode,C),C.ref=jo(x,v,w),C.return=x,x=C)}return o(x);case ki:e:{for(k=w.key;v!==null;){if(v.key===k)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(x,v.sibling),v=s(v,w.children||[]),v.return=x,x=v;break e}else{n(x,v);break}else t(x,v);v=v.sibling}v=ld(w,x.mode,C),v.return=x,x=v}return o(x);case Jr:return k=w._init,_(x,v,k(w._payload),C)}if(Fo(w))return g(x,v,w,C);if(Eo(w))return y(x,v,w,C);ml(x,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(n(x,v.sibling),v=s(v,w),v.return=x,x=v):(n(x,v),v=ad(w,x.mode,C),v.return=x,x=v),o(x)):n(x,v)}return _}var Ji=t_(!0),n_=t_(!1),mu=Is(null),gu=null,Ni=null,Xh=null;function Jh(){Xh=Ni=gu=null}function Zh(e){var t=mu.current;Ue(mu),e._currentValue=t}function xf(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 Ui(e,t){gu=e,Xh=Ni=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Zt=!0),e.firstContext=null)}function Vn(e){var t=e._currentValue;if(Xh!==e)if(e={context:e,memoizedValue:t,next:null},Ni===null){if(gu===null)throw Error(W(308));Ni=e,gu.dependencies={lanes:0,firstContext:e}}else Ni=Ni.next=e;return t}var Us=null;function ep(e){Us===null?Us=[e]:Us.push(e)}function r_(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,ep(t)):(n.next=s.next,s.next=n),t.interleaved=n,Ur(e,r)}function Ur(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 Zr=!1;function tp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function s_(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 Fr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function hs(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Te&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Ur(e,n)}return s=r.interleaved,s===null?(t.next=t,ep(r)):(t.next=s.next,s.next=t),r.interleaved=t,Ur(e,n)}function Bl(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,Bh(e,n)}}function Eg(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=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};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function yu(e,t,n,r){var s=e.updateQueue;Zr=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?i=u:o.next=u,o=l;var c=e.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==o&&(a===null?c.firstBaseUpdate=u:a.next=u,c.lastBaseUpdate=l))}if(i!==null){var f=s.baseState;o=0,c=u=l=null,a=i;do{var h=a.lane,p=a.eventTime;if((r&h)===h){c!==null&&(c=c.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=e,y=a;switch(h=t,p=n,y.tag){case 1:if(g=y.payload,typeof g=="function"){f=g.call(p,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=y.payload,h=typeof g=="function"?g.call(p,f,h):g,h==null)break e;f=Je({},f,h);break e;case 2:Zr=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[a]:h.push(a))}else p={eventTime:p,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(u=c=p,l=f):c=c.next=p,o|=h;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;h=a,a=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(c===null&&(l=f),s.baseState=l,s.firstBaseUpdate=u,s.lastBaseUpdate=c,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);ni|=o,e.lanes=o,e.memoizedState=f}}function Tg(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(W(191,s));s.call(r)}}}var Ga={},xr=Is(Ga),ba=Is(Ga),Sa=Is(Ga);function Vs(e){if(e===Ga)throw Error(W(174));return e}function np(e,t){switch(Oe(Sa,t),Oe(ba,e),Oe(xr,Ga),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Jd(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Jd(t,e)}Ue(xr),Oe(xr,t)}function Zi(){Ue(xr),Ue(ba),Ue(Sa)}function i_(e){Vs(Sa.current);var t=Vs(xr.current),n=Jd(t,e.type);t!==n&&(Oe(ba,e),Oe(xr,n))}function rp(e){ba.current===e&&(Ue(xr),Ue(ba))}var Ke=Is(0);function vu(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 td=[];function sp(){for(var e=0;e<td.length;e++)td[e]._workInProgressVersionPrimary=null;td.length=0}var $l=qr.ReactCurrentDispatcher,nd=qr.ReactCurrentBatchConfig,ti=0,Xe=null,ht=null,yt=null,xu=!1,Yo=!1,ka=0,yT=0;function Tt(){throw Error(W(321))}function ip(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!sr(e[n],t[n]))return!1;return!0}function op(e,t,n,r,s,i){if(ti=i,Xe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$l.current=e===null||e.memoizedState===null?_T:bT,e=n(r,s),Yo){i=0;do{if(Yo=!1,ka=0,25<=i)throw Error(W(301));i+=1,yt=ht=null,t.updateQueue=null,$l.current=ST,e=n(r,s)}while(Yo)}if($l.current=wu,t=ht!==null&&ht.next!==null,ti=0,yt=ht=Xe=null,xu=!1,t)throw Error(W(300));return e}function ap(){var e=ka!==0;return ka=0,e}function dr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return yt===null?Xe.memoizedState=yt=e:yt=yt.next=e,yt}function Hn(){if(ht===null){var e=Xe.alternate;e=e!==null?e.memoizedState:null}else e=ht.next;var t=yt===null?Xe.memoizedState:yt.next;if(t!==null)yt=t,ht=e;else{if(e===null)throw Error(W(310));ht=e,e={memoizedState:ht.memoizedState,baseState:ht.baseState,baseQueue:ht.baseQueue,queue:ht.queue,next:null},yt===null?Xe.memoizedState=yt=e:yt=yt.next=e}return yt}function Ca(e,t){return typeof t=="function"?t(e):t}function rd(e){var t=Hn(),n=t.queue;if(n===null)throw Error(W(311));n.lastRenderedReducer=e;var r=ht,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var a=o=null,l=null,u=i;do{var c=u.lane;if((ti&c)===c)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:c,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(a=l=f,o=r):l=l.next=f,Xe.lanes|=c,ni|=c}u=u.next}while(u!==null&&u!==i);l===null?o=r:l.next=a,sr(r,t.memoizedState)||(Zt=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,Xe.lanes|=i,ni|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function sd(e){var t=Hn(),n=t.queue;if(n===null)throw Error(W(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);sr(i,t.memoizedState)||(Zt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function o_(){}function a_(e,t){var n=Xe,r=Hn(),s=t(),i=!sr(r.memoizedState,s);if(i&&(r.memoizedState=s,Zt=!0),r=r.queue,lp(c_.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||yt!==null&&yt.memoizedState.tag&1){if(n.flags|=2048,Ea(9,u_.bind(null,n,r,s,t),void 0,null),vt===null)throw Error(W(349));ti&30||l_(n,t,s)}return s}function l_(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Xe.updateQueue,t===null?(t={lastEffect:null,stores:null},Xe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function u_(e,t,n,r){t.value=n,t.getSnapshot=r,d_(t)&&f_(e)}function c_(e,t,n){return n(function(){d_(t)&&f_(e)})}function d_(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!sr(e,n)}catch{return!0}}function f_(e){var t=Ur(e,1);t!==null&&nr(t,e,1,-1)}function Ig(e){var t=dr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ca,lastRenderedState:e},t.queue=e,e=e.dispatch=wT.bind(null,Xe,e),[t.memoizedState,e]}function Ea(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Xe.updateQueue,t===null?(t={lastEffect:null,stores:null},Xe.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 h_(){return Hn().memoizedState}function Ul(e,t,n,r){var s=dr();Xe.flags|=e,s.memoizedState=Ea(1|t,n,void 0,r===void 0?null:r)}function ac(e,t,n,r){var s=Hn();r=r===void 0?null:r;var i=void 0;if(ht!==null){var o=ht.memoizedState;if(i=o.destroy,r!==null&&ip(r,o.deps)){s.memoizedState=Ea(t,n,i,r);return}}Xe.flags|=e,s.memoizedState=Ea(1|t,n,i,r)}function Rg(e,t){return Ul(8390656,8,e,t)}function lp(e,t){return ac(2048,8,e,t)}function p_(e,t){return ac(4,2,e,t)}function m_(e,t){return ac(4,4,e,t)}function g_(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 y_(e,t,n){return n=n!=null?n.concat([e]):null,ac(4,4,g_.bind(null,t,e),n)}function up(){}function v_(e,t){var n=Hn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ip(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function x_(e,t){var n=Hn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ip(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function w_(e,t,n){return ti&21?(sr(n,t)||(n=Cw(),Xe.lanes|=n,ni|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Zt=!0),e.memoizedState=n)}function vT(e,t){var n=Re;Re=n!==0&&4>n?n:4,e(!0);var r=nd.transition;nd.transition={};try{e(!1),t()}finally{Re=n,nd.transition=r}}function __(){return Hn().memoizedState}function xT(e,t,n){var r=ms(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},b_(e))S_(t,n);else if(n=r_(e,t,n,r),n!==null){var s=Ut();nr(n,e,r,s),k_(n,t,r)}}function wT(e,t,n){var r=ms(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(b_(e))S_(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,sr(a,o)){var l=t.interleaved;l===null?(s.next=s,ep(t)):(s.next=l.next,l.next=s),t.interleaved=s;return}}catch{}finally{}n=r_(e,t,s,r),n!==null&&(s=Ut(),nr(n,e,r,s),k_(n,t,r))}}function b_(e){var t=e.alternate;return e===Xe||t!==null&&t===Xe}function S_(e,t){Yo=xu=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function k_(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bh(e,n)}}var wu={readContext:Vn,useCallback:Tt,useContext:Tt,useEffect:Tt,useImperativeHandle:Tt,useInsertionEffect:Tt,useLayoutEffect:Tt,useMemo:Tt,useReducer:Tt,useRef:Tt,useState:Tt,useDebugValue:Tt,useDeferredValue:Tt,useTransition:Tt,useMutableSource:Tt,useSyncExternalStore:Tt,useId:Tt,unstable_isNewReconciler:!1},_T={readContext:Vn,useCallback:function(e,t){return dr().memoizedState=[e,t===void 0?null:t],e},useContext:Vn,useEffect:Rg,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ul(4194308,4,g_.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ul(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ul(4,2,e,t)},useMemo:function(e,t){var n=dr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=dr();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=xT.bind(null,Xe,e),[r.memoizedState,e]},useRef:function(e){var t=dr();return e={current:e},t.memoizedState=e},useState:Ig,useDebugValue:up,useDeferredValue:function(e){return dr().memoizedState=e},useTransition:function(){var e=Ig(!1),t=e[0];return e=vT.bind(null,e[1]),dr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Xe,s=dr();if(Ve){if(n===void 0)throw Error(W(407));n=n()}else{if(n=t(),vt===null)throw Error(W(349));ti&30||l_(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,Rg(c_.bind(null,r,i,e),[e]),r.flags|=2048,Ea(9,u_.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=dr(),t=vt.identifierPrefix;if(Ve){var n=Or,r=Lr;n=(r&~(1<<32-tr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ka++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=yT++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},bT={readContext:Vn,useCallback:v_,useContext:Vn,useEffect:lp,useImperativeHandle:y_,useInsertionEffect:p_,useLayoutEffect:m_,useMemo:x_,useReducer:rd,useRef:h_,useState:function(){return rd(Ca)},useDebugValue:up,useDeferredValue:function(e){var t=Hn();return w_(t,ht.memoizedState,e)},useTransition:function(){var e=rd(Ca)[0],t=Hn().memoizedState;return[e,t]},useMutableSource:o_,useSyncExternalStore:a_,useId:__,unstable_isNewReconciler:!1},ST={readContext:Vn,useCallback:v_,useContext:Vn,useEffect:lp,useImperativeHandle:y_,useInsertionEffect:p_,useLayoutEffect:m_,useMemo:x_,useReducer:sd,useRef:h_,useState:function(){return sd(Ca)},useDebugValue:up,useDeferredValue:function(e){var t=Hn();return ht===null?t.memoizedState=e:w_(t,ht.memoizedState,e)},useTransition:function(){var e=sd(Ca)[0],t=Hn().memoizedState;return[e,t]},useMutableSource:o_,useSyncExternalStore:a_,useId:__,unstable_isNewReconciler:!1};function Xn(e,t){if(e&&e.defaultProps){t=Je({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function wf(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Je({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var lc={isMounted:function(e){return(e=e._reactInternals)?li(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ut(),s=ms(e),i=Fr(r,s);i.payload=t,n!=null&&(i.callback=n),t=hs(e,i,s),t!==null&&(nr(t,e,s,r),Bl(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ut(),s=ms(e),i=Fr(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=hs(e,i,s),t!==null&&(nr(t,e,s,r),Bl(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ut(),r=ms(e),s=Fr(n,r);s.tag=2,t!=null&&(s.callback=t),t=hs(e,s,r),t!==null&&(nr(t,e,r,n),Bl(t,e,r))}};function Pg(e,t,n,r,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!va(n,r)||!va(s,i):!0}function C_(e,t,n){var r=!1,s=_s,i=t.contextType;return typeof i=="object"&&i!==null?i=Vn(i):(s=tn(t)?Zs:Mt.current,r=t.contextTypes,i=(r=r!=null)?Qi(e,s):_s),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=lc,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function jg(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&&lc.enqueueReplaceState(t,t.state,null)}function _f(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},tp(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=Vn(i):(i=tn(t)?Zs:Mt.current,s.context=Qi(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(wf(e,t,i,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&lc.enqueueReplaceState(s,s.state,null),yu(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function eo(e,t){try{var n="",r=t;do n+=XC(r),r=r.return;while(r);var s=n}catch(i){s=`
|
|
39
|
+
Error generating stack: `+i.message+`
|
|
40
|
+
`+i.stack}return{value:e,source:t,stack:s,digest:null}}function id(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function bf(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var kT=typeof WeakMap=="function"?WeakMap:Map;function E_(e,t,n){n=Fr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){bu||(bu=!0,Af=r),bf(e,t)},n}function T_(e,t,n){n=Fr(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){bf(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){bf(e,t),typeof r!="function"&&(ps===null?ps=new Set([this]):ps.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function Ag(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new kT;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=zT.bind(null,e,t,n),t.then(e,e))}function Ng(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 Mg(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,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=Fr(-1,1),t.tag=2,hs(n,t,1))),n.lanes|=1),e)}var CT=qr.ReactCurrentOwner,Zt=!1;function Bt(e,t,n,r){t.child=e===null?n_(t,null,n,r):Ji(t,e.child,n,r)}function Dg(e,t,n,r,s){n=n.render;var i=t.ref;return Ui(t,s),r=op(e,t,n,r,i,s),n=ap(),e!==null&&!Zt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Vr(e,t,s)):(Ve&&n&&Gh(t),t.flags|=1,Bt(e,t,r,s),t.child)}function Lg(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!yp(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,I_(e,t,i,r,s)):(e=ql(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:va,n(o,r)&&e.ref===t.ref)return Vr(e,t,s)}return t.flags|=1,e=gs(i,r),e.ref=t.ref,e.return=t,t.child=e}function I_(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(va(i,r)&&e.ref===t.ref)if(Zt=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(Zt=!0);else return t.lanes=e.lanes,Vr(e,t,s)}return Sf(e,t,n,r,s)}function R_(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Oe(Di,mn),mn|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Oe(Di,mn),mn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Oe(Di,mn),mn|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Oe(Di,mn),mn|=r;return Bt(e,t,s,n),t.child}function P_(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Sf(e,t,n,r,s){var i=tn(n)?Zs:Mt.current;return i=Qi(t,i),Ui(t,s),n=op(e,t,n,r,i,s),r=ap(),e!==null&&!Zt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Vr(e,t,s)):(Ve&&r&&Gh(t),t.flags|=1,Bt(e,t,n,s),t.child)}function Og(e,t,n,r,s){if(tn(n)){var i=!0;fu(t)}else i=!1;if(Ui(t,s),t.stateNode===null)Vl(e,t),C_(t,n,r),_f(t,n,r,s),r=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=Vn(u):(u=tn(n)?Zs:Mt.current,u=Qi(t,u));var c=n.getDerivedStateFromProps,f=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==u)&&jg(t,o,r,u),Zr=!1;var h=t.memoizedState;o.state=h,yu(t,r,o,s),l=t.memoizedState,a!==r||h!==l||en.current||Zr?(typeof c=="function"&&(wf(t,n,c,r),l=t.memoizedState),(a=Zr||Pg(t,n,a,r,h,l,u))?(f||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=u,r=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,s_(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:Xn(t.type,a),o.props=u,f=t.pendingProps,h=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=Vn(l):(l=tn(n)?Zs:Mt.current,l=Qi(t,l));var p=n.getDerivedStateFromProps;(c=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==f||h!==l)&&jg(t,o,r,l),Zr=!1,h=t.memoizedState,o.state=h,yu(t,r,o,s);var g=t.memoizedState;a!==f||h!==g||en.current||Zr?(typeof p=="function"&&(wf(t,n,p,r),g=t.memoizedState),(u=Zr||Pg(t,n,u,r,h,g,l)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,g,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,g,l)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),o.props=r,o.state=g,o.context=l,r=u):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return kf(e,t,n,r,i,s)}function kf(e,t,n,r,s,i){P_(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return s&&bg(t,n,!1),Vr(e,t,i);r=t.stateNode,CT.current=t;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ji(t,e.child,null,i),t.child=Ji(t,null,a,i)):Bt(e,t,a,i),t.memoizedState=r.state,s&&bg(t,n,!0),t.child}function j_(e){var t=e.stateNode;t.pendingContext?_g(e,t.pendingContext,t.pendingContext!==t.context):t.context&&_g(e,t.context,!1),np(e,t.containerInfo)}function zg(e,t,n,r,s){return Xi(),Qh(s),t.flags|=256,Bt(e,t,n,r),t.child}var Cf={dehydrated:null,treeContext:null,retryLane:0};function Ef(e){return{baseLanes:e,cachePool:null,transitions:null}}function A_(e,t,n){var r=t.pendingProps,s=Ke.current,i=!1,o=(t.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(s&2)!==0),a?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),Oe(Ke,s&1),e===null)return vf(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,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=dc(o,r,0,null),e=qs(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Ef(n),t.memoizedState=Cf,e):cp(t,o));if(s=e.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return ET(e,t,o,r,a,s,n);if(i){i=r.fallback,o=t.mode,s=e.child,a=s.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=gs(s,l),r.subtreeFlags=s.subtreeFlags&14680064),a!==null?i=gs(a,i):(i=qs(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?Ef(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=Cf,r}return i=e.child,e=i.sibling,r=gs(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function cp(e,t){return t=dc({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function gl(e,t,n,r){return r!==null&&Qh(r),Ji(t,e.child,null,n),e=cp(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ET(e,t,n,r,s,i,o){if(n)return t.flags&256?(t.flags&=-257,r=id(Error(W(422))),gl(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=dc({mode:"visible",children:r.children},s,0,null),i=qs(i,s,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Ji(t,e.child,null,o),t.child.memoizedState=Ef(o),t.memoizedState=Cf,i);if(!(t.mode&1))return gl(e,t,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(W(419)),r=id(i,r,void 0),gl(e,t,o,r)}if(a=(o&e.childLanes)!==0,Zt||a){if(r=vt,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=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:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,Ur(e,s),nr(r,e,s,-1))}return gp(),r=id(Error(W(421))),gl(e,t,o,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=FT.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,vn=fs(s.nextSibling),_n=t,Ve=!0,Zn=null,e!==null&&(Dn[Ln++]=Lr,Dn[Ln++]=Or,Dn[Ln++]=ei,Lr=e.id,Or=e.overflow,ei=t),t=cp(t,r.children),t.flags|=4096,t)}function Fg(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),xf(e.return,t,n)}function od(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function N_(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(Bt(e,t,r.children,n),r=Ke.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&&Fg(e,n,t);else if(e.tag===19)Fg(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(Oe(Ke,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&vu(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),od(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&vu(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}od(t,!0,n,null,i);break;case"together":od(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Vl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Vr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ni|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(W(153));if(t.child!==null){for(e=t.child,n=gs(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=gs(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function TT(e,t,n){switch(t.tag){case 3:j_(t),Xi();break;case 5:i_(t);break;case 1:tn(t.type)&&fu(t);break;case 4:np(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;Oe(mu,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Oe(Ke,Ke.current&1),t.flags|=128,null):n&t.child.childLanes?A_(e,t,n):(Oe(Ke,Ke.current&1),e=Vr(e,t,n),e!==null?e.sibling:null);Oe(Ke,Ke.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return N_(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Oe(Ke,Ke.current),r)break;return null;case 22:case 23:return t.lanes=0,R_(e,t,n)}return Vr(e,t,n)}var M_,Tf,D_,L_;M_=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}};Tf=function(){};D_=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Vs(xr.current);var i=null;switch(n){case"input":s=Gd(e,s),r=Gd(e,r),i=[];break;case"select":s=Je({},s,{value:void 0}),r=Je({},r,{value:void 0}),i=[];break;case"textarea":s=Xd(e,s),r=Xd(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=cu)}Zd(n,r);var o;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var a=s[u];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(da.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var l=r[u];if(a=s?.[u],r.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="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||(i||(i=[]),i.push(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(da.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&$e("scroll",e),i||a===l||(i=[])):(i=i||[]).push(u,l))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};L_=function(e,t,n,r){n!==r&&(t.flags|=4)};function Ao(e,t){if(!Ve)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 It(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function IT(e,t,n){var r=t.pendingProps;switch(Yh(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return It(t),null;case 1:return tn(t.type)&&du(),It(t),null;case 3:return r=t.stateNode,Zi(),Ue(en),Ue(Mt),sp(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(pl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Zn!==null&&(Df(Zn),Zn=null))),Tf(e,t),It(t),null;case 5:rp(t);var s=Vs(Sa.current);if(n=t.type,e!==null&&t.stateNode!=null)D_(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(W(166));return It(t),null}if(e=Vs(xr.current),pl(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[pr]=t,r[_a]=i,e=(t.mode&1)!==0,n){case"dialog":$e("cancel",r),$e("close",r);break;case"iframe":case"object":case"embed":$e("load",r);break;case"video":case"audio":for(s=0;s<$o.length;s++)$e($o[s],r);break;case"source":$e("error",r);break;case"img":case"image":case"link":$e("error",r),$e("load",r);break;case"details":$e("toggle",r);break;case"input":Gm(r,i),$e("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},$e("invalid",r);break;case"textarea":Qm(r,i),$e("invalid",r)}Zd(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var a=i[o];o==="children"?typeof a=="string"?r.textContent!==a&&(i.suppressHydrationWarning!==!0&&hl(r.textContent,a,e),s=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&hl(r.textContent,a,e),s=["children",""+a]):da.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&$e("scroll",r)}switch(n){case"input":il(r),Ym(r,i,!0);break;case"textarea":il(r),Xm(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=cu)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=cw(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[pr]=t,e[_a]=r,M_(e,t,!1,!1),t.stateNode=e;e:{switch(o=ef(n,r),n){case"dialog":$e("cancel",e),$e("close",e),s=r;break;case"iframe":case"object":case"embed":$e("load",e),s=r;break;case"video":case"audio":for(s=0;s<$o.length;s++)$e($o[s],e);s=r;break;case"source":$e("error",e),s=r;break;case"img":case"image":case"link":$e("error",e),$e("load",e),s=r;break;case"details":$e("toggle",e),s=r;break;case"input":Gm(e,r),s=Gd(e,r),$e("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Je({},r,{value:void 0}),$e("invalid",e);break;case"textarea":Qm(e,r),s=Xd(e,r),$e("invalid",e);break;default:s=r}Zd(n,s),a=s;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?hw(e,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&dw(e,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&fa(e,l):typeof l=="number"&&fa(e,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(da.hasOwnProperty(i)?l!=null&&i==="onScroll"&&$e("scroll",e):l!=null&&Mh(e,i,l,o))}switch(n){case"input":il(e),Ym(e,r,!1);break;case"textarea":il(e),Xm(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ws(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?zi(e,!!r.multiple,i,!1):r.defaultValue!=null&&zi(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=cu)}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 It(t),null;case 6:if(e&&t.stateNode!=null)L_(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(W(166));if(n=Vs(Sa.current),Vs(xr.current),pl(t)){if(r=t.stateNode,n=t.memoizedProps,r[pr]=t,(i=r.nodeValue!==n)&&(e=_n,e!==null))switch(e.tag){case 3:hl(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&hl(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[pr]=t,t.stateNode=r}return It(t),null;case 13:if(Ue(Ke),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ve&&vn!==null&&t.mode&1&&!(t.flags&128))e_(),Xi(),t.flags|=98560,i=!1;else if(i=pl(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(W(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(W(317));i[pr]=t}else Xi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;It(t),i=!1}else Zn!==null&&(Df(Zn),Zn=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Ke.current&1?pt===0&&(pt=3):gp())),t.updateQueue!==null&&(t.flags|=4),It(t),null);case 4:return Zi(),Tf(e,t),e===null&&xa(t.stateNode.containerInfo),It(t),null;case 10:return Zh(t.type._context),It(t),null;case 17:return tn(t.type)&&du(),It(t),null;case 19:if(Ue(Ke),i=t.memoizedState,i===null)return It(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)Ao(i,!1);else{if(pt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=vu(e),o!==null){for(t.flags|=128,Ao(i,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Oe(Ke,Ke.current&1|2),t.child}e=e.sibling}i.tail!==null&&at()>to&&(t.flags|=128,r=!0,Ao(i,!1),t.lanes=4194304)}else{if(!r)if(e=vu(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ao(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Ve)return It(t),null}else 2*at()-i.renderingStartTime>to&&n!==1073741824&&(t.flags|=128,r=!0,Ao(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=at(),t.sibling=null,n=Ke.current,Oe(Ke,r?n&1|2:n&1),t):(It(t),null);case 22:case 23:return mp(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?mn&1073741824&&(It(t),t.subtreeFlags&6&&(t.flags|=8192)):It(t),null;case 24:return null;case 25:return null}throw Error(W(156,t.tag))}function RT(e,t){switch(Yh(t),t.tag){case 1:return tn(t.type)&&du(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Zi(),Ue(en),Ue(Mt),sp(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return rp(t),null;case 13:if(Ue(Ke),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(W(340));Xi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ue(Ke),null;case 4:return Zi(),null;case 10:return Zh(t.type._context),null;case 22:case 23:return mp(),null;case 24:return null;default:return null}}var yl=!1,Rt=!1,PT=typeof WeakSet=="function"?WeakSet:Set,ee=null;function Mi(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ze(e,t,r)}else n.current=null}function If(e,t,n){try{n()}catch(r){Ze(e,t,r)}}var Bg=!1;function jT(e,t){if(df=au,e=$w(),Kh(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 s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,c=0,f=e,h=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(a=o+s),f!==i||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===s&&(a=o),h===i&&++c===r&&(l=o),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(ff={focusedElem:e,selectionRange:n},au=!1,ee=t;ee!==null;)if(t=ee,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ee=e;else for(;ee!==null;){t=ee;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var y=g.memoizedProps,_=g.memoizedState,x=t.stateNode,v=x.getSnapshotBeforeUpdate(t.elementType===t.type?y:Xn(t.type,y),_);x.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(W(163))}}catch(C){Ze(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,ee=e;break}ee=t.return}return g=Bg,Bg=!1,g}function Qo(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&If(t,n,i)}s=s.next}while(s!==r)}}function uc(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 Rf(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 O_(e){var t=e.alternate;t!==null&&(e.alternate=null,O_(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[pr],delete t[_a],delete t[mf],delete t[hT],delete t[pT])),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 z_(e){return e.tag===5||e.tag===3||e.tag===4}function $g(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||z_(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 Pf(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=cu));else if(r!==4&&(e=e.child,e!==null))for(Pf(e,t,n),e=e.sibling;e!==null;)Pf(e,t,n),e=e.sibling}function jf(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(jf(e,t,n),e=e.sibling;e!==null;)jf(e,t,n),e=e.sibling}var wt=null,Jn=!1;function Qr(e,t,n){for(n=n.child;n!==null;)F_(e,t,n),n=n.sibling}function F_(e,t,n){if(vr&&typeof vr.onCommitFiberUnmount=="function")try{vr.onCommitFiberUnmount(tc,n)}catch{}switch(n.tag){case 5:Rt||Mi(n,t);case 6:var r=wt,s=Jn;wt=null,Qr(e,t,n),wt=r,Jn=s,wt!==null&&(Jn?(e=wt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):wt.removeChild(n.stateNode));break;case 18:wt!==null&&(Jn?(e=wt,n=n.stateNode,e.nodeType===8?Zc(e.parentNode,n):e.nodeType===1&&Zc(e,n),ga(e)):Zc(wt,n.stateNode));break;case 4:r=wt,s=Jn,wt=n.stateNode.containerInfo,Jn=!0,Qr(e,t,n),wt=r,Jn=s;break;case 0:case 11:case 14:case 15:if(!Rt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&If(n,t,o),s=s.next}while(s!==r)}Qr(e,t,n);break;case 1:if(!Rt&&(Mi(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Ze(n,t,a)}Qr(e,t,n);break;case 21:Qr(e,t,n);break;case 22:n.mode&1?(Rt=(r=Rt)||n.memoizedState!==null,Qr(e,t,n),Rt=r):Qr(e,t,n);break;default:Qr(e,t,n)}}function Ug(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new PT),t.forEach(function(r){var s=BT.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Qn(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 5:wt=a.stateNode,Jn=!1;break e;case 3:wt=a.stateNode.containerInfo,Jn=!0;break e;case 4:wt=a.stateNode.containerInfo,Jn=!0;break e}a=a.return}if(wt===null)throw Error(W(160));F_(i,o,s),wt=null,Jn=!1;var l=s.alternate;l!==null&&(l.return=null),s.return=null}catch(u){Ze(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)B_(t,e),t=t.sibling}function B_(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Qn(t,e),ur(e),r&4){try{Qo(3,e,e.return),uc(3,e)}catch(y){Ze(e,e.return,y)}try{Qo(5,e,e.return)}catch(y){Ze(e,e.return,y)}}break;case 1:Qn(t,e),ur(e),r&512&&n!==null&&Mi(n,n.return);break;case 5:if(Qn(t,e),ur(e),r&512&&n!==null&&Mi(n,n.return),e.flags&32){var s=e.stateNode;try{fa(s,"")}catch(y){Ze(e,e.return,y)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&lw(s,i),ef(a,o);var u=ef(a,i);for(o=0;o<l.length;o+=2){var c=l[o],f=l[o+1];c==="style"?hw(s,f):c==="dangerouslySetInnerHTML"?dw(s,f):c==="children"?fa(s,f):Mh(s,c,f,u)}switch(a){case"input":Yd(s,i);break;case"textarea":uw(s,i);break;case"select":var h=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?zi(s,!!i.multiple,p,!1):h!==!!i.multiple&&(i.defaultValue!=null?zi(s,!!i.multiple,i.defaultValue,!0):zi(s,!!i.multiple,i.multiple?[]:"",!1))}s[_a]=i}catch(y){Ze(e,e.return,y)}}break;case 6:if(Qn(t,e),ur(e),r&4){if(e.stateNode===null)throw Error(W(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(y){Ze(e,e.return,y)}}break;case 3:if(Qn(t,e),ur(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ga(t.containerInfo)}catch(y){Ze(e,e.return,y)}break;case 4:Qn(t,e),ur(e);break;case 13:Qn(t,e),ur(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(hp=at())),r&4&&Ug(e);break;case 22:if(c=n!==null&&n.memoizedState!==null,e.mode&1?(Rt=(u=Rt)||c,Qn(t,e),Rt=u):Qn(t,e),ur(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!c&&e.mode&1)for(ee=e,c=e.child;c!==null;){for(f=ee=c;ee!==null;){switch(h=ee,p=h.child,h.tag){case 0:case 11:case 14:case 15:Qo(4,h,h.return);break;case 1:Mi(h,h.return);var g=h.stateNode;if(typeof g.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(y){Ze(r,n,y)}}break;case 5:Mi(h,h.return);break;case 22:if(h.memoizedState!==null){Hg(f);continue}}p!==null?(p.return=h,ee=p):Hg(f)}c=c.sibling}e:for(c=null,f=e;;){if(f.tag===5){if(c===null){c=f;try{s=f.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=f.stateNode,l=f.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=fw("display",o))}catch(y){Ze(e,e.return,y)}}}else if(f.tag===6){if(c===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(y){Ze(e,e.return,y)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;c===f&&(c=null),f=f.return}c===f&&(c=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Qn(t,e),ur(e),r&4&&Ug(e);break;case 21:break;default:Qn(t,e),ur(e)}}function ur(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(z_(n)){var r=n;break e}n=n.return}throw Error(W(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(fa(s,""),r.flags&=-33);var i=$g(e);jf(e,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,a=$g(e);Pf(e,a,o);break;default:throw Error(W(161))}}catch(l){Ze(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function AT(e,t,n){ee=e,$_(e)}function $_(e,t,n){for(var r=(e.mode&1)!==0;ee!==null;){var s=ee,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||yl;if(!o){var a=s.alternate,l=a!==null&&a.memoizedState!==null||Rt;a=yl;var u=Rt;if(yl=o,(Rt=l)&&!u)for(ee=s;ee!==null;)o=ee,l=o.child,o.tag===22&&o.memoizedState!==null?Wg(s):l!==null?(l.return=o,ee=l):Wg(s);for(;i!==null;)ee=i,$_(i),i=i.sibling;ee=s,yl=a,Rt=u}Vg(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,ee=i):Vg(e)}}function Vg(e){for(;ee!==null;){var t=ee;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Rt||uc(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Rt)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:Xn(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Tg(t,i,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}Tg(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 u=t.alternate;if(u!==null){var c=u.memoizedState;if(c!==null){var f=c.dehydrated;f!==null&&ga(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(W(163))}Rt||t.flags&512&&Rf(t)}catch(h){Ze(t,t.return,h)}}if(t===e){ee=null;break}if(n=t.sibling,n!==null){n.return=t.return,ee=n;break}ee=t.return}}function Hg(e){for(;ee!==null;){var t=ee;if(t===e){ee=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ee=n;break}ee=t.return}}function Wg(e){for(;ee!==null;){var t=ee;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{uc(4,t)}catch(l){Ze(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(l){Ze(t,s,l)}}var i=t.return;try{Rf(t)}catch(l){Ze(t,i,l)}break;case 5:var o=t.return;try{Rf(t)}catch(l){Ze(t,o,l)}}}catch(l){Ze(t,t.return,l)}if(t===e){ee=null;break}var a=t.sibling;if(a!==null){a.return=t.return,ee=a;break}ee=t.return}}var NT=Math.ceil,_u=qr.ReactCurrentDispatcher,dp=qr.ReactCurrentOwner,$n=qr.ReactCurrentBatchConfig,Te=0,vt=null,ft=null,St=0,mn=0,Di=Is(0),pt=0,Ta=null,ni=0,cc=0,fp=0,Xo=null,Yt=null,hp=0,to=1/0,jr=null,bu=!1,Af=null,ps=null,vl=!1,is=null,Su=0,Jo=0,Nf=null,Hl=-1,Wl=0;function Ut(){return Te&6?at():Hl!==-1?Hl:Hl=at()}function ms(e){return e.mode&1?Te&2&&St!==0?St&-St:gT.transition!==null?(Wl===0&&(Wl=Cw()),Wl):(e=Re,e!==0||(e=window.event,e=e===void 0?16:Aw(e.type)),e):1}function nr(e,t,n,r){if(50<Jo)throw Jo=0,Nf=null,Error(W(185));Wa(e,n,r),(!(Te&2)||e!==vt)&&(e===vt&&(!(Te&2)&&(cc|=n),pt===4&&ns(e,St)),nn(e,r),n===1&&Te===0&&!(t.mode&1)&&(to=at()+500,oc&&Rs()))}function nn(e,t){var n=e.callbackNode;gE(e,t);var r=ou(e,e===vt?St:0);if(r===0)n!==null&&eg(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&eg(n),t===1)e.tag===0?mT(qg.bind(null,e)):Xw(qg.bind(null,e)),dT(function(){!(Te&6)&&Rs()}),n=null;else{switch(Ew(r)){case 1:n=Fh;break;case 4:n=Sw;break;case 16:n=iu;break;case 536870912:n=kw;break;default:n=iu}n=Y_(n,U_.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function U_(e,t){if(Hl=-1,Wl=0,Te&6)throw Error(W(327));var n=e.callbackNode;if(Vi()&&e.callbackNode!==n)return null;var r=ou(e,e===vt?St:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ku(e,r);else{t=r;var s=Te;Te|=2;var i=H_();(vt!==e||St!==t)&&(jr=null,to=at()+500,Ws(e,t));do try{LT();break}catch(a){V_(e,a)}while(!0);Jh(),_u.current=i,Te=s,ft!==null?t=0:(vt=null,St=0,t=pt)}if(t!==0){if(t===2&&(s=of(e),s!==0&&(r=s,t=Mf(e,s))),t===1)throw n=Ta,Ws(e,0),ns(e,r),nn(e,at()),n;if(t===6)ns(e,r);else{if(s=e.current.alternate,!(r&30)&&!MT(s)&&(t=ku(e,r),t===2&&(i=of(e),i!==0&&(r=i,t=Mf(e,i))),t===1))throw n=Ta,Ws(e,0),ns(e,r),nn(e,at()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(W(345));case 2:zs(e,Yt,jr);break;case 3:if(ns(e,r),(r&130023424)===r&&(t=hp+500-at(),10<t)){if(ou(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Ut(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=pf(zs.bind(null,e,Yt,jr),t);break}zs(e,Yt,jr);break;case 4:if(ns(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var o=31-tr(r);i=1<<o,o=t[o],o>s&&(s=o),r&=~i}if(r=s,r=at()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*NT(r/1960))-r,10<r){e.timeoutHandle=pf(zs.bind(null,e,Yt,jr),r);break}zs(e,Yt,jr);break;case 5:zs(e,Yt,jr);break;default:throw Error(W(329))}}}return nn(e,at()),e.callbackNode===n?U_.bind(null,e):null}function Mf(e,t){var n=Xo;return e.current.memoizedState.isDehydrated&&(Ws(e,t).flags|=256),e=ku(e,t),e!==2&&(t=Yt,Yt=n,t!==null&&Df(t)),e}function Df(e){Yt===null?Yt=e:Yt.push.apply(Yt,e)}function MT(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 s=n[r],i=s.getSnapshot;s=s.value;try{if(!sr(i(),s))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&=~fp,t&=~cc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-tr(t),r=1<<n;e[n]=-1,t&=~r}}function qg(e){if(Te&6)throw Error(W(327));Vi();var t=ou(e,0);if(!(t&1))return nn(e,at()),null;var n=ku(e,t);if(e.tag!==0&&n===2){var r=of(e);r!==0&&(t=r,n=Mf(e,r))}if(n===1)throw n=Ta,Ws(e,0),ns(e,t),nn(e,at()),n;if(n===6)throw Error(W(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,zs(e,Yt,jr),nn(e,at()),null}function pp(e,t){var n=Te;Te|=1;try{return e(t)}finally{Te=n,Te===0&&(to=at()+500,oc&&Rs())}}function ri(e){is!==null&&is.tag===0&&!(Te&6)&&Vi();var t=Te;Te|=1;var n=$n.transition,r=Re;try{if($n.transition=null,Re=1,e)return e()}finally{Re=r,$n.transition=n,Te=t,!(Te&6)&&Rs()}}function mp(){mn=Di.current,Ue(Di)}function Ws(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,cT(n)),ft!==null)for(n=ft.return;n!==null;){var r=n;switch(Yh(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&du();break;case 3:Zi(),Ue(en),Ue(Mt),sp();break;case 5:rp(r);break;case 4:Zi();break;case 13:Ue(Ke);break;case 19:Ue(Ke);break;case 10:Zh(r.type._context);break;case 22:case 23:mp()}n=n.return}if(vt=e,ft=e=gs(e.current,null),St=mn=t,pt=0,Ta=null,fp=cc=ni=0,Yt=Xo=null,Us!==null){for(t=0;t<Us.length;t++)if(n=Us[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}Us=null}return e}function V_(e,t){do{var n=ft;try{if(Jh(),$l.current=wu,xu){for(var r=Xe.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}xu=!1}if(ti=0,yt=ht=Xe=null,Yo=!1,ka=0,dp.current=null,n===null||n.return===null){pt=1,Ta=t,ft=null;break}e:{var i=e,o=n.return,a=n,l=t;if(t=St,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=l,c=a,f=c.tag;if(!(c.mode&1)&&(f===0||f===11||f===15)){var h=c.alternate;h?(c.updateQueue=h.updateQueue,c.memoizedState=h.memoizedState,c.lanes=h.lanes):(c.updateQueue=null,c.memoizedState=null)}var p=Ng(o);if(p!==null){p.flags&=-257,Mg(p,o,a,i,t),p.mode&1&&Ag(i,u,t),t=p,l=u;var g=t.updateQueue;if(g===null){var y=new Set;y.add(l),t.updateQueue=y}else g.add(l);break e}else{if(!(t&1)){Ag(i,u,t),gp();break e}l=Error(W(426))}}else if(Ve&&a.mode&1){var _=Ng(o);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Mg(_,o,a,i,t),Qh(eo(l,a));break e}}i=l=eo(l,a),pt!==4&&(pt=2),Xo===null?Xo=[i]:Xo.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var x=E_(i,l,t);Eg(i,x);break e;case 1:a=l;var v=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof v.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(ps===null||!ps.has(w)))){i.flags|=65536,t&=-t,i.lanes|=t;var C=T_(i,a,t);Eg(i,C);break e}}i=i.return}while(i!==null)}q_(n)}catch(S){t=S,ft===n&&n!==null&&(ft=n=n.return);continue}break}while(!0)}function H_(){var e=_u.current;return _u.current=wu,e===null?wu:e}function gp(){(pt===0||pt===3||pt===2)&&(pt=4),vt===null||!(ni&268435455)&&!(cc&268435455)||ns(vt,St)}function ku(e,t){var n=Te;Te|=2;var r=H_();(vt!==e||St!==t)&&(jr=null,Ws(e,t));do try{DT();break}catch(s){V_(e,s)}while(!0);if(Jh(),Te=n,_u.current=r,ft!==null)throw Error(W(261));return vt=null,St=0,pt}function DT(){for(;ft!==null;)W_(ft)}function LT(){for(;ft!==null&&!aE();)W_(ft)}function W_(e){var t=G_(e.alternate,e,mn);e.memoizedProps=e.pendingProps,t===null?q_(e):ft=t,dp.current=null}function q_(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=RT(n,t),n!==null){n.flags&=32767,ft=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{pt=6,ft=null;return}}else if(n=IT(n,t,mn),n!==null){ft=n;return}if(t=t.sibling,t!==null){ft=t;return}ft=t=e}while(t!==null);pt===0&&(pt=5)}function zs(e,t,n){var r=Re,s=$n.transition;try{$n.transition=null,Re=1,OT(e,t,n,r)}finally{$n.transition=s,Re=r}return null}function OT(e,t,n,r){do Vi();while(is!==null);if(Te&6)throw Error(W(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(W(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(yE(e,i),e===vt&&(ft=vt=null,St=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||vl||(vl=!0,Y_(iu,function(){return Vi(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=$n.transition,$n.transition=null;var o=Re;Re=1;var a=Te;Te|=4,dp.current=null,jT(e,n),B_(n,e),rT(ff),au=!!df,ff=df=null,e.current=n,AT(n),lE(),Te=a,Re=o,$n.transition=i}else e.current=n;if(vl&&(vl=!1,is=e,Su=s),i=e.pendingLanes,i===0&&(ps=null),dE(n.stateNode),nn(e,at()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(bu)throw bu=!1,e=Af,Af=null,e;return Su&1&&e.tag!==0&&Vi(),i=e.pendingLanes,i&1?e===Nf?Jo++:(Jo=0,Nf=e):Jo=0,Rs(),null}function Vi(){if(is!==null){var e=Ew(Su),t=$n.transition,n=Re;try{if($n.transition=null,Re=16>e?16:e,is===null)var r=!1;else{if(e=is,is=null,Su=0,Te&6)throw Error(W(331));var s=Te;for(Te|=4,ee=e.current;ee!==null;){var i=ee,o=i.child;if(ee.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var u=a[l];for(ee=u;ee!==null;){var c=ee;switch(c.tag){case 0:case 11:case 15:Qo(8,c,i)}var f=c.child;if(f!==null)f.return=c,ee=f;else for(;ee!==null;){c=ee;var h=c.sibling,p=c.return;if(O_(c),c===u){ee=null;break}if(h!==null){h.return=p,ee=h;break}ee=p}}}var g=i.alternate;if(g!==null){var y=g.child;if(y!==null){g.child=null;do{var _=y.sibling;y.sibling=null,y=_}while(y!==null)}}ee=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,ee=o;else e:for(;ee!==null;){if(i=ee,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Qo(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,ee=x;break e}ee=i.return}}var v=e.current;for(ee=v;ee!==null;){o=ee;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,ee=w;else e:for(o=v;ee!==null;){if(a=ee,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:uc(9,a)}}catch(S){Ze(a,a.return,S)}if(a===o){ee=null;break e}var C=a.sibling;if(C!==null){C.return=a.return,ee=C;break e}ee=a.return}}if(Te=s,Rs(),vr&&typeof vr.onPostCommitFiberRoot=="function")try{vr.onPostCommitFiberRoot(tc,e)}catch{}r=!0}return r}finally{Re=n,$n.transition=t}}return!1}function Kg(e,t,n){t=eo(n,t),t=E_(e,t,1),e=hs(e,t,1),t=Ut(),e!==null&&(Wa(e,1,t),nn(e,t))}function Ze(e,t,n){if(e.tag===3)Kg(e,e,n);else for(;t!==null;){if(t.tag===3){Kg(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(ps===null||!ps.has(r))){e=eo(n,e),e=T_(t,e,1),t=hs(t,e,1),e=Ut(),t!==null&&(Wa(t,1,e),nn(t,e));break}}t=t.return}}function zT(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Ut(),e.pingedLanes|=e.suspendedLanes&n,vt===e&&(St&n)===n&&(pt===4||pt===3&&(St&130023424)===St&&500>at()-hp?Ws(e,0):fp|=n),nn(e,t)}function K_(e,t){t===0&&(e.mode&1?(t=ll,ll<<=1,!(ll&130023424)&&(ll=4194304)):t=1);var n=Ut();e=Ur(e,t),e!==null&&(Wa(e,t,n),nn(e,n))}function FT(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),K_(e,n)}function BT(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(W(314))}r!==null&&r.delete(t),K_(e,n)}var G_;G_=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||en.current)Zt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Zt=!1,TT(e,t,n);Zt=!!(e.flags&131072)}else Zt=!1,Ve&&t.flags&1048576&&Jw(t,pu,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Vl(e,t),e=t.pendingProps;var s=Qi(t,Mt.current);Ui(t,n),s=op(null,t,r,e,s,n);var i=ap();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,tn(r)?(i=!0,fu(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,tp(t),s.updater=lc,t.stateNode=s,s._reactInternals=t,_f(t,r,e,n),t=kf(null,t,r,!0,i,n)):(t.tag=0,Ve&&i&&Gh(t),Bt(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Vl(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=UT(r),e=Xn(r,e),s){case 0:t=Sf(null,t,r,e,n);break e;case 1:t=Og(null,t,r,e,n);break e;case 11:t=Dg(null,t,r,e,n);break e;case 14:t=Lg(null,t,r,Xn(r.type,e),n);break e}throw Error(W(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Xn(r,s),Sf(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Xn(r,s),Og(e,t,r,s,n);case 3:e:{if(j_(t),e===null)throw Error(W(387));r=t.pendingProps,i=t.memoizedState,s=i.element,s_(e,t),yu(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=eo(Error(W(423)),t),t=zg(e,t,r,n,s);break e}else if(r!==s){s=eo(Error(W(424)),t),t=zg(e,t,r,n,s);break e}else for(vn=fs(t.stateNode.containerInfo.firstChild),_n=t,Ve=!0,Zn=null,n=n_(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Xi(),r===s){t=Vr(e,t,n);break e}Bt(e,t,r,n)}t=t.child}return t;case 5:return i_(t),e===null&&vf(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,hf(r,s)?o=null:i!==null&&hf(r,i)&&(t.flags|=32),P_(e,t),Bt(e,t,o,n),t.child;case 6:return e===null&&vf(t),null;case 13:return A_(e,t,n);case 4:return np(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ji(t,null,r,n):Bt(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Xn(r,s),Dg(e,t,r,s,n);case 7:return Bt(e,t,t.pendingProps,n),t.child;case 8:return Bt(e,t,t.pendingProps.children,n),t.child;case 12:return Bt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,Oe(mu,r._currentValue),r._currentValue=o,i!==null)if(sr(i.value,o)){if(i.children===s.children&&!en.current){t=Vr(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=Fr(-1,n&-n),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),xf(i.return,n,t),a.lanes|=n;break}l=l.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(W(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),xf(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}Bt(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Ui(t,n),s=Vn(s),r=r(s),t.flags|=1,Bt(e,t,r,n),t.child;case 14:return r=t.type,s=Xn(r,t.pendingProps),s=Xn(r.type,s),Lg(e,t,r,s,n);case 15:return I_(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Xn(r,s),Vl(e,t),t.tag=1,tn(r)?(e=!0,fu(t)):e=!1,Ui(t,n),C_(t,r,s),_f(t,r,s,n),kf(null,t,r,!0,e,n);case 19:return N_(e,t,n);case 22:return R_(e,t,n)}throw Error(W(156,t.tag))};function Y_(e,t){return bw(e,t)}function $T(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 zn(e,t,n,r){return new $T(e,t,n,r)}function yp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function UT(e){if(typeof e=="function")return yp(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Lh)return 11;if(e===Oh)return 14}return 2}function gs(e,t){var n=e.alternate;return n===null?(n=zn(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 ql(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")yp(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Ci:return qs(n.children,s,i,t);case Dh:o=8,s|=8;break;case Hd:return e=zn(12,n,t,s|2),e.elementType=Hd,e.lanes=i,e;case Wd:return e=zn(13,n,t,s),e.elementType=Wd,e.lanes=i,e;case qd:return e=zn(19,n,t,s),e.elementType=qd,e.lanes=i,e;case iw:return dc(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case rw:o=10;break e;case sw:o=9;break e;case Lh:o=11;break e;case Oh:o=14;break e;case Jr:o=16,r=null;break e}throw Error(W(130,e==null?e:typeof e,""))}return t=zn(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function qs(e,t,n,r){return e=zn(7,e,r,t),e.lanes=n,e}function dc(e,t,n,r){return e=zn(22,e,r,t),e.elementType=iw,e.lanes=n,e.stateNode={isHidden:!1},e}function ad(e,t,n){return e=zn(6,e,null,t),e.lanes=n,e}function ld(e,t,n){return t=zn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function VT(e,t,n,r,s){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=Uc(0),this.expirationTimes=Uc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Uc(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function vp(e,t,n,r,s,i,o,a,l){return e=new VT(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=zn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},tp(i),e}function HT(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ki,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Q_(e){if(!e)return _s;e=e._reactInternals;e:{if(li(e)!==e||e.tag!==1)throw Error(W(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(tn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(W(171))}if(e.tag===1){var n=e.type;if(tn(n))return Qw(e,n,t)}return t}function X_(e,t,n,r,s,i,o,a,l){return e=vp(n,r,!0,e,s,i,o,a,l),e.context=Q_(null),n=e.current,r=Ut(),s=ms(n),i=Fr(r,s),i.callback=t??null,hs(n,i,s),e.current.lanes=s,Wa(e,s,r),nn(e,r),e}function fc(e,t,n,r){var s=t.current,i=Ut(),o=ms(s);return n=Q_(n),t.context===null?t.context=n:t.pendingContext=n,t=Fr(i,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=hs(s,t,o),e!==null&&(nr(e,s,o,i),Bl(e,s,o)),o}function Cu(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 Gg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function xp(e,t){Gg(e,t),(e=e.alternate)&&Gg(e,t)}function WT(){return null}var J_=typeof reportError=="function"?reportError:function(e){console.error(e)};function wp(e){this._internalRoot=e}hc.prototype.render=wp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(W(409));fc(e,t,null,null)};hc.prototype.unmount=wp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ri(function(){fc(null,e,null,null)}),t[$r]=null}};function hc(e){this._internalRoot=e}hc.prototype.unstable_scheduleHydration=function(e){if(e){var t=Rw();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ts.length&&t!==0&&t<ts[n].priority;n++);ts.splice(n,0,e),n===0&&jw(e)}};function _p(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function pc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Yg(){}function qT(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=Cu(o);i.call(u)}}var o=X_(t,r,e,0,null,!1,!1,"",Yg);return e._reactRootContainer=o,e[$r]=o.current,xa(e.nodeType===8?e.parentNode:e),ri(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var a=r;r=function(){var u=Cu(l);a.call(u)}}var l=vp(e,0,!1,null,null,!1,!1,"",Yg);return e._reactRootContainer=l,e[$r]=l.current,xa(e.nodeType===8?e.parentNode:e),ri(function(){fc(t,l,n,r)}),l}function mc(e,t,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var a=s;s=function(){var l=Cu(o);a.call(l)}}fc(t,o,e,s)}else o=qT(n,t,e,s,r);return Cu(o)}Tw=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Bo(t.pendingLanes);n!==0&&(Bh(t,n|1),nn(t,at()),!(Te&6)&&(to=at()+500,Rs()))}break;case 13:ri(function(){var r=Ur(e,1);if(r!==null){var s=Ut();nr(r,e,1,s)}}),xp(e,1)}};$h=function(e){if(e.tag===13){var t=Ur(e,134217728);if(t!==null){var n=Ut();nr(t,e,134217728,n)}xp(e,134217728)}};Iw=function(e){if(e.tag===13){var t=ms(e),n=Ur(e,t);if(n!==null){var r=Ut();nr(n,e,t,r)}xp(e,t)}};Rw=function(){return Re};Pw=function(e,t){var n=Re;try{return Re=e,t()}finally{Re=n}};nf=function(e,t,n){switch(t){case"input":if(Yd(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 s=ic(r);if(!s)throw Error(W(90));aw(r),Yd(r,s)}}}break;case"textarea":uw(e,n);break;case"select":t=n.value,t!=null&&zi(e,!!n.multiple,t,!1)}};gw=pp;yw=ri;var KT={usingClientEntryPoint:!1,Events:[Ka,Ri,ic,pw,mw,pp]},No={findFiberByHostInstance:$s,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},GT={bundleType:No.bundleType,version:No.version,rendererPackageName:No.rendererPackageName,rendererConfig:No.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:qr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ww(e),e===null?null:e.stateNode},findFiberByHostInstance:No.findFiberByHostInstance||WT,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 xl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xl.isDisabled&&xl.supportsFiber)try{tc=xl.inject(GT),vr=xl}catch{}}In.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=KT;In.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!_p(t))throw Error(W(200));return HT(e,t,null,n)};In.createRoot=function(e,t){if(!_p(e))throw Error(W(299));var n=!1,r="",s=J_;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=vp(e,1,!1,null,null,n,!1,r,s),e[$r]=t.current,xa(e.nodeType===8?e.parentNode:e),new wp(t)};In.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(W(188)):(e=Object.keys(e).join(","),Error(W(268,e)));return e=ww(t),e=e===null?null:e.stateNode,e};In.flushSync=function(e){return ri(e)};In.hydrate=function(e,t,n){if(!pc(t))throw Error(W(200));return mc(null,e,t,!0,n)};In.hydrateRoot=function(e,t,n){if(!_p(e))throw Error(W(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=J_;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=X_(t,null,e,1,n??null,s,!1,i,o),e[$r]=t.current,xa(e),r)for(e=0;e<r.length;e++)n=r[e],s=n._getVersion,s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s);return new hc(t)};In.render=function(e,t,n){if(!pc(t))throw Error(W(200));return mc(null,e,t,!1,n)};In.unmountComponentAtNode=function(e){if(!pc(e))throw Error(W(40));return e._reactRootContainer?(ri(function(){mc(null,null,e,!1,function(){e._reactRootContainer=null,e[$r]=null})}),!0):!1};In.unstable_batchedUpdates=pp;In.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!pc(n))throw Error(W(200));if(e==null||e._reactInternals===void 0)throw Error(W(38));return mc(e,t,n,!1,r)};In.version="18.3.1-next-f1338f8080-20240426";function Z_(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Z_)}catch(e){console.error(e)}}Z_(),Zx.exports=In;var eb=Zx.exports,tb,Qg=eb;tb=Qg.createRoot,Qg.hydrateRoot;function YT(e,t){const n=e[nb];if(!n)throw new Error("ResourceElement.type is not a valid Resource");return n(t)}const nb=Symbol("fnSymbol");function _e(e){const t=n=>({type:t,props:n});return t[nb]=e,t}function br(e,t){return{...t,key:e}}let Zo=null;function QT(e,t){e.currentIndex=0;const n=Zo;Zo=e;try{if(t(),e.isFirstRender=!1,e.cells.length!==e.currentIndex)throw new Error(`Rendered ${e.currentIndex} hooks but expected ${e.cells.length}. Hooks must be called in the exact same order in every render.`)}finally{Zo=n}}function bs(){if(!Zo)throw new Error("No resource fiber available");return Zo}function XT(e){return null}const rb=e=>({version:0,committedVersion:0,dispatchUpdate:e,changelog:[],dirtyCells:[]}),Eu=e=>{for(const t of e.dirtyCells)t.dirty=!1,t.queue.clear(),t.current=t.workInProgress;e.committedVersion=e.version,e.changelog.length=0,e.dirtyCells.length=0},ea=(e,t)=>{const n=e.version>t;if(e.version=t,n){for(const r of e.dirtyCells)r.dirty=!1,r.queue.clear(),r.workInProgress=r.current;if(e.dirtyCells.length=0,t===e.committedVersion)e.changelog.length=0;else{if(e.committedVersion>t)throw new Error("Version is less than committed version");for(;e.committedVersion+e.changelog.length>t;)e.changelog.pop();e.changelog.forEach(r=>r()),Eu(e)}}},Xg=(e,t)=>{t.dirty||(t.dirty=!0,e.markDirty?.(),e.root.dirtyCells.push(t))},sb=(e,t)=>{const n=bs(),r=n.currentIndex++;if(!n.isFirstRender&&r>=n.cells.length)throw new Error("Rendered more hooks than during the previous render. Hooks must be called in the exact same order in every render.");let s=n.cells[r];if(s||(s=t(),n.cells[r]=s),s.type!==e)throw new Error("Hook order changed between renders");return s},JT=e=>{bs().renderContext.effectTasks.push(e)},ZT=(e,t)=>{if(e.renderContext)throw new Error("Resource updated during render");if(e.isNeverMounted)throw new Error("Resource updated before mount");e.root.dispatchUpdate(()=>{const n=t();return n?(n(),e.root.changelog.push(n),!0):!1})};function ib(e,t,n,r){const s=sb("reducer",()=>{const a=bs(),l=r?r(n):n;return{type:"reducer",queue:new Set,dirty:!1,workInProgress:l,current:l,reducer:e,dispatch:u=>{const c={action:u,hasEagerState:!1,eagerState:void 0};ZT(a,()=>a.root.dirtyCells.length===0&&!c.hasEagerState&&(c.eagerState=e(s.workInProgress,u),c.hasEagerState=!0,Object.is(s.current,c.eagerState))?null:()=>{Xg(a,s),s.queue.add(c)})}}}),i=bs(),o=e===s.reducer;s.reducer=e;for(const a of s.queue)(!a.hasEagerState||!o)&&(a.eagerState=e(s.workInProgress,a.action),a.hasEagerState=!0),s.workInProgress=a.eagerState;if(s.queue.clear(),t){const a=t(s.workInProgress);Object.is(a,s.workInProgress)||(Xg(i,s),s.workInProgress=a)}return[s.workInProgress,s.dispatch]}function eI(e,t,n){return ib(e,void 0,t,n)}function tI(e,t,n,r){return ib(e,t,n,r)}const nI=(e,t)=>typeof t=="function"?t(e):t,rI=e=>typeof e=="function"?e():e;function Cn(e){return eI(nI,e,rI)}const ob=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0},sI=()=>({type:"effect",cleanup:void 0,deps:null});function lt(e,t){const n=sb("effect",sI);if(!(t&&n.deps&&ob(n.deps,t))){if(n.deps!==null&&!!t!=!!n.deps)throw new Error("tapEffect called with and without dependencies across re-renders");JT(()=>{const r=[];try{n.cleanup?.()}catch(s){r.push(s)}finally{n.cleanup=void 0}try{const s=e();if(s!==void 0&&typeof s!="function")throw new Error(`An effect function must either return a cleanup function or nothing. Received: ${typeof s}`);n.cleanup=s}catch(s){r.push(s)}if(n.deps=t,r.length>0){if(r.length===1)throw r[0];for(const s of r)console.error(s);throw new AggregateError(r,"Errors during commit")}})}}function wr(e){const[t]=Cn(()=>({current:e}));return t}function Ks(e,t){const[n]=Cn(e);return n}const iI=()=>{throw new Error("Memo reducer should not be called")},pe=(e,t)=>{bs();const[n]=tI(iI,r=>r&&ob(r.deps,t)?r:{value:e(),deps:t},null);return n.value},Ia=(e,t)=>pe(()=>e,t);function _r(e){const t=wr(e);lt(()=>{t.current=e});const n=bs();return Ia((...r)=>t.current(...r),[n])}function oI(e){const t=[];for(const n of e.effectTasks)try{n()}catch(r){t.push(r)}if(t.length>0){if(t.length===1)throw t[0];for(const n of t)console.error(n);throw new AggregateError(t,"Errors during commit")}}function aI(e){const t=[];for(const n of e.cells)if(n?.type==="effect"&&(n.deps=null,n.cleanup))try{n.cleanup?.()}catch(r){t.push(r)}finally{n.cleanup=void 0}if(t.length>0){if(t.length===1)throw t[0];for(const n of t)console.error(n);throw new AggregateError(t,"Errors during cleanup")}}function Ra(e,t,n=void 0,r=XT()){return{type:e,root:t,markDirty:n,devStrictMode:r,cells:[],currentIndex:0,renderContext:void 0,isFirstRender:!0,isMounted:!1,isNeverMounted:!0}}function Hi(e){if(!e.isMounted)throw new Error("Tried to unmount a fiber that is already unmounted");e.isMounted=!1,aI(e)}function ys(e,t){const n={effectTasks:[],props:t,output:void 0};return QT(e,()=>{e.renderContext=n;try{n.output=YT(e.type,t)}finally{e.renderContext=void 0}}),n}function no(e,t){e.isMounted=!0,e.isNeverMounted=!1,oI(t)}function _t(e,t){const n=bs(),r=wr(0),s=pe(()=>(e.key,Ra(e.type,n.root,()=>{r.current++,n.markDirty?.()})),[e.type,e.key,n]),i=t?pe(()=>ys(s,e.props),[s,...t,r.current]):ys(s,e.props);return lt(()=>()=>Hi(s),[s]),lt(()=>{no(s,i)},[s,i]),i.output}function gc(e,t){const n=wr(0),r=n.current,s=Ks(bs),i=Ks(()=>()=>{n.current++,s.markDirty?.()}),o=Ks(()=>new Map),a=t?Ia(e,t):e,l=pe(()=>{const u=a(),c=new Set,f=[];let h=0;for(let p=0;p<u.length;p++){const g=u[p],y=g.key;if(y===void 0)throw new Error(`tapResources did not provide a key for array at index ${p}`);if(c.has(y))throw new Error(`Duplicate key ${y} in tapResources`);c.add(y);let _=o.get(y);if(_)if(_.fiber.type!==g.type){const x=Ra(g.type,s.root,i),v=ys(x,g.props);_.next=[x,v],f.push(v.output)}else _.next=ys(_.fiber,g.props),f.push(_.next.output);else{const x=Ra(g.type,s.root,i),v=ys(x,g.props);_={fiber:x,next:v},h++,o.set(y,_),f.push(v.output)}}if(o.size>f.length-h)for(const p of o.keys())c.has(p)||(o.get(p).next="delete");return f},[a,r]);return lt(()=>()=>{for(const u of o.keys()){const c=o.get(u).fiber;Hi(c)}},[]),lt(()=>{for(const[u,c]of o.entries())c.next==="delete"?(c.fiber.isMounted&&Hi(c.fiber),o.delete(u)):Array.isArray(c.next)?(Hi(c.fiber),c.fiber=c.next[0],no(c.fiber,c.next[1])):no(c.fiber,c.next)},[l]),l}const lI=50;let gr={schedulers:new Set([]),isScheduled:!1};var uI=class{constructor(e){N(this,"_task");N(this,"_isDirty",!1);this._task=e}get isDirty(){return this._isDirty}markDirty(){this._isDirty=!0,gr.schedulers.add(this),cI()}runTask(){this._isDirty=!1,this._task()}};const cI=()=>{gr.isScheduled||(gr.isScheduled=!0,dI())},Lf=()=>{try{const e=[];let t=0;for(const n of gr.schedulers)if(gr.schedulers.delete(n),!!n.isDirty){if(t++,t>lI)throw new Error("Maximum update depth exceeded. This can happen when a resource repeatedly calls setState inside tapEffect.");try{n.runTask()}catch(r){e.push(r)}}if(e.length>0){if(e.length===1)throw e[0];for(const n of e)console.error(n);throw new AggregateError(e,"Errors occurred during flushSync")}}finally{gr.schedulers.clear(),gr.isScheduled=!1}},dI=(()=>{if(typeof MessageChannel<"u"){const e=new MessageChannel;return e.port1.onmessage=Lf,()=>e.port2.postMessage(null)}return()=>setTimeout(Lf,0)})(),Jg=e=>{const t=gr;gr={schedulers:new Set([]),isScheduled:!0};try{const n=e();return Lf(),n}finally{gr=t}},fI=e=>{const t=Ks(()=>new uI(()=>u(null))),n=Ks(()=>[]),r=pe(()=>(e.key,Ra(e.type,rb(c=>{!t.isDirty&&!c()||(n.push(c),t.markDirty())}))),[e.type,e.key]);ea(r.root,r.root.committedVersion);const s=ys(r,e.props),i=wr(!1),o=wr(e.props),a=wr(s.output),l=Ks(()=>new Set),u=_r(c=>{if(c===null&&(ea(r.root,2),ea(r.root,1),n.forEach(f=>{f()}),c=ys(r,o.current)),t.isDirty)throw new Error("Scheduler is dirty, this should never happen");Eu(r.root),n.length=0,i.current&&no(r,c),!(t.isDirty||a.current===c.output)&&(a.current=c.output,l.forEach(f=>f()))});return lt(()=>(i.current=!0,()=>{i.current=!1,Hi(r)}),[r]),lt(()=>{o.current=s.props,Eu(r.root),no(r,s),!(t.isDirty||a.current===s.output)&&(a.current=s.output,l.forEach(c=>c()))}),pe(()=>({getValue:()=>a.current,subscribe:c=>(l.add(c),()=>l.delete(c))}),[])},ta=Symbol("tap.Context"),ab=e=>({[ta]:e}),lb=(e,t,n)=>{const r=e[ta];e[ta]=t;try{return n()}finally{e[ta]=r}},ub=e=>e[ta],hI=_e(()=>{const[e,t]=Cn(()=>({renderers:{},fallbacks:[]}));return{getState:()=>e,setDataUI:Ia((n,r)=>(t(s=>({...s,renderers:{...s.renderers,[n]:[...s.renderers[n]??[],r]}})),()=>{t(s=>({...s,renderers:{...s.renderers,[n]:s.renderers[n]?.filter(i=>i!==r)??[]}}))}),[]),setFallbackDataUI:Ia(n=>(t(r=>({...r,fallbacks:[...r.fallbacks,n]})),()=>{t(r=>({...r,fallbacks:r.fallbacks.filter(s=>s!==n)}))}),[])}}),pI=e=>{const t=Array.from(e).map(r=>r.getModelContext()).sort((r,s)=>(s.priority??0)-(r.priority??0)),n={};return t.reduce((r,s)=>{const i=s.priority??0;if(s.system&&(r.system?r.system+=`
|
|
41
|
+
|
|
42
|
+
${s.system}`:r.system=s.system),s.tools)for(const[o,a]of Object.entries(s.tools)){const l=r.tools?.[o];if(l&&l!==a){const u=n[o];if(u===i)throw new Error(`You tried to define a tool with the name ${o}, but it already exists.`);const c=u>i?l:a,f=u>i?a:l;r.tools[o]={...f,...c},n[o]=Math.max(u,i);continue}r.tools||(r.tools={}),r.tools[o]=a,n[o]??(n[o]=i)}return s.config&&(r.config={...r.config,...s.config}),s.callSettings&&(r.callSettings={...r.callSettings,...s.callSettings}),r},{})};var bp=class{constructor(){N(this,"_providers",new Set);N(this,"_subscribers",new Set)}getModelContext(){return pI(this._providers)}registerModelContextProvider(e){this._providers.add(e);const t=e.subscribe?.(()=>{this.notifySubscribers()});return this.notifySubscribers(),()=>{this._providers.delete(e),t?.(),this.notifySubscribers()}}notifySubscribers(){for(const e of this._subscribers)e()}subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}};const Of=[],mI={modelName:void 0,toolNames:Of},gI=(e,t)=>e===t||e.length===t.length&&e.every((n,r)=>n===t[r]),wl=(e,t)=>{const n=e.getModelContext(),r=n.config?.modelName,s=n.tools?Object.keys(n.tools).sort():Of,i=s.length?s:Of;return r===t.modelName&&gI(i,t.toolNames)?t:{modelName:r,toolNames:i}},cb=_e(()=>{const e=pe(()=>new bp,[]),[t,n]=Cn(()=>wl(e,mI));return lt(()=>(n(r=>wl(e,r)),e.subscribe(()=>{n(r=>wl(e,r))})),[e]),{getState:()=>wl(e,t),getModelContext:()=>e.getModelContext(),subscribe:r=>e.subscribe(r),register:r=>e.registerModelContextProvider(r)}}),yI=e=>e.display!==void 0?e.display==="standalone":e.type==="human",vI=(e,t)=>{if(!(t.status?.type==="running"||t.status?.type==="requires-action")){const r=e.complete;return typeof r!="function"?r??null:r({args:t.args,result:t.result})}const n=e.running;return typeof n!="function"?n??null:n({args:t.args})},xI=e=>function(n){return vI(e,n)},zf=Symbol("assistant-ui.store.clientIndex"),wI=e=>e[zf],db=ab([]),Sp=()=>ub(db),_I=(e,t)=>{const n=Sp();return lb(db,pe(()=>[...n,e],[n,e]),t)},bI=new Set(["$$typeof","nodeType","then"]),yc=(e,t)=>{if(e===Symbol.toStringTag)return t;if(typeof e!="symbol"){if(e==="toJSON")return()=>t;if(!bI.has(e))return!1}};var kp=class{getOwnPropertyDescriptor(e,t){const n=this.get(e,t);if(n!==void 0)return{value:n,writable:!1,enumerable:!0,configurable:!1}}set(){return!1}setPrototypeOf(){return!1}defineProperty(){return!1}deleteProperty(){return!1}preventExtensions(){return!1}};const fb=e=>{const t=_e(e);return n=>{const r=t(n);return n.key===void 0?r:br(n.key,r)}},Tu=Symbol("assistant-ui.store.getValue"),SI=e=>{const t=e[Tu];if(!t)throw new Error("Client scope contains a non-client resource. Ensure your Derived get() returns a client created with tapClientResource(), not a plain resource.");return t.getState?.()},Zg=new Map;function kI(e){let t=Zg.get(e);return t||(t=function(...n){if(!this||typeof this!="object")throw new Error(`Method "${String(e)}" called without proper context. This may indicate the function was called incorrectly.`);const r=this[Tu];if(!r)throw new Error(`Method "${String(e)}" called on invalid client proxy. Ensure you are calling this method on a valid client instance.`);const s=r[e];if(!s)throw new Error(`Method "${String(e)}" is not implemented.`);if(typeof s!="function")throw new Error(`"${String(e)}" is not a function.`);return s(...n)},Zg.set(e,t)),t}var CI=class extends kp{constructor(t,n){super();N(this,"outputRef");N(this,"index");N(this,"boundFns");N(this,"cachedReceiver");this.outputRef=t,this.index=n}get(t,n,r){if(n===Tu)return this.outputRef.current;if(n===zf)return this.index;const s=yc(n,"ClientProxy");if(s!==!1)return s;const i=this.outputRef.current[n];if(typeof i=="function"){this.cachedReceiver!==r&&(this.boundFns=new Map,this.cachedReceiver=r);let o=this.boundFns.get(n);return o||(o=kI(n).bind(r),this.boundFns.set(n,o)),o}return i}ownKeys(){return Object.keys(this.outputRef.current)}has(t,n){return n===Tu||n===zf?!0:n in this.outputRef.current}};const hb=fb(e=>{const t=wr(null),n=Sp().length,r=pe(()=>new Proxy({},new CI(t,n)),[n]),s=_I(r,()=>_t(e));return t.current||(t.current=s),lt(()=>{t.current=s}),{methods:r,state:s.getState?.(),key:e.key}}),vc=e=>_t(hb(e)),na=Symbol("assistant-ui.store.proxiedAssistantState"),ud=e=>e==="on"||e==="subscribe"||typeof e=="symbol",pb=e=>{class t extends kp{get(r,s){const i=yc(s,"AssistantState");if(i!==!1)return i;const o=s;if(!ud(o))return SI(e[o]())}ownKeys(){return Object.keys(e).filter(r=>!ud(r))}has(r,s){return!ud(s)&&s in e}}return new Proxy({},new t)},EI=e=>e[na],ey=()=>()=>{},mb=e=>{const t=()=>{throw new Error(e)};return t.source=null,t.query=null,t};var TI=class extends kp{get(e,t){if(t==="subscribe"||t==="on")return ey;if(t===na)return II;const n=yc(t,"DefaultAssistantClient");return n!==!1?n:mb("You are using a component or hook that requires an AuiProvider. Wrap your component in an <AuiProvider> component.")}ownKeys(){return["subscribe","on",na]}has(e,t){return t==="subscribe"||t==="on"||t===na}};const xc=new Proxy({},new TI),II=pb(xc),RI=()=>new Proxy({},{get(e,t){const n=yc(t,"AssistantClient");return n!==!1?n:mb(`The current scope does not have a "${String(t)}" property.`)}}),gb=m.createContext(xc),PI=()=>m.useContext(gb),Kr=({value:e,children:t})=>d.jsx(gb.Provider,{value:e,children:t}),Un=_e(e=>null),Ff=Symbol("assistant-ui.transform-scopes");function yb(e,t){const n=e;if(n[Ff])throw new Error("transformScopes is already attached to this resource");n[Ff]=t}function jI(e){return e[Ff]}const vb=e=>typeof e=="string"?{scope:e.split(".")[0],event:e}:{scope:e.scope,event:e.event},xb=ab(null),AI=(e,t)=>lb(xb,e,t),wb=()=>{const e=ub(xb);if(!e)throw new Error("AssistantTapContext is not available");return e},_b=()=>wb().clientRef,Cp=()=>{const{emit:e}=wb(),t=Sp();return _r((n,r)=>{e(n,r,t)})};function NI(e,t){const n={...e},r=new Set;let s=!0;for(;s;){s=!1;for(const a of Object.values(n)){if(a.type===Un||r.has(a.type))continue;r.add(a.type);const l=jI(a.type);if(l){l(n,t),s=!0;break}}}const i={},o={};for(const[a,l]of Object.entries(n))l.type===Un?o[a]=l:i[a]=l;return{rootClients:i,derivedClients:o}}const ty=e=>pe(()=>e,[...Object.entries(e).flat()]),MI=(e,t)=>{const{rootClients:n,derivedClients:r}=NI(e,t);return{rootClients:ty(n),derivedClients:ty(r)}},DI=_e(()=>Ks(()=>{const e=new Map,t=new Set,n=new Set;return{on(r,s){const i=s;if(r==="*")return t.add(i),()=>t.delete(i);let o=e.get(r);return o||(o=new Set,e.set(r,o)),o.add(i),()=>{o.delete(i),o.size===0&&e.delete(r)}},emit(r,s,i){const o=e.get(r);!o&&t.size===0||queueMicrotask(()=>{const a=[];if(o)for(const l of o)try{l(s,i)}catch(u){a.push(u)}if(t.size>0){const l={event:r,payload:s};for(const u of t)try{u(l,i)}catch(c){a.push(c)}}if(a.length>0){if(a.length===1)throw a[0];for(const l of a)console.error(l);throw new AggregateError(a,"Errors occurred during event emission")}})},subscribe(r){return n.add(r),()=>n.delete(r)},notifySubscribers(){for(const r of n)try{r()}catch(s){console.error("NotificationManager: subscriber callback error",s)}}}})),LI=()=>null;function bb(e){const t=m.useMemo(()=>rb(a=>r(a)),[]),[n,r]=m.useReducer((a,l)=>(ea(t,a),a+(l()?1:0)),0);ea(t,n);const s=LI(),i=m.useMemo(()=>(e.key,Ra(e.type,t,void 0,s)),[e.type,e.key,t,s]),o=ys(i,e.props);return m.useLayoutEffect(()=>()=>Hi(i),[i]),m.useLayoutEffect(()=>{Eu(t),no(i,o)}),o.output}const Sb=e=>pe(()=>e,e),OI=_e(({element:e,emit:t,clientRef:n})=>{const{methods:r,state:s}=AI({clientRef:n,emit:t},()=>vc(e));return pe(()=>({state:s,methods:r}),[r,s])}),zI=_e(({element:e,notifications:t,clientRef:n,name:r})=>{const s=fI(OI({element:e,emit:t.emit,clientRef:n}));return lt(()=>s.subscribe(t.notifySubscribers),[s,t]),pe(()=>{const i=()=>s.getValue().methods;return Object.defineProperties(i,{source:{value:"root",writable:!1},query:{value:{},writable:!1},name:{value:r,configurable:!0}}),i},[s,r])}),FI=_e(()=>pe(()=>({clients:[],subscribe:void 0,on:void 0}),[])),BI=_e(({clients:e,clientRef:t})=>{const n=_t(DI());lt(()=>t.parent.subscribe(n.notifySubscribers),[t,n]);const r=Sb(gc(()=>Object.keys(e).map(s=>br(s,zI({element:e[s],notifications:n,clientRef:t,name:s}))),[e,n,t]));return pe(()=>({clients:r,subscribe:n.subscribe,on:function(s,i){if(!this)throw new Error("const { on } = useAui() is not supported. Use aui.on() instead.");const{scope:o,event:a}=vb(s);if(o!=="*"&&this[o].source===null)throw new Error(`Scope "${o}" is not available. Use { scope: "*", event: "${a}" } to listen globally.`);const l=n.on(a,(c,f)=>{if(o==="*"){i(c);return}const h=this[o]();h===f[wI(h)]&&i(c)});if(o!=="*"&&t.parent[o].source===null)return l;const u=t.parent.on(s,i);return()=>{l(),u()}}}),[r,n,t])}),$I=_e(({element:e,clientRef:t,name:n})=>{const r=wr(e.props);return r.current=e.props,pe(()=>{const s=()=>r.current.get(t.current);return Object.defineProperties(s,{source:{value:r.current.source},query:{value:r.current.query},name:{value:n,configurable:!0}}),s},[t,n])}),UI=(e,t)=>{let n;try{const r={};for(const s of Object.keys(t.query).sort())r[s]=t.query[s];n=JSON.stringify(r)}catch{n=String(t.query)}return`${e}::${t.source}::${n}`},VI=_e(({clients:e,clientRef:t})=>Sb(gc(()=>Object.keys(e).map(n=>{const r=n,s=e[r];return br(UI(r,s.props),$I({element:s,clientRef:t,name:r}))}),[e,t]))),HI=_e(({parent:e,clients:t})=>{const{rootClients:n,derivedClients:r}=MI(t,e),s=wr({parent:e,current:null}).current;lt(()=>{s.current=a});const i=_t(Object.keys(n).length>0?BI({clients:n,clientRef:s}):FI()),o=_t(VI({clients:r,clientRef:s})),a=pe(()=>{const l=e===xc?RI():e,u=Object.create(l);Object.assign(u,{subscribe:i.subscribe??e.subscribe,on:i.on??e.on,[na]:pb(u)});for(const c of i.clients)u[c.name]=c;for(const c of o)u[c.name]=c;return u},[e,i,o]);return s.current===null&&(s.current=a),a});function he(e,{parent:t}={parent:PI()}){if(e)return bb(HI({parent:t??xc,clients:e}));if(t===null)throw new Error("received null parent, this usage is not allowed");return t}const Y=e=>{const t=he(),n=EI(t),r=m.useSyncExternalStore(t.subscribe,()=>e(n),()=>e(n));if(r===n)throw new Error("You tried to return the entire AssistantState. This is not supported due to technical limitations.");return m.useDebugValue(r),r},WI=e=>{const t=he(),n=m.useRef(!1),r=n.current?null:e(t);return Y(()=>n.current?e(t):r),()=>(n.current=!0,e(t))},qI=Object.freeze({});function go({getItemState:e,children:t}){return KI(t(WI(e)))}const KI=e=>{const t=typeof e=="object"&&e!=null&&"type"in e?e:null,n=t?.type,r=t?.key;return m.useMemo(()=>t,[n,r,typeof t?.props=="object"&&t.props!=null&&Object.entries(t.props).length===0?qI:t?.props])??e},GI=Jt.createContext(!0);function ny(){throw new Error("A function wrapped in useEffectEvent can't be called during rendering.")}const YI="use"in Jt?()=>{try{return Jt.use(GI)}catch{return!1}}:()=>!1;function QI(e){const t=Jt.useRef(ny);return Jt.useInsertionEffect(()=>{t.current=e},[e]),(...n)=>{YI()&&ny();const r=t.current;return r(...n)}}const Iu=(e,t)=>{const n=he(),r=QI(t),{scope:s,event:i}=vb(e);m.useEffect(()=>n.on({scope:s,event:i},r),[n,s,i])},XI=fb(e=>{if(e.key===void 0)throw new Error("tapClientResource: Element has no key");return _t(hb(e))});function ro(e,t){const n=gc(()=>e().map(i=>XI(i)),t),r=pe(()=>Object.keys(n),[n]),s=pe(()=>n.reduce((i,o,a)=>(i[o.key]=a,i),{}),[n]);return{state:pe(()=>n.map(i=>i.state),[n]),get:i=>{if("index"in i){if(i.index<0||i.index>=r.length)throw new Error(`tapClientLookup: Index ${i.index} out of bounds (length: ${r.length})`);return n[i.index].methods}const o=s[i.key];if(o===void 0)throw new Error(`tapClientLookup: Key "${i.key}" not found`);return n[o].methods}}}const kb=_e(({toolkit:e,mcpApp:t})=>{const n=gc(()=>t?[br("mcpApp",t)]:[],[t])[0],[r,s]=Cn(()=>({})),i=pe(()=>({toolUIs:r,mcpApp:n,tools:Object.fromEntries(Object.entries(r).map(([l,u])=>[l,u.map(c=>c.render)]))}),[r,n]),o=_b(),a=Ia((l,u,c)=>{const f={render:u,standalone:c?.standalone??!1};return s(h=>({...h,[l]:[...h[l]??[],f]})),()=>{s(h=>{const p=h[l]?.filter(_=>_!==f)??[];if(p.length>0)return{...h,[l]:p};const{[l]:g,...y}=h;return y})}},[]);return lt(()=>{if(!e)return;const l=[];for(const[c,f]of Object.entries(e)){const h="render"in f?f.render:void 0,p="renderText"in f?f.renderText:void 0,g=h??(p?xI(p):void 0);g&&l.push(a(c,g,{standalone:yI(f)}))}const u=Object.entries(e).reduce((c,[f,h])=>{if(h.type==="mcp")return c;const{display:p,render:g,renderText:y,..._}=h;return c[f]=_,c},{});return l.push(o.current.modelContext().register({getModelContext:()=>({tools:u})})),()=>{l.forEach(c=>c())}},[e,a,o]),{getState:()=>i,setToolUI:a}});yb(kb,(e,t)=>{!e.modelContext&&t.modelContext.source===null&&(e.modelContext=cb())});const ui=e=>{const[,t]=Cn(e.getState);return lt(()=>(t(e.getState()),e.subscribe(()=>{t(e.getState())})),[e]),e.getState()},Cb=_e(({runtime:e})=>{const t=ui(e);return{getState:()=>t,remove:e.remove,__internal_getRuntime:()=>e}}),JI=_e(({runtime:e,index:t})=>_t(Cb({runtime:pe(()=>e.getAttachmentByIndex(t),[e,t])}))),Eb=_e(({threadIdRef:e,messageIdRef:t,runtime:n})=>{const r=ui(n),s=Cp();lt(()=>{const a=[];for(const l of["send","attachmentAdd"]){const u=n.unstable_on(l,()=>{s(`composer.${l}`,{threadId:e.current,...t&&{messageId:t.current}})});a.push(u)}return a.push(n.unstable_on("attachmentAddError",l=>{s("composer.attachmentAddError",{threadId:e.current,...t&&{messageId:t.current},...l.attachmentId&&{attachmentId:l.attachmentId},reason:l.reason,message:l.message})})),()=>{for(const l of a)l()}},[n,s,e,t]);const i=ro(()=>r.attachments.map((a,l)=>br(a.id,JI({runtime:n,index:l}))),[r.attachments,n]),o=pe(()=>({text:r.text,role:r.role,attachments:i.state,runConfig:r.runConfig,isEditing:r.isEditing,canCancel:r.canCancel,canSend:r.canSend,attachmentAccept:r.attachmentAccept,isEmpty:r.isEmpty,type:r.type??"thread",dictation:r.dictation,quote:r.quote,queue:[]}),[r,i.state]);return{getState:()=>o,setText:n.setText,setRole:n.setRole,setRunConfig:n.setRunConfig,addAttachment:n.addAttachment,reset:n.reset,clearAttachments:n.clearAttachments,send:n.send,cancel:n.cancel,beginEdit:n.beginEdit??(()=>{throw new Error("beginEdit is not supported in this runtime")}),startDictation:n.startDictation,stopDictation:n.stopDictation,setQuote:n.setQuote,attachment:a=>"id"in a?i.get({key:a.id}):i.get(a),queueItem:()=>{throw new Error("Queue is not supported in this runtime")},__internal_getRuntime:()=>n}}),ZI=_e(({runtime:e})=>{const t=ui(e);return{getState:()=>t,addToolResult:n=>e.addToolResult(n),resumeToolCall:n=>e.resumeToolCall(n),respondToToolApproval:n=>e.respondToToolApproval(n),__internal_getRuntime:()=>e}}),eR=_e(({runtime:e,index:t})=>_t(Cb({runtime:pe(()=>e.getAttachmentByIndex(t),[e,t])}))),tR=_e(({runtime:e,index:t})=>_t(ZI({runtime:pe(()=>e.getMessagePartByIndex(t),[e,t])}))),nR=_e(({runtime:e,threadIdRef:t})=>{const n=ui(e),[r,s]=Cn(!1),[i,o]=Cn(!1),a=pe(()=>({get current(){return e.getState().id}}),[e]),l=vc(Eb({runtime:e.composer,threadIdRef:t,messageIdRef:a})),u=ro(()=>n.content.map((h,p)=>br("toolCallId"in h&&h.toolCallId!=null?`toolCallId-${h.toolCallId}`:`index-${p}`,tR({runtime:e,index:p}))),[n.content,e]),c=ro(()=>(n.attachments??[]).map((h,p)=>br(h.id,eR({runtime:e,index:p}))),[n.attachments,e]),f=pe(()=>({...n,parts:u.state,composer:l.state,isCopied:r,isHovering:i}),[n,u.state,l.state,r,i]);return{getState:()=>f,composer:()=>l.methods,reload:h=>e.reload(h),speak:()=>e.speak(),stopSpeaking:()=>e.stopSpeaking(),submitFeedback:h=>e.submitFeedback(h),switchToBranch:h=>e.switchToBranch(h),getCopyText:()=>e.unstable_getCopyText(),part:h=>"index"in h?u.get({index:h.index}):u.get({key:`toolCallId-${h.toolCallId}`}),attachment:h=>"id"in h?c.get({key:h.id}):c.get(h),setIsCopied:s,setIsHovering:o,__internal_getRuntime:()=>e}}),rR=_e(({runtime:e,id:t,threadIdRef:n})=>_t(nR({runtime:pe(()=>e.getMessageById(t),[e,t]),threadIdRef:n}))),sR=_e(({runtime:e})=>{const t=ui(e),n=Cp();lt(()=>{const a=[];for(const l of["runStart","runEnd","initialize","modelContextUpdate"]){const u=e.unstable_on(l,()=>{const c=e.getState()?.threadId||"unknown";n(`thread.${l}`,{threadId:c})});a.push(u)}return()=>{for(const l of a)l()}},[e,n]);const r=pe(()=>({get current(){return e.getState().threadId}}),[e]),s=vc(Eb({runtime:e.composer,threadIdRef:r})),i=ro(()=>t.messages.map(a=>br(a.id,rR({runtime:e,id:a.id,threadIdRef:r}))),[t.messages,e,r]),o=pe(()=>({isEmpty:i.state.length===0&&!t.isLoading,isDisabled:t.isDisabled,isLoading:t.isLoading,isRunning:t.isRunning,capabilities:t.capabilities,state:t.state,suggestions:t.suggestions,extras:t.extras,speech:t.speech,voice:t.voice,composer:s.state,messages:i.state}),[t,i,s.state]);return{getState:()=>o,composer:()=>s.methods,append:e.append,startRun:e.startRun,resumeRun:e.resumeRun,cancelRun:e.cancelRun,getModelContext:e.getModelContext,export:e.export,import:e.import,reset:e.reset,stopSpeaking:e.stopSpeaking,connectVoice:e.connectVoice,disconnectVoice:e.disconnectVoice,getVoiceVolume:e.getVoiceVolume,subscribeVoiceVolume:e.subscribeVoiceVolume,muteVoice:e.muteVoice,unmuteVoice:e.unmuteVoice,message:a=>"id"in a?i.get({key:a.id}):i.get(a),__internal_getRuntime:()=>e}}),iR=_e(({runtime:e})=>{const t=ui(e),n=Cp();return lt(()=>{const r=[];for(const s of["switchedTo","switchedAway"]){const i=e.unstable_on(s,()=>{n(`threadListItem.${s}`,{threadId:e.getState().id})});r.push(i)}return()=>{for(const s of r)s()}},[e,n]),{getState:()=>t,switchTo:e.switchTo,rename:e.rename,updateCustom:e.updateCustom,archive:e.archive,unarchive:e.unarchive,delete:e.delete,generateTitle:e.generateTitle,initialize:e.initialize,detach:e.detach,__internal_getRuntime:()=>e}}),oR=_e(({runtime:e,id:t})=>_t(iR({runtime:pe(()=>e.getItemById(t),[e,t])}))),aR=_e(({runtime:e,__internal_assistantRuntime:t})=>{const n=ui(e),r=vc(sR({runtime:e.main})),s=ro(()=>Object.keys(n.threadItems).map(o=>br(o,oR({runtime:e,id:o}))),[n.threadItems,e]),i=pe(()=>({mainThreadId:n.mainThreadId,newThreadId:n.newThreadId??null,isLoading:n.isLoading,isLoadingMore:n.isLoadingMore,hasMore:n.hasMore,threadIds:n.threadIds,archivedThreadIds:n.archivedThreadIds,threadItems:s.state,main:r.state}),[n,s.state,r.state]);return{getState:()=>i,thread:()=>r.methods,item:o=>{if(o==="main")return s.get({key:i.mainThreadId});if("id"in o)return s.get({key:o.id});const{index:a,archived:l=!1}=o,u=l?i.archivedThreadIds[a]:i.threadIds[a];return s.get({key:u})},switchToThread:async(o,a)=>{await e.switchToThread(o,a)},switchToNewThread:async()=>{await e.switchToNewThread()},getLoadThreadsPromise:()=>e.getLoadThreadsPromise(),reload:()=>e.reload(),loadMore:()=>e.loadMore(),__internal_getAssistantRuntime:()=>t}}),lR=_e(e=>({getState:()=>e})),uR=_e(e=>{const[t]=Cn(()=>({suggestions:(e??[]).map(r=>typeof r=="string"?{title:r,label:"",prompt:r}:{title:r.title,label:r.label,prompt:r.prompt})})),n=ro(()=>t.suggestions.map((r,s)=>br(s,lR(r))),[t.suggestions]);return{getState:()=>t,suggestion:({index:r})=>n.get({index:r})}}),cR=_e(e=>{const t=_b();return lt(()=>e.registerModelContextProvider(t.current.modelContext()),[e,t]),_t(aR({runtime:e.threads,__internal_assistantRuntime:e}))}),dR=(e,t)=>{e.thread??(e.thread=Un({source:"threads",query:{type:"main"},get:n=>n.threads().thread("main")})),e.threadListItem??(e.threadListItem=Un({source:"threads",query:{type:"main"},get:n=>n.threads().item("main")})),e.composer??(e.composer=Un({source:"thread",query:{},get:n=>n.threads().thread("main").composer()})),!e.modelContext&&t.modelContext.source===null&&(e.modelContext=cb()),!e.suggestions&&t.suggestions.source===null&&(e.suggestions=uR())},Tb=_e(e=>_t(cR(e)));yb(Tb,(e,t)=>{dR(e,t),!e.tools&&t.tools.source===null&&(e.tools=kb({})),!e.dataRenderers&&t.dataRenderers.source===null&&(e.dataRenderers=hI())});const fR=e=>e._core?.RenderComponent,hR=m.memo(({runtime:e,aui:t=null,children:n})=>{const r=he({threads:Tb(e)},{parent:t}),s=fR(e);return d.jsxs(Kr,{value:r,children:[s&&d.jsx(s,{}),n]})}),ry=e=>{let t;const n=new Set,r=(u,c)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=c??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(p=>p(t,h))}},s=()=>t,a={setState:r,getState:s,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u))},l=t=e(r,s,a);return a},pR=e=>e?ry(e):ry,mR=e=>e;function gR(e,t=mR){const n=Jt.useSyncExternalStore(e.subscribe,Jt.useCallback(()=>t(e.getState()),[e,t]),Jt.useCallback(()=>t(e.getInitialState()),[e,t]));return Jt.useDebugValue(n),n}const sy=e=>{const t=pR(e),n=r=>gR(t,r);return Object.assign(n,t),n},Ib=e=>e?sy(e):sy,Ep=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});if(!e||!t)throw new Error("Failed to create promise");return{promise:n,resolve:e,reject:t}},yR=()=>{const e=[];let t=!1,n,r;const s=i=>{i.promise||(i.promise=i.reader.read().then(({done:o,value:a})=>{i.promise=void 0,o?(e.splice(e.indexOf(i),1),t&&e.length===0&&n.close()):n.enqueue(a),r?.resolve(),r=void 0}).catch(o=>{console.error(o),e.forEach(a=>{a.reader.cancel()}),e.length=0,n.error(o),r?.reject(o),r=void 0}))};return{readable:new ReadableStream({start(i){n=i},pull(){return r=Ep(),e.forEach(i=>{s(i)}),r.promise},cancel(){e.forEach(i=>{i.reader.cancel()}),e.length=0}}),isSealed(){return t},seal(){t=!0,e.length===0&&n.close()},addStream(i){if(t)throw new Error("Cannot add streams after the run callback has settled.");const o={reader:i.getReader()};e.push(o),s(o)},enqueue(i){this.addStream(new ReadableStream({start(o){o.enqueue(i),o.close()}}))}}};var iy=class{constructor(e){N(this,"_controller");N(this,"_isClosed",!1);this._controller=e}append(e){return this._controller.enqueue({type:"text-delta",path:[],textDelta:e}),this}close(){this._isClosed||(this._isClosed=!0,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}};const Rb=e=>new ReadableStream({start(t){return e.start?.(new iy(t))},pull(t){return e.pull?.(new iy(t))},cancel(t){return e.cancel?.(t)}}),oy=()=>{let e;return[Rb({start(t){e=t}}),e]};var ay=class{constructor(e){N(this,"_controller");N(this,"_isClosed",!1);N(this,"_mergeTask");N(this,"_argsTextController");this._controller=e;const t=Rb({start:r=>{this._argsTextController=r}});let n=!1;this._mergeTask=t.pipeTo(new WritableStream({write:r=>{switch(r.type){case"text-delta":n=!0,this._controller.enqueue(r);break;case"part-finish":n||this._controller.enqueue({type:"text-delta",textDelta:"{}",path:[]}),this._controller.enqueue({type:"tool-call-args-text-finish",path:[]});break;default:throw new Error(`Unexpected chunk type: ${r.type}`)}}}))}get argsText(){return this._argsTextController}async setResponse(e){this._argsTextController.close(),await Promise.resolve(),this._controller.enqueue({type:"result",path:[],...e.artifact!==void 0?{artifact:e.artifact}:{},result:e.result,isError:e.isError??!1,...e.modelContent!==void 0?{modelContent:e.modelContent}:{},...e.messages!==void 0?{messages:e.messages}:{}})}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}};const vR=e=>new ReadableStream({start(t){return e.start?.(new ay(t))},pull(t){return e.pull?.(new ay(t))},cancel(t){return e.cancel?.(t)}}),xR=()=>{let e;return[vR({start(t){e=t}}),e]};var Pb=class{constructor(){N(this,"value",-1)}up(){return++this.value}},wR=class extends TransformStream{constructor(e){super({transform(t,n){n.enqueue({...t,path:[e,...t.path]})}})}};(class extends TransformStream{constructor(e){super({transform(t,n){const{path:[r,...s]}=t;if(e!==r)throw new Error(`Path mismatch: expected ${e}, got ${r}`);n.enqueue({...t,path:s})}})}});var _R=class extends TransformStream{constructor(e){const t=new Pb,n=new Map;super({transform(r,s){r.type==="part-start"&&r.path.length===0&&n.set(t.up(),e.up());const[i,...o]=r.path;if(i===void 0){s.enqueue(r);return}const a=n.get(i);if(a===void 0)throw new Error("Path not found");s.enqueue({...r,path:[a,...o]})}})}},bR=class extends TransformStream{constructor(e){super();const t=e(super.readable);Object.defineProperty(this,"readable",{value:t,writable:!1})}},jb=class extends TransformStream{constructor(){const e=[];super({transform(t,n){if(t.type==="part-start"){if(t.path.length!==0){n.error(new Error("Nested parts are not supported"));return}e.push(t.part),n.enqueue(t);return}if(t.type==="text-delta"||t.type==="result"||t.type==="part-finish"||t.type==="tool-call-args-text-finish"){if(t.path.length!==1){n.error(new Error(`${t.type} chunks must have a path of length 1`));return}const r=t.path[0];if(r<0||r>=e.length){n.error(new Error(`Invalid path index: ${r}`));return}const s=e[r];n.enqueue({...t,meta:s});return}n.enqueue(t)}})}};let Ab=(e,t=21)=>(n=t)=>{let r="",s=n|0;for(;s--;)r+=e[Math.random()*e.length|0];return r};const SR=Ab("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);var kR=class Nb{constructor(t){N(this,"_state");N(this,"_parentId");this._state=t||{merger:yR(),contentCounter:new Pb}}get __internal_isClosed(){return this._state.merger.isSealed()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(t){this._state.closeSubscriber=t}_addPart(t,n){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:"part-start",part:t,path:[]}),this._state.merger.addStream(n.pipeThrough(new wR(this._state.contentCounter.value)))}merge(t){this._state.merger.addStream(t.pipeThrough(new _R(this._state.contentCounter)))}appendText(t){(this._state.append?.kind!=="text"||this._state.append.parentId!==this._parentId)&&(this._state.append={kind:"text",parentId:this._parentId,controller:this.addTextPart()}),this._state.append.controller.append(t)}appendReasoning(t){(this._state.append?.kind!=="reasoning"||this._state.append.parentId!==this._parentId)&&(this._state.append={kind:"reasoning",parentId:this._parentId,controller:this.addReasoningPart()}),this._state.append.controller.append(t)}addTextPart(){const[t,n]=oy();return this._addPart(this._withParentIdOption({type:"text"}),t),n}addReasoningPart(){const[t,n]=oy();return this._addPart(this._withParentIdOption({type:"reasoning"}),t),n}addToolCallPart(t){const n=typeof t=="string"?{toolName:t}:t,r=n.toolName,s=n.toolCallId??SR(),[i,o]=xR();return this._addPart({type:"tool-call",toolName:r,toolCallId:s,...this._parentId&&{parentId:this._parentId}},i),n.argsText!==void 0&&(o.argsText.append(n.argsText),o.argsText.close()),n.args!==void 0&&(o.argsText.append(JSON.stringify(n.args)),o.argsText.close()),n.response!==void 0&&o.setResponse(n.response),o}_finishedPartStream(){return new ReadableStream({start(t){t.enqueue({type:"part-finish",path:[]}),t.close()}})}_withParentIdOption(t){return this._parentId?{...t,parentId:this._parentId}:t}appendSource(t){this._addPart(this._withParentIdOption(t),this._finishedPartStream())}appendFile(t){this._addPart(this._withParentIdOption(t),this._finishedPartStream())}appendData(t){this._addPart(this._withParentIdOption(t),this._finishedPartStream())}enqueue(t){this._state.merger.enqueue(t),t.type==="part-start"&&t.path.length===0&&this._state.contentCounter.up()}withParentId(t){const n=new Nb(this._state);return n._parentId=t,n}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}};function CR(e){const t=new kR;return(async()=>{try{await e(t)}catch(r){throw t.__internal_isClosed||t.enqueue({type:"error",path:[],error:String(r)}),r}finally{t.__internal_isClosed||t.close()}})(),t.__internal_getReadable()}function ER(){const{resolve:e,promise:t}=Ep();let n;return[CR(r=>(n=r,n.__internal_subscribeToClose(e),t)),n]}function TR(e){const t=["ROOT"];let n=-1,r=null;const s=[];let i;function o(){i!==void 0&&(s.push(JSON.parse(`"${i}"`)),i=void 0)}function a(f,h,p){switch(f){case'"':n=h,t.pop(),t.push(p),t.push("INSIDE_STRING"),o();break;case"f":case"t":case"n":n=h,r=h,t.pop(),t.push(p),t.push("INSIDE_LITERAL");break;case"-":t.pop(),t.push(p),t.push("INSIDE_NUMBER"),o();break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=h,t.pop(),t.push(p),t.push("INSIDE_NUMBER"),o();break;case"{":n=h,t.pop(),t.push(p),t.push("INSIDE_OBJECT_START"),o();break;case"[":n=h,t.pop(),t.push(p),t.push("INSIDE_ARRAY_START"),o();break}}function l(f,h){switch(f){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":n=h,t.pop(),i=s.pop();break}}function u(f,h){switch(f){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA"),i=(Number(i)+1).toString();break;case"]":n=h,t.pop(),i=s.pop();break}}for(let f=0;f<e.length;f++){const h=e[f];switch(t[t.length-1]){case"ROOT":a(h,f,"FINISH");break;case"INSIDE_OBJECT_START":switch(h){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY"),i="";break;case"}":n=f,t.pop(),i=s.pop();break}break;case"INSIDE_OBJECT_AFTER_COMMA":switch(h){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY"),i="";break}break;case"INSIDE_OBJECT_KEY":switch(h){case'"':t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY");break;case"\\":t.push("INSIDE_STRING_ESCAPE"),i+=h;break;default:i+=h;break}break;case"INSIDE_OBJECT_AFTER_KEY":switch(h){case":":t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE");break}break;case"INSIDE_OBJECT_BEFORE_VALUE":a(h,f,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":l(h,f);break;case"INSIDE_STRING":switch(h){case'"':t.pop(),n=f,i=s.pop();break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:n=f}break;case"INSIDE_ARRAY_START":switch(h){case"]":n=f,t.pop(),i=s.pop();break;default:n=f,i="0",a(h,f,"INSIDE_ARRAY_AFTER_VALUE");break}break;case"INSIDE_ARRAY_AFTER_VALUE":switch(h){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA"),i=(Number(i)+1).toString();break;case"]":n=f,t.pop(),i=s.pop();break;default:n=f;break}break;case"INSIDE_ARRAY_AFTER_COMMA":a(h,f,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),t[t.length-1]==="INSIDE_STRING"?n=f:t[t.length-1]==="INSIDE_OBJECT_KEY"&&(i+=h);break;case"INSIDE_NUMBER":switch(h){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=f;break;case"e":case"E":case"-":case".":break;case",":t.pop(),i=s.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,f),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(h,f);break;case"}":t.pop(),i=s.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(h,f);break;case"]":t.pop(),i=s.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,f);break;default:t.pop(),i=s.pop();break}break;case"INSIDE_LITERAL":{const p=e.substring(r,f+1);!"false".startsWith(p)&&!"true".startsWith(p)&&!"null".startsWith(p)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?l(h,f):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(h,f)):n=f;break}}}let c=e.slice(0,n+1);for(let f=t.length-1;f>=0;f--)switch(t[f]){case"INSIDE_STRING":c+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":c+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":c+="]";break;case"INSIDE_LITERAL":{const h=e.substring(r,e.length);"true".startsWith(h)?c+="true".slice(h.length):"false".startsWith(h)?c+="false".slice(h.length):"null".startsWith(h)&&(c+="null".slice(h.length))}}return[c,s]}var yo={exports:{}};const IR=typeof Buffer<"u",ly=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,uy=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function Mb(e,t,n){n==null&&t!==null&&typeof t=="object"&&(n=t,t=void 0),IR&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));const r=JSON.parse(e,t);if(r===null||typeof r!="object")return r;const s=n&&n.protoAction||"error",i=n&&n.constructorAction||"error";if(s==="ignore"&&i==="ignore")return r;if(s!=="ignore"&&i!=="ignore"){if(ly.test(e)===!1&&uy.test(e)===!1)return r}else if(s!=="ignore"&&i==="ignore"){if(ly.test(e)===!1)return r}else if(uy.test(e)===!1)return r;return Db(r,{protoAction:s,constructorAction:i,safe:n&&n.safe})}function Db(e,{protoAction:t="error",constructorAction:n="error",safe:r}={}){let s=[e];for(;s.length;){const i=s;s=[];for(const o of i){if(t!=="ignore"&&Object.prototype.hasOwnProperty.call(o,"__proto__")){if(r===!0)return null;if(t==="error")throw new SyntaxError("Object contains forbidden prototype property");delete o.__proto__}if(n!=="ignore"&&Object.prototype.hasOwnProperty.call(o,"constructor")&&o.constructor!==null&&typeof o.constructor=="object"&&Object.prototype.hasOwnProperty.call(o.constructor,"prototype")){if(r===!0)return null;if(n==="error")throw new SyntaxError("Object contains forbidden prototype property");delete o.constructor}for(const a in o){const l=o[a];l&&typeof l=="object"&&s.push(l)}}}return e}function Tp(e,t,n){const{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return Mb(e,t,n)}finally{Error.stackTraceLimit=r}}function RR(e,t){const{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return Mb(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}}yo.exports=Tp;yo.exports.default=Tp;yo.exports.parse=Tp;yo.exports.safeParse=RR;yo.exports.scan=Db;var PR=yo.exports;const Bf=Va(PR),Kl=Symbol("aui.parse-partial-json-object.meta"),jR=e=>e?.[Kl],$f=e=>{if(e.length===0)return{[Kl]:{state:"partial",partialPath:[]}};try{const t=Bf.parse(e);if(typeof t!="object"||t===null)throw new Error("argsText is expected to be an object");return t[Kl]={state:"complete",partialPath:[]},t}catch{try{const[t,n]=TR(e),r=Bf.parse(t);if(typeof r!="object"||r===null)throw new Error("argsText is expected to be an object");return r[Kl]={state:"partial",partialPath:n},r}catch{return}}},Lb=(e,t,n)=>{if(typeof e!="object"||e===null)return t.state;if(t.state==="complete")return"complete";if(n.length===0)return t.state;const[r,...s]=n;if(!Object.hasOwn(e,r))return"partial";const[i,...o]=t.partialPath;if(r!==i)return"complete";const a=e[r];return Lb(a,{state:"partial",partialPath:o},s)},so=(e,t)=>{const n=jR(e);if(!n)throw new Error("unable to determine object state");return Lb(e,n,t.map(String))};async function*AR(){const e=this.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{e.releaseLock()}}function cd(e){var t;return e[t=Symbol.asyncIterator]??(e[t]=AR),e}const cy=Symbol.for("aui.tool-response");var zr=class Uf{constructor(t){N(this,"artifact");N(this,"result");N(this,"isError");N(this,"modelContent");N(this,"messages");t.artifact!==void 0&&(this.artifact=t.artifact),this.result=t.result,this.isError=t.isError??!1,t.modelContent!==void 0&&(this.modelContent=t.modelContent),t.messages!==void 0&&(this.messages=t.messages)}get[cy](){return!0}static[Symbol.hasInstance](t){return typeof t=="object"&&t!==null&&cy in t}static toResponse(t){return t instanceof Uf?t:new Uf({result:t===void 0?"<no result>":t})}};function NR(e,t,n){try{const r=e();if(typeof r=="object"&&r!==null&&"then"in r)return r.then(t,n);t(r)}catch(r){n(r)}}function io(e,t){let n=e;for(const r of t){if(n==null)return;n=n[r]}return n}var MR=class{constructor(e,t,n){N(this,"resolve");N(this,"reject");N(this,"disposed",!1);N(this,"fieldPath");this.resolve=e,this.reject=t,this.fieldPath=n}update(e){if(!this.disposed)try{if(so(e,this.fieldPath)==="complete"){const t=io(e,this.fieldPath);t!==void 0&&(this.resolve(t),this.dispose())}}catch(t){this.reject(t),this.dispose()}}end(e){if(!this.disposed)try{const t=io(e,this.fieldPath);this.resolve(t)}catch(t){this.reject(t)}finally{this.dispose()}}dispose(){this.disposed=!0}},DR=class{constructor(e,t){N(this,"controller");N(this,"disposed",!1);N(this,"fieldPath");this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{const t=io(e,this.fieldPath);t!==void 0&&this.controller.enqueue(t),so(e,this.fieldPath)==="complete"&&(this.controller.close(),this.dispose())}catch(t){this.controller.error(t),this.dispose()}}end(){this.disposed||(this.controller.close(),this.dispose())}dispose(){this.disposed=!0}},LR=class{constructor(e,t){N(this,"controller");N(this,"disposed",!1);N(this,"fieldPath");N(this,"lastValue");this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{const t=io(e,this.fieldPath);if(t!==void 0&&typeof t=="string"){const n=t.substring(this.lastValue?.length||0);this.lastValue=t,this.controller.enqueue(n)}so(e,this.fieldPath)==="complete"&&(this.controller.close(),this.dispose())}catch(t){this.controller.error(t),this.dispose()}}end(){this.disposed||(this.controller.close(),this.dispose())}dispose(){this.disposed=!0}},OR=class{constructor(e,t){N(this,"controller");N(this,"disposed",!1);N(this,"fieldPath");N(this,"processedIndexes",new Set);this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{const t=io(e,this.fieldPath);if(!Array.isArray(t))return;for(let n=0;n<t.length;n++)this.processedIndexes.has(n)||so(e,[...this.fieldPath,n])==="complete"&&(this.controller.enqueue(t[n]),this.processedIndexes.add(n));so(e,this.fieldPath)==="complete"&&(this.controller.close(),this.dispose())}catch(t){this.controller.error(t),this.dispose()}}end(){this.disposed||(this.controller.close(),this.dispose())}dispose(){this.disposed=!0}},zR=class{constructor(e){N(this,"argTextDeltas");N(this,"handles",new Set);N(this,"args",$f(""));N(this,"finished",!1);this.argTextDeltas=e,this.processStream()}async processStream(){try{let e="";const t=this.argTextDeltas.getReader();for(;;){const{value:n,done:r}=await t.read();if(r)break;e+=n;const s=$f(e);if(s!==void 0){this.args=s;for(const i of this.handles)i.update(s)}}}catch(e){console.error("Error processing argument stream:",e)}finally{this.finished=!0;for(const e of this.handles)e.end(this.args);this.handles.clear()}}get(...e){return new Promise((t,n)=>{const r=new MR(t,n,e);if(this.args&&so(this.args,e)==="complete"){const s=io(this.args,e);if(s!==void 0){t(s);return}}if(this.finished){r.end(this.args);return}this.handles.add(r),r.update(this.args)})}streamValues(...e){const t=e;let n;return cd(new ReadableStream({start:r=>{n=new DR(r,t),this.finished||this.handles.add(n),n.update(this.args),this.finished&&n.end()},cancel:()=>{n&&(n.dispose(),this.handles.delete(n))}}))}streamText(...e){const t=e;let n;return cd(new ReadableStream({start:r=>{n=new LR(r,t),this.finished||this.handles.add(n),n.update(this.args),this.finished&&n.end()},cancel:()=>{n&&(n.dispose(),this.handles.delete(n))}}))}forEach(...e){const t=e;let n;return cd(new ReadableStream({start:r=>{n=new OR(r,t),this.finished||this.handles.add(n),n.update(this.args),this.finished&&n.end()},cancel:()=>{n&&(n.dispose(),this.handles.delete(n))}}))}},FR=class{constructor(e){N(this,"promise");this.promise=e}get(){return this.promise}},BR=class{constructor(){N(this,"args");N(this,"response");N(this,"writable");N(this,"resolve");N(this,"argsText","");N(this,"result",{get:async()=>(await this.response.get()).result});const e=new TransformStream;this.writable=e.writable,this.args=new zR(e.readable);const{promise:t,resolve:n}=Ep();this.resolve=n,this.response=new FR(t)}async appendArgsTextDelta(e){const t=this.writable.getWriter();try{await t.write(e)}catch(n){console.warn(n)}finally{t.releaseLock()}this.argsText+=e}async finishArgsText(){const e=this.writable.getWriter();try{await e.close()}catch(t){console.warn(t)}finally{e.releaseLock()}}setResponse(e){this.resolve(e)}},$R=class extends bR{constructor(e){const t=new Map,n=new Map;super(r=>{const s=new TransformStream({async transform(i,o){switch((i.type!=="part-finish"||i.meta.type!=="tool-call")&&o.enqueue(i),i.type){case"part-start":if(i.part.type==="tool-call"){const a=new BR;n.set(i.part.toolCallId,a),e.streamCall({reader:a,toolCallId:i.part.toolCallId,toolName:i.part.toolName})}break;case"text-delta":if(i.meta.type==="tool-call"){const a=i.meta.toolCallId,l=n.get(a);if(!l)throw new Error("No controller found for tool call");await l.appendArgsTextDelta(i.textDelta)}break;case"result":{if(i.meta.type!=="tool-call")break;const{toolCallId:a}=i.meta,l=n.get(a);if(!l)throw new Error("No controller found for tool call");l.setResponse(new zr({result:i.result,artifact:i.artifact,isError:i.isError,modelContent:i.modelContent}));break}case"tool-call-args-text-finish":{if(i.meta.type!=="tool-call")break;const{toolCallId:a,toolName:l}=i.meta,u=n.get(a);if(!u)throw new Error("No controller found for tool call");await u.finishArgsText();let c=!1;const f=NR(()=>{let h;try{h=Bf.parse(u.argsText)}catch(g){throw new Error(`Function parameter parsing failed. ${JSON.stringify(g.message)}`)}const p=e.execute({toolCallId:a,toolName:l,args:h});return p!==void 0&&(c=!0,e.onExecutionStart?.(a,l)),p},h=>{if(c&&e.onExecutionEnd?.(a,l),h===void 0)return;const p=new zr({artifact:h.artifact,result:h.result,isError:h.isError,messages:h.messages,modelContent:h.modelContent});u.setResponse(p),o.enqueue({type:"result",path:i.path,...p})},h=>{c&&e.onExecutionEnd?.(a,l);const p=new zr({result:String(h),isError:!0});u.setResponse(p),o.enqueue({type:"result",path:i.path,...p})});f&&t.set(a,f);break}case"part-finish":{if(i.meta.type!=="tool-call")break;const{toolCallId:a}=i.meta,l=t.get(a);l?l.then(()=>{t.delete(a),n.delete(a),o.enqueue(i)}):o.enqueue(i)}}},async flush(){await Promise.all(t.values())}});return r.pipeThrough(new jb).pipeThrough(s)})}};const UR=e=>typeof e=="object"&&e!==null&&"~standard"in e&&e["~standard"].version===1;function VR(e,t,n,r){const s=e?.[n.toolName];return s?.execute?(async o=>{if(t.aborted)return new zr({result:"Tool execution was cancelled.",isError:!0});let a=o;if(UR(s.parameters)){let c=s.parameters["~standard"].validate(n.args);c instanceof Promise&&(c=await c),c.issues&&(a=s.experimental_onSchemaValidationError??(()=>{throw new Error(`Function parameter validation failed. ${JSON.stringify(c.issues)}`)}))}const l=new Promise(c=>{const f=()=>{queueMicrotask(()=>{queueMicrotask(()=>{c(new zr({result:"Tool execution was cancelled.",isError:!0}))})})};t.aborted?f():t.addEventListener("abort",f,{once:!0})}),u=(async()=>{const c=await a(n.args,{toolCallId:n.toolCallId,abortSignal:t,human:h=>r(n.toolCallId,h)}),f=zr.toResponse(c);if(s.toModelOutput&&!f.isError&&f.modelContent===void 0)try{const h=await s.toModelOutput({toolCallId:n.toolCallId,input:n.args,output:f.result});return new zr({result:f.result,artifact:f.artifact,isError:f.isError,messages:f.messages,modelContent:h})}catch(h){console.warn(`[assistant-stream] tool "${n.toolName}" toModelOutput threw; falling back to default projection.`,h)}return f})();return Promise.race([u,l])})(s.execute):void 0}function HR(e,t,n,r,s){e?.[r.toolName]?.streamCall?.(n,{toolCallId:r.toolCallId,abortSignal:t,human:i=>s(r.toolCallId,i)})}function WR(e,t,n,r){const s=typeof e=="function"?e:()=>e,i=typeof t=="function"?t:()=>t;return new $R({execute:o=>VR(s(),i(),o,n),streamCall:({reader:o,...a})=>HR(s(),i(),o,a,n),onExecutionStart:r?.onExecutionStart,onExecutionEnd:r?.onExecutionEnd})}const Ob=({index:e,children:t})=>d.jsx(Kr,{value:he({attachment:Un({source:"message",query:{type:"index",index:e},get:n=>n.message().attachment({index:e})})}),children:t}),zb=({index:e,children:t})=>d.jsx(Kr,{value:he({attachment:Un({source:"composer",query:{type:"index",index:e},get:n=>n.composer().attachment({index:e})})}),children:t}),Fb=({index:e,children:t})=>d.jsx(Kr,{value:he({message:Un({source:"thread",query:{type:"index",index:e},get:n=>n.thread().message({index:e})}),composer:Un({source:"message",query:{},get:n=>n.thread().message({index:e}).composer()})}),children:t}),Ip=({index:e,children:t})=>d.jsx(Kr,{value:he({part:Un({source:"message",query:{type:"index",index:e},get:n=>n.message().part({index:e})})}),children:t}),qR=_e(({text:e,isRunning:t})=>{const n=pe(()=>({type:"text",text:e,status:t?{type:"running"}:{type:"complete"}}),[e,t]);return{getState:()=>n,addToolResult:()=>{throw new Error("Not supported")},resumeToolCall:()=>{throw new Error("Not supported")},respondToToolApproval:()=>{throw new Error("Not supported")}}}),Rp=({text:e,isRunning:t=!1,children:n})=>d.jsx(Kr,{value:he({part:qR({text:e,isRunning:t})}),children:n}),KR=Object.freeze({type:"complete"}),GR=_e(({parts:e,getMessagePart:t})=>{const[n,r]=Cn(!0),s=pe(()=>e[e.length-1]?.status??KR,[e]),i=pe(()=>({parts:e,collapsed:n,status:s}),[e,n,s]);return{getState:()=>i,setCollapsed:r,part:t}}),YR=({startIndex:e,endIndex:t,children:n})=>{const r=Y(i=>i.message.parts).slice(e,t+1),s=he();return d.jsx(Kr,{value:he({chainOfThought:GR({parts:r,getMessagePart:({index:i})=>{if(i<0||i>=r.length)throw new Error(`ChainOfThought part index ${i} is out of bounds (0..${r.length-1})`);return s.message().part({index:e+i})}})}),children:n})},Bb=({index:e,children:t})=>d.jsx(Kr,{value:he({suggestion:Un({source:"suggestions",query:{index:e},get:n=>n.suggestions().suggestion({index:e})})}),children:t}),QR=({index:e,children:t})=>d.jsx(Kr,{value:he({queueItem:Un({source:"composer",query:{index:e},get:n=>n.composer().queueItem({index:e})})}),children:t}),si=Symbol("innerMessage"),dd=Symbol("innerMessages"),XR=[],JR=(e,t)=>{si in e||(e[si]=t)},ZR=e=>{const t="messages"in e?e.messages:e,n=t[dd]||t[si];return n?Array.isArray(n)?n:(t[dd]=[n],t[dd]):XR},ir=Symbol("skip-update");function eP(e,t){if(e===void 0&&t===void 0)return!0;if(e===void 0||t===void 0)return!1;for(const n of Object.keys(e)){const r=e[n],s=t[n];if(!Object.is(r,s))return!1}return!0}var tP=class{constructor(){N(this,"_subscribers",new Set)}subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}waitForUpdate(){return new Promise(e=>{const t=this.subscribe(()=>{t(),e()})})}_notifySubscribers(){const e=[];for(const t of this._subscribers)try{t()}catch(n){e.push(n)}if(e.length>0){if(e.length===1)throw e[0];for(const t of e)console.error(t);throw new AggregateError(e)}}},wc=class{constructor(){N(this,"_subscriptions",new Set);N(this,"_connection")}get isConnected(){return!!this._connection}notifySubscribers(e){for(const t of this._subscriptions)t(e)}_updateConnection(){if(this._subscriptions.size>0){if(this._connection)return;this._connection=this._connect()}else this._connection?.(),this._connection=void 0}subscribe(e){return this._subscriptions.add(e),this._updateConnection(),()=>{this._subscriptions.delete(e),this._updateConnection()}}},er=class extends wc{constructor(t){super();N(this,"binding");N(this,"_previousState");N(this,"getState",()=>(this.isConnected||this._syncState(),this._previousState));this.binding=t;const n=t.getState();if(n===ir)throw new Error("Entry not available in the store");this._previousState=n}get path(){return this.binding.path}_syncState(){const t=this.binding.getState();return t===ir||eP(t,this._previousState)?!1:(this._previousState=t,!0)}_connect(){const t=()=>{this._syncState()&&this.notifySubscribers()};return this.binding.subscribe(t)}},Pp=class extends wc{constructor(t){super();N(this,"binding");N(this,"_previousStateDirty",!0);N(this,"_previousState");N(this,"getState",()=>{if(!this.isConnected||this._previousStateDirty){const t=this.binding.getState();t!==ir&&(this._previousState=t),this._previousStateDirty=!1}if(this._previousState===void 0)throw new Error("Entry not available in the store");return this._previousState});this.binding=t}get path(){return this.binding.path}_connect(){const t=()=>{this._previousStateDirty=!0,this.notifySubscribers()};return this.binding.subscribe(t)}},Ru=class extends wc{constructor(t){super();N(this,"binding");this.binding=t}get path(){return this.binding.path}getState(){return this.binding.getState()}outerSubscribe(t){return this.binding.subscribe(t)}_connect(){const t=()=>{this.notifySubscribers()};let n=this.binding.getState(),r=n?.subscribe(t);const s=()=>{const o=this.binding.getState();o!==n&&(n=o,r?.(),r=o?.subscribe(t),t())},i=this.outerSubscribe(s);return()=>{i?.(),r?.()}}},$b=class extends wc{constructor(t){super();N(this,"config");this.config=t}getState(){return this.config.binding.getState()}outerSubscribe(t){return this.config.binding.subscribe(t)}_connect(){const t=o=>{this.notifySubscribers(o)};let n=this.config.binding.getState(),r=n?.unstable_on(this.config.event,t);const s=()=>{const o=this.config.binding.getState();o!==n&&(n=o,r?.(),r=o?.unstable_on(this.config.event,t))},i=this.outerSubscribe(s);return()=>{i?.(),r?.()}}},Ub=class{constructor(e){N(this,"_core");this._core=e,this.__internal_bindMethods()}get path(){return this._core.path}__internal_bindMethods(){this.getState=this.getState.bind(this),this.remove=this.remove.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this._core.getState()}subscribe(e){return this._core.subscribe(e)}},Vb=class extends Ub{constructor(t,n){super(t);N(this,"_composerApi");this._composerApi=n}remove(){const t=this._composerApi.getState();if(!t)throw new Error("Composer is not available");return t.removeAttachment(this.getState().id)}},nP=class extends Vb{get source(){return"thread-composer"}},rP=class extends Vb{get source(){return"edit-composer"}},sP=class extends Ub{get source(){return"message"}remove(){throw new Error("Message attachments cannot be removed")}};const Hb=Object.freeze([]),Wb=Object.freeze({}),iP=e=>Object.freeze({type:"thread",isEditing:e?.isEditing??!1,canCancel:e?.canCancel??!1,canSend:e?.canSend??!1,isEmpty:e?.isEmpty??!0,attachments:e?.attachments??Hb,text:e?.text??"",role:e?.role??"user",runConfig:e?.runConfig??Wb,attachmentAccept:e?.attachmentAccept??"",dictation:e?.dictation,quote:e?.quote,value:e?.text??""}),oP=e=>Object.freeze({type:"edit",isEditing:e?.isEditing??!1,canCancel:e?.canCancel??!1,canSend:e?.canSend??!1,isEmpty:e?.isEmpty??!0,text:e?.text??"",role:e?.role??"user",attachments:e?.attachments??Hb,runConfig:e?.runConfig??Wb,attachmentAccept:e?.attachmentAccept??"",dictation:e?.dictation,quote:e?.quote,parentId:e?.parentId??null,sourceId:e?.sourceId??null,value:e?.text??""});var qb=class{constructor(e){N(this,"_core");N(this,"_eventSubscriptionSubjects",new Map);this._core=e}get path(){return this._core.path}__internal_bindMethods(){this.setText=this.setText.bind(this),this.setRunConfig=this.setRunConfig.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.addAttachment=this.addAttachment.bind(this),this.reset=this.reset.bind(this),this.clearAttachments=this.clearAttachments.bind(this),this.send=this.send.bind(this),this.cancel=this.cancel.bind(this),this.setRole=this.setRole.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.startDictation=this.startDictation.bind(this),this.stopDictation=this.stopDictation.bind(this),this.setQuote=this.setQuote.bind(this),this.unstable_on=this.unstable_on.bind(this)}setText(e){const t=this._core.getState();if(!t)throw new Error("Composer is not available");t.setText(e)}setRunConfig(e){const t=this._core.getState();if(!t)throw new Error("Composer is not available");t.setRunConfig(e)}addAttachment(e){const t=this._core.getState();if(!t)throw new Error("Composer is not available");return t.addAttachment(e)}reset(){const e=this._core.getState();if(!e)throw new Error("Composer is not available");return e.reset()}clearAttachments(){const e=this._core.getState();if(!e)throw new Error("Composer is not available");return e.clearAttachments()}send(e){const t=this._core.getState();if(!t)throw new Error("Composer is not available");t.send(e)}cancel(){const e=this._core.getState();if(!e)throw new Error("Composer is not available");e.cancel()}setRole(e){const t=this._core.getState();if(!t)throw new Error("Composer is not available");t.setRole(e)}startDictation(){const e=this._core.getState();if(!e)throw new Error("Composer is not available");e.startDictation()}stopDictation(){const e=this._core.getState();if(!e)throw new Error("Composer is not available");e.stopDictation()}setQuote(e){const t=this._core.getState();if(!t)throw new Error("Composer is not available");t.setQuote(e)}subscribe(e){return this._core.subscribe(e)}unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new $b({event:e,binding:this._core}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}},aP=class extends qb{constructor(t){const n=new Pp({path:t.path,getState:()=>iP(t.getState()),subscribe:r=>t.subscribe(r)});super({path:t.path,getState:()=>t.getState(),subscribe:r=>n.subscribe(r)});N(this,"_getState");this._getState=n.getState.bind(n),this.__internal_bindMethods()}get path(){return this._core.path}get type(){return"thread"}getState(){return this._getState()}getAttachmentByIndex(t){return new nP(new er({path:{...this.path,attachmentSource:"thread-composer",attachmentSelector:{type:"index",index:t},ref:`${this.path.ref}.attachments[${t}]`},getState:()=>{const n=this.getState().attachments[t];return n?{...n,source:"thread-composer"}:ir},subscribe:n=>this._core.subscribe(n)}),this._core)}},lP=class extends qb{constructor(t,n){const r=new Pp({path:t.path,getState:()=>oP(t.getState()),subscribe:s=>t.subscribe(s)});super({path:t.path,getState:()=>t.getState(),subscribe:s=>r.subscribe(s)});N(this,"_beginEdit");N(this,"_getState");this._beginEdit=n,this._getState=r.getState.bind(r),this.__internal_bindMethods()}get path(){return this._core.path}get type(){return"edit"}__internal_bindMethods(){super.__internal_bindMethods(),this.beginEdit=this.beginEdit.bind(this)}getState(){return this._getState()}beginEdit(){this._beginEdit()}getAttachmentByIndex(t){return new rP(new er({path:{...this.path,attachmentSource:"edit-composer",attachmentSelector:{type:"index",index:t},ref:`${this.path.ref}.attachments[${t}]`},getState:()=>{const n=this.getState().attachments[t];return n?{...n,source:"edit-composer"}:ir},subscribe:n=>this._core.subscribe(n)}),this._core)}};const Pa=e=>e.content.filter(t=>t.type==="text").map(t=>t.text).join(`
|
|
43
|
+
|
|
44
|
+
`);var dy=class{constructor(e,t,n){N(this,"contentBinding");N(this,"messageApi");N(this,"threadApi");this.contentBinding=e,this.messageApi=t,this.threadApi=n,this.__internal_bindMethods()}get path(){return this.contentBinding.path}__internal_bindMethods(){this.addToolResult=this.addToolResult.bind(this),this.resumeToolCall=this.resumeToolCall.bind(this),this.respondToToolApproval=this.respondToToolApproval.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this.contentBinding.getState()}addToolResult(e){const t=this.contentBinding.getState();if(!t)throw new Error("Message part is not available");if(t.type!=="tool-call")throw new Error("Tried to add tool result to non-tool message part");if(!this.messageApi)throw new Error("Message API is not available. This is likely a bug in assistant-ui.");if(!this.threadApi)throw new Error("Thread API is not available");const n=this.messageApi.getState();if(!n)throw new Error("Message is not available");const r=t.toolName,s=t.toolCallId,i=zr.toResponse(e);this.threadApi.getState().addToolResult({messageId:n.id,toolName:r,toolCallId:s,result:i.result,artifact:i.artifact,isError:i.isError})}resumeToolCall(e){const t=this.contentBinding.getState();if(!t)throw new Error("Message part is not available");if(t.type!=="tool-call")throw new Error("Tried to resume tool call on non-tool message part");if(!this.threadApi)throw new Error("Thread API is not available");const n=t.toolCallId;this.threadApi.getState().resumeToolCall({toolCallId:n,payload:e})}respondToToolApproval(e){const t=this.contentBinding.getState();if(!t)throw new Error("Message part is not available");if(t.type!=="tool-call")throw new Error("Tried to respond to tool approval on non-tool message part");if(!t.approval||t.approval.approved!==void 0)throw new Error("Tool call has no pending approval");if(!this.threadApi)throw new Error("Thread API is not available");this.threadApi.getState().respondToToolApproval({approvalId:t.approval.id,approved:e.approved,...e.reason!=null&&{reason:e.reason}})}subscribe(e){return this.contentBinding.subscribe(e)}};const _l=Object.freeze({type:"complete"}),uP=(e,t,n)=>{if(e.role!=="assistant")return _l;if(n.type==="tool-call")return n.result?_l:e.status;const r=t===Math.max(0,e.content.length-1);return e.status.type==="requires-action"?_l:r?e.status:_l},fy=(e,t)=>{const n=e.content[t];if(!n)return ir;const r=uP(e,t,n);return Object.freeze({...n,[si]:n[si],status:r})};var cP=class{constructor(e,t){N(this,"_core");N(this,"_threadBinding");N(this,"composer");N(this,"_getEditComposerRuntimeCore",()=>this._threadBinding.getState().getEditComposer(this._core.getState().id));this._core=e,this._threadBinding=t,this.composer=new lP(new Ru({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.composer`,composerSource:"edit"},getState:this._getEditComposerRuntimeCore,subscribe:n=>this._threadBinding.subscribe(n)}),()=>this._threadBinding.getState().beginEdit(this._core.getState().id)),this.__internal_bindMethods()}get path(){return this._core.path}__internal_bindMethods(){this.reload=this.reload.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getMessagePartByIndex=this.getMessagePartByIndex.bind(this),this.getMessagePartByToolCallId=this.getMessagePartByToolCallId.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.unstable_getCopyText=this.unstable_getCopyText.bind(this),this.speak=this.speak.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.submitFeedback=this.submitFeedback.bind(this),this.switchToBranch=this.switchToBranch.bind(this)}getState(){return this._core.getState()}reload(e={}){const t=this._getEditComposerRuntimeCore(),n=t??this._threadBinding.getState().composer,r=t??n,{runConfig:s=r.runConfig}=e,i=this._core.getState();if(i.role!=="assistant")throw new Error("Can only reload assistant messages");this._threadBinding.getState().startRun({parentId:i.parentId,sourceId:i.id,runConfig:s})}speak(){const e=this._core.getState();return this._threadBinding.getState().speak(e.id)}stopSpeaking(){const e=this._core.getState();if(this._threadBinding.getState().speech?.messageId===e.id)this._threadBinding.getState().stopSpeaking();else throw new Error("Message is not being spoken")}submitFeedback({type:e}){const t=this._core.getState();this._threadBinding.getState().submitFeedback({messageId:t.id,type:e})}switchToBranch({position:e,branchId:t}){const n=this._core.getState();if(t&&e)throw new Error("May not specify both branchId and position");if(!t&&!e)throw new Error("Must specify either branchId or position");const r=this._threadBinding.getState().getBranches(n.id);let s=t;if(e==="previous"?s=r[n.branchNumber-2]:e==="next"&&(s=r[n.branchNumber]),!s)throw new Error("Branch not found");this._threadBinding.getState().switchToBranch(s)}unstable_getCopyText(){return Pa(this.getState())}subscribe(e){return this._core.subscribe(e)}getMessagePartByIndex(e){if(e<0)throw new Error("Message part index must be >= 0");return new dy(new er({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.content[${e}]`,messagePartSelector:{type:"index",index:e}},getState:()=>fy(this.getState(),e),subscribe:t=>this._core.subscribe(t)}),this._core,this._threadBinding)}getMessagePartByToolCallId(e){return new dy(new er({path:{...this.path,ref:this.path.ref+`${this.path.ref}.content[toolCallId=${JSON.stringify(e)}]`,messagePartSelector:{type:"toolCallId",toolCallId:e}},getState:()=>{const t=this._core.getState(),n=t.content.findIndex(r=>r.type==="tool-call"&&r.toolCallId===e);return n===-1?ir:fy(t,n)},subscribe:t=>this._core.subscribe(t)}),this._core,this._threadBinding)}getAttachmentByIndex(e){return new sP(new er({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.attachments[${e}]`,attachmentSource:"message",attachmentSelector:{type:"index",index:e}},getState:()=>{const t=this.getState().attachments?.[e];return t?{...t,source:"message"}:ir},subscribe:t=>this._core.subscribe(t)}))}};const dP=e=>({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{},...e.stream?{stream:e.stream}:{}}),fP=e=>({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{}}),hP=(e,t)=>typeof t=="string"?{createdAt:new Date,parentId:e.at(-1)?.id??null,sourceId:null,runConfig:{},role:"user",content:[{type:"text",text:t}],attachments:[],metadata:{custom:{}}}:{createdAt:t.createdAt??new Date,parentId:t.parentId??e.at(-1)?.id??null,sourceId:t.sourceId??null,role:t.role??"user",content:t.content,attachments:t.attachments??[],metadata:t.metadata??{custom:{}},runConfig:t.runConfig??{},startRun:t.startRun},pP=(e,t)=>{const n=e.messages.at(-1);return Object.freeze({threadId:t.id,metadata:t,capabilities:e.capabilities,isDisabled:e.isDisabled,isLoading:e.isLoading,isRunning:e.isRunning??(n?.role!=="assistant"?!1:n.status.type==="running"),messages:e.messages,state:e.state,suggestions:e.suggestions,extras:e.extras,speech:e.speech,voice:e.voice})};var Kb=class{constructor(e,t){N(this,"_threadBinding");N(this,"composer");N(this,"_eventSubscriptionSubjects",new Map);const n=new er({path:e.path,getState:()=>pP(e.getState(),t.getState()),subscribe:r=>{const s=e.subscribe(r),i=t.subscribe(r);return()=>{s(),i()}}});this._threadBinding={path:e.path,getState:()=>e.getState(),getStateState:()=>n.getState(),outerSubscribe:r=>e.outerSubscribe(r),subscribe:r=>e.subscribe(r)},this.composer=new aP(new Ru({path:{...this.path,ref:`${this.path.ref}.composer`,composerSource:"thread"},getState:()=>this._threadBinding.getState().composer,subscribe:r=>this._threadBinding.subscribe(r)})),this.__internal_bindMethods()}get path(){return this._threadBinding.path}get __internal_threadBinding(){return this._threadBinding}__internal_bindMethods(){this.append=this.append.bind(this),this.resumeRun=this.resumeRun.bind(this),this.importExternalState=this.importExternalState.bind(this),this.exportExternalState=this.exportExternalState.bind(this),this.startRun=this.startRun.bind(this),this.cancelRun=this.cancelRun.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.connectVoice=this.connectVoice.bind(this),this.disconnectVoice=this.disconnectVoice.bind(this),this.muteVoice=this.muteVoice.bind(this),this.unmuteVoice=this.unmuteVoice.bind(this),this.getVoiceVolume=this.getVoiceVolume.bind(this),this.subscribeVoiceVolume=this.subscribeVoiceVolume.bind(this),this.export=this.export.bind(this),this.import=this.import.bind(this),this.reset=this.reset.bind(this),this.getMessageByIndex=this.getMessageByIndex.bind(this),this.getMessageById=this.getMessageById.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getModelContext=this.getModelContext.bind(this),this.getState=this.getState.bind(this)}getState(){return this._threadBinding.getStateState()}append(e){this._threadBinding.getState().append(hP(this._threadBinding.getState().messages,e))}subscribe(e){return this._threadBinding.subscribe(e)}getModelContext(){return this._threadBinding.getState().getModelContext()}startRun(e){return this._threadBinding.getState().startRun(fP(e))}resumeRun(e){return this._threadBinding.getState().resumeRun(dP(e))}exportExternalState(){return this._threadBinding.getState().exportExternalState()}importExternalState(e){this._threadBinding.getState().importExternalState(e)}cancelRun(){this._threadBinding.getState().cancelRun()}stopSpeaking(){return this._threadBinding.getState().stopSpeaking()}connectVoice(){this._threadBinding.getState().connectVoice()}disconnectVoice(){this._threadBinding.getState().disconnectVoice()}getVoiceVolume(){return this._threadBinding.getState().getVoiceVolume()}subscribeVoiceVolume(e){return this._threadBinding.getState().subscribeVoiceVolume(e)}muteVoice(){this._threadBinding.getState().muteVoice()}unmuteVoice(){this._threadBinding.getState().unmuteVoice()}export(){return this._threadBinding.getState().export()}import(e){this._threadBinding.getState().import(e)}reset(e){this._threadBinding.getState().reset(e)}getMessageByIndex(e){if(e<0)throw new Error("Message index must be >= 0");return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[${e}]`,messageSelector:{type:"index",index:e}},()=>{const t=this._threadBinding.getState().messages,n=t[e];if(n)return{message:n,parentId:t[e-1]?.id??null,index:e}})}getMessageById(e){return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[messageId=${JSON.stringify(e)}]`,messageSelector:{type:"messageId",messageId:e}},()=>this._threadBinding.getState().getMessageById(e))}_getMessageRuntime(e,t){return new cP(new er({path:e,getState:()=>{const{message:n,parentId:r,index:s}=t()??{},{messages:i,speech:o}=this._threadBinding.getState();if(!n||r===void 0||s===void 0)return ir;const a=this._threadBinding.getState().getBranches(n.id);return{...n,[si]:n[si],index:s,isLast:i.at(-1)?.id===n.id,parentId:r,branchNumber:a.indexOf(n.id)+1,branchCount:a.length,speech:o?.messageId===n.id?o:void 0}},subscribe:n=>this._threadBinding.subscribe(n)}),this._threadBinding)}unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new $b({event:e,binding:this._threadBinding}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}};const mP=m.createContext(null),gP=()=>m.useContext(mP);var bl=class{constructor(e,t){N(this,"_core");N(this,"_threadListBinding");this._core=e,this._threadListBinding=t,this.__internal_bindMethods()}get path(){return this._core.path}__internal_bindMethods(){this.switchTo=this.switchTo.bind(this),this.rename=this.rename.bind(this),this.updateCustom=this.updateCustom.bind(this),this.archive=this.archive.bind(this),this.unarchive=this.unarchive.bind(this),this.delete=this.delete.bind(this),this.initialize=this.initialize.bind(this),this.generateTitle=this.generateTitle.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getState=this.getState.bind(this),this.detach=this.detach.bind(this)}getState(){return this._core.getState()}switchTo(e){const t=this._core.getState();return this._threadListBinding.switchToThread(t.id,e)}rename(e){const t=this._core.getState();return this._threadListBinding.rename(t.id,e)}updateCustom(e){const t=this._core.getState();if(!this._threadListBinding.updateCustom)throw new Error("Thread list runtime does not support updating custom metadata");return this._threadListBinding.updateCustom(t.id,e)}archive(){const e=this._core.getState();return this._threadListBinding.archive(e.id)}unarchive(){const e=this._core.getState();return this._threadListBinding.unarchive(e.id)}delete(){const e=this._core.getState();return this._threadListBinding.delete(e.id)}initialize(){const e=this._core.getState();return this._threadListBinding.initialize(e.id)}generateTitle(){const e=this._core.getState();return this._threadListBinding.generateTitle(e.id)}unstable_on(e,t){let n=this._core.getState().isMain,r=this._core.getState().id;return this.subscribe(()=>{const s=this._core.getState(),i=s.isMain,o=s.id;n===i&&r===o||(n=i,r=o,!(e==="switchedTo"&&!i)&&(e==="switchedAway"&&i||t({})))})}subscribe(e){return this._core.subscribe(e)}detach(){const e=this._core.getState();this._threadListBinding.detach(e.id)}__internal_getRuntime(){return this}};const hy=Promise.resolve(),yP=e=>({mainThreadId:e.mainThreadId,newThreadId:e.newThreadId,threadIds:e.threadIds,archivedThreadIds:e.archivedThreadIds,isLoading:e.isLoading,isLoadingMore:e.isLoadingMore??!1,hasMore:e.hasMore??!1,threadItems:e.threadItems}),Sl=(e,t)=>{if(t===void 0)return ir;const n=e.getItemById(t);return n?{id:n.id,remoteId:n.remoteId,externalId:n.externalId,title:n.title,status:n.status,custom:n.custom,isMain:n.id===e.mainThreadId}:ir};var vP=class{constructor(e,t=Kb){N(this,"_core");N(this,"_runtimeFactory");N(this,"_getState");N(this,"_mainThreadListItemRuntime");N(this,"main");this._core=e,this._runtimeFactory=t;const n=new Pp({path:{},getState:()=>yP(e),subscribe:r=>e.subscribe(r)});this._getState=n.getState.bind(n),this._mainThreadListItemRuntime=new bl(new er({path:{ref:"threadItems[main]",threadSelector:{type:"main"}},getState:()=>Sl(this._core,this._core.mainThreadId),subscribe:r=>this._core.subscribe(r)}),this._core),this.main=new t(new Ru({path:{ref:"threads.main",threadSelector:{type:"main"}},getState:()=>e.getMainThreadRuntimeCore(),subscribe:r=>e.subscribe(r)}),this._mainThreadListItemRuntime),this.__internal_bindMethods()}__internal_bindMethods(){this.switchToThread=this.switchToThread.bind(this),this.switchToNewThread=this.switchToNewThread.bind(this),this.getLoadThreadsPromise=this.getLoadThreadsPromise.bind(this),this.reload=this.reload.bind(this),this.loadMore=this.loadMore.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getById=this.getById.bind(this),this.getItemById=this.getItemById.bind(this),this.getItemByIndex=this.getItemByIndex.bind(this),this.getArchivedItemByIndex=this.getArchivedItemByIndex.bind(this)}switchToThread(e,t){return this._core.switchToThread(e,t)}switchToNewThread(){return this._core.switchToNewThread()}getLoadThreadsPromise(){return this._core.getLoadThreadsPromise()}reload(){return this._core.reload?.()??hy}loadMore(){return this._core.loadMore?.()??hy}getState(){return this._getState()}subscribe(e){return this._core.subscribe(e)}get mainItem(){return this._mainThreadListItemRuntime}getById(e){return new this._runtimeFactory(new Ru({path:{ref:`threads[threadId=${JSON.stringify(e)}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>this._core.getThreadRuntimeCore(e),subscribe:t=>this._core.subscribe(t)}),this.mainItem)}getItemByIndex(e){return new bl(new er({path:{ref:`threadItems[${e}]`,threadSelector:{type:"index",index:e}},getState:()=>Sl(this._core,this._core.threadIds[e]),subscribe:t=>this._core.subscribe(t)}),this._core)}getArchivedItemByIndex(e){return new bl(new er({path:{ref:`archivedThreadItems[${e}]`,threadSelector:{type:"archiveIndex",index:e}},getState:()=>Sl(this._core,this._core.archivedThreadIds[e]),subscribe:t=>this._core.subscribe(t)}),this._core)}getItemById(e){return new bl(new er({path:{ref:`threadItems[threadId=${e}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>Sl(this._core,e),subscribe:t=>this._core.subscribe(t)}),this._core)}},Gb=class{constructor(e){N(this,"_core");N(this,"threads");N(this,"_thread");this._core=e,this.threads=new vP(e.threads),this._thread=this.threads.main,this.__internal_bindMethods()}__internal_bindMethods(){this.registerModelContextProvider=this.registerModelContextProvider.bind(this)}get thread(){return this._thread}registerModelContextProvider(e){return this._core.registerModelContextProvider(e)}},Yb=class{constructor(){N(this,"_contextProvider",new bp)}registerModelContextProvider(e){return this._contextProvider.registerModelContextProvider(e)}getModelContextProvider(){return this._contextProvider}};const Ns=Object.freeze([]),Wi="DEFAULT_THREAD_ID",xP=Object.freeze([Wi]),wP=Object.freeze({id:Wi,remoteId:void 0,externalId:void 0,status:"regular"}),_P=Promise.resolve(),py=Object.freeze({[Wi]:wP});var bP=class{constructor(e={},t){N(this,"threadFactory");N(this,"_mainThreadId",Wi);N(this,"_threads",xP);N(this,"_archivedThreads",Ns);N(this,"_threadData",py);N(this,"adapter",{});N(this,"_mainThread");N(this,"_subscriptions",new Set);this.threadFactory=t,this.__internal_setAdapter(e,!0)}get isLoading(){return this.adapter.isLoading??!1}get newThreadId(){}get threadIds(){return this._threads}get archivedThreadIds(){return this._archivedThreads}get threadItems(){return this._threadData}getLoadThreadsPromise(){return _P}get mainThreadId(){return this._mainThreadId}getMainThreadRuntimeCore(){return this._mainThread}getThreadRuntimeCore(){throw new Error("Method not implemented.")}getItemById(e){return this._threadData[e]}__internal_setAdapter(e,t=!1){const n=this.adapter;this.adapter=e;const r=e.threadId??Wi,s=e.threads??Ns,i=e.archivedThreads??Ns,o=n.threadId??Wi,a=n.threads??Ns,l=n.archivedThreads??Ns;!t&&o===r&&a===s&&l===i||((a!==s||l!==i||o!==r)&&(this._threadData={...py,...Object.fromEntries(e.threads?.map(u=>[u.id,{...u,remoteId:u.remoteId,externalId:u.externalId,status:"regular"}])??[]),...Object.fromEntries(e.archivedThreads?.map(u=>[u.id,{...u,remoteId:u.remoteId,externalId:u.externalId,status:"archived"}])??[])}),a!==s&&(this._threads=this.adapter.threads?.map(u=>u.id)??Ns),l!==i&&(this._archivedThreads=this.adapter.archivedThreads?.map(u=>u.id)??Ns),(t||o!==r)&&(this._mainThreadId=r,this._mainThread=this.threadFactory()),this._threadData[this._mainThreadId]||(this._threadData={...this._threadData,[this._mainThreadId]:{id:this._mainThreadId,remoteId:void 0,externalId:void 0,status:"regular"}}),this._notifySubscribers())}async switchToThread(e,t){if(this._mainThreadId===e)return;const n=this.adapter.onSwitchToThread;if(!n)throw new Error("External store adapter does not support switching to thread");await n(e)}async switchToNewThread(){const e=this.adapter.onSwitchToNewThread;if(!e)throw new Error("External store adapter does not support switching to new thread");await e()}async rename(e,t){const n=this.adapter.onRename;if(!n)throw new Error("External store adapter does not support renaming");await n(e,t)}async updateCustom(e,t){const n=this.adapter.onUpdateCustom;if(!n)throw new Error("External store adapter does not support updating custom metadata");await n(e,t)}async detach(){}async archive(e){const t=this.adapter.onArchive;if(!t)throw new Error("External store adapter does not support archiving");await t(e)}async unarchive(e){const t=this.adapter.onUnarchive;if(!t)throw new Error("External store adapter does not support unarchiving");await t(e)}async delete(e){const t=this.adapter.onDelete;if(!t)throw new Error("External store adapter does not support deleting");await t(e)}initialize(e){return Promise.resolve({remoteId:e,externalId:void 0})}generateTitle(){throw new Error("Method not implemented.")}subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}_notifySubscribers(){for(const e of this._subscriptions)e()}};const Ss=Ab("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7),vo=Symbol("autoStatus"),SP=Object.freeze(Object.assign({type:"running"},{[vo]:!0})),kP=Object.freeze(Object.assign({type:"complete",reason:"unknown"},{[vo]:!0})),CP=Object.freeze(Object.assign({type:"requires-action",reason:"tool-calls"},{[vo]:!0})),EP=Object.freeze(Object.assign({type:"requires-action",reason:"interrupt"},{[vo]:!0})),TP=e=>e[vo]===!0,Pu=(e,t,n,r,s)=>e&&s?Object.assign({type:"incomplete",reason:"error",error:s},{[vo]:!0}):e&&t?SP:n?EP:r?CP:kP,fd=(e,t)=>{if(e.startsWith("data-"))return{type:"data",name:e.substring(5),data:t}},ja=(e,t,n)=>{const{role:r,id:s,createdAt:i,attachments:o,status:a,metadata:l}=e,u={id:s??t,createdAt:i??new Date},c=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content,f=({image:h,...p})=>h.match(/^data:image\/(png|jpeg|jpg|gif|webp|svg\+xml);base64,(.*)$/)?{...p,image:h}:/^(https:\/\/|blob:)/.test(h)?{...p,image:h}:(console.warn("Invalid image data format detected"),null);if(r!=="user"&&o?.length)throw new Error("attachments are only supported for user messages");if(r!=="assistant"&&a)throw new Error("status is only supported for assistant messages");if(r!=="assistant"&&l?.steps)throw new Error("metadata.steps is only supported for assistant messages");switch(r){case"assistant":return{...u,role:r,content:c.map(h=>{const p=h.type;switch(p){case"text":case"reasoning":return h.text.trim().length===0?null:h;case"file":case"source":return h;case"image":return f(h);case"data":return h;case"generative-ui":return h;case"tool-call":{const{parentId:g,messages:y,..._}=h,x={..._,toolCallId:h.toolCallId??`tool-${Ss()}`,...g!==void 0&&{parentId:g},...y!==void 0&&{messages:y}};return h.args?{...x,args:h.args,argsText:h.argsText??JSON.stringify(h.args)}:{...x,args:$f(h.argsText??"")??{},argsText:h.argsText??""}}default:{const g=fd(p,h.data);if(g)return g;throw new Error(`Unsupported assistant message part type: ${p}`)}}}).filter(h=>!!h),status:a??n,metadata:{unstable_state:l?.unstable_state??null,unstable_annotations:l?.unstable_annotations??[],unstable_data:l?.unstable_data??[],custom:l?.custom??{},steps:l?.steps??[],...l?.timing&&{timing:l.timing},...l?.submittedFeedback&&{submittedFeedback:l.submittedFeedback},...l?.isOptimistic&&{isOptimistic:!0}}};case"user":return{...u,role:r,content:c.map(h=>{const p=h.type;switch(p){case"text":case"image":case"audio":case"file":case"data":return h;default:{const g=fd(p,h.data);if(g)return g;throw new Error(`Unsupported user message part type: ${p}`)}}}),attachments:(o??[]).map(h=>({...h,content:h.content.map(p=>fd(p.type,p.data)??p)})),metadata:{custom:l?.custom??{}}};case"system":if(c.length!==1||c[0].type!=="text")throw new Error("System messages must have exactly one text message part.");return{...u,role:r,content:c,metadata:{custom:l?.custom??{}}};default:throw new Error(`Unknown message role: ${r}`)}},Qb={fromArray:e=>{const t=e.map(n=>ja(n,Ss(),Pu(!1,!1,!1,!1,void 0)));return{messages:t.map((n,r)=>({parentId:r>0?t[r-1].id:null,message:n}))}},fromBranchableArray:(e,t)=>{const n=Pu(!1,!1,!1,!1,void 0);return{...t?.headId!==void 0?{headId:t.headId}:void 0,messages:e.map(({message:r,parentId:s})=>{if(!r.id)throw new Error("ExportedMessageRepository.fromBranchableArray: Each message must have an 'id' field set.");return{parentId:s,message:ja(r,r.id,n)}})}}},Gl=e=>e.next?Gl(e.next):"current"in e?e:null;var IP=class{constructor(e){N(this,"func");N(this,"_value",null);this.func=e}get value(){return this._value===null&&(this._value=this.func()),this._value}dirty(){this._value=null}},jp=class{constructor(){N(this,"messages",new Map);N(this,"head",null);N(this,"root",{children:[],next:null});N(this,"_messages",new IP(()=>{const e=new Array((this.head?.level??-1)+1);for(let t=this.head;t;t=t.prev)e[t.level]=t.current;return e}))}updateLevels(e,t){e.level=t;for(const n of e.children){const r=this.messages.get(n);r&&this.updateLevels(r,t+1)}}performOp(e,t,n){const r=t.prev??this.root,s=e??this.root;if(!(n==="relink"&&r===s)){if(n!=="link"&&(r.children=r.children.filter(i=>i!==t.current.id),r.next===t)){const i=r.children.at(-1),o=i?this.messages.get(i):null;if(o===void 0)throw new Error("MessageRepository(performOp/cut): Fallback sibling message not found. This is likely an internal bug in assistant-ui.");r.next=o}if(n!=="cut"){for(let o=e;o;o=o.prev)if(o.current.id===t.current.id)throw new Error("MessageRepository(performOp/link): A message with the same id already exists in the parent tree. This error occurs if the same message id is found multiple times. This is likely an internal bug in assistant-ui.");s.children=[...s.children,t.current.id],(Gl(t)===this.head||s.next===null)&&(s.next=t),t.prev=e;const i=e?e.level+1:0;this.updateLevels(t,i)}}}get headId(){return this.head?.current.id??null}getMessages(e){if(e===void 0||e===this.head?.current.id)return this._messages.value;const t=this.messages.get(e);if(!t)throw new Error("MessageRepository(getMessages): Head message not found. This is likely an internal bug in assistant-ui.");const n=new Array(t.level+1);for(let r=t;r;r=r.prev)n[r.level]=r.current;return n}addOrUpdateMessage(e,t){const n=this.messages.get(t.id),r=e?this.messages.get(e):null;if(r===void 0)throw new Error("MessageRepository(addOrUpdateMessage): Parent message not found. This is likely an internal bug in assistant-ui.");if(n){n.current=t,this.performOp(r,n,"relink"),this._messages.dirty();return}const s={prev:r,current:t,next:null,children:[],level:r?r.level+1:0};this.messages.set(t.id,s),this.performOp(r,s,"link"),this.head===r&&(this.head=s),this._messages.dirty()}getMessage(e){const t=this.messages.get(e);if(!t)throw new Error("MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui.");return{parentId:t.prev?.current.id??null,message:t.current,index:t.level}}deleteMessage(e,t){const n=this.messages.get(e);if(!n)throw new Error("MessageRepository(deleteMessage): Message not found. This is likely an internal bug in assistant-ui.");const r=t===void 0?n.prev:t===null?null:this.messages.get(t);if(r===void 0)throw new Error("MessageRepository(deleteMessage): Replacement not found. This is likely an internal bug in assistant-ui.");for(const s of n.children){const i=this.messages.get(s);if(!i)throw new Error("MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui.");this.performOp(r,i,"relink")}this.performOp(null,n,"cut"),this.messages.delete(e),this.head===n&&(this.head=Gl(r??this.root)),this._messages.dirty()}getBranches(e){const t=this.messages.get(e);if(!t)throw new Error("MessageRepository(getBranches): Message not found. This is likely an internal bug in assistant-ui.");const{children:n}=t.prev??this.root;return n}evictOffBranchOptimisticMessages(e,t){if(!e)return;const n=new Set;for(let s=t;s;s=s.prev)n.add(s.current.id);const r=[];for(let s=e;s&&!n.has(s.current.id);s=s.prev)s.current.metadata?.isOptimistic&&r.push(s.current.id);for(const s of r)this.messages.has(s)&&this.deleteMessage(s)}switchToBranch(e){const t=this.messages.get(e);if(!t)throw new Error("MessageRepository(switchToBranch): Branch not found. This is likely an internal bug in assistant-ui.");const n=this.head,r=t.prev??this.root;r.next=t,this.head=Gl(t),this.evictOffBranchOptimisticMessages(n,this.head),this._messages.dirty()}resetHead(e){if(e===null){this.clear();return}const t=this.messages.get(e);if(!t)throw new Error("MessageRepository(resetHead): Branch not found. This is likely an internal bug in assistant-ui.");const n=this.head;if(t.children.length>0){const r=s=>{for(const i of s.children){const o=this.messages.get(i);o&&(r(o),this.messages.delete(i))}};r(t),t.children=[],t.next=null}this.head=t;for(let r=t;r;r=r.prev)r.prev?r.prev.next=r:this.root.next=r;this.evictOffBranchOptimisticMessages(n,this.head),this._messages.dirty()}clear(){this.messages.clear(),this.head=null,this.root={children:[],next:null},this._messages.dirty()}export(){const e=[];for(const[,n]of this.messages)n.current.metadata?.isOptimistic||e.push({message:n.current,parentId:n.prev?.current.id??null});let t=this.head;for(;t?.current.metadata?.isOptimistic;)t=t.prev;return{headId:t?.current.id??null,messages:e}}import({headId:e,messages:t}){for(const{message:n,parentId:r}of t)this.addOrUpdateMessage(r,n);this.resetHead(e??t.at(-1)?.message.id??null)}};function my(e,t){if(t==="*")return!0;const n=t.split(",").map(i=>i.trim().toLowerCase()),r=`.${e.name.split(".").pop().toLowerCase()}`,s=e.type.toLowerCase();for(const i of n){if(i.startsWith(".")&&i===r||i.includes("/")&&i===s)return!0;if(i.endsWith("/*")){const o=i.split("/")[0];if(s.startsWith(`${o}/`))return!0}}return!1}function RP(e,t){return e.length!==t.length?!1:e.every((n,r)=>n.id===t[r].id)}function PP(e){const t=Ss();return e.type==="image"?{id:t,type:"image",name:e.filename??"image",content:[e],status:{type:"complete"}}:e.type==="file"?{id:t,type:"document",name:e.filename??"document",contentType:e.mimeType,content:[e],status:{type:"complete"}}:e.type==="audio"?{id:t,type:"audio",name:`audio.${e.audio.format}`,contentType:`audio/${e.audio.format}`,content:[e],status:{type:"complete"}}:{id:t,type:"data",name:e.name,content:[e],status:{type:"complete"}}}function jP(e){const t=[];for(const n of e)n.type!=="text"&&t.push(PP(n));return t}const hd=e=>e.status.type==="complete";var Xb=class extends tP{constructor(){super(...arguments);N(this,"isEditing",!0);N(this,"_attachments",[]);N(this,"_text","");N(this,"_role","user");N(this,"_runConfig",{});N(this,"_quote");N(this,"_dictation");N(this,"_dictationSession");N(this,"_dictationUnsubscribes",[]);N(this,"_dictationBaseText","");N(this,"_currentInterimText","");N(this,"_dictationSessionIdCounter",0);N(this,"_activeDictationSessionId");N(this,"_isCleaningDictation",!1);N(this,"_eventSubscribers",new Map)}get attachmentAccept(){return this.getAttachmentAdapter()?.accept??"*"}get attachments(){return this._attachments}setAttachments(t){this._attachments=t,this._notifySubscribers()}get isEmpty(){return!this.text.trim()&&!this.attachments.length}get text(){return this._text}get role(){return this._role}get runConfig(){return this._runConfig}get quote(){return this._quote}setQuote(t){this._quote!==t&&(this._quote=t,this._notifySubscribers())}setText(t){if(this._text!==t){if(this._text=t,this._dictation){this._dictationBaseText=t,this._currentInterimText="";const{status:n,inputDisabled:r}=this._dictation;this._dictation=r?{status:n,inputDisabled:r}:{status:n}}this._notifySubscribers()}}setRole(t){this._role!==t&&(this._role=t,this._notifySubscribers())}setRunConfig(t){this._runConfig!==t&&(this._runConfig=t,this._notifySubscribers())}_emptyTextAndAttachments(){this._attachments=[],this._text="",this._notifySubscribers()}async _onClearAttachments(){const t=this.getAttachmentAdapter();if(t){const n=this._attachments.filter(r=>!hd(r));await Promise.all(n.map(r=>t.remove(r)))}}async reset(){if(this._attachments.length===0&&this._text===""&&this._role==="user"&&Object.keys(this._runConfig).length===0&&this._quote===void 0)return;this._role="user",this._runConfig={},this._quote=void 0;const t=this._onClearAttachments();this._emptyTextAndAttachments(),await t}async clearAttachments(){const t=this._onClearAttachments();this.setAttachments([]),await t}async send(t){if(!this.canSend)return;this._dictationSession&&(this._dictationSession.cancel(),this._cleanupDictation());const n=this.getAttachmentAdapter(),r=this.attachments.length>0?Promise.all(this.attachments.map(async a=>{if(hd(a))return a;if(!n)throw new Error("Attachments are not supported");return await n.send(a)})):[],s=this.text,i=this._quote;this._quote=void 0,this._emptyTextAndAttachments();const o={createdAt:new Date,role:this.role,content:s?[{type:"text",text:s}]:[],attachments:await r,runConfig:this.runConfig,metadata:{custom:{...i?{quote:i}:{}}}};this.handleSend(o,t),this._notifyEventSubscribers("send",{})}cancel(){this.handleCancel()}async addAttachment(t){if(!(t instanceof File)){const i=this.getAttachmentAdapter();if(i&&!my({name:t.name,type:t.contentType??""},i.accept)){const a=`File type ${t.contentType||"unknown"} is not accepted. Accepted types: ${i.accept}`,l=new Error(a);throw this._safeEmitAttachmentAddError("not-accepted",a,void 0,l),l}const o={id:t.id??Ss(),type:t.type??"document",name:t.name,contentType:t.contentType,content:t.content,status:{type:"complete"}};this._attachments=[...this._attachments,o],this._notifySubscribers(),this._notifyEventSubscribers("attachmentAdd",{});return}const n=i=>{const o=this._attachments.findIndex(a=>a.id===i.id);o!==-1?this._attachments=[...this._attachments.slice(0,o),i,...this._attachments.slice(o+1)]:this._attachments=[...this._attachments,i],this._notifySubscribers()},r=this.getAttachmentAdapter();if(!r){const i="Attachments are not supported",o=new Error(i);throw this._safeEmitAttachmentAddError("no-adapter",i,void 0,o),o}if(!my({name:t.name,type:t.type},r.accept)){const i=`File type ${t.type||"unknown"} is not accepted. Accepted types: ${r.accept}`,o=new Error(i);throw this._safeEmitAttachmentAddError("not-accepted",i,void 0,o),o}let s;try{const i=r.add({file:t});if(Symbol.asyncIterator in i)for await(const o of i)s=o,n(o);else s=await i,n(s)}catch(i){throw s&&n({...s,status:{type:"incomplete",reason:"error"}}),this._safeEmitAttachmentAddError("adapter-error",i instanceof Error?i.message:String(i),s?.id,i instanceof Error?i:void 0),i}s?.status.type==="incomplete"&&s.status.reason==="error"?this._safeEmitAttachmentAddError("adapter-error","Attachment upload did not complete successfully.",s?.id):this._notifyEventSubscribers("attachmentAdd",{})}_safeEmitAttachmentAddError(t,n,r,s){try{this._notifyEventSubscribers("attachmentAddError",{reason:t,message:n,...r!==void 0&&{attachmentId:r},...s!==void 0&&{error:s}})}catch(i){console.error("[assistant-ui] attachmentAddError subscriber threw:",i)}}async removeAttachment(t){const n=this._attachments.findIndex(s=>s.id===t);if(n===-1)throw new Error("Attachment not found");const r=this._attachments[n];if(!hd(r)){const s=this.getAttachmentAdapter();if(!s)throw new Error("Attachments are not supported");await s.remove(r)}this._attachments=this._attachments.filter(s=>s.id!==t),this._notifySubscribers()}get dictation(){return this._dictation}_isActiveSession(t,n){return this._activeDictationSessionId===t&&this._dictationSession===n}startDictation(){const t=this.getDictationAdapter();if(!t)throw new Error("Dictation adapter not configured");if(this._dictationSession){for(const u of this._dictationUnsubscribes)u();this._dictationUnsubscribes=[],this._dictationSession.stop().catch(()=>{}),this._dictationSession=void 0}const n=t.disableInputDuringDictation??!1;this._dictationBaseText=this._text,this._currentInterimText="";const r=t.listen();this._dictationSession=r;const s=++this._dictationSessionIdCounter;this._activeDictationSessionId=s,this._dictation={status:r.status,inputDisabled:n},this._notifySubscribers();const i=r.onSpeech(u=>{if(!this._isActiveSession(s,r))return;const c=u.isFinal!==!1,f=this._dictationBaseText&&!this._dictationBaseText.endsWith(" ")&&u.transcript?" ":"";if(c){if(this._dictationBaseText=this._dictationBaseText+f+u.transcript,this._currentInterimText="",this._text=this._dictationBaseText,this._dictation){const{transcript:h,...p}=this._dictation;this._dictation=p}this._notifySubscribers()}else this._currentInterimText=f+u.transcript,this._text=this._dictationBaseText+this._currentInterimText,this._dictation&&(this._dictation={...this._dictation,transcript:u.transcript}),this._notifySubscribers()});this._dictationUnsubscribes.push(i);const o=r.onSpeechStart(()=>{this._isActiveSession(s,r)&&(this._dictation={status:{type:"running"},inputDisabled:n,...this._dictation?.transcript&&{transcript:this._dictation.transcript}},this._notifySubscribers())});this._dictationUnsubscribes.push(o);const a=r.onSpeechEnd(()=>{this._cleanupDictation({sessionId:s})});this._dictationUnsubscribes.push(a);const l=setInterval(()=>{this._isActiveSession(s,r)&&r.status.type==="ended"&&this._cleanupDictation({sessionId:s})},100);this._dictationUnsubscribes.push(()=>clearInterval(l))}stopDictation(){if(!this._dictationSession)return;const t=this._dictationSession,n=this._activeDictationSessionId;t.stop().finally(()=>{this._cleanupDictation({sessionId:n})})}_cleanupDictation(t){if(!(t?.sessionId!==void 0&&t.sessionId!==this._activeDictationSessionId||this._isCleaningDictation)){this._isCleaningDictation=!0;try{for(const n of this._dictationUnsubscribes)n();this._dictationUnsubscribes=[],this._dictationSession=void 0,this._activeDictationSessionId=void 0,this._dictation=void 0,this._dictationBaseText="",this._currentInterimText="",this._notifySubscribers()}finally{this._isCleaningDictation=!1}}}_notifyEventSubscribers(t,n){const r=this._eventSubscribers.get(t);if(r)for(const s of r)s(n)}unstable_on(t,n){const r=n;let s=this._eventSubscribers.get(t);return s||(s=new Set,this._eventSubscribers.set(t,s)),s.add(r),()=>{this._eventSubscribers.get(t)?.delete(r)}}},Jb=class extends Xb{constructor(t){super();N(this,"runtime");N(this,"_canCancel",!1);this.runtime=t,this.connect()}get canCancel(){return this._canCancel}get canSend(){return!this.isEmpty&&!this.runtime.isSendDisabled}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}connect(){let t=this.runtime.isSendDisabled;return this.runtime.subscribe(()=>{let n=!1;this.canCancel!==this.runtime.capabilities.cancel&&(this._canCancel=this.runtime.capabilities.cancel,n=!0),t!==this.runtime.isSendDisabled&&(t=this.runtime.isSendDisabled,n=!0),n&&this._notifySubscribers()})}async handleSend(t,n){this.runtime.append({...t,parentId:this.runtime.messages.at(-1)?.id??null,sourceId:null,startRun:n?.startRun})}async handleCancel(){this.runtime.cancelRun()}},AP=class extends Xb{constructor(t,n,{parentId:r,message:s}){super();N(this,"runtime");N(this,"endEditCallback");N(this,"_previousText");N(this,"_previousAttachments");N(this,"_nonTextPassthrough");N(this,"_parentId");N(this,"_sourceId");this.runtime=t,this.endEditCallback=n,this._parentId=r,this._sourceId=s.id,this._previousText=Pa(s),this.setText(this._previousText),this.setRole(s.role),s.role==="user"?(this._previousAttachments=[...s.attachments??[],...jP(s.content)],this._nonTextPassthrough=[]):(this._previousAttachments=s.attachments??[],this._nonTextPassthrough=s.content.filter(i=>i.type!=="text")),this.setAttachments(this._previousAttachments),this.setRunConfig({...t.composer.runConfig})}get canCancel(){return!0}get canSend(){return!this.isEmpty}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}get parentId(){return this._parentId}get sourceId(){return this._sourceId}async handleSend(t,n){const r=Pa(t),s=!RP(t.attachments??[],this._previousAttachments);if(r!==this._previousText||s||n?.startRun){const i=this._nonTextPassthrough.length>0?[...t.content,...this._nonTextPassthrough]:t.content;this.runtime.append({...t,content:i,parentId:this._parentId,sourceId:this._sourceId,startRun:n?.startRun})}this.handleCancel()}handleCancel(){this.endEditCallback(),this._notifySubscribers()}},NP=class{constructor(e){N(this,"_contextProvider");N(this,"_subscriptions",new Set);N(this,"_isInitialized",!1);N(this,"repository",new jp);N(this,"_voiceMessages",[]);N(this,"_voiceGeneration",0);N(this,"_cachedMergedMessages",null);N(this,"_cachedVoiceGeneration",-1);N(this,"_cachedMergedBase",null);N(this,"composer",new Jb(this));N(this,"_editComposers",new Map);N(this,"_stopSpeaking");N(this,"speech");N(this,"_voiceSession");N(this,"_voiceUnsubs",[]);N(this,"voice");N(this,"_voiceVolume",0);N(this,"_voiceVolumeSubscribers",new Set);N(this,"getVoiceVolume",()=>this._voiceVolume);N(this,"subscribeVoiceVolume",e=>(this._voiceVolumeSubscribers.add(e),()=>this._voiceVolumeSubscribers.delete(e)));N(this,"_currentAssistantMsg",null);N(this,"_eventSubscribers",new Map);this._contextProvider=e}_markVoiceMessagesDirty(){this._voiceGeneration++,this._cachedMergedMessages=null}_getBaseMessages(){return this.repository.getMessages()}get messages(){if(this._voiceMessages.length===0)return this._getBaseMessages();const e=this._getBaseMessages();return(this._cachedVoiceGeneration!==this._voiceGeneration||this._cachedMergedBase!==e)&&(this._cachedMergedMessages=[...e,...this._voiceMessages],this._cachedVoiceGeneration=this._voiceGeneration,this._cachedMergedBase=e),this._cachedMergedMessages}get state(){let e;for(const t of this.messages)t.role==="assistant"&&(e=t);return e?.metadata.unstable_state??null}getModelContext(){return this._contextProvider.getModelContext()}getEditComposer(e){return this._editComposers.get(e)}beginEdit(e){if(this._editComposers.has(e))throw new Error("Edit already in progress");this._editComposers.set(e,new AP(this,()=>this._editComposers.delete(e),this.repository.getMessage(e))),this._notifySubscribers()}getMessageById(e){try{return this.repository.getMessage(e)}catch{const t=this.repository.getMessages(),n=this._voiceMessages.findIndex(r=>r.id===e);return n!==-1?{parentId:n>0?this._voiceMessages[n-1].id:t.at(-1)?.id??null,message:this._voiceMessages[n],index:t.length+n}:void 0}}getBranches(e){return this._voiceMessages.some(t=>t.id===e)?[]:this.repository.getBranches(e)}switchToBranch(e){this.repository.switchToBranch(e),this._notifySubscribers()}_notifySubscribers(){for(const e of this._subscriptions)e()}_notifyEventSubscribers(e,t){const n=this._eventSubscribers.get(e);if(n)for(const r of n)r(t)}subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}submitFeedback({messageId:e,type:t}){const n=this.adapters?.feedback;if(!n)throw new Error("Feedback adapter not configured");const{message:r,parentId:s}=this.repository.getMessage(e);if(n.submit({message:r,type:t}),r.role==="assistant"){const i={...r,metadata:{...r.metadata,submittedFeedback:{type:t}}};this.repository.addOrUpdateMessage(s,i)}this._notifySubscribers()}speak(e){const t=this.adapters?.speech;if(!t)throw new Error("Speech adapter not configured");const{message:n}=this.repository.getMessage(e);this._stopSpeaking?.();const r=t.speak(Pa(n)),s=r.subscribe(()=>{r.status.type==="ended"?(this._stopSpeaking=void 0,this.speech=void 0):this.speech={messageId:e,status:r.status},this._notifySubscribers()});this.speech={messageId:e,status:r.status},this._notifySubscribers(),this._stopSpeaking=()=>{r.cancel(),s(),this.speech=void 0,this._stopSpeaking=void 0}}stopSpeaking(){if(!this._stopSpeaking)throw new Error("No message is being spoken");this._stopSpeaking(),this._notifySubscribers()}connectVoice(){const e=this.adapters?.voice;if(!e)throw new Error("Voice adapter not configured");this.disconnectVoice();const t=e.connect({});this._voiceSession=t;const n=[];let r="listening";this.voice={status:t.status,isMuted:t.isMuted,mode:r},this._voiceVolume=0,this._notifySubscribers(),n.push(t.onStatusChange(s=>{s.type==="ended"?(this._finishVoiceAssistantMessage(),this._voiceSession=void 0,this.voice=void 0):this.voice={status:s,isMuted:t.isMuted,mode:r},this._notifySubscribers()})),n.push(t.onModeChange(s=>{r=s,this.voice&&(this.voice={...this.voice,mode:s},this._notifySubscribers())})),n.push(t.onVolumeChange(s=>{this._voiceVolume=s;for(const i of this._voiceVolumeSubscribers)i()})),n.push(t.onTranscript(s=>{this._handleVoiceTranscript(s)})),this._voiceUnsubs=n}_handleVoiceTranscript(e){if(this.ensureInitialized(),e.role==="user")this._finishVoiceAssistantMessage(),this._currentAssistantMsg=null,e.isFinal&&(this._voiceMessages.push({id:Ss(),role:"user",content:[{type:"text",text:e.text}],metadata:{custom:{}},createdAt:new Date,status:{type:"complete",reason:"unknown"},attachments:[]}),this._markVoiceMessagesDirty(),this._notifySubscribers());else{if(!this._currentAssistantMsg)this._currentAssistantMsg={id:Ss(),role:"assistant",content:[{type:"text",text:e.text}],metadata:{unstable_state:this.state,unstable_annotations:[],unstable_data:[],steps:[],custom:{}},status:{type:"running"},createdAt:new Date},this._voiceMessages.push(this._currentAssistantMsg);else{const t=this._voiceMessages.indexOf(this._currentAssistantMsg);if(t===-1)return;const n={...this._currentAssistantMsg,content:[{type:"text",text:e.text}],...e.isFinal?{status:{type:"complete",reason:"stop"}}:{}};this._voiceMessages[t]=n,this._currentAssistantMsg=n}e.isFinal&&(this._currentAssistantMsg=null),this._markVoiceMessagesDirty(),this._notifySubscribers()}}_finishVoiceAssistantMessage(){const e=this._voiceMessages.at(-1);if(e?.role==="assistant"&&e.status.type==="running"){const t=this._voiceMessages.length-1;this._voiceMessages[t]={...e,status:{type:"complete",reason:"stop"}},this._markVoiceMessagesDirty(),this._notifySubscribers()}}disconnectVoice(){this._finishVoiceAssistantMessage(),this._currentAssistantMsg=null;for(const e of this._voiceUnsubs)e();this._voiceUnsubs=[],this._voiceSession?.disconnect(),this._voiceSession=void 0,this.voice=void 0,this._voiceVolume=0;for(const e of this._voiceVolumeSubscribers)e();this._voiceMessages=[],this._markVoiceMessagesDirty(),this._notifySubscribers()}muteVoice(){if(!this._voiceSession)throw new Error("No active voice session");this._voiceSession.mute(),this.voice={...this.voice,isMuted:!0},this._notifySubscribers()}unmuteVoice(){if(!this._voiceSession)throw new Error("No active voice session");this._voiceSession.unmute(),this.voice={...this.voice,isMuted:!1},this._notifySubscribers()}ensureInitialized(){this._isInitialized||(this._isInitialized=!0,this._notifyEventSubscribers("initialize",{}))}export(){return this.repository.export()}import(e){this.ensureInitialized(),this.repository.clear(),this.repository.import(e),this._notifySubscribers()}reset(e){this.import(Qb.fromArray(e??[]))}unstable_on(e,t){const n=t;if(e==="modelContextUpdate")return this._contextProvider.subscribe?.(()=>n({}))??(()=>{});let r=this._eventSubscribers.get(e);return r||(r=new Set,this._eventSubscribers.set(e,r)),r.add(n),e==="initialize"&&this._isInitialized&&queueMicrotask(()=>{r.has(n)&&n({})}),()=>{this._eventSubscribers.get(e)?.delete(n)}}},gy=class{constructor(){N(this,"cache",new WeakMap)}convertMessages(e,t){return e.map((n,r)=>{const s=t(this.cache.get(n),n,r);return this.cache.set(n,s),s})}};function Vf(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function ju(e,t=0){return t>100?!1:e===null||typeof e=="string"||typeof e=="boolean"?!0:typeof e=="number"?!Number.isNaN(e)&&Number.isFinite(e):Array.isArray(e)?e.every(n=>ju(n,t+1)):Vf(e)?Object.entries(e).every(([n,r])=>typeof n=="string"&&ju(r,t+1)):!1}const MP=100,Hf=(e,t,n)=>{if(e===t)return!0;if(n>MP||e==null||t==null)return!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((i,o)=>Hf(i,t[o],n+1));if(Array.isArray(t)||!Vf(e)||!Vf(t))return!1;const r=Object.keys(e),s=Object.keys(t);return r.length!==s.length?!1:r.every(i=>Object.hasOwn(t,i)&&Hf(e[i],t[i],n+1))},DP=(e,t)=>!ju(e)||!ju(t)?!1:Hf(e,t,0),kl=e=>{try{return JSON.parse(e),!0}catch{return!1}},yy=e=>{try{return JSON.parse(e)}catch{return}},vy=(e,t)=>{const n=yy(e),r=yy(t);return n===void 0||r===void 0?!1:DP(n,r)};var LP=class{constructor(e,t){N(this,"_getTools");N(this,"_callbacks");N(this,"_entries",new Map);N(this,"_skipExecuteStreamIds",new Set);N(this,"_humanInput",new Map);N(this,"_executing",new Set);N(this,"_settledResolvers",[]);N(this,"_statuses",new Map);N(this,"_ac",new AbortController);N(this,"_pendingRestore",!0);N(this,"_lastSnapshot",null);N(this,"_isRunning",!1);N(this,"_controller");N(this,"_pipelineDead",!1);N(this,"_pipelineRestartUsed",!1);this._getTools=e,this._callbacks=t,this._initPipeline()}_initPipeline(){const[e,t]=ER();this._controller=t;const n=WR(()=>this._getWrappedTools(),()=>this._ac.signal,(r,s)=>this._onHumanInput(r,s),{onExecutionStart:r=>this._onExecutionStart(r),onExecutionEnd:r=>this._onExecutionEnd(r)});e.pipeThrough(n).pipeThrough(new jb).pipeTo(new WritableStream({write:r=>{try{if(r.type!=="result")return;this._handleResultChunk(r)}catch(s){console.error("[ToolInvocationTracker] result chunk handling failed",s)}}})).catch(r=>{console.error("[ToolInvocationTracker] stream pipeline failed; will attempt single restart on next setState",r),this._pipelineDead=!0})}setState(e){try{if(this._pipelineDead){if(this._pipelineRestartUsed)return;this._pipelineRestartUsed=!0,this._pipelineDead=!1,this._demoteEntriesToRestored(),this._executing.clear(),this._ac=new AbortController,this._initPipeline()}if(this._lastSnapshot&&this._lastSnapshot.messages===e.messages&&this._lastSnapshot.isRunning===e.isRunning&&this._lastSnapshot.isLoading===e.isLoading)return;e.isLoading===!0&&(this._pendingRestore=!0);const t=this._isRunning;this._isRunning=e.isRunning;try{this._processMessages(e.messages)}catch(n){throw this._isRunning=t,n}this._lastSnapshot=e,this._pendingRestore=!1}catch(t){console.error("[ToolInvocationTracker] setState failed; snapshot dropped",t)}}reset(){try{this._pendingRestore=!0,this._entries.clear(),this._lastSnapshot=null,this.abort().finally(()=>{this._executing.clear()})}catch(e){console.error("[ToolInvocationTracker] reset failed",e)}}abort(){try{return this._humanInput.forEach(({reject:e})=>{try{e(new Error("Tool execution aborted"))}catch{}}),this._humanInput.clear(),this._ac.abort(),this._ac=new AbortController,this._executing.size===0?Promise.resolve():new Promise(e=>{this._settledResolvers.push(e)})}catch(e){return console.error("[ToolInvocationTracker] abort failed",e),Promise.resolve()}}resume(e,t){try{const n=this._humanInput.get(e);return n?(this._humanInput.delete(e),this._setStatus(e,{type:"executing"}),n.resolve(t),!0):!1}catch(n){return console.error("[ToolInvocationTracker] resume failed",n),!1}}getStatuses(){return this._statuses}_getWrappedTools(){const e=this._getTools();if(e)return Object.fromEntries(Object.entries(e).map(([t,n])=>{const r=n.execute;return r===void 0?[t,n]:[t,{...n,execute:(...[s,i])=>this._skipExecuteStreamIds.has(i.toolCallId)?new Promise(()=>{}):r(s,i)}]}))}_onHumanInput(e,t){return new Promise((n,r)=>{const s=this._humanInput.get(e);if(s)try{s.reject(new Error("Human input request was superseded by a new request"))}catch{}this._humanInput.set(e,{resolve:n,reject:r}),this._setStatus(e,{type:"interrupt",payload:{type:"human",payload:t}})})}_onExecutionStart(e){this._skipExecuteStreamIds.has(e)||(this._executing.add(e),this._setStatus(e,{type:"executing"}))}_onExecutionEnd(e){this._executing.delete(e)&&(this._deleteStatus(e),this._executing.size===0&&this._settledResolvers.splice(0).forEach(t=>{try{t()}catch{}}))}_handleResultChunk(e){const t=e.meta.toolCallId,n=this._entries.get(t);!n&&this._skipExecuteStreamIds.has(t)||n?.hasResult||this._invokeOnResult({type:"add-tool-result",toolCallId:t,toolName:e.meta.toolName,result:e.result,isError:e.isError,...e.artifact!==void 0&&{artifact:e.artifact},...e.modelContent!==void 0&&{modelContent:e.modelContent}})}_invokeOnResult(e){try{this._callbacks.onResult(e)}catch(t){console.error("[ToolInvocationTracker] onResult callback threw; result dropped",t)}}_invokeOnStatusesChange(){try{this._callbacks.onStatusesChange(this._statuses)}catch(e){console.error("[ToolInvocationTracker] onStatusesChange callback threw; status change not propagated",e)}}_setStatus(e,t){const n=new Map(this._statuses);n.set(e,t),this._statuses=n,this._invokeOnStatusesChange()}_deleteStatus(e){if(!this._statuses.has(e))return;const t=new Map(this._statuses);t.delete(e),this._statuses=t,this._invokeOnStatusesChange()}_hasExecutableTool(e){const t=this._getTools()?.[e];return t?.execute!==void 0||t?.streamCall!==void 0}_shouldCloseArgsStream({toolName:e,argsText:t,hasResult:n}){return n?!0:(this._hasExecutableTool(e)||!this._isRunning)&&kl(t)}_startActiveEntry(e,t,n){const r=this._controller.addToolCallPart({toolName:t,toolCallId:e});n&&this._skipExecuteStreamIds.add(e);const s={toolName:t,controller:r,argsText:"",hasResult:!1,argsComplete:!1};return this._entries.set(e,s),s}_demoteEntriesToRestored(){for(const[e,t]of this._entries)t.controller&&this._entries.set(e,{toolName:t.toolName,argsText:t.argsText,hasResult:t.hasResult})}_processArgsText(e,t){if(!e.controller)return;const n=t.result!==void 0;if(t.argsText!==e.argsText){let r=!0;if(e.argsComplete)vy(e.argsText,t.argsText)&&(e.argsText=t.argsText),r=!1;else if(!t.argsText.startsWith(e.argsText))if(kl(e.argsText)&&kl(t.argsText)&&vy(e.argsText,t.argsText)){const s=this._shouldCloseArgsStream({toolName:t.toolName,argsText:t.argsText,hasResult:n});s&&e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=s,r=!1}else r=!1;if(r&&e.controller){const s=t.argsText.slice(e.argsText.length);e.controller.argsText.append(s);const i=this._shouldCloseArgsStream({toolName:t.toolName,argsText:t.argsText,hasResult:n});i&&e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=i}}!e.argsComplete&&e.controller&&this._shouldCloseArgsStream({toolName:t.toolName,argsText:t.argsText,hasResult:n})&&(e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=!0)}_processMessages(e){const t=this._pendingRestore;for(const n of e)if(!(!n||!Array.isArray(n.content)))for(const r of n.content){if(!r||r.type!=="tool-call")continue;const s=this._entries.get(r.toolCallId);if(t){s?.controller||this._entries.set(r.toolCallId,{toolName:r.toolName,argsText:r.argsText,hasResult:r.result!==void 0}),r.messages&&this._processMessages(r.messages);continue}let i=s;if(i&&!i.controller){if(!(r.argsText!==i.argsText||r.result!==void 0!==i.hasResult)){r.messages&&this._processMessages(r.messages);continue}this._entries.delete(r.toolCallId),i=void 0}if(i||(i=this._startActiveEntry(r.toolCallId,r.toolName,r.result!==void 0)),this._processArgsText(i,r),r.result!==void 0&&!i.hasResult){const{controller:o}=i;if(!o)continue;i.hasResult=!0,i.argsComplete=!0,o.setResponse(new zr({result:r.result,artifact:r.artifact,isError:r.isError,...r.modelContent!==void 0?{modelContent:r.modelContent}:{}})),o.close()}r.messages&&this._processMessages(r.messages)}}};const OP=Object.freeze([]),xy=(e,t)=>{const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(e[r]!==t[r])return!1;return!0},zP=(e,t)=>e&&t[t.length-1]?.role!=="assistant";var FP=class extends NP{constructor(t,n){super(t);N(this,"_capabilities",{switchToBranch:!1,switchBranchDuringRun:!1,edit:!1,reload:!1,cancel:!1,unstable_copy:!1,speech:!1,dictation:!1,voice:!1,attachments:!1,feedback:!1,queue:!1});N(this,"_messages");N(this,"isDisabled");N(this,"isSendDisabled");N(this,"suggestions",[]);N(this,"extras");N(this,"_converter",new gy);N(this,"_store");N(this,"_toolInvocations",null);N(this,"_toolCallToMessageId",new Map);N(this,"_messagesForToolCallIndex",null);N(this,"updateMessages",t=>{this._store.convertMessage!==void 0?this._store.setMessages?.(t.flatMap(ZR)):this._store.setMessages?.(t)});this.__internal_setAdapter(n)}get capabilities(){return this._capabilities}get isLoading(){return this._store.isLoading??!1}get isRunning(){return this._store.isRunning}_getBaseMessages(){return this._messages}get state(){return this._store.state??super.state}get adapters(){return this._store.adapters}beginEdit(t){if(!this._store.onEdit)throw new Error("Runtime does not support editing.");super.beginEdit(t)}__internal_setAdapter(t){if(this._store===t)return;const n=t.isRunning??!1;this.isDisabled=t.isDisabled??!1,this.isSendDisabled=t.isSendDisabled??!1;const r=this._store;this._store=t,this.extras!==t.extras&&(this.extras=t.extras);const s=t.suggestions??OP;xy(this.suggestions,s)||(this.suggestions=s);const i={switchToBranch:this._store.setMessages!==void 0,switchBranchDuringRun:!1,edit:this._store.onEdit!==void 0,reload:this._store.onReload!==void 0,cancel:this._store.onCancel!==void 0,speech:this._store.adapters?.speech!==void 0,dictation:this._store.adapters?.dictation!==void 0,voice:this._store.adapters?.voice!==void 0,unstable_copy:this._store.unstable_capabilities?.copy!==!1,attachments:!!this._store.adapters?.attachments,feedback:!!this._store.adapters?.feedback,queue:!1};xy(this._capabilities,i)||(this._capabilities=i);let o;if(t.messageRepository){if(r&&r.isRunning===t.isRunning&&r.messageRepository===t.messageRepository){this._notifySubscribers();return}this.repository.clear(),this.repository.import(t.messageRepository),o=this.repository.getMessages()}else if(t.messages){if(r){if(r.convertMessage!==t.convertMessage)this._converter=new gy;else if(r.isRunning===t.isRunning&&r.messages===t.messages){this._notifySubscribers();return}}o=t.convertMessage?this._converter.convertMessages(t.messages,(l,u,c)=>{if(!t.convertMessage)return u;const f=Pu(c===(t.messages?.length??0)-1,n,!1,!1,void 0);if(l&&(l.role!=="assistant"||!TP(l.status)||l.status===f))return l;const h=ja(t.convertMessage(u,c),c.toString(),f);return JR(h,u),h}):t.messages;for(let l=0;l<o.length;l++){const u=o[l],c=o[l-1];this.repository.addOrUpdateMessage(c?.id??null,u)}}else throw new Error("ExternalStoreAdapter must provide either 'messages' or 'messageRepository'");o.length>0&&this.ensureInitialized(),(r?.isRunning??!1)!==(t.isRunning??!1)&&(t.isRunning?this._notifyEventSubscribers("runStart",{}):this._notifyEventSubscribers("runEnd",{}));let a=null;zP(n,o)&&(a=Ss(),this.repository.addOrUpdateMessage(o.at(-1)?.id??null,ja({role:"assistant",content:[],metadata:{isOptimistic:!0}},a,{type:"running"}))),this.repository.resetHead(a??o.at(-1)?.id??null),this._messages=this.repository.getMessages(),this._driveToolInvocations(),this._notifySubscribers()}_driveToolInvocations(){if(!this._store.unstable_enableToolInvocations){this._toolInvocations&&(this._toolInvocations.reset(),this._toolInvocations=null,this._store.setToolStatuses?.({}));return}this._toolInvocations||(this._toolInvocations=new LP(()=>this.getModelContext().tools,{onResult:t=>{try{const n=this._findMessageIdForToolCall(t.toolCallId);if(n===void 0)return;this._store.onAddToolResult?.({messageId:n,toolCallId:t.toolCallId,toolName:t.toolName,result:t.result,isError:t.isError,...t.artifact!==void 0&&{artifact:t.artifact},...t.modelContent!==void 0&&{modelContent:t.modelContent}})}catch(n){console.error("[ExternalStoreThreadRuntimeCore] onAddToolResult dispatch failed",n)}},onStatusesChange:t=>{this._store.setToolStatuses?.(Object.fromEntries(t))}})),this._toolInvocations.setState({messages:this._messages,isRunning:this._store.isRunning??!1,...this._store.isLoading!==void 0&&{isLoading:this._store.isLoading}})}_findMessageIdForToolCall(t){if(this._messagesForToolCallIndex!==this._messages){this._toolCallToMessageId.clear();const n=r=>{for(const s of r)if(Array.isArray(s.content))for(const i of s.content)!i||i.type!=="tool-call"||(this._toolCallToMessageId.set(i.toolCallId,s.id),i.messages&&n(i.messages))};n(this._messages),this._messagesForToolCallIndex=this._messages}return this._toolCallToMessageId.get(t)}switchToBranch(t){if(!this._store.setMessages)throw new Error("Runtime does not support switching branches.");this._store.isRunning||(this.repository.switchToBranch(t),this.updateMessages(this.repository.getMessages()))}async append(t){if((t.startRun??t.role==="user")&&await this._toolInvocations?.abort(),t.parentId!==(this.messages.at(-1)?.id??null)){if(!this._store.onEdit)throw new Error("Runtime does not support editing messages.");await this._store.onEdit(t)}else await this._store.onNew(t)}async startRun(t){if(!this._store.onReload)throw new Error("Runtime does not support reloading messages.");await this._toolInvocations?.abort(),await this._store.onReload(t.parentId,t)}async resumeRun(t){if(!this._store.onResume)throw new Error("Runtime does not support resuming runs.");await this._store.onResume(t)}exportExternalState(){if(!this._store.onExportExternalState)throw new Error("Runtime does not support exporting external states.");return this._store.onExportExternalState()}importExternalState(t){if(!this._store.onLoadExternalState)throw new Error("Runtime does not support importing external states.");this._toolInvocations&&(this._toolInvocations.reset(),this._store.setToolStatuses?.({})),this._store.onLoadExternalState(t)}cancelRun(){if(!this._store.onCancel)throw new Error("Runtime does not support cancelling runs.");this._toolInvocations?.abort(),this._store.onCancel();const t=this.repository.getMessages().at(-1);t&&t.metadata.isOptimistic&&t.content.length===0&&this.repository.deleteMessage(t.id);let n=this.repository.getMessages();const r=n[n.length-1];r?.role==="user"&&r.id===n.at(-1)?.id?(this.repository.deleteMessage(r.id),this.composer.text.trim()||this.composer.setText(Pa(r)),n=this.repository.getMessages()):this._notifySubscribers(),setTimeout(()=>{this.updateMessages(n)},0)}addToolResult(t){if(!this._store.onAddToolResult)throw new Error("Runtime does not support tool results.");this._store.onAddToolResult?.(t)}resumeToolCall(t){if(!(this._toolInvocations?.resume(t.toolCallId,t.payload)??!1)){if(this._store.onResumeToolCall){this._store.onResumeToolCall(t);return}throw new Error(`Tool call ${t.toolCallId} is not waiting for resume.`)}}respondToToolApproval(t){if(!this._store.onRespondToToolApproval)throw new Error("Runtime does not support tool approvals.");this._store.onRespondToToolApproval(t)}reset(t){const n=new jp;n.import(Qb.fromArray(t??[])),this.updateMessages(n.getMessages())}import(t){super.import(t),this._store.onImport&&this._store.onImport(this.repository.getMessages())}};const wy=e=>e.adapters?.threadList??{};var BP=class extends Yb{constructor(t){super();N(this,"threads");this.threads=new bP(wy(t),()=>new FP(this._contextProvider,t))}setAdapter(t){this.threads.__internal_setAdapter(wy(t)),this.threads.getMainThreadRuntimeCore().__internal_setAdapter(t)}};const Ya=e=>{const[t]=m.useState(()=>new BP(e));m.useEffect(()=>{t.setAdapter(e)});const{modelContext:n}=gP()??{};return m.useEffect(()=>{if(n)return t.registerModelContextProvider(n)},[n,t]),m.useMemo(()=>new Gb(t),[t])},Zb=(e,t)=>e.Message===t.Message&&e.EditComposer===t.EditComposer&&e.UserEditComposer===t.UserEditComposer&&e.AssistantEditComposer===t.AssistantEditComposer&&e.SystemEditComposer===t.SystemEditComposer&&e.UserMessage===t.UserMessage&&e.AssistantMessage===t.AssistantMessage&&e.SystemMessage===t.SystemMessage,$P=()=>null,UP=(e,t,n)=>{switch(t){case"user":return n?e.UserEditComposer??e.EditComposer??e.UserMessage??e.Message:e.UserMessage??e.Message;case"assistant":return n?e.AssistantEditComposer??e.EditComposer??e.AssistantMessage??e.Message:e.AssistantMessage??e.Message;case"system":return n?e.SystemEditComposer??e.EditComposer??e.SystemMessage??e.Message:e.SystemMessage??e.Message??$P;default:throw new Error(`Unknown message role: ${t}`)}},e0=({components:e})=>d.jsx(UP(e,Y(t=>t.message.role),Y(t=>t.message.composer.isEditing)),{}),t0=m.memo(({index:e,components:t})=>d.jsx(Fb,{index:e,children:d.jsx(e0,{components:t})}),(e,t)=>e.index===t.index&&Zb(e.components,t.components));t0.displayName="ThreadPrimitive.MessageByIndex";const _y=({children:e})=>{const t=Y(n=>n.thread.messages.length);return m.useMemo(()=>t===0?null:Array.from({length:t},(n,r)=>d.jsx(Fb,{index:r,children:d.jsx(go,{getItemState:s=>s.thread().message({index:r}).getState(),children:s=>e({get message(){return s()}})})},r)),[t,e])},n0=({components:e,children:t})=>e?d.jsx(_y,{children:()=>d.jsx(e0,{components:e})}):d.jsx(_y,{children:t});n0.displayName="ThreadPrimitive.Messages";const VP=m.memo(n0,(e,t)=>e.children||t.children?e.children===t.children:Zb(e.components,t.components)),r0=e=>{const t=e.message.metadata;if(!(!t||typeof t!="object"))return t.custom?.quote};var HP=class extends Error{constructor(t,n=`Component "${t}" is not in the generative-ui allowlist.`){super(n);N(this,"componentName");this.name="GenerativeUIRenderError",this.componentName=t}};const WP=e=>typeof e=="object"&&e!==null,s0=(e,t,n,r)=>{if(e==null)return null;if(typeof e=="string")return e;if(!WP(e)||!("component"in e))return null;const{component:s,props:i,children:o,key:a}=e,l=t[s];if(!l){if(n)return d.jsx(n,{component:s,props:i},a??r);throw new HP(s)}const u=o?.length?o.map((c,f)=>s0(c,t,n,`${r}/${f}`)):void 0;return m.createElement(l,{...i??{},key:a??r},...u??[])},qP=e=>{if(!e||e.root===void 0||e.root===null)return[];const t=e.root;return Array.isArray(t)?t:[t]},Ap=({spec:e,components:t,Fallback:n})=>d.jsx(d.Fragment,{children:m.useMemo(()=>qP(e),[e]).map((r,s)=>s0(r,t,n,`${s}`))});Ap.displayName="GenerativeUIRender";const i0=({components:e,spec:t,Fallback:n})=>{const r=Y(i=>{const o=i.part;return o?.type==="generative-ui"?o.spec:void 0}),s=t??r;return s?d.jsx(Ap,{spec:s,components:e,Fallback:n}):null};i0.displayName="MessagePrimitive.GenerativeUI";const KP="ui://",GP=e=>!!e?.startsWith(KP),by=e=>Symbol.iterator in e,Sy=e=>"entries"in e,ky=(e,t)=>{const n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(const[s,i]of n)if(!r.has(s)||!Object.is(i,r.get(s)))return!1;return!0},YP=(e,t)=>{const n=e[Symbol.iterator](),r=t[Symbol.iterator]();let s=n.next(),i=r.next();for(;!s.done&&!i.done;){if(!Object.is(s.value,i.value))return!1;s=n.next(),i=r.next()}return!!s.done&&!!i.done};function QP(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:by(e)&&by(t)?Sy(e)&&Sy(t)?ky(e,t):YP(e,t):ky({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function o0(e){const t=Jt.useRef(void 0);return n=>{const r=e(n);return QP(t.current,r)?t.current:t.current=r}}const pd=e=>{let t=-1;return{startGroup:n=>{t===-1&&(t=n)},endGroup:(n,r)=>{t!==-1&&(r.push({type:e,startIndex:t,endIndex:n}),t=-1)},finalize:(n,r)=>{t!==-1&&r.push({type:e,startIndex:t,endIndex:n})}}},XP=(e,t)=>{const n=[];if(t){const r=pd("chainOfThoughtGroup");for(let s=0;s<e.length;s++){const i=e[s];i==="tool-call"||i==="reasoning"?r.startGroup(s):(r.endGroup(s-1,n),n.push({type:"single",index:s}))}r.finalize(e.length-1,n)}else{const r=pd("toolGroup"),s=pd("reasoningGroup");for(let i=0;i<e.length;i++){const o=e[i];o==="tool-call"?(s.endGroup(i-1,n),r.startGroup(i)):o==="reasoning"?(r.endGroup(i-1,n),s.startGroup(i)):(r.endGroup(i-1,n),s.endGroup(i-1,n),n.push({type:"single",index:i}))}r.finalize(e.length-1,n),s.finalize(e.length-1,n)}return n},JP=e=>{const t=Y(o0(n=>n.message.parts.map(r=>r.type)));return m.useMemo(()=>t.length===0?[]:XP(t,e),[t,e])},ZP=({Fallback:e,...t})=>{const n=Y(r=>r.tools.toolUIs[t.toolName]?.[0]?.render??e);return n?d.jsx(n,{...t}):null},Np=(e,t,n)=>{const r=e.renderers[t]?.[0];return r||(e.fallbacks[0]??n)},ej=({Fallback:e,...t})=>{const n=Y(r=>Np(r.dataRenderers,t.name,e));return n?d.jsx(n,{...t}):null},Pt={Text:()=>null,Reasoning:()=>null,Source:()=>null,Image:()=>null,File:()=>null,Unstable_Audio:()=>null,ToolGroup:({children:e})=>e,ReasoningGroup:({children:e})=>e},tj=({components:{Text:e=Pt.Text,Reasoning:t=Pt.Reasoning,Image:n=Pt.Image,Source:r=Pt.Source,File:s=Pt.File,Unstable_Audio:i=Pt.Unstable_Audio,tools:o={},data:a,generativeUI:l}={}})=>{const u=he(),c=Y(h=>h.part),f=c.type;if(f==="tool-call"){const h=u.part().addToolResult,p=u.part().resumeToolCall,g=u.part().respondToToolApproval;if("Override"in o)return d.jsx(o.Override,{...c,addResult:h,resume:p,respondToApproval:g});const y=o.by_name?.[c.toolName]??o.Fallback;return d.jsx(ZP,{...c,Fallback:y,addResult:h,resume:p,respondToApproval:g})}if(c.status?.type==="requires-action")throw new Error("Encountered unexpected requires-action status");switch(f){case"text":return d.jsx(e,{...c});case"reasoning":return d.jsx(t,{...c});case"source":return d.jsx(r,{...c});case"image":return d.jsx(n,{...c});case"file":return d.jsx(s,{...c});case"audio":return d.jsx(i,{...c});case"data":{const h=a?.by_name?.[c.name]??a?.Fallback;return d.jsx(ej,{...c,Fallback:h})}case"generative-ui":return l?.components?d.jsx(Ap,{spec:c.spec,components:l.components,Fallback:l.Fallback}):null;default:return console.warn(`Unknown message part type: ${f}`),null}},ra=m.memo(({index:e,components:t})=>d.jsx(Ip,{index:e,children:d.jsx(tj,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.generativeUI===t.components?.generativeUI&&e.components?.ToolGroup===t.components?.ToolGroup&&e.components?.ReasoningGroup===t.components?.ReasoningGroup);ra.displayName="MessagePrimitive.PartByIndex";const nj=({status:e,component:t})=>d.jsx(Rp,{text:"",isRunning:e.type==="running",children:d.jsx(t,{type:"text",text:"",status:e})}),rj=Object.freeze({type:"complete"}),sj=Object.freeze({type:"running"}),ij=({components:e})=>{const t=Y(n=>n.message.status??rj);return e?.Empty?d.jsx(e.Empty,{status:t}):t.type!=="running"?null:d.jsx(nj,{status:t,component:e?.Text??Pt.Text})},a0=m.memo(ij,(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),oj=({components:e,enabled:t})=>Y(n=>{if(!t||n.message.parts.length===0)return!1;const r=n.message.parts[n.message.parts.length-1];return r?.type!=="text"&&r?.type!=="reasoning"})?d.jsx(a0,{components:e}):null,aj=m.memo(oj,(e,t)=>e.enabled===t.enabled&&e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),lj=({Quote:e})=>{const t=Y(r0);return t?d.jsx(e,{text:t.text,messageId:t.messageId}):null},uj=m.memo(lj);function l0(e,t){const n=e.toolUIs[t.toolName]?.[0]?.render??null;return n||(GP(t.mcp?.app?.resourceUri)&&e.mcpApp?e.mcpApp.render:null)}const u0=()=>{const e=he(),t=Y(r=>r.part),n=Y(r=>r.part.type==="tool-call"?l0(r.tools,r.part):null);return!n||t.type!=="tool-call"?null:d.jsx(n,{...t,addResult:e.part().addToolResult,resume:e.part().resumeToolCall,respondToApproval:e.part().respondToToolApproval})},c0=()=>{const e=Y(n=>n.part),t=Y(n=>n.part.type==="data"?Np(n.dataRenderers,n.part.name,void 0)??null:null);return!t||e.type!=="data"?null:d.jsx(t,{...e})},cj=()=>{const e=Y(t=>t.part.type);return e==="tool-call"?d.jsx(u0,{}):e==="data"?d.jsx(c0,{}):null},dj=Object.freeze({type:"text",text:"",status:sj}),d0=({index:e,children:t})=>{const n=he(),r=Y(s=>s.dataRenderers);return d.jsx(Ip,{index:e,children:d.jsx(go,{getItemState:s=>s.message().part({index:e}).getState(),children:s=>t({get part(){const i=s();if(i.type==="tool-call"){const o=l0(n.tools().getState(),i)!==null,a=n.message().part({index:e});return{...i,toolUI:o?d.jsx(u0,{}):null,addResult:a.addToolResult,resume:a.resumeToolCall,respondToApproval:a.respondToToolApproval}}if(i.type==="data"){const o=Np(r,i.name,void 0)!==void 0;return{...i,dataRendererUI:o?d.jsx(c0,{}):null}}return i}})})})},fj=({children:e})=>{const t=Y(s=>s.message.parts.length),n=Y(s=>(s.message.status?.type??"complete")==="running"),r=t===0&&n;return t===0?r?d.jsx(Rp,{text:"",isRunning:!0,children:e({part:dj})}):null:d.jsx(d.Fragment,{children:Array.from({length:t},(s,i)=>d.jsx(d0,{index:i,children:o=>e(o)??d.jsx(cj,{})},i))})},Wf=({components:e,unstable_showEmptyOnNonTextEnd:t=!0,children:n})=>n?d.jsx(fj,{children:n}):d.jsx(hj,{components:e,unstable_showEmptyOnNonTextEnd:t});Wf.displayName="MessagePrimitive.Parts";const hj=({components:e,unstable_showEmptyOnNonTextEnd:t})=>{const n=Y(i=>i.message.parts.length),r=JP(!!e?.ChainOfThought),s=m.useMemo(()=>n===0?d.jsx(a0,{components:e}):r.map(i=>{if(i.type==="single")return d.jsx(ra,{index:i.index,components:e},i.index);if(i.type==="chainOfThoughtGroup"){const o=e?.ChainOfThought;return o?d.jsx(YR,{startIndex:i.startIndex,endIndex:i.endIndex,children:d.jsx(o,{})},`chainOfThought-${i.startIndex}`):null}else return i.type==="toolGroup"?d.jsx(e?.ToolGroup??Pt.ToolGroup,{startIndex:i.startIndex,endIndex:i.endIndex,children:Array.from({length:i.endIndex-i.startIndex+1},(o,a)=>{const l=i.startIndex+a;return d.jsx(ra,{index:l,components:e},`part-${l}`)})},`tool-${i.startIndex}`):d.jsx(e?.ReasoningGroup??Pt.ReasoningGroup,{startIndex:i.startIndex,endIndex:i.endIndex,children:Array.from({length:i.endIndex-i.startIndex+1},(o,a)=>{const l=i.startIndex+a;return d.jsx(ra,{index:l,components:e},`part-${l}`)})},`reasoning-${i.startIndex}`)}),[r,e,n]);return d.jsxs(d.Fragment,{children:[e?.Quote&&d.jsx(uj,{Quote:e.Quote}),s,d.jsx(aj,{components:e,enabled:t})]})},pj=Symbol.for("@assistant-ui/groupBy.memoKey"),Cy=e=>{const t=e.nextChildIdx++;return e.nodeKey===""?String(t):`${e.nodeKey}.${t}`},mj=e=>{const t={key:"",nodeKey:"",indices:[],children:[],nextChildIdx:0},n=[t],r=()=>{const s=n.pop();n[n.length-1].children.push({type:"group",key:s.key,nodeKey:s.nodeKey,indices:s.indices,children:s.children})};for(let s=0;s<e.length;s++){const i=e[s];let o=0;for(;o<n.length-1&&o<i.length&&n[o+1].key===i[o];)o++;for(;n.length-1>o;)r();for(;n.length-1<i.length;){const l=n[n.length-1];n.push({key:i[n.length-1],nodeKey:Cy(l),indices:[],children:[],nextChildIdx:0})}const a=n[n.length-1];a.children.push({type:"part",index:s,nodeKey:Cy(a)});for(let l=1;l<n.length;l++)n[l].indices.push(s)}for(;n.length>1;)r();return t.children},gj=Object.freeze({type:"complete"}),yj=(e,t,n)=>{if(!n)return!1;switch(e){case"never":return!1;case"always":return!0;case"empty":return t.length===0;case"no-text":{const r=t[t.length-1];return r!==void 0&&r.type!=="text"&&r.type!=="reasoning"}}},f0=()=>{throw new Error("MessagePrimitive.GroupedParts: rendered `children` under a leaf part. `children` is only meaningful for `group-…` cases — add a matching case for the part type or return `null` to skip it.")},h0=(e,t,n)=>{if(e.type==="part")return d.jsx(d0,{index:e.index,children:({part:s})=>n({part:s,children:d.jsx(f0,{})})},`part-${e.index}`);const r=t[e.indices.at(-1)]?.status??gj;return d.jsx(m.Fragment,{children:n({part:{type:e.key,status:r,indices:e.indices},children:d.jsx(d.Fragment,{children:e.children.map(s=>h0(s,t,n))})})},e.nodeKey)},p0=({groupBy:e,indicator:t="no-text",children:n})=>{const r=Y(o0(o=>o.message.parts)),s=Y(o=>o.tools.toolUIs),i=Y(o=>t==="never"?!1:o.message.status?.type==="running");return d.jsxs(d.Fragment,{children:[m.useMemo(()=>{const o={toolUIs:s};return mj(r.map(a=>e(a,o)??[]))},[r,e[pj]??e,s]).map(o=>h0(o,r,n)),yj(t,r,i)&&n({part:{type:"indicator"},children:d.jsx(f0,{})})]})};p0.displayName="MessagePrimitive.GroupedParts";const vj=({children:e})=>{const t=Y(r0);return t?d.jsx(d.Fragment,{children:e(t)}):null},m0=m.memo(vj);m0.displayName="MessagePrimitive.Quote";const g0=(e,t)=>{switch(t.type){case"image":return e?.Image??e?.Attachment;case"document":return e?.Document??e?.Attachment;case"file":return e?.File??e?.Attachment;default:return e?.Attachment}},xj=({components:e})=>{const t=Y(r=>r.attachment);if(!t)return null;const n=g0(e,t);return n?d.jsx(n,{}):null},y0=m.memo(({index:e,components:t})=>d.jsx(Ob,{index:e,children:d.jsx(xj,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);y0.displayName="MessagePrimitive.AttachmentByIndex";const Ey=({children:e})=>{const t=Y(n=>n.message.role!=="user"?0:(n.message.attachments??[]).length);return m.useMemo(()=>Array.from({length:t},(n,r)=>d.jsx(Ob,{index:r,children:d.jsx(go,{getItemState:s=>s.message().attachment({index:r}).getState(),children:s=>e({get attachment(){return s()}})})},r)),[t,e])},v0=({components:e,children:t})=>e?d.jsx(Ey,{children:({attachment:n})=>{const r=g0(e,n);return r?d.jsx(r,{}):null}}):d.jsx(Ey,{children:t});v0.displayName="MessagePrimitive.Attachments";const x0=(e,t)=>{switch(t.type){case"image":return e?.Image??e?.Attachment;case"document":return e?.Document??e?.Attachment;case"file":return e?.File??e?.Attachment;default:return e?.Attachment}},wj=({components:e})=>{const t=Y(r=>r.attachment);if(!t)return null;const n=x0(e,t);return n?d.jsx(n,{}):null},w0=m.memo(({index:e,components:t})=>d.jsx(zb,{index:e,children:d.jsx(wj,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);w0.displayName="ComposerPrimitive.AttachmentByIndex";const Ty=({children:e})=>{const t=Y(n=>n.composer.attachments.length);return m.useMemo(()=>Array.from({length:t},(n,r)=>d.jsx(zb,{index:r,children:d.jsx(go,{getItemState:s=>s.composer().attachment({index:r}).getState(),children:s=>e({get attachment(){return s()}})})},r)),[t,e])},_0=({components:e,children:t})=>e?d.jsx(Ty,{children:({attachment:n})=>{const r=x0(e,n);return r?d.jsx(r,{}):null}}):d.jsx(Ty,{children:t});_0.displayName="ComposerPrimitive.Attachments";const _j=({children:e})=>{const t=Y(n=>n.composer.queue.length);return m.useMemo(()=>Array.from({length:t},(n,r)=>d.jsx(QR,{index:r,children:d.jsx(go,{getItemState:s=>s.composer().queueItem({index:r}).getState(),children:s=>e({get queueItem(){return s()}})})},r)),[t,e])},b0=m.memo(_j);b0.displayName="ComposerPrimitive.Queue";const Mp=({children:e})=>Y(t=>t.part.status.type==="running")?e:null;Mp.displayName="MessagePartPrimitive.InProgress";const S0=({components:e})=>{const t=e.Suggestion;return d.jsx(t,{})},k0=m.memo(({index:e,components:t})=>d.jsx(Bb,{index:e,children:d.jsx(S0,{components:t})}),(e,t)=>e.index===t.index&&e.components.Suggestion===t.components.Suggestion);k0.displayName="ThreadPrimitive.SuggestionByIndex";const Iy=({children:e})=>{const t=Y(n=>n.suggestions.suggestions.length);return m.useMemo(()=>t===0?null:Array.from({length:t},(n,r)=>d.jsx(Bb,{index:r,children:d.jsx(go,{getItemState:s=>s.suggestions().suggestion({index:r}).getState(),children:s=>e({get suggestion(){return s()}})})},r)),[t,e])},C0=({components:e,children:t})=>e?d.jsx(Iy,{children:()=>d.jsx(S0,{components:e})}):d.jsx(Iy,{children:t});C0.displayName="ThreadPrimitive.Suggestions";const bj=m.memo(C0,(e,t)=>e.children||t.children?e.children===t.children:e.components.Suggestion===t.components.Suggestion),Sj=e=>Y(t=>{if(e.editing===!0&&!t.composer.isEditing||e.editing===!1&&t.composer.isEditing)return!1;const n=t.composer.dictation!=null;return!(e.dictation===!0&&!n||e.dictation===!1&&n)}),E0=({children:e,...t})=>Sj(t)?e:null;E0.displayName="ComposerPrimitive.If";const kj=()=>{const e=he(),t=Y(n=>!n.composer.canSend||n.thread.isRunning&&!n.thread.capabilities.queue);return{send:m.useCallback(n=>{e.composer().send(n)},[e]),disabled:t}},Cj=()=>{const e=he(),t=Y(n=>!n.composer.canCancel);return{cancel:m.useCallback(()=>{e.composer().cancel()},[e]),disabled:t}},Ej=()=>{const e=he(),t=Y(n=>n.composer.dictation!=null||!n.thread.capabilities.dictation||!n.composer.isEditing);return{startDictation:m.useCallback(()=>{e.composer().startDictation()},[e]),disabled:t}},Tj=()=>{const e=he(),t=Y(n=>!n.composer.isEditing);return{addAttachment:m.useCallback(n=>e.composer().addAttachment(n),[e]),disabled:t}},Ij=({copiedDuration:e=3e3,copyToClipboard:t}={})=>{const n=he(),r=Y(a=>!((a.message.role!=="assistant"||a.message.status?.type!=="running")&&a.message.parts.some(l=>l.type==="text"&&l.text.length>0))),s=Y(a=>a.message.isCopied),i=Y(a=>a.composer.isEditing),o=Y(a=>a.composer.text);return{copy:m.useCallback(()=>{const a=i?o:n.message().getCopyText();if(!a)return;const l=t??(()=>{});Promise.resolve(l(a)).then(()=>{n.message().setIsCopied(!0),setTimeout(()=>n.message().setIsCopied(!1),e)},()=>{})},[n,i,o,e,t]),disabled:r,isCopied:s}},Rj=()=>{const e=he(),t=Y(n=>n.composer.isEditing);return{edit:m.useCallback(()=>{e.composer().beginEdit()},[e]),disabled:t}},Pj=()=>{const e=he(),t=Y(n=>n.thread.isRunning||n.thread.isDisabled||n.message.role!=="assistant");return{reload:m.useCallback(()=>{e.message().reload()},[e]),disabled:t}},jj=()=>{const e=he(),t=Y(n=>n.message.metadata.submittedFeedback?.type==="positive");return{submit:m.useCallback(()=>{e.message().submitFeedback({type:"positive"})},[e]),isSubmitted:t}},Aj=()=>{const e=he(),t=Y(n=>n.message.metadata.submittedFeedback?.type==="negative");return{submit:m.useCallback(()=>{e.message().submitFeedback({type:"negative"})},[e]),isSubmitted:t}},Nj=()=>{const e=he(),t=Y(n=>!((n.message.role!=="assistant"||n.message.status?.type!=="running")&&n.message.parts.some(r=>r.type==="text"&&r.text.length>0)));return{speak:m.useCallback(async()=>{e.message().speak()},[e]),disabled:t}},Mj=()=>{const e=he(),t=Y(n=>n.message.speech==null);return{stopSpeaking:m.useCallback(()=>{e.message().stopSpeaking()},[e]),disabled:t}},Dj=({prompt:e,send:t,clearComposer:n=!0})=>{const r=he(),s=Y(o=>o.thread.isDisabled),i=t??!1;return{trigger:m.useCallback(()=>{const o=r.thread().getState().isRunning;if(i&&!o)r.thread().append({content:[{type:"text",text:e}],runConfig:r.composer().getState().runConfig}),n&&r.composer().setText("");else if(n)r.composer().setText(e);else{const a=r.composer().getState().text;r.composer().setText(a.trim()?`${a} ${e}`:e)}},[r,i,n,e]),disabled:s}},Lj=()=>Y(e=>e.message.status?.type==="incomplete"&&e.message.status.reason==="error"?e.message.status.error??"An error occurred":void 0),Oj=e=>{const{cloud:t,initialMessages:n,maxSteps:r,adapters:s,unstable_humanToolNames:i,...o}=e;return{localRuntimeOptions:{cloud:t,initialMessages:n,maxSteps:r,adapters:s,unstable_humanToolNames:i},otherOptions:o}},zj=/:([\w-]{1,64})\[([^\]\n]{1,1024})\](?:\{name=([^}\n]{1,1024})\})?/gu,T0={serialize(e){const t=e.id!==e.label?`{name=${e.id}}`:"";return`:${e.type}[${e.label}]${t}`},parse(e){const t=[];let n=0;for(const r of e.matchAll(zj)){r.index>n&&t.push({kind:"text",text:e.slice(n,r.index)});const s=r[2];t.push({kind:"mention",type:r[1],label:s,id:r[3]??s}),n=r.index+r[0].length}return n<e.length&&t.push({kind:"text",text:e.slice(n)}),t}};function Fj(e,t){function n(r){const s=m.useContext(e);if(!r?.optional&&!s)throw new Error(`This component must be used within ${t}.`);return s}return n}function I0(e,t){function n(s){const i=e(s);return i?i[t]:null}function r(s){let i=!1,o;typeof s=="function"?o=s:s&&typeof s=="object"&&(i=!!s.optional,o=s.selector);const a=n({optional:i});return a?o?a(o):a():null}return{[t]:r,[`${t}Store`]:n}}const R0=m.createContext(null),{useThreadViewport:ci,useThreadViewportStore:di}=I0(Fj(R0,"ThreadPrimitive.Viewport"),"useThreadViewport"),Ry=e=>{const t=new Map,n=()=>{let r=0;for(const s of t.values())r+=s;e(r)};return{register:()=>{const r=Symbol();return t.set(r,0),{setHeight:s=>{t.get(r)!==s&&(t.set(r,s),n())},unregister:()=>{t.delete(r),n()}}}}},Bj=(e={})=>{const t=new Set,n=Ry(o=>{i.setState({height:{...i.getState().height,viewport:o}})}),r=Ry(o=>{i.setState({height:{...i.getState().height,inset:o}})}),s=(o,a)=>(i.setState({element:{...i.getState().element,[o]:a}}),()=>{i.getState().element[o]===a&&i.setState({element:{...i.getState().element,[o]:null}})}),i=Ib(()=>({isAtBottom:!0,scrollToBottom:({behavior:o="auto"}={})=>{for(const a of t)a({behavior:o})},onScrollToBottom:o=>(t.add(o),()=>{t.delete(o)}),turnAnchor:e.turnAnchor??"bottom",topAnchorMessageClamp:{tallerThan:e.topAnchorMessageClamp?.tallerThan??"10em",visibleHeight:e.topAnchorMessageClamp?.visibleHeight??"6em"},height:{viewport:0,inset:0},element:{viewport:null,anchor:null,target:null},targetConfig:null,topAnchorTurn:null,registerViewport:n.register,registerContentInset:r.register,registerViewportElement:o=>s("viewport",o),registerAnchorElement:o=>s("anchor",o),registerAnchorTargetElement:(o,a)=>(i.setState({element:{...i.getState().element,target:o},targetConfig:o&&a?a:null}),()=>{i.getState().element.target===o&&i.setState({element:{...i.getState().element,target:null},targetConfig:null})}),setTopAnchorTurn:o=>{i.setState({topAnchorTurn:o})}}));return i},Au=e=>e,$j=e=>{const t=di({optional:!0}),[n]=m.useState(()=>Bj(e));return m.useEffect(()=>t?.getState().onScrollToBottom(()=>{n.getState().scrollToBottom()}),[t,n]),m.useEffect(()=>{if(t)return n.subscribe(r=>{t.getState().isAtBottom!==r.isAtBottom&&Au(t).setState({isAtBottom:r.isAtBottom})})},[n,t]),n},Dp=({children:e,options:t={}})=>{const n=$j(t),[r]=m.useState(()=>({useThreadViewport:n}));return d.jsx(R0.Provider,{value:r,children:e})},Uj=()=>{const e=he();return m.useEffect(()=>{},[e]),null},Vj=({children:e,aui:t,runtime:n})=>d.jsxs(hR,{runtime:n,aui:t??null,children:[d.jsx(Uj,{}),d.jsx(Dp,{children:e})]}),Qa=m.memo(Vj),Hj=e=>{const t=e;t.__isBound||(t.__internal_bindMethods?.(),t.__isBound=!0)};function Wj(e,t=qj){Hj(e);const n=m.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getState()));return m.useDebugValue(n),n}const qj=e=>e;function Kj(e){function t(n){let r=!1,s;typeof n=="function"?s=n:n&&(r=!!n.optional,s=n.selector);const i=e({optional:r});return i?Wj(i,s):null}return t}function P0(e){const t=he(),n=Y(()=>t.composer.source?t.composer().__internal_getRuntime?.()??null:null);if(!n&&!e?.optional)throw new Error("ComposerRuntime is not available");return n}function Gj(e){const t=he(),n=Y(()=>t.message.source?t.message().__internal_getRuntime?.()??null:null);if(!n&&!e?.optional)throw new Error("MessageRuntime is not available");return n}const Nu=Kj(Gj);function Py(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Yj(...e){return t=>{let n=!1;const r=e.map(s=>{const i=Py(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():Py(e[s],null)}}}}function fi(...e){return m.useCallback(Yj(...e),e)}var jy=Object.defineProperty,xo=(e,t)=>{let n={};for(var r in e)jy(n,r,{get:e[r],enumerable:!0});return jy(n,Symbol.toStringTag,{value:"Module"}),n};function j0(e){const t=m.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,a=!1;const l=[];Ay(s)&&typeof Cl=="function"&&(s=Cl(s._payload)),m.Children.forEach(s,h=>{if(eA(h)){a=!0;const p=h;let g="child"in p.props?p.props.child:p.props.children;Ay(g)&&typeof Cl=="function"&&(g=Cl(g._payload)),o=Xj(p,g),l.push(o?.props?.children)}else l.push(h)}),o?o=m.cloneElement(o,void 0,l):!a&&m.Children.count(s)===1&&m.isValidElement(s)&&(o=s);const u=o?Zj(o):void 0,c=fi(r,u);if(!o){if(s||s===0)throw new Error(a?sA(e):rA(e));return s}const f=Jj(i,o.props??{});return o.type!==m.Fragment&&(f.ref=r?c:u),m.cloneElement(o,f)});return t.displayName=`${e}.Slot`,t}var Mu=j0("Slot"),Qj=Symbol.for("radix.slottable"),Xj=(e,t)=>{if("child"in e.props){const n=e.props.child;return m.isValidElement(n)?m.cloneElement(n,void 0,e.props.children(n.props.children)):null}return m.isValidElement(t)?t:null};function Jj(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{const l=i(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function Zj(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function eA(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Qj}var tA=Symbol.for("react.lazy");function Ay(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===tA&&"_payload"in e&&nA(e._payload)}function nA(e){return typeof e=="object"&&e!==null&&"then"in e}var rA=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,sA=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Cl=zC[" use ".trim().toString()],iA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],oA=iA.reduce((e,t)=>{const n=j0(`Primitive.${t}`),r=m.forwardRef((s,i)=>{const{asChild:o,...a}=s,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});const aA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"];function lA(e){const t=m.forwardRef(({render:n,asChild:r,children:s,...i},o)=>{const a=e;if(n&&m.isValidElement(n)){const l=s!==void 0?s:n.props.children;return d.jsx(a,{...i,asChild:!0,ref:o,children:m.cloneElement(n,void 0,l)})}return d.jsx(a,{...i,asChild:r,ref:o,children:s})});return t.displayName=typeof e=="string"?e:e.displayName??e.name??"Component",t}function uA(e){const t=oA[e],n=lA(t);return n.displayName=`Primitive.${e}`,n}const ze=aA.reduce((e,t)=>(e[t]=uA(t),e),{}),cA=({hideWhenRunning:e,autohide:t,autohideFloat:n,forceVisible:r})=>Y(s=>{if(e&&s.thread.isRunning)return"hidden";const i=t==="always"||t==="not-last"&&!s.message.isLast,o=r||s.message.isHovering;return i?o?n==="always"||n==="single-branch"&&s.message.branchCount<=1?"floating":"normal":"hidden":"normal"}),dA=m.createContext(null),A0=m.forwardRef(({hideWhenRunning:e,autohide:t,autohideFloat:n,...r},s)=>{const[i,o]=m.useState(0),a=m.useCallback(()=>{let c=!1;return o(f=>f+1),()=>{c||(c=!0,o(f=>Math.max(0,f-1)))}},[]),l=m.useMemo(()=>({acquireInteractionLock:a}),[a]),u=cA({hideWhenRunning:e,autohide:t,autohideFloat:n,forceVisible:i>0});return u==="hidden"?null:d.jsx(dA.Provider,{value:l,children:d.jsx(ze.div,{...u==="floating"?{"data-floating":"true"}:null,...r,ref:s})})});A0.displayName="ActionBarPrimitive.Root";function Ye(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s.defaultPrevented)return t?.(s)}}const fA=({copiedDuration:e=3e3}={})=>{const{copy:t,disabled:n}=Ij({copiedDuration:e,copyToClipboard:r=>typeof navigator>"u"||!navigator.clipboard?Promise.reject(new Error("Clipboard API is unavailable")):navigator.clipboard.writeText(r)});return n?null:t},N0=m.forwardRef(({copiedDuration:e,onClick:t,disabled:n,...r},s)=>{const i=Y(a=>a.message.isCopied),o=fA({copiedDuration:e});return d.jsx(ze.button,{type:"button",...i?{"data-copied":"true"}:{},...r,ref:s,disabled:n||!o,onClick:Ye(t,()=>{o?.()})})});N0.displayName="ActionBarPrimitive.Copy";const or=(e,t,n=[])=>{const r=m.forwardRef((s,i)=>{const o={},a={};Object.keys(s).forEach(u=>{n.includes(u)?o[u]=s[u]:a[u]=s[u]});const l=t(o)??void 0;return d.jsx(ze.button,{...a,type:"button",ref:i,disabled:a.disabled||!l,onClick:Ye(a.onClick,l)})});return r.displayName=e,r},hA=()=>{const{disabled:e,reload:t}=Pj();return e?null:t},pA=or("ActionBarPrimitive.Reload",hA),mA=()=>{const{disabled:e,edit:t}=Rj();return e?null:t},gA=or("ActionBarPrimitive.Edit",mA),yA=()=>{const{disabled:e,speak:t}=Nj();return e?null:t},vA=or("ActionBarPrimitive.Speak",yA);function ii(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>t.current?.(...n),[])}function M0(e,t=globalThis?.document){const n=ii(e);m.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}const xA=()=>{const{disabled:e,stopSpeaking:t}=Mj();return e?null:t},D0=m.forwardRef((e,t)=>{const n=xA();return M0(r=>{n&&(r.preventDefault(),n())}),d.jsx(ze.button,{type:"button",disabled:!n,...e,ref:t,onClick:Ye(e.onClick,()=>{n?.()})})});D0.displayName="ActionBarPrimitive.StopSpeaking";const wA=()=>{const{submit:e}=jj();return e},L0=m.forwardRef(({onClick:e,disabled:t,...n},r)=>{const s=Y(o=>o.message.metadata.submittedFeedback?.type==="positive"),i=wA();return d.jsx(ze.button,{type:"button",...s?{"data-submitted":"true"}:{},...n,ref:r,disabled:t||!i,onClick:Ye(e,()=>{i?.()})})});L0.displayName="ActionBarPrimitive.FeedbackPositive";const _A=()=>{const{submit:e}=Aj();return e},O0=m.forwardRef(({onClick:e,disabled:t,...n},r)=>{const s=Y(o=>o.message.metadata.submittedFeedback?.type==="negative"),i=_A();return d.jsx(ze.button,{type:"button",...s?{"data-submitted":"true"}:{},...n,ref:r,disabled:t||!i,onClick:Ye(e,()=>{i?.()})})});O0.displayName="ActionBarPrimitive.FeedbackNegative";const bA=({filename:e,onExport:t}={})=>{const n=he(),r=Y(i=>(i.message.role!=="assistant"||i.message.status?.type!=="running")&&i.message.parts.some(o=>o.type==="text"&&o.text.length>0)),s=m.useCallback(async()=>{const i=n.message().getCopyText();if(!i)return;if(t){await t(i);return}const o=new Blob([i],{type:"text/markdown"}),a=URL.createObjectURL(o),l=document.createElement("a");l.href=a,l.download=e??`message-${Date.now()}.md`,l.click(),URL.revokeObjectURL(a)},[n,e,t]);return r?s:null},z0=m.forwardRef(({filename:e,onExport:t,onClick:n,disabled:r,...s},i)=>{const o=bA({filename:e,onExport:t});return d.jsx(ze.button,{type:"button",...s,ref:i,disabled:r||!o,onClick:Ye(n,()=>{o?.()})})});z0.displayName="ActionBarPrimitive.ExportMarkdown";var Ny=xo({Copy:()=>N0,Edit:()=>gA,ExportMarkdown:()=>z0,FeedbackNegative:()=>O0,FeedbackPositive:()=>L0,Reload:()=>pA,Root:()=>A0,Speak:()=>vA,StopSpeaking:()=>D0});const F0=m.forwardRef((e,t)=>d.jsx(ze.div,{...e,ref:t}));F0.displayName="AttachmentPrimitive.Root";const B0=m.forwardRef((e,t)=>{const n=Y(r=>{const s=r.attachment.name.split(".");return s.length>1?s.pop():""});return d.jsxs(ze.div,{...e,ref:t,children:[".",n]})});B0.displayName="AttachmentPrimitive.unstable_Thumb";const $0=()=>d.jsx(d.Fragment,{children:Y(e=>e.attachment.name)});$0.displayName="AttachmentPrimitive.Name";const SA=()=>{const e=he();return m.useCallback(()=>{e.attachment().remove()},[e])},kA=or("AttachmentPrimitive.Remove",SA);var My=xo({Name:()=>$0,Remove:()=>kA,Root:()=>F0,unstable_Thumb:()=>B0});const CA=e=>Y(t=>{const{role:n,attachments:r,parts:s,branchCount:i,isLast:o,speech:a,isCopied:l,isHovering:u}=t.message;return!(e.hasBranches===!0&&i<2||e.user&&n!=="user"||e.assistant&&n!=="assistant"||e.system&&n!=="system"||e.lastOrHover===!0&&!u&&!o||e.last!==void 0&&e.last!==o||e.copied===!0&&!l||e.copied===!1&&l||e.speaking===!0&&a==null||e.speaking===!1&&a!=null||e.hasAttachments===!0&&(n!=="user"||!r?.length)||e.hasAttachments===!1&&n==="user"&&r?.length||e.hasContent===!0&&s.length===0||e.hasContent===!1&&s.length>0||e.submittedFeedback!==void 0&&(t.message.metadata.submittedFeedback?.type??null)!==e.submittedFeedback)}),U0=({children:e,...t})=>CA(t)?e:null;U0.displayName="MessagePrimitive.If";const V0=m.createContext(null),_c=()=>m.useContext(V0),EA=({children:e})=>{const t=m.useRef(new Map),n=m.useRef([]),r=m.useCallback(()=>{const a=Array.from(t.current.entries());a.sort((l,u)=>u[1]-l[1]),n.current=a.map(([l])=>l)},[]),s=m.useCallback((a,l)=>{const u=l?.priority??0;return t.current.set(a,u),r(),()=>{t.current.delete(a),r()}},[r]),i=m.useCallback(()=>n.current,[]),o=m.useMemo(()=>({register:s,getPlugins:i}),[s,i]);return d.jsx(V0.Provider,{value:o,children:e})},Lp=m.createContext(null),H0=m.createContext(null),Op=()=>{const e=m.useContext(Lp);if(!e)throw new Error("useTriggerPopoverRootContext must be used within ComposerPrimitive.TriggerPopoverRoot");return e},zp=()=>m.useContext(Lp),TA=()=>{const e=m.useContext(H0);if(!e)throw new Error("useTriggerPopoverAriaPublish must be used within ComposerPrimitive.TriggerPopoverRoot");return e},IA=()=>{const e=Op();return m.useSyncExternalStore(e.subscribe,e.getTriggers,e.getTriggers)},RA=new Map,W0=()=>()=>{},Dy=()=>RA,PA=()=>{const e=zp();return m.useSyncExternalStore(e?e.subscribe:W0,e?e.getTriggers:Dy,e?e.getTriggers:Dy)},Ly=()=>null,jA=()=>{const e=zp();return m.useSyncExternalStore(e?e.subscribeAria:W0,e?e.getActiveAria:Ly,e?e.getActiveAria:Ly)};function Oy(){const e=m.useRef(new Set);return{notify:m.useCallback(()=>{for(const t of e.current)t()},[]),subscribe:m.useCallback(t=>(e.current.add(t),()=>{e.current.delete(t)}),[])}}const zy=({children:e})=>{const t=m.useRef(new Map),n=m.useRef(new Set),{notify:r,subscribe:s}=Oy(),i=m.useCallback(_=>{const{char:x}=_;if(t.current.has(x))return()=>{};const v=new Map(t.current);v.set(x,_),t.current=v,r();for(const w of n.current)w.added(_);return()=>{const w=new Map(t.current);w.delete(x),t.current=w,r();for(const C of n.current)C.removed(x)}},[r]),o=m.useCallback(()=>t.current,[]),a=m.useCallback(_=>(n.current.add(_),()=>{n.current.delete(_)}),[]),l=m.useRef(null),u=m.useRef(null),{notify:c,subscribe:f}=Oy(),h=m.useCallback((_,x)=>{if(x===null){if(u.current!==_)return;l.current=null,u.current=null,c();return}const v=l.current;u.current===_&&v!==null&&v.popoverId===x.popoverId&&v.highlightedItemId===x.highlightedItemId||(l.current=x,u.current=_,c())},[c]),p=m.useCallback(()=>l.current,[]),g=m.useMemo(()=>({register:i,getTriggers:o,subscribe:s,subscribeLifecycle:a,getActiveAria:p,subscribeAria:f}),[i,o,s,a,p,f]),y=m.useMemo(()=>({setActiveAria:h}),[h]);return d.jsx(Lp.Provider,{value:g,children:d.jsx(H0.Provider,{value:y,children:e})})},q0=({children:e})=>_c()?d.jsx(zy,{children:e}):d.jsx(EA,{children:d.jsx(zy,{children:e})});q0.displayName="ComposerPrimitive.TriggerPopoverRoot";const Fy=/\s/u;function AA(e,t,n){const r=e.slice(0,n);for(let s=r.length-1;s>=0;s--){const i=r[s];if(Fy.test(i))return null;if(r.startsWith(t,s)){if(s>0&&!Fy.test(r[s-1]))continue;return{query:r.slice(s+t.length),offset:s}}}return null}const NA=_e(({text:e,triggerChar:t})=>{const[n,r]=Cn(e.length),s=pe(()=>AA(e,t,Math.min(n,e.length)),[n,e,t]);return{trigger:s,query:s?.query??"",setCursorPosition:r}});function MA(e){return"type"in e}const DA=_e(({navigableList:e,isSearchMode:t,activeCategoryId:n,query:r,popoverId:s,open:i,selectItem:o,selectCategory:a,goBack:l,close:u})=>{const[c,f]=Cn(0);lt(()=>{f(0)},[e]),lt(()=>{f(0)},[t,n]);const h=_r(y=>{y<0||y>=e.length||y!==c&&f(y)}),p=_r(y=>{if(!i)return!1;switch(y.key){case"ArrowDown":return y.preventDefault(),f(_=>{const x=e.length;return x===0?0:_<x-1?_+1:0}),!0;case"ArrowUp":return y.preventDefault(),f(_=>{const x=e.length;return x===0?0:_>0?_-1:x-1}),!0;case"Enter":case"Tab":{if(y.shiftKey)return!1;y.preventDefault();const _=e[c];return _&&(MA(_)?o(_):a(_.id)),!0}case"Escape":return y.preventDefault(),u(),!0;case"Backspace":return n&&r===""?(y.preventDefault(),l(),!0):!1;default:return!1}}),g=e[c];return{highlightedIndex:c,highlightedItemId:i&&g?`${s}-option-${g.id}`:void 0,highlightIndex:h,handleKeyDown:p}});function By(e,t){return e.id.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)||(e.description?.toLowerCase().includes(t)??!1)}const LA=_e(({adapter:e,query:t,open:n})=>{const[r,s]=Cn(null);lt(()=>{n||s(null)},[n]);const i=pe(()=>!n||!e?[]:e.categories(),[n,e]),o=n?r:null,a=pe(()=>!o||!e?[]:e.categoryItems(o),[o,e]),l=pe(()=>{if(!n||!e||o||!t&&i.length>0)return null;if(e.search)return e.search(t);const h=[],p=t.toLowerCase();for(const g of i)for(const y of e.categoryItems(g.id))By(y,p)&&h.push(y);return h},[n,e,t,o,i]),u=l!==null,c=pe(()=>{if(u)return[];if(!t)return i;const h=t.toLowerCase();return i.filter(p=>p.label.toLowerCase().includes(h))},[i,t,u]),f=pe(()=>{if(u)return l??[];if(!t)return a;const h=t.toLowerCase();return a.filter(p=>By(p,h))},[a,t,u,l]);return{categories:c,items:f,isSearchMode:u,activeCategoryId:o,navigableList:pe(()=>u?l??[]:o?f:c,[u,l,o,f,c]),selectCategory:_r(h=>{s(h)}),goBack:_r(()=>{s(null)})}}),OA=_e(({behavior:e,trigger:t,aui:n,triggerChar:r,setCursorPosition:s,onSelected:i})=>{const o=wr(null),a=_r(l=>(o.current=l,()=>{o.current===l&&(o.current=null)}));return{selectItem:_r(l=>{if(!t||!e)return;if(o.current?.(l)){i();return}const u=n.composer().getState().text,c=u.slice(0,t.offset),f=u.slice(t.offset+r.length+t.query.length),h=()=>{const p=e.formatter.serialize(l);n.composer().setText(c+p+(f.startsWith(" ")?f:` ${f}`))};e.kind==="directive"?(h(),e.onInserted?.(l)):(e.removeOnExecute?n.composer().setText(c+(f.startsWith(" ")?f.slice(1):f)):h(),e.onExecute(l)),i()}),close:_r(()=>{i(),t&&s(t.offset)}),registerSelectItemOverride:a}}),zA=_e(({adapter:e,text:t,triggerChar:n,behavior:r,aui:s,popoverId:i})=>{const o=_t(NA({text:t,triggerChar:n})),a=o.trigger!==null&&e!==void 0&&r!==void 0,l=_t(LA({adapter:e,query:o.query,open:a})),u=_r(()=>{l.goBack()}),c=_t(OA({behavior:r,trigger:o.trigger,aui:s,triggerChar:n,setCursorPosition:o.setCursorPosition,onSelected:u})),f=_t(DA({navigableList:l.navigableList,isSearchMode:l.isSearchMode,activeCategoryId:l.activeCategoryId,query:o.query,popoverId:i,open:a,selectItem:c.selectItem,selectCategory:l.selectCategory,goBack:l.goBack,close:c.close}));return{open:a,query:o.query,activeCategoryId:l.activeCategoryId,categories:l.categories,items:l.items,highlightedIndex:f.highlightedIndex,isSearchMode:l.isSearchMode,popoverId:i,highlightedItemId:f.highlightedItemId,selectCategory:l.selectCategory,goBack:l.goBack,selectItem:c.selectItem,close:c.close,highlightIndex:f.highlightIndex,handleKeyDown:f.handleKeyDown,setCursorPosition:o.setCursorPosition,registerSelectItemOverride:c.registerSelectItemOverride}}),Fp=m.createContext(null),wo=()=>{const e=m.useContext(Fp);if(!e)throw new Error("useTriggerPopoverScopeContext must be used within ComposerPrimitive.TriggerPopover");return e},FA=()=>m.useContext(Fp),K0=m.createContext(null),G0=()=>{const e=m.useContext(K0);if(!e)throw new Error("TriggerPopover.Directive / TriggerPopover.Action must be rendered inside ComposerPrimitive.TriggerPopover");return e},Y0=m.forwardRef(({char:e,adapter:t,"aria-label":n,children:r,...s},i)=>{const o=he(),a=Y(S=>S.composer.text),l=m.useId(),u=m.useRef(null),[c,f]=m.useState(null),h=m.useRef(0),p=m.useCallback(S=>(h.current+=1,u.current=S,f(S),()=>{h.current=Math.max(0,h.current-1),u.current===S&&(u.current=null,f(null))}),[e]),g=m.useMemo(()=>({register:p}),[p]),y=bb(zA({adapter:t,text:a,triggerChar:e,behavior:c??void 0,aui:o,popoverId:l})),_=m.useRef(y);_.current=y;const x=Op();m.useEffect(()=>x.register({char:e,...c?{behavior:c}:{},resource:_.current}),[x,e,c]);const v=_c();m.useEffect(()=>{if(v)return v.register(_.current)},[v]);const w=c!==null&&y.open,C=TA();return m.useEffect(()=>{if(w)return()=>{C.setActiveAria(e,null)}},[C,e,w]),m.useEffect(()=>{w&&C.setActiveAria(e,{popoverId:l,highlightedItemId:y.highlightedItemId})},[C,e,l,w,y.highlightedItemId]),d.jsx(K0.Provider,{value:g,children:d.jsx(Fp.Provider,{value:y,children:w?d.jsx(ze.div,{role:"listbox",id:l,"aria-label":n??"Suggestions","aria-activedescendant":y.highlightedItemId,"data-state":"open",...s,ref:i,children:r}):r})})});Y0.displayName="ComposerPrimitive.TriggerPopover";const Q0=()=>{const{disabled:e,send:t}=kj(),n=m.useCallback(()=>t(),[t]);return e?null:n},BA=or("ComposerPrimitive.Send",Q0),X0=m.forwardRef(({onSubmit:e,...t},n)=>{const r=Q0(),s=i=>{i.preventDefault(),r&&r()};return d.jsx(ze.form,{...t,ref:n,onSubmit:Ye(e,s)})});X0.displayName="ComposerPrimitive.Root";const J0=e=>{const t=ii(e),n=ci(r=>r.onScrollToBottom);m.useEffect(()=>n(t),[n,t])},$A=()=>!1,UA=()=>{},VA=e=>m.useSyncExternalStore(m.useCallback(t=>{if(typeof window>"u"||e===null)return UA;const n=window.matchMedia(e);return n.addEventListener("change",t),()=>n.removeEventListener("change",t)},[e]),m.useCallback(()=>typeof window>"u"||e===null?!1:window.matchMedia(e).matches,[e]),$A);function qf(){return qf=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},qf.apply(null,arguments)}function HA(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}var WA=m.useLayoutEffect,qA=function(t){var n=Jt.useRef(t);return WA(function(){n.current=t}),n},$y=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},KA=function(t,n){var r=Jt.useRef();return Jt.useCallback(function(s){t.current=s,r.current&&$y(r.current,null),r.current=n,n&&$y(n,s)},[n])},Uy={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},GA=function(t){Object.keys(Uy).forEach(function(n){t.style.setProperty(n,Uy[n],"important")})},Vy=GA,Ft=null,Hy=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function YA(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),Ft||(Ft=document.createElement("textarea"),Ft.setAttribute("tabindex","-1"),Ft.setAttribute("aria-hidden","true"),Vy(Ft)),Ft.parentNode===null&&document.body.appendChild(Ft);var s=e.paddingSize,i=e.borderSize,o=e.sizingStyle,a=o.boxSizing;Object.keys(o).forEach(function(h){var p=h;Ft.style[p]=o[p]}),Vy(Ft),Ft.value=t;var l=Hy(Ft,e);Ft.value=t,l=Hy(Ft,e),Ft.value="x";var u=Ft.scrollHeight-s,c=u*n;a==="border-box"&&(c=c+s+i),l=Math.max(c,l);var f=u*r;return a==="border-box"&&(f=f+s+i),l=Math.min(f,l),[l,u]}var Wy=function(){},QA=function(t,n){return t.reduce(function(r,s){return r[s]=n[s],r},{})},XA=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],JA=!!document.documentElement.currentStyle,ZA=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=QA(XA,n),s=r.boxSizing;if(s==="")return null;JA&&s==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var i=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),o=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:i,borderSize:o}},eN=ZA;function Bp(e,t,n){var r=qA(n);m.useLayoutEffect(function(){var s=function(o){return r.current(o)};if(e)return e.addEventListener(t,s),function(){return e.removeEventListener(t,s)}},[])}var tN=function(t,n){Bp(document.body,"reset",function(r){t.current.form===r.target&&n(r)})},nN=function(t){Bp(window,"resize",t)},rN=function(t){Bp(document.fonts,"loadingdone",t)},sN=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],iN=function(t,n){var r=t.cacheMeasurements,s=t.maxRows,i=t.minRows,o=t.onChange,a=o===void 0?Wy:o,l=t.onHeightChange,u=l===void 0?Wy:l,c=HA(t,sN),f=c.value!==void 0,h=m.useRef(null),p=KA(h,n),g=m.useRef(0),y=m.useRef(),_=function(){var w=h.current,C=r&&y.current?y.current:eN(w);if(C){y.current=C;var S=YA(C,w.value||w.placeholder||"x",i,s),k=S[0],T=S[1];g.current!==k&&(g.current=k,w.style.setProperty("height",k+"px","important"),u(k,{rowHeight:T}))}},x=function(w){f||_(),a(w)};return m.useLayoutEffect(_),tN(h,function(){if(!f){var v=h.current.value;requestAnimationFrame(function(){var w=h.current;w&&v!==w.value&&_()})}}),nN(_),rN(_),m.createElement("textarea",qf({},c,{onChange:x,ref:p}))},oN=m.forwardRef(iN);const aN="(pointer: coarse) and (not (any-pointer: fine))",Z0=m.forwardRef(({autoFocus:e=!1,asChild:t,render:n,disabled:r,onChange:s,onKeyDown:i,onPaste:o,onSelect:a,submitOnEnter:l,submitMode:u,cancelOnEscape:c=!0,unstable_focusOnRunStart:f=!0,unstable_focusOnScrollToBottom:h=!0,unstable_focusOnThreadSwitched:p=!0,unstable_insertNewlineOnTouchEnter:g=!1,addAttachmentOnPaste:y=!0,..._},x)=>{const v=he(),w=_c(),C=jA(),S=u??(l===!1?"none":"enter"),k=VA(g?aN:null),T=g&&k&&S==="enter"?"none":S,R=Y(z=>z.composer.isEditing?z.composer.text:""),P=Y(z=>z.thread.isDisabled||z.composer.dictation?.inputDisabled)||r,E=m.useRef(null),M=fi(x,E),D=m.useRef(!1);M0(z=>{if(!E.current?.contains(z.target))return;if(w){for(const H of w.getPlugins())if(H.handleKeyDown(z))return}if(!c)return;const b=v.composer();b.getState().canCancel&&(b.cancel(),z.preventDefault())});const $=z=>{if(!P&&!z.nativeEvent.isComposing){if(w){for(const b of w.getPlugins())if(b.handleKeyDown(z))return}if(z.key==="Enter"){const b=v.thread().getState(),H=b.capabilities.queue;if(z.shiftKey&&(z.ctrlKey||z.metaKey)&&H&&S!=="none"&&v.composer().getState().canSend){z.preventDefault(),v.composer().send({steer:!0});return}if(z.shiftKey||b.isRunning&&!H)return;let X=!1;T==="ctrlEnter"?X=z.ctrlKey||z.metaKey:T==="enter"&&(X=!0),X&&(z.preventDefault(),E.current?.closest("form")?.requestSubmit())}}},U=async z=>{if(!y)return;const b=v.thread().getState().capabilities,H=Array.from(z.clipboardData?.files||[]);if(b.attachments&&H.length>0)try{z.preventDefault(),await Promise.all(H.map(X=>v.composer().addAttachment(X)))}catch(X){console.error("Error adding attachment:",X)}},V=e&&!P,J=m.useCallback(()=>{const z=E.current;!z||!V||(z.focus({preventScroll:!0}),z.setSelectionRange(z.value.length,z.value.length))},[V]);m.useEffect(()=>J(),[J]),J0(()=>{v.composer().getState().type==="thread"&&h&&J()}),m.useEffect(()=>{if(!(v.composer().getState().type!=="thread"||!f))return v.on("thread.runStart",J)},[f,J,v]),m.useEffect(()=>{if(!(v.composer().getState().type!=="thread"||!p))return v.on("threadListItem.switchedTo",J)},[p,J,v]);const te=C?{"aria-controls":C.popoverId,"aria-expanded":!0,"aria-haspopup":"listbox","aria-activedescendant":C.highlightedItemId}:{},B={name:"input",value:R,..._,...te,ref:M,disabled:P,onChange:Ye(s,z=>{if(!v.composer().getState().isEditing)return;const b=z.nativeEvent.isComposing===!0;D.current&&!b&&(D.current=!1);const H=b||D.current;if(Jg(()=>{v.composer().setText(z.target.value)}),H)return;const X=z.target.selectionStart??z.target.value.length;if(w)for(const I of w.getPlugins())I.setCursorPosition(X)}),onKeyDown:Ye(i,$),onCompositionStart:Ye(_.onCompositionStart,()=>{D.current=!0}),onCompositionEnd:Ye(_.onCompositionEnd,z=>{if(D.current=!1,!v.composer().getState().isEditing)return;const b=z.target;Jg(()=>{v.composer().setText(b.value)});const H=b.selectionStart??b.value.length;if(w)for(const X of w.getPlugins())X.setCursorPosition(H)}),onSelect:Ye(a,z=>{if(D.current)return;const b=z.target,H=b.selectionStart??b.value.length;if(w)for(const X of w.getPlugins())X.setCursorPosition(H)}),onPaste:Ye(o,U)};if(n&&m.isValidElement(n)){const z=_.children!==void 0?_.children:n.props.children;return d.jsx(Mu,{...B,children:m.cloneElement(n,void 0,z)})}return d.jsx(t?Mu:oN,{...B})});Z0.displayName="ComposerPrimitive.Input";const lN=()=>{const{disabled:e,cancel:t}=Cj();return e?null:t},uN=or("ComposerPrimitive.Cancel",lN),cN=({multiple:e=!0}={})=>{const{disabled:t,addAttachment:n}=Tj(),r=he(),s=m.useCallback(()=>{const i=document.createElement("input");i.type="file",i.multiple=e,i.hidden=!0;const o=r.composer().getState().attachmentAccept;o!=="*"&&(i.accept=o),document.body.appendChild(i),i.onchange=a=>{const l=a.target.files;if(l){for(const u of l)n(u);document.body.removeChild(i)}},i.oncancel=()=>{(!i.files||i.files.length===0)&&document.body.removeChild(i)},i.click()},[r,e,n]);return t?null:s},dN=or("ComposerPrimitive.AddAttachment",cN,["multiple"]),eS=m.forwardRef(({disabled:e,asChild:t=!1,render:n,children:r,...s},i)=>{const[o,a]=m.useState(!1),l=he(),u=m.useCallback(g=>{e||(g.preventDefault(),a(!0))},[e]),c=m.useCallback(g=>{e||(g.preventDefault(),o||a(!0))},[e,o]),f=m.useCallback(g=>{if(e)return;g.preventDefault();const y=g.relatedTarget;y&&g.currentTarget.contains(y)||a(!1)},[e]),h=m.useCallback(async g=>{if(e)return;g.preventDefault(),a(!1);const y=Array.from(g.dataTransfer.files);await Promise.all(y.map(async _=>{try{await l.composer().addAttachment(_)}catch(x){console.error("Failed to add attachment:",x)}}))},[e,l]),p={...o?{"data-dragging":"true"}:null,...s,onDragEnterCapture:Ye(s.onDragEnterCapture,u),onDragOverCapture:Ye(s.onDragOverCapture,c),onDragLeaveCapture:Ye(s.onDragLeaveCapture,f),onDropCapture:Ye(s.onDropCapture,h),ref:i};if(n&&m.isValidElement(n)){const g=r!==void 0?r:n.props.children;return d.jsx(Mu,{...p,children:m.cloneElement(n,void 0,g)})}return d.jsx(t?Mu:"div",{...p,children:r})});eS.displayName="ComposerPrimitive.AttachmentDropzone";const fN=()=>{const{disabled:e,startDictation:t}=Ej();return e?null:t},hN=or("ComposerPrimitive.Dictate",fN),pN=()=>{const e=he(),t=Y(r=>r.composer.dictation!=null),n=m.useCallback(()=>{e.composer().stopDictation()},[e]);return t?n:null},mN=or("ComposerPrimitive.StopDictation",pN),tS=m.forwardRef(({children:e,...t},n)=>{const r=Y(s=>s.composer.dictation?.transcript);return r?d.jsx(ze.span,{...t,ref:n,children:e??r}):null});tS.displayName="ComposerPrimitive.DictationTranscript";const nS=m.forwardRef((e,t)=>Y(n=>n.composer.quote)?d.jsx(ze.div,{...e,ref:t}):null);nS.displayName="ComposerPrimitive.Quote";const rS=m.forwardRef(({children:e,...t},n)=>{const r=Y(s=>s.composer.quote?.text);return r?d.jsx(ze.span,{...t,ref:n,children:e??r}):null});rS.displayName="ComposerPrimitive.QuoteText";const sS=m.forwardRef(({onClick:e,...t},n)=>{const r=he(),s=m.useCallback(()=>{r.composer().setQuote(void 0)},[r]);return d.jsx(ze.button,{type:"button",...t,ref:n,onClick:Ye(e,s)})});sS.displayName="ComposerPrimitive.QuoteDismiss";const iS=m.forwardRef(({children:e,"aria-label":t,...n},r)=>{const{categories:s,activeCategoryId:i,isSearchMode:o,open:a}=wo();return!a||i||o?null:d.jsx(ze.div,{role:"group","aria-label":t??"Categories",...n,ref:r,children:e(s)})});iS.displayName="ComposerPrimitive.TriggerPopoverCategories";const oS=m.forwardRef(({categoryId:e,onClick:t,onMouseMove:n,...r},s)=>{const{selectCategory:i,highlightIndex:o,categories:a,highlightedIndex:l,activeCategoryId:u,isSearchMode:c,popoverId:f}=wo(),h=m.useCallback(()=>{i(e)},[i,e]),p=a.findIndex(_=>_.id===e),g=!u&&!c&&p===l,y=m.useCallback(()=>{o(p)},[o,p]);return d.jsx(ze.button,{type:"button",role:"option",id:`${f}-option-${e}`,"aria-selected":g,"data-highlighted":g?"":void 0,...r,ref:s,onClick:Ye(t,h),onMouseMove:Ye(n,y)})});oS.displayName="ComposerPrimitive.TriggerPopoverCategoryItem";const aS=m.forwardRef(({children:e,"aria-label":t,...n},r)=>{const{items:s,activeCategoryId:i,isSearchMode:o,open:a}=wo();return!a||!i&&!o?null:d.jsx(ze.div,{role:"group","aria-label":t??"Items",...n,ref:r,children:e(s)})});aS.displayName="ComposerPrimitive.TriggerPopoverItems";const lS=m.forwardRef(({item:e,index:t,onClick:n,onMouseMove:r,...s},i)=>{const{selectItem:o,highlightIndex:a,items:l,highlightedIndex:u,activeCategoryId:c,isSearchMode:f,popoverId:h}=wo(),p=m.useCallback(()=>{o(e)},[o,e]),g=t??l.findIndex(x=>x.id===e.id),y=(f||c!==null)&&g===u,_=m.useCallback(()=>{a(g)},[a,g]);return d.jsx(ze.button,{type:"button",role:"option",id:`${h}-option-${e.id}`,"aria-selected":y,"data-highlighted":y?"":void 0,...s,ref:i,onClick:Ye(n,p),onMouseMove:Ye(r,_)})});lS.displayName="ComposerPrimitive.TriggerPopoverItem";const uS=m.forwardRef(({onClick:e,...t},n)=>{const{activeCategoryId:r,isSearchMode:s,goBack:i,open:o}=wo();return!o||!r||s?null:d.jsx(ze.button,{type:"button",...t,ref:n,onClick:Ye(e,i)})});uS.displayName="ComposerPrimitive.TriggerPopoverBack";const cS=({formatter:e,onExecute:t,removeOnExecute:n})=>{const{register:r}=G0(),s=m.useRef(t);return s.current=t,m.useEffect(()=>r({kind:"action",formatter:e??T0,onExecute:i=>s.current(i),...n!==void 0?{removeOnExecute:n}:{}}),[r,e,n]),null};cS.displayName="ComposerPrimitive.TriggerPopoverAction";const dS=({formatter:e,onInserted:t})=>{const{register:n}=G0(),r=m.useRef(t);return r.current=t,m.useEffect(()=>n({kind:"directive",formatter:e??T0,onInserted:s=>r.current?.(s)}),[n,e]),null};dS.displayName="ComposerPrimitive.TriggerPopoverDirective";const gN=Object.assign(Y0,{Directive:dS,Action:cS});var El=xo({AddAttachment:()=>dN,AttachmentByIndex:()=>w0,AttachmentDropzone:()=>eS,Attachments:()=>_0,Cancel:()=>uN,Dictate:()=>hN,DictationTranscript:()=>tS,If:()=>E0,Input:()=>Z0,Queue:()=>b0,Quote:()=>nS,QuoteDismiss:()=>sS,QuoteText:()=>rS,Root:()=>X0,Send:()=>BA,StopDictation:()=>mN,Unstable_TriggerPopover:()=>gN,Unstable_TriggerPopoverBack:()=>uS,Unstable_TriggerPopoverCategories:()=>iS,Unstable_TriggerPopoverCategoryItem:()=>oS,Unstable_TriggerPopoverItem:()=>lS,Unstable_TriggerPopoverItems:()=>aS,Unstable_TriggerPopoverRoot:()=>q0,unstable_useTriggerPopoverRootContext:()=>Op,unstable_useTriggerPopoverRootContextOptional:()=>zp,unstable_useTriggerPopoverScopeContext:()=>wo,unstable_useTriggerPopoverScopeContextOptional:()=>FA,unstable_useTriggerPopoverTriggers:()=>IA,unstable_useTriggerPopoverTriggersOptional:()=>PA});const fS=()=>Y(e=>{if(e.part.type!=="text"&&e.part.type!=="reasoning")throw new Error("MessagePartText can only be used inside text or reasoning message parts.");return e.part}),yN=()=>Y(e=>{if(e.part.type!=="image")throw new Error("MessagePartImage can only be used inside image message parts.");return e.part}),hS=m.createContext(null),vN=e=>({useSmoothStatus:Ib(()=>e)}),xN=({children:e})=>{const t=pS({optional:!0}),n=he(),[r]=m.useState(()=>vN(n.part().getState().status));return t?e:d.jsx(hS.Provider,{value:r,children:e})},wN=e=>{const t=m.forwardRef((n,r)=>d.jsx(xN,{children:d.jsx(e,{...n,ref:r})}));return t.displayName=e.displayName,t};function pS(e){const t=m.useContext(hS);if(!e?.optional&&!t)throw new Error("This component must be used within a SmoothContextProvider.");return t}const{useSmoothStatus:_N,useSmoothStatusStore:bN}=I0(pS,"useSmoothStatus");var SN=class{constructor(e,t){N(this,"currentText");N(this,"setText");N(this,"animationFrameId",null);N(this,"lastUpdateTime",Date.now());N(this,"targetText","");N(this,"animate",()=>{const e=Date.now();let t=e-this.lastUpdateTime;const n=this.targetText.length-this.currentText.length,r=Math.min(5,250/n);let s=0;for(;t>=r&&s<n;)s++,t-=r;s!==n?this.animationFrameId=requestAnimationFrame(this.animate):this.animationFrameId=null,s!==0&&(this.currentText=this.targetText.slice(0,this.currentText.length+s),this.lastUpdateTime=e-t,this.setText(this.currentText))});this.currentText=e,this.setText=t}start(){this.animationFrameId===null&&(this.lastUpdateTime=Date.now(),this.animate())}stop(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}};const md=Object.freeze({type:"running"}),mS=(e,t=!1)=>{const{text:n}=e,[r,s]=m.useState(e.status.type==="running"?"":n),i=he(),o=Y(()=>i.part()),[a,l]=m.useState(o);(o!==a||!n.startsWith(r))&&(l(o),s(e.status.type==="running"?"":n));const u=bN({optional:!0}),c=ii(p=>{if(s(p),u){const g=r!==p||e.status.type==="running"?md:e.status;Au(u).setState(g,!0)}});m.useEffect(()=>{if(u){const p=t&&(r!==n||e.status.type==="running")?md:e.status;Au(u).setState(p,!0)}},[u,t,n,r,e.status]);const[f]=m.useState(new SN(r,c)),h=m.useRef(o);return m.useEffect(()=>{if(!t){f.stop();return}const p=h.current!==o;if(h.current=o,p||!n.startsWith(f.targetText)){e.status.type==="running"?(f.currentText="",f.targetText=n,f.start()):(f.currentText=n,f.targetText=n,f.stop());return}f.targetText=n,f.start()},[f,t,n,e.status.type,o]),m.useEffect(()=>()=>{f.stop()},[f]),m.useMemo(()=>t?{type:"text",text:r,status:n===r?e.status:md}:e,[t,r,e,n])},$p=m.forwardRef(({smooth:e=!0,component:t="span",...n},r)=>{const{text:s,status:i}=mS(fS(),e);return d.jsx(t,{"data-status":i.type,...n,ref:r,children:s})});$p.displayName="MessagePartPrimitive.Text";const Up=m.forwardRef((e,t)=>{const{image:n}=yN();return d.jsx(ze.img,{src:n,...e,ref:t})});Up.displayName="MessagePartPrimitive.Image";const hi=e=>{const t=m.useRef(void 0);return m.useCallback(n=>{t.current&&(t.current(),t.current=void 0),n&&(t.current=e(n))},[e])},qy=(e,t)=>{const n=e.trim().match(/^(\d+(?:\.\d+)?|\.\d+)(em|px|rem)$/);if(!n)return Number.POSITIVE_INFINITY;const r=Number(n[1]),s=n[2];return s==="px"?r:s==="em"?r*(parseFloat(getComputedStyle(t).fontSize)||16):s==="rem"?r*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16):Number.POSITIVE_INFINITY},kN=e=>e.dataset.messageId,CN=()=>{const e=document.createElement("div");return e.dataset.auiTopAnchorReserve="",e.style.height="0px",e.style.flexShrink="0",e.style.pointerEvents="none",e.setAttribute("aria-hidden","true"),e},Ky=(e,t)=>{const n=`${t}px`;return e.style.height!==n?(e.style.height=n,!0):!1},EN=e=>{const t=window.devicePixelRatio||1;return Math.round(e*t)/t},gS=()=>{const e=he(),t=Y(()=>e.message());return hi(m.useCallback(n=>{const r=()=>{t.setIsHovering(!0)},s=()=>{t.setIsHovering(!1)};return n.addEventListener("mouseenter",r),n.addEventListener("mouseleave",s),n.matches(":hover")&&queueMicrotask(()=>t.setIsHovering(!0)),()=>{n.removeEventListener("mouseenter",r),n.removeEventListener("mouseleave",s),t.setIsHovering(!1)}},[t]))},TN=()=>{const e=ci(t=>t.topAnchorTurn?.anchorId);return Y(t=>t.message.role==="user"&&t.message.index>0&&t.message.index===t.thread.messages.length-2&&t.thread.messages.at(-1)?.role==="assistant"&&(t.message.id===e||t.thread.isRunning))},IN=()=>{const e=ci(t=>t.topAnchorTurn?.targetId);return Y(t=>t.message.isLast&&t.message.role==="assistant"&&t.message.index>=1&&t.thread.messages.at(t.message.index-1)?.role==="user"&&(t.message.id===e||t.thread.isRunning))},RN=(e,t)=>hi(m.useCallback(n=>{if(e)return t.getState().registerAnchorElement(n)},[e,t])),PN=({active:e,threadViewportStore:t})=>hi(m.useCallback(n=>{if(!e)return;const r=t.getState(),s=r.topAnchorMessageClamp;return r.registerAnchorTargetElement(n,{tallerThan:qy(s.tallerThan,n),visibleHeight:qy(s.visibleHeight,n)})},[e,t])),jN=({forwardedRef:e,...t})=>{const n=fi(e,gS()),r=Y(s=>s.message.id);return d.jsx(ze.div,{...t,ref:n,"data-message-id":r})},AN=({forwardedRef:e,threadViewportStore:t,...n})=>{const r=gS(),s=TN(),i=IN(),o=fi(e,r,RN(s,t),PN({active:i,threadViewportStore:t})),a=Y(l=>l.message.id);return d.jsx(ze.div,{...n,ref:o,"data-message-id":a,"data-aui-top-anchor-user":s?"":void 0,"data-aui-top-anchor-target":i?"":void 0})},yS=m.forwardRef((e,t)=>{const n=di();return n.getState().turnAnchor==="top"?d.jsx(AN,{...e,forwardedRef:t,threadViewportStore:n}):d.jsx(jN,{...e,forwardedRef:t})});yS.displayName="MessagePrimitive.Root";const gd={...Pt,Text:()=>d.jsxs("p",{style:{whiteSpace:"pre-line"},children:[d.jsx($p,{}),d.jsx(Mp,{children:d.jsx("span",{style:{fontFamily:"revert"},children:" ●"})})]}),Image:()=>d.jsx(Up,{})},Kf=e=>{if("children"in e)return d.jsx(Wf,{children:e.children});const{components:t,...n}=e;return d.jsx(Wf,{components:t?{Text:t.Text??gd.Text,Image:t.Image??gd.Image,Reasoning:t.Reasoning??Pt.Reasoning,Source:t.Source??Pt.Source,File:t.File??Pt.File,Unstable_Audio:t.Unstable_Audio??Pt.Unstable_Audio,..."ChainOfThought"in t?{ChainOfThought:t.ChainOfThought}:{tools:t.tools,data:t.data,ToolGroup:t.ToolGroup??Pt.ToolGroup,ReasoningGroup:t.ReasoningGroup??Pt.ReasoningGroup},Empty:t.Empty,Quote:t.Quote,generativeUI:t.generativeUI}:gd,...n})};Kf.displayName="MessagePrimitive.Parts";const vS=({children:e})=>Lj()!==void 0?e:null;vS.displayName="MessagePrimitive.Error";const NN=e=>{const t=new Map;for(let r=0;r<e.length;r++){const s=e[r]?.parentId??`__ungrouped_${r}`,i=t.get(s)??[];i.push(r),t.set(s,i)}const n=[];for(const[r,s]of t){const i=r.startsWith("__ungrouped_")?void 0:r;n.push({groupKey:i,indices:s})}return n},MN=e=>{const t=Y(n=>n.message.parts);return m.useMemo(()=>t.length===0?[]:e(t),[t,e])},DN=({Fallback:e,...t})=>{const n=Y(r=>{const s=r.tools.tools[t.toolName]??e;return Array.isArray(s)?s[0]??e:s});return n?d.jsx(n,{...t}):null},LN=({Fallback:e,...t})=>{const n=Y(r=>{const s=r.dataRenderers.renderers[t.name]??e;return Array.isArray(s)?s[0]??e:s});return n?d.jsx(n,{...t}):null},es={Text:()=>d.jsxs("p",{style:{whiteSpace:"pre-line"},children:[d.jsx($p,{}),d.jsx(Mp,{children:d.jsx("span",{style:{fontFamily:"revert"},children:" ●"})})]}),Reasoning:()=>null,Source:()=>null,Image:()=>d.jsx(Up,{}),File:()=>null,Unstable_Audio:()=>null,Group:({children:e})=>e},ON=({components:{Text:e=es.Text,Reasoning:t=es.Reasoning,Image:n=es.Image,Source:r=es.Source,File:s=es.File,Unstable_Audio:i=es.Unstable_Audio,tools:o={},data:a}={}})=>{const l=he(),u=Y(f=>f.part),c=u.type;if(c==="tool-call"){const f=l.part().addToolResult,h=l.part().resumeToolCall,p=l.part().respondToToolApproval;if("Override"in o)return d.jsx(o.Override,{...u,addResult:f,resume:h,respondToApproval:p});const g=o.by_name?.[u.toolName]??o.Fallback;return d.jsx(DN,{...u,Fallback:g,addResult:f,resume:h,respondToApproval:p})}if(u.status?.type==="requires-action")throw new Error("Encountered unexpected requires-action status");switch(c){case"text":return d.jsx(e,{...u});case"reasoning":return d.jsx(t,{...u});case"source":return d.jsx(r,{...u});case"image":return d.jsx(n,{...u});case"file":return d.jsx(s,{...u});case"audio":return d.jsx(i,{...u});case"data":{const f=a?.by_name?.[u.name]??a?.Fallback;return d.jsx(LN,{...u,Fallback:f})}default:return console.warn(`Unknown message part type: ${c}`),null}},zN=({partIndex:e,components:t})=>d.jsx(Ip,{index:e,children:d.jsx(ON,{components:t})}),FN=m.memo(zN,(e,t)=>e.partIndex===t.partIndex&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.Group===t.components?.Group),BN=({status:e,component:t})=>d.jsx(Rp,{text:"",isRunning:e.type==="running",children:d.jsx(t,{type:"text",text:"",status:e})}),$N=Object.freeze({type:"complete"}),UN=({components:e})=>{const t=Y(n=>n.message.status??$N);return e?.Empty?d.jsx(e.Empty,{status:t}):d.jsx(BN,{status:t,component:e?.Text??es.Text})},VN=m.memo(UN,(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),Vp=({groupingFunction:e,components:t})=>{const n=Y(s=>s.message.parts.length),r=MN(e);return d.jsx(d.Fragment,{children:m.useMemo(()=>n===0?d.jsx(VN,{components:t}):r.map((s,i)=>d.jsx(t?.Group??es.Group,{groupKey:s.groupKey,indices:s.indices,children:s.indices.map(o=>d.jsx(FN,{partIndex:o,components:t},o))},`group-${i}-${s.groupKey??"ungrouped"}`)),[r,t,n])})};Vp.displayName="MessagePrimitive.Unstable_PartsGrouped";const xS=({components:e,...t})=>d.jsx(Vp,{...t,components:e,groupingFunction:NN});xS.displayName="MessagePrimitive.Unstable_PartsGroupedByParentId";var Du=xo({AttachmentByIndex:()=>y0,Attachments:()=>v0,Content:()=>Kf,Error:()=>vS,GenerativeUI:()=>i0,GroupedParts:()=>p0,If:()=>U0,PartByIndex:()=>ra,Parts:()=>Kf,Quote:()=>m0,Root:()=>yS,Unstable_PartsGrouped:()=>Vp,Unstable_PartsGroupedByParentId:()=>xS});const HN=e=>{const t=ii(e);return hi(m.useCallback(n=>{const r=new ResizeObserver(()=>{t()}),s=new MutationObserver(i=>{i.some(o=>o.type!=="attributes"||o.attributeName!=="style")&&t()});return r.observe(n),s.observe(n,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>{r.disconnect(),s.disconnect()}},[t]))},WN=({autoScroll:e,scrollToBottomOnRunStart:t=!0,scrollToBottomOnInitialize:n=!0,scrollToBottomOnThreadSwitch:r=!0})=>{const s=m.useRef(null),i=Y(C=>C.thread.messages.length>0),o=m.useRef(!1),a=m.useRef(null),l=di();e===void 0&&(e=l.getState().turnAnchor!=="top");const u=m.useRef(0),c=m.useRef(0),f=m.useRef(0),h=m.useRef(0),p=m.useRef(null),g=m.useCallback(C=>{const S=s.current;S&&(p.current=C,S.scrollTo({top:S.scrollHeight,behavior:C}))},[]),y=m.useCallback(C=>{p.current=C,a.current!==null&&cancelAnimationFrame(a.current),a.current=requestAnimationFrame(()=>{a.current=null,g(C)})},[g]);m.useLayoutEffect(()=>()=>{a.current!==null&&cancelAnimationFrame(a.current)},[]);const _=m.useCallback(()=>{const C=l.getState();return C.turnAnchor==="top"&&C.element.viewport===s.current&&C.element.anchor!==null},[l]),x=()=>{const C=s.current;if(!C)return;const S=l.getState().isAtBottom,k=Math.abs(C.scrollHeight-C.scrollTop-C.clientHeight)<=1||C.scrollHeight<=C.clientHeight;!k&&u.current<C.scrollTop||(k?C.scrollHeight>C.clientHeight+1&&(p.current=null):u.current>C.scrollTop&&c.current===C.scrollHeight&&(p.current=null),(k||p.current===null)&&k!==S&&Au(l).setState({isAtBottom:k})),u.current=C.scrollTop,c.current=C.scrollHeight},v=HN(()=>{const C=s.current;if(!C)return;const{scrollHeight:S,clientHeight:k}=C;if(S===f.current&&k===h.current)return;f.current=S,h.current=k;const T=p.current;T&&_()?p.current=null:T?g(T):e&&l.getState().isAtBottom&&g("instant"),x()}),w=hi(C=>(C.addEventListener("scroll",x),()=>{C.removeEventListener("scroll",x)}));return m.useLayoutEffect(()=>{if(n){if(!i){o.current=!1;return}o.current||(o.current=!0,p.current===null&&y("instant"))}},[i,y,n]),J0(({behavior:C})=>{g(C)}),Iu("thread.runStart",()=>{t&&l.getState().turnAnchor!=="top"&&y("auto")}),Iu("threadListItem.switchedTo",()=>{r&&y("instant")}),fi(v,w,s)},wS=m.forwardRef((e,t)=>d.jsx(ze.div,{...e,ref:t}));wS.displayName="ThreadPrimitive.Root";const _S=({children:e})=>Y(t=>t.thread.isEmpty)?e:null;_S.displayName="ThreadPrimitive.Empty";const qN=e=>Y(t=>!(e.empty===!0&&!t.thread.isEmpty||e.empty===!1&&t.thread.isEmpty||e.running===!0&&!t.thread.isRunning||e.running===!1&&t.thread.isRunning||e.disabled===!0&&!t.thread.isDisabled||e.disabled===!1&&t.thread.isDisabled)),bS=({children:e,...t})=>qN(t)?e:null;bS.displayName="ThreadPrimitive.If";const SS=(e,t)=>hi(m.useCallback(n=>{if(!e)return;const r=e(),s=()=>{const o=t?t(n):n.offsetHeight;r.setHeight(o)},i=new ResizeObserver(s);return i.observe(n),s(),()=>{i.disconnect(),r.unregister()}},[e,t])),Gy=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},KN=(e,t)=>{let n=0,r=e;for(;r&&r!==t;)n+=r.offsetTop,r=r.offsetParent;return r===t?n:Gy(e)-Gy(t)},kS=({viewport:e,anchor:t,tallerThan:n,visibleHeight:r})=>{const s=KN(t,e),i=t.offsetHeight;return s+Math.max(0,i-(i<=n?i:r))},GN=({scrollHeight:e,...t})=>{const{viewport:n}=t,r=kS(t)+n.clientHeight;return Math.max(0,r-e)},YN=({viewport:e,reserve:t,...n})=>GN({viewport:e,...n,scrollHeight:e.scrollHeight-t.offsetHeight}),QN=e=>{const t=new ResizeObserver(e),n=new MutationObserver(e);let r=null,s=null,i=null;const o=()=>{t.disconnect(),n.disconnect(),r=null,s=null,i=null};return{target:(a,l,u)=>{r===a&&s===l&&i===u||(o(),t.observe(a),t.observe(l),t.observe(u),n.observe(u,{childList:!0,subtree:!0,characterData:!0}),r=a,s=l,i=u)},disconnect:o}},XN=e=>{let t=null;return{schedule:()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))},cancel:()=>{t!==null&&(cancelAnimationFrame(t),t=null)}}},JN=e=>{let t=null,n;function r(){const a=e.getState(),{viewport:l,anchor:u,target:c}=a.element,f=a.targetConfig;if(a.turnAnchor!=="top"||!l||!u||!c||!f){i.disconnect(),t&&(Ky(t,0),t.remove());return}if(t??(t=CN()),(t.parentElement!==c.parentElement||t.previousElementSibling!==c)&&c.after(t),i.target(l,u,c),Ky(t,YN({viewport:l,anchor:u,reserve:t,...f}))){s.schedule();return}const h=kN(u);if(h!==void 0&&n===h)return;const p=EN(kS({viewport:l,anchor:u,...f}));Math.abs(l.scrollTop-p)>1&&l.scrollTo({top:p,behavior:"smooth"}),h!==void 0&&(n=h)}const s=XN(r),i=QN(s.schedule);s.schedule();const o=e.subscribe(s.schedule);return()=>{s.cancel(),o(),i.disconnect(),t?.remove()}},ZN=e=>{const t=di();m.useLayoutEffect(()=>{if(e)return JN(t)},[e,t])},CS=({isRunning:e,messages:t})=>{if(!e)return null;const n=t.at(-1),r=t.at(-2);return r?.role!=="user"||n?.role!=="assistant"?null:{anchorId:r.id,targetId:n.id}},eM=e=>CS(e)?.anchorId,tM=e=>CS(e)?.targetId,nM=()=>SS(ci(e=>e.registerViewport),m.useCallback(e=>e.clientHeight,[])),rM=()=>hi(ci(e=>e.registerViewportElement)),sM=e=>{const t=di(),n=Y(o=>{if(e)return eM(o.thread)}),r=Y(o=>{if(e)return tM(o.thread)}),s=m.useMemo(()=>!n||!r?null:{anchorId:n,targetId:r},[n,r]);m.useLayoutEffect(()=>{if(!s)return;const o=t.getState(),a=o.topAnchorTurn;a?.anchorId===s.anchorId&&a.targetId===s.targetId||o.setTopAnchorTurn(s)},[s,t]);const i=m.useCallback(()=>{t.getState().setTopAnchorTurn(null)},[t]);Iu("thread.initialize",i),Iu("threadListItem.switchedTo",i)},ES=m.forwardRef(({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:r,children:s,...i},o)=>{const a=WN({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:r}),l=nM(),u=rM(),c=di().getState().turnAnchor==="top";sM(c),ZN(c);const f=fi(o,a,l,u);return d.jsx(ze.div,{...i,ref:f,children:s})});ES.displayName="ThreadPrimitive.ViewportScrollable";const TS=m.forwardRef(({turnAnchor:e,topAnchorMessageClamp:t,...n},r)=>d.jsx(Dp,{options:{turnAnchor:e,topAnchorMessageClamp:t},children:d.jsx(ES,{...n,ref:r})}));TS.displayName="ThreadPrimitive.Viewport";const IS=m.forwardRef((e,t)=>{const n=fi(t,SS(ci(r=>r.registerContentInset),m.useCallback(r=>{const s=parseFloat(getComputedStyle(r).marginTop)||0;return r.offsetHeight+s},[])));return d.jsx(ze.div,{...e,ref:n})});IS.displayName="ThreadPrimitive.ViewportFooter";const iM=({behavior:e}={})=>{const t=ci(s=>s.isAtBottom),n=di(),r=m.useCallback(()=>{n.getState().scrollToBottom({behavior:e})},[n,e]);return t?null:r},oM=or("ThreadPrimitive.ScrollToBottom",iM,["behavior"]),aM=({prompt:e,send:t,clearComposer:n,autoSend:r,method:s})=>{const{disabled:i,trigger:o}=Dj({prompt:e,send:t??r??!1,clearComposer:n});return i?null:o},lM=or("ThreadPrimitive.Suggestion",aM,["prompt","send","clearComposer","autoSend","method"]);var bt=xo({Empty:()=>_S,If:()=>bS,MessageByIndex:()=>t0,Messages:()=>VP,Root:()=>wS,ScrollToBottom:()=>oM,Suggestion:()=>lM,SuggestionByIndex:()=>k0,Suggestions:()=>bj,Viewport:()=>TS,ViewportFooter:()=>IS,ViewportProvider:()=>Dp}),uM=xo({AssistantRuntimeImpl:()=>Gb,BaseAssistantRuntimeCore:()=>Yb,CompositeContextProvider:()=>bp,DefaultThreadComposerRuntimeCore:()=>Jb,MessageRepository:()=>jp,ThreadRuntimeImpl:()=>Kb,fromThreadMessageLike:()=>ja,generateId:()=>Ss,getAutoStatus:()=>Pu,splitLocalRuntimeOptions:()=>Oj,useComposerInputPluginRegistryOptional:()=>_c,useSmooth:()=>mS,useSmoothStatus:()=>_N,withSmoothContextProvider:()=>wN});const Hp="claude-control.token";let Lu=null,Ou=!1;function cM(){try{return window.localStorage.getItem(Hp)}catch{return null}}const dM="claude-control";function bc(){return Ou||(Lu=cM(),Ou=!0),Lu}function RS(e){Lu=e,Ou=!0;try{window.localStorage.setItem(Hp,e)}catch{}}function PS(){Lu=null,Ou=!0;try{window.localStorage.removeItem(Hp)}catch{}}function fM(){if(typeof window>"u"||!window.location)return;let e;try{e=new URLSearchParams(window.location.search)}catch{return}const t=e.get("token");if(!t)return;RS(t),e.delete("token");const n=e.toString(),r=window.location.pathname+(n?`?${n}`:"")+window.location.hash;try{window.history.replaceState(null,"",r)}catch{}}fM();const Gf=new Set;function hM(e){return Gf.add(e),()=>Gf.delete(e)}function jS(){PS();for(const e of Gf)e()}function pM(e){const t=bc(),n={...e??{}};return t&&(n.Authorization=`Bearer ${t}`),n}async function tt(e,t){const n=await fetch(e,{...t,headers:pM(t?.headers)});return n.status===401&&jS(),n}function mM(e){const t=`/term/${encodeURIComponent(e)}/`,n=bc();return n?`${t}?token=${encodeURIComponent(n)}`:t}function gM(){const e=window.location;return`${e.protocol==="https:"?"wss:":"ws:"}//${e.host}/`}async function AS(){try{const e=await tt("/api/version");return e.ok?await e.json():null}catch{return null}}async function yM(){try{const e=await tt("/api/update",{method:"POST"}),t=await e.json().catch(()=>({}));return e.ok&&!!t.ok}catch{return!0}}async function vM(){try{const e=await tt("/api/push/vapid");return e.ok?(await e.json()).publicKey??null:null}catch{return null}}async function xM(e){try{return(await tt("/api/push/subscribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})).ok}catch{return!1}}async function wM(e){try{return(await tt("/api/push/unsubscribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({endpoint:e})})).ok}catch{return!1}}async function _M(e){const t=await tt("/api/icon",{method:"POST",body:e}),n=await t.json().catch(()=>({}));if(!t.ok||!n.ok)throw new Error(n.error||`HTTP ${t.status}`)}async function bM(){const e=await tt("/api/icon",{method:"DELETE"}),t=await e.json().catch(()=>({}));if(!e.ok||!t.ok)throw new Error(t.error||`HTTP ${e.status}`)}async function SM(){const e=await tt("/api/models");if(!e.ok)throw new Error(`HTTP ${e.status}`);return await e.json()}async function kM(e,t){const n=await tt("/api/optimize",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:e})}),r=await n.json().catch(()=>({}));if(!n.ok||typeof r.optimized!="string")throw new Error(r.error||`HTTP ${n.status}`);return{optimized:r.optimized,rationale:r.rationale??[],changes:r.changes??[],mode:r.mode==="rules"?"rules":"llm"}}async function CM(e,t="webm",n){const r=await tt(`/api/transcribe?ext=${encodeURIComponent(t)}`,{method:"POST",body:e,signal:n}),s=await r.json().catch(()=>({}));if(!r.ok||!s.ok)throw new Error(s.error||`HTTP ${r.status}`);return s.text??""}async function NS(){const e=await tt("/api/config");if(!e.ok)throw new Error(`HTTP ${e.status}`);return await e.json()}async function EM(e){const t=await tt("/api/config",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>({}));if(!t.ok)throw new Error("error"in n&&n.error||`HTTP ${t.status}`);return n}async function MS(e){const t=await tt("/api/session/new",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e??{})}),n=await t.json().catch(()=>({}));if(!t.ok||!("ok"in n)||!n.ok){const r="error"in n&&n.error||`HTTP ${t.status}`;throw new Error(r)}return n}async function TM(){const e=await tt("/api/spawn-agents"),t=await e.json().catch(()=>({}));if(!e.ok||!("agents"in t)){const n="error"in t&&t.error||`HTTP ${e.status}`;throw new Error(n)}return t.agents}async function IM(e,t){const n=await tt("/api/session/rename",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:e,name:t})}),r=await n.json().catch(()=>({}));if(!n.ok||!("ok"in r)||!r.ok){const s="error"in r&&r.error||`HTTP ${n.status}`;throw new Error(s)}}function RM(e){return`/api/uploads/${encodeURIComponent(e)}`}async function PM(){const e=await tt("/api/ps");if(!e.ok)throw new Error(`HTTP ${e.status}`);return(await e.json()).processes??[]}async function jM(e,t){const n=await tt("/api/kill",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pid:e,signal:t})}),r=await n.json().catch(()=>({}));if(!n.ok||!r.ok)throw new Error(r.error||`HTTP ${n.status}`)}async function DS(e){const t=e?`/api/skills?id=${encodeURIComponent(e)}`:"/api/skills",n=await tt(t);if(!n.ok)throw new Error(`HTTP ${n.status}`);return(await n.json()).skills??[]}async function AM(e){const t=e?`/api/agents?id=${encodeURIComponent(e)}`:"/api/agents",n=await tt(t);if(!n.ok)throw new Error(`HTTP ${n.status}`);return(await n.json()).agents??[]}async function NM(e){const t=`/api/upload?name=${encodeURIComponent(e.name)}`,n=await tt(t,{method:"POST",body:e});let r=null;try{r=await n.json()}catch{}const s=r??{};if(!n.ok||!s.ok||!s.path)throw new Error(s.error||`HTTP ${n.status}`);return{ok:!0,path:s.path,name:s.name??e.name}}const MM=1008,Yy=1e3,DM=3e4;class LM{constructor(){N(this,"ws",null);N(this,"reconnectTimer",null);N(this,"reconnectDelay",Yy);N(this,"selectedId",null);N(this,"closed",!1);N(this,"msgHandlers",new Set);N(this,"stateHandlers",new Set)}connect(){if(this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))return;this.emitState("connecting");const t=bc(),n=t?[dM,t]:void 0,r=new WebSocket(gM(),n);this.ws=r,r.addEventListener("open",()=>{this.reconnectDelay=Yy,this.emitState("connected"),this.selectedId&&this.send({type:"subscribe",id:this.selectedId})}),r.addEventListener("message",s=>{let i;try{i=JSON.parse(s.data)}catch{return}for(const o of this.msgHandlers)o(i)}),r.addEventListener("close",s=>{if(this.ws=null,this.emitState("disconnected"),s.code===MM){jS();return}this.closed||this.scheduleReconnect()}),r.addEventListener("error",()=>{})}scheduleReconnect(){this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout(()=>this.connect(),this.reconnectDelay),this.reconnectDelay=Math.min(this.reconnectDelay*2,DM)}send(t){return this.ws&&this.ws.readyState===WebSocket.OPEN?(this.ws.send(JSON.stringify(t)),!0):!1}isOpen(){return this.ws?.readyState===WebSocket.OPEN}select(t){this.selectedId!==t&&(this.selectedId&&this.send({type:"unsubscribe",id:this.selectedId}),this.selectedId=t,t&&this.send({type:"subscribe",id:t}))}resubscribe(){const t=this.selectedId;t&&(this.send({type:"unsubscribe",id:t}),this.send({type:"subscribe",id:t}))}onMessage(t){return this.msgHandlers.add(t),()=>this.msgHandlers.delete(t)}onState(t){return this.stateHandlers.add(t),()=>this.stateHandlers.delete(t)}emitState(t){for(const n of this.stateHandlers)n(t)}close(){this.closed=!0,this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.ws?.close(),this.ws=null}}const Qy=2e3;function OM(e,t){if(!e||e.length===0)return Xy(t);if(t.length===0)return e;const n=new Set;for(const s of e)n.add(s.uuid);const r=t.filter(s=>!n.has(s.uuid));return r.length===0?e:Xy([...e,...r])}function Xy(e){return e.length>Qy?e.slice(e.length-Qy):e}const zM=10*6e4;function FM(){const e=m.useRef(null);e.current||(e.current=new LM);const t=e.current,[n,r]=m.useState([]),[s,i]=m.useState(null),[o,a]=m.useState("connecting"),[l,u]=m.useState({snapshot:null,warning:null}),[c,f]=m.useState([]),[h,p]=m.useState(null),[g,y]=m.useState(null),[_,x]=m.useState({}),[v,w]=m.useState({}),[C,S]=m.useState({}),[k,T]=m.useState({}),R=m.useRef(null);R.current=s;const P=m.useRef([]);P.current=n,m.useEffect(()=>{const Z=t.onState(a),se=t.onMessage(ie=>{switch(ie.type){case"sessions":r(fe=>{const ut=new Map(fe.map(rt=>[rt.id,rt]));return(ie.sessions??[]).map(rt=>{const mt=ut.get(rt.id);return mt?{...rt,model:rt.model??mt.model,ctxPct:rt.ctxPct??mt.ctxPct}:rt})});break;case"messages":x(fe=>({...fe,[ie.id]:OM(fe[ie.id],ie.messages??[])})),w(fe=>({...fe,[ie.id]:ie.pending??null}));break;case"append":x(fe=>({...fe,[ie.id]:[...fe[ie.id]??[],...ie.messages??[]]}));break;case"pending":w(fe=>({...fe,[ie.id]:ie.pending})),r(fe=>fe.map(ut=>ut.id===ie.id?{...ut,pending:!!ie.pending}:ut));break;case"resources":{const fe=ie.snapshot??null;if(u({snapshot:fe,warning:ie.warning??null}),fe){const ut=Date.now(),rt={t:ut,cpu:fe.self?.cpuPct??0,mem:fe.system?.memUsedPct??0};f(mt=>[...mt,rt].filter(Pn=>ut-Pn.t<=zM))}break}case"capture":ie.id===R.current&&p(ie.text??"");break;case"shell-output":(!ie.id||ie.id===R.current)&&y(ie.text??"");break;case"prompt":T(fe=>({...fe,[ie.id]:ie.prompt}));break;case"subagents":S(fe=>({...fe,[ie.id]:Object.fromEntries((ie.subagents??[]).map(ut=>[ut.agentId,ut]))}));break;case"subagent":S(fe=>({...fe,[ie.id]:{...fe[ie.id]??{},[ie.subagent.agentId]:ie.subagent}}));break;case"ack":window.dispatchEvent(new CustomEvent("cockpit:ack",{detail:ie}));break}});return t.connect(),()=>{Z(),se()}},[t]),m.useEffect(()=>()=>t.close(),[t]);const E=m.useCallback(Z=>{Z!==R.current&&(i(Z),p(null),t.select(Z))},[t]),M=m.useCallback(Z=>{const se=R.current;return!se||!Z.trim()?!1:t.send({type:"reply",id:se,text:Z})},[t]),D=m.useCallback((Z,se)=>{const ie=R.current;return ie?t.send({type:"answer",id:ie,toolUseId:Z,selections:se}):!1},[t]),$=m.useCallback((Z,se)=>{const ie=R.current;return ie?t.send({type:"capture",id:ie,lines:Z,escapes:se}):!1},[t]),U=m.useCallback(()=>p(null),[]),V=m.useCallback(Z=>{const se=R.current;return se?t.send({type:"pane-text",id:se,text:Z}):!1},[t]),J=m.useCallback(Z=>{const se=R.current;return se?t.send({type:"pane-key",id:se,key:Z}):!1},[t]),te=m.useCallback(Z=>{const se=R.current;return se?t.send({type:"shell-input",id:se,line:Z}):!1},[t]),B=m.useCallback(Z=>{const se=R.current;return se?t.send({type:"shell-text",id:se,text:Z}):!1},[t]),z=m.useCallback(Z=>{const se=R.current;return se?t.send({type:"shell-key",id:se,key:Z}):!1},[t]),b=m.useCallback(Z=>{const se=R.current;return se?t.send({type:"shell-capture",id:se,lines:Z}):!1},[t]),H=m.useCallback(()=>y(null),[]),X=m.useCallback(()=>t.resubscribe(),[t]),I=m.useCallback(Z=>{const se=R.current;return se?t.send({type:"promptkey",id:se,key:Z}):!1},[t]),de=m.useCallback((Z,se)=>t.send({type:"promptselect",id:Z,labels:se}),[t]),Se=m.useMemo(()=>s!=null&&s in _,[s,_]),me=m.useMemo(()=>s?_[s]??[]:[],[s,_]),nt=m.useMemo(()=>s?v[s]??null:null,[s,v]),We=m.useMemo(()=>s?k[s]??null:null,[s,k]),Pe=m.useMemo(()=>{const Z=s?C[s]:null;return Z?Object.values(Z).sort((se,ie)=>(ie.createdAt??-1/0)-(se.createdAt??-1/0)):[]},[s,C]);return{sessions:n,selectedId:s,messages:me,messagesLoaded:Se,pending:nt,prompt:We,subagents:Pe,conn:o,resources:l,resourceHistory:c,capture:h,shellOutput:g,select:E,resubscribe:X,sendReply:M,sendPromptKey:I,sendPromptSelect:de,sendAnswer:D,requestCapture:$,clearCapture:U,sendPaneText:V,sendPaneKey:J,sendShellInput:te,sendShellText:B,sendShellKey:z,requestShellCapture:b,clearShellOutput:H}}const yd="cc:push:intent";function BM(){return typeof window>"u"||!("serviceWorker"in navigator)||!("PushManager"in window)||!("Notification"in window)?!1:window.isSecureContext===!0}function $M(){if(typeof navigator>"u")return!1;const e=navigator.userAgent||"",t=/iPad|iPhone|iPod/.test(e),n=navigator.platform==="MacIntel"&&typeof navigator.maxTouchPoints=="number"&&navigator.maxTouchPoints>1;return t||n}function Jy(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),r=window.atob(n),s=new ArrayBuffer(r.length),i=new Uint8Array(s);for(let o=0;o<r.length;o+=1)i[o]=r.charCodeAt(o);return s}function UM(){const e=BM(),t=$M(),[n,r]=m.useState(e?"off":"unsupported"),s=m.useCallback(async()=>{const a=await navigator.serviceWorker.register("/sw.js");if(await navigator.serviceWorker.ready,await Notification.requestPermission()!=="granted")return r("denied"),!1;const u=await vM();if(!u)return r("off"),!1;let c=await a.pushManager.getSubscription();if(c)try{const h=Jy(u),p=c.options?.applicationServerKey;let g=!1;if(p instanceof ArrayBuffer){const y=new Uint8Array(p),_=new Uint8Array(h);if(y.length!==_.length)g=!0;else for(let x=0;x<y.length;x++)if(y[x]!==_[x]){g=!0;break}}g&&(await c.unsubscribe(),c=null)}catch{}return c||(c=await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Jy(u)})),await xM(c.toJSON())},[]),i=m.useCallback(async()=>{if(e){r("working");try{await s()?(localStorage.setItem(yd,"1"),r("on")):r(l=>l==="denied"?"denied":"off")}catch{r("off")}}},[e,s]),o=m.useCallback(async()=>{r("working"),localStorage.removeItem(yd);try{const l=await(await navigator.serviceWorker.getRegistration())?.pushManager.getSubscription();l&&(await wM(l.endpoint),await l.unsubscribe())}catch{}r("off")},[]);return m.useEffect(()=>{if(!e||localStorage.getItem(yd)!=="1")return;if(Notification.permission!=="granted"){r(Notification.permission==="denied"?"denied":"off");return}let a=!1;return(async()=>{try{const l=await s();a||r(l?"on":"off")}catch{a||r("off")}})(),()=>{a=!0}},[e,s]),{status:n,supported:e,iosHint:t,enable:i,disable:o}}const Yf=70,VM=110,HM=.5,WM=".thread-viewport, .rail-scroll, .live-pane-body";function qM(e,t=()=>window.location.reload()){const[n,r]=m.useState(0),[s,i]=m.useState(!1),o=m.useRef(0),a=m.useRef(!1),l=m.useRef(0),u=m.useRef(null),c=f=>{o.current=f,r(f)};return m.useEffect(()=>{const f=e.current;if(!f)return;const h=y=>{if(y.touches.length!==1){a.current=!1;return}const x=y.target?.closest(WM)??null;x&&x.scrollTop<=0?(u.current=x,l.current=y.touches[0].clientY,a.current=!0):a.current=!1},p=y=>{if(!a.current)return;const _=y.touches[0].clientY-l.current,x=u.current;if(_<=0||x&&x.scrollTop>0){o.current!==0&&c(0),x&&x.scrollTop>0&&(a.current=!1);return}const v=Math.min(VM,_*HM);c(v),y.cancelable&&y.preventDefault()},g=()=>{a.current&&(a.current=!1,o.current>=Yf?(c(Yf),i(!0),setTimeout(t,150)):c(0))};return f.addEventListener("touchstart",h,{passive:!0}),f.addEventListener("touchmove",p,{passive:!1}),f.addEventListener("touchend",g,{passive:!0}),f.addEventListener("touchcancel",g,{passive:!0}),()=>{f.removeEventListener("touchstart",h),f.removeEventListener("touchmove",p),f.removeEventListener("touchend",g),f.removeEventListener("touchcancel",g)}},[e,t]),{pull:n,refreshing:s}}const KM=Yf,zu="__cockpitSummary";function GM(e){if(e&&typeof e=="object"&&zu in e){const t=e[zu];return typeof t=="string"?t:""}return""}function LS(e){if(!e||typeof e!="object")return e;const t={};for(const[n,r]of Object.entries(e))n!==zu&&(t[n]=r);return t}function YM(e){if(e&&typeof e=="object"&&"text"in e){const t=e;return{text:String(t.text??""),isError:!!t.isError}}return null}function OS(e){const t=new Map;for(const s of e)for(const i of s.blocks??[])i.kind==="tool_result"&&t.set(i.forId,{text:i.text??"",isError:!!i.isError});const n=[],r=new Set;return e.forEach((s,i)=>{const o=JM(s.blocks??[],t,s.role==="user");if(o.length===0)return;const a=s.role==="user"?"user":"assistant";let l=s.uuid||`m-${i}`;r.has(l)&&(l=`${l}#${i}`),r.add(l),n.push({role:a,id:l,createdAt:s.ts?new Date(s.ts):void 0,content:o,metadata:{custom:{cockpitRole:s.role}}})}),QM(n)}function QM(e){const t=r=>r.role==="assistant"&&(r.metadata?.custom?.cockpitRole??"assistant")==="assistant",n=[];for(const r of e){const s=n[n.length-1];s&&t(s)&&t(r)?n[n.length-1]={...s,content:[...s.content,...r.content]}:n.push(r)}return n}function XM(e){const t=e.trimStart();if(!t.startsWith("<"))return null;const n=/<summary>([\s\S]*?)<\/summary>/.exec(t)?.[1]?.trim();return t.startsWith("<task-notification")?`⚙ background task ${n?`— ${n}`:"update"}`:t.startsWith("<system-reminder")?"⚙ system reminder":t.startsWith("<command-name")||t.startsWith("<command-message")?"⌘ slash command":t.startsWith("<local-command-stdout")?"⌘ command output":t.startsWith("<user-prompt-submit-hook")||t.startsWith("<session-")?"⚙ session hook":null}function JM(e,t,n=!1){const r=[];for(const s of e)switch(s.kind){case"text":{if(s.text&&s.text.length>0){const i=n?XM(s.text):null;r.push({type:"text",text:i??s.text})}break}case"thinking":{s.text&&s.text.trim().length>0&&r.push({type:"reasoning",text:s.text});break}case"tool_use":{const i=t.get(s.id),o=s.input&&typeof s.input=="object"?s.input:s.input!=null?{value:s.input}:{};r.push({type:"tool-call",toolCallId:s.id,toolName:s.name||"tool",args:{...o,[zu]:s.inputSummary??""},argsText:s.inputSummary??"",result:i??void 0,isError:i?.isError});break}}return r}const ZM="image/*,application/pdf,text/*,.md,.json,.csv,.log",Qf=" cockpit-path:";function e2(e){return Qf+e}const Yl=new Map;function t2(e){return Yl.get(e)??null}function n2(e){for(const t of e.content??[])if(t.type==="text"&&t.text.startsWith(Qf))return t.text.slice(Qf.length);return t2(e.id)}function r2(e){return`${e.name}-${e.size}-${e.lastModified}`}function s2(e){return{accept:ZM,async add({file:t}){const n=r2(t),r=t.type.startsWith("image/"),s=t.type==="application/pdf",i={id:n,type:r?"image":s?"document":"file",name:t.name,contentType:t.type||"application/octet-stream",file:t};e(`Uploading ${t.name}…`);try{const o=await NM(t);return Yl.set(n,o.path),e(`Attached ${o.name}`,"ok"),{...i,status:{type:"requires-action",reason:"composer-send"}}}catch(o){const a=o instanceof Error?o.message:String(o);return e(`Attach failed: ${a}`,"error"),{...i,status:{type:"incomplete",reason:"error"}}}},async send(t){const n=Yl.get(t.id);if(!n)throw new Error(`attachment ${t.name} was not uploaded`);return{...t,status:{type:"complete"},content:[{type:"text",text:e2(n)}]}},async remove(t){Yl.delete(t.id)}}}function Ar(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zS(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}/*!
|
|
45
|
+
* GSAP 3.15.0
|
|
46
|
+
* https://gsap.com
|
|
47
|
+
*
|
|
48
|
+
* @license Copyright 2008-2026, GreenSock. All rights reserved.
|
|
49
|
+
* Subject to the terms at https://gsap.com/standard-license
|
|
50
|
+
* @author: Jack Doyle, jack@greensock.com
|
|
51
|
+
*/var bn={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Aa={duration:.5,overwrite:!1,delay:0},Wp,kt,He,Fn=1e8,Ne=1/Fn,Xf=Math.PI*2,i2=Xf/4,o2=0,FS=Math.sqrt,a2=Math.cos,l2=Math.sin,xt=function(t){return typeof t=="string"},et=function(t){return typeof t=="function"},Hr=function(t){return typeof t=="number"},qp=function(t){return typeof t>"u"},Sr=function(t){return typeof t=="object"},rn=function(t){return t!==!1},Kp=function(){return typeof window<"u"},Tl=function(t){return et(t)||xt(t)},BS=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Nt=Array.isArray,u2=/random\([^)]+\)/g,c2=/,\s*/g,Zy=/(?:-?\.?\d|\.)+/gi,$S=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Li=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,vd=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,US=/[+-]=-?[.\d]+/,d2=/[^,'"\[\]\s]+/gi,f2=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Ge,hr,Jf,Gp,En={},Fu={},VS,HS=function(t){return(Fu=oo(t,En))&&ln},Yp=function(t,n){return console.warn("Invalid property",t,"set to",n,"Missing plugin? gsap.registerPlugin()")},Na=function(t,n){return!n&&console.warn(t)},WS=function(t,n){return t&&(En[t]=n)&&Fu&&(Fu[t]=n)||En},Ma=function(){return 0},h2={suppressEvents:!0,isStart:!0,kill:!1},Ql={suppressEvents:!0,kill:!1},p2={suppressEvents:!0},Qp={},vs=[],Zf={},qS,gn={},xd={},ev=30,Xl=[],Xp="",Jp=function(t){var n=t[0],r,s;if(Sr(n)||et(n)||(t=[t]),!(r=(n._gsap||{}).harness)){for(s=Xl.length;s--&&!Xl[s].targetTest(n););r=Xl[s]}for(s=t.length;s--;)t[s]&&(t[s]._gsap||(t[s]._gsap=new pk(t[s],r)))||t.splice(s,1);return t},Gs=function(t){return t._gsap||Jp(Bn(t))[0]._gsap},KS=function(t,n,r){return(r=t[n])&&et(r)?t[n]():qp(r)&&t.getAttribute&&t.getAttribute(n)||r},sn=function(t,n){return(t=t.split(",")).forEach(n)||t},ot=function(t){return Math.round(t*1e5)/1e5||0},qe=function(t){return Math.round(t*1e7)/1e7||0},qi=function(t,n){var r=n.charAt(0),s=parseFloat(n.substr(2));return t=parseFloat(t),r==="+"?t+s:r==="-"?t-s:r==="*"?t*s:t/s},m2=function(t,n){for(var r=n.length,s=0;t.indexOf(n[s])<0&&++s<r;);return s<r},Bu=function(){var t=vs.length,n=vs.slice(0),r,s;for(Zf={},vs.length=0,r=0;r<t;r++)s=n[r],s&&s._lazy&&(s.render(s._lazy[0],s._lazy[1],!0)._lazy=0)},Zp=function(t){return!!(t._initted||t._startAt||t.add)},GS=function(t,n,r,s){vs.length&&!kt&&Bu(),t.render(n,r,!!(kt&&n<0&&Zp(t))),vs.length&&!kt&&Bu()},YS=function(t){var n=parseFloat(t);return(n||n===0)&&(t+"").match(d2).length<2?n:xt(t)?t.trim():t},QS=function(t){return t},Tn=function(t,n){for(var r in n)r in t||(t[r]=n[r]);return t},g2=function(t){return function(n,r){for(var s in r)s in n||s==="duration"&&t||s==="ease"||(n[s]=r[s])}},oo=function(t,n){for(var r in n)t[r]=n[r];return t},tv=function e(t,n){for(var r in n)r!=="__proto__"&&r!=="constructor"&&r!=="prototype"&&(t[r]=Sr(n[r])?e(t[r]||(t[r]={}),n[r]):n[r]);return t},$u=function(t,n){var r={},s;for(s in t)s in n||(r[s]=t[s]);return r},sa=function(t){var n=t.parent||Ge,r=t.keyframes?g2(Nt(t.keyframes)):Tn;if(rn(t.inherit))for(;n;)r(t,n.vars.defaults),n=n.parent||n._dp;return t},y2=function(t,n){for(var r=t.length,s=r===n.length;s&&r--&&t[r]===n[r];);return r<0},XS=function(t,n,r,s,i){var o=t[s],a;if(i)for(a=n[i];o&&o[i]>a;)o=o._prev;return o?(n._next=o._next,o._next=n):(n._next=t[r],t[r]=n),n._next?n._next._prev=n:t[s]=n,n._prev=o,n.parent=n._dp=t,n},Sc=function(t,n,r,s){r===void 0&&(r="_first"),s===void 0&&(s="_last");var i=n._prev,o=n._next;i?i._next=o:t[r]===n&&(t[r]=o),o?o._prev=i:t[s]===n&&(t[s]=i),n._next=n._prev=n.parent=null},ks=function(t,n){t.parent&&(!n||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},Ys=function(t,n){if(t&&(!n||n._end>t._dur||n._start<0))for(var r=t;r;)r._dirty=1,r=r.parent;return t},v2=function(t){for(var n=t.parent;n&&n.parent;)n._dirty=1,n.totalDuration(),n=n.parent;return t},eh=function(t,n,r,s){return t._startAt&&(kt?t._startAt.revert(Ql):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(n,!0,s))},x2=function e(t){return!t||t._ts&&e(t.parent)},nv=function(t){return t._repeat?ao(t._tTime,t=t.duration()+t._rDelay)*t:0},ao=function(t,n){var r=Math.floor(t=qe(t/n));return t&&r===t?r-1:r},Uu=function(t,n){return(t-n._start)*n._ts+(n._ts>=0?0:n._dirty?n.totalDuration():n._tDur)},kc=function(t){return t._end=qe(t._start+(t._tDur/Math.abs(t._ts||t._rts||Ne)||0))},Cc=function(t,n){var r=t._dp;return r&&r.smoothChildTiming&&t._ts&&(t._start=qe(r._time-(t._ts>0?n/t._ts:((t._dirty?t.totalDuration():t._tDur)-n)/-t._ts)),kc(t),r._dirty||Ys(r,t)),t},JS=function(t,n){var r;if((n._time||!n._dur&&n._initted||n._start<t._time&&(n._dur||!n.add))&&(r=Uu(t.rawTime(),n),(!n._dur||Xa(0,n.totalDuration(),r)-n._tTime>Ne)&&n.render(r,!0)),Ys(t,n)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(r=t;r._dp;)r.rawTime()>=0&&r.totalTime(r._tTime),r=r._dp;t._zTime=-Ne}},mr=function(t,n,r,s){return n.parent&&ks(n),n._start=qe((Hr(r)?r:r||t!==Ge?Mn(t,r,n):t._time)+n._delay),n._end=qe(n._start+(n.totalDuration()/Math.abs(n.timeScale())||0)),XS(t,n,"_first","_last",t._sort?"_start":0),th(n)||(t._recent=n),s||JS(t,n),t._ts<0&&Cc(t,t._tTime),t},ZS=function(t,n){return(En.ScrollTrigger||Yp("scrollTrigger",n))&&En.ScrollTrigger.create(n,t)},ek=function(t,n,r,s,i){if(tm(t,n,i),!t._initted)return 1;if(!r&&t._pt&&!kt&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&qS!==yn.frame)return vs.push(t),t._lazy=[i,s],1},w2=function e(t){var n=t.parent;return n&&n._ts&&n._initted&&!n._lock&&(n.rawTime()<0||e(n))},th=function(t){var n=t.data;return n==="isFromStart"||n==="isStart"},_2=function(t,n,r,s){var i=t.ratio,o=n<0||!n&&(!t._start&&w2(t)&&!(!t._initted&&th(t))||(t._ts<0||t._dp._ts<0)&&!th(t))?0:1,a=t._rDelay,l=0,u,c,f;if(a&&t._repeat&&(l=Xa(0,t._tDur,n),c=ao(l,a),t._yoyo&&c&1&&(o=1-o),c!==ao(t._tTime,a)&&(i=1-o,t.vars.repeatRefresh&&t._initted&&t.invalidate())),o!==i||kt||s||t._zTime===Ne||!n&&t._zTime){if(!t._initted&&ek(t,n,s,r,l))return;for(f=t._zTime,t._zTime=n||(r?Ne:0),r||(r=n&&!f),t.ratio=o,t._from&&(o=1-o),t._time=0,t._tTime=l,u=t._pt;u;)u.r(o,u.d),u=u._next;n<0&&eh(t,n,r,!0),t._onUpdate&&!r&&xn(t,"onUpdate"),l&&t._repeat&&!r&&t.parent&&xn(t,"onRepeat"),(n>=t._tDur||n<0)&&t.ratio===o&&(o&&ks(t,1),!r&&!kt&&(xn(t,o?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=n)},b2=function(t,n,r){var s;if(r>n)for(s=t._first;s&&s._start<=r;){if(s.data==="isPause"&&s._start>n)return s;s=s._next}else for(s=t._last;s&&s._start>=r;){if(s.data==="isPause"&&s._start<n)return s;s=s._prev}},lo=function(t,n,r,s){var i=t._repeat,o=qe(n)||0,a=t._tTime/t._tDur;return a&&!s&&(t._time*=o/t._dur),t._dur=o,t._tDur=i?i<0?1e10:qe(o*(i+1)+t._rDelay*i):o,a>0&&!s&&Cc(t,t._tTime=t._tDur*a),t.parent&&kc(t),r||Ys(t.parent,t),t},rv=function(t){return t instanceof Qt?Ys(t):lo(t,t._dur)},S2={_start:0,endTime:Ma,totalDuration:Ma},Mn=function e(t,n,r){var s=t.labels,i=t._recent||S2,o=t.duration()>=Fn?i.endTime(!1):t._dur,a,l,u;return xt(n)&&(isNaN(n)||n in s)?(l=n.charAt(0),u=n.substr(-1)==="%",a=n.indexOf("="),l==="<"||l===">"?(a>=0&&(n=n.replace(/=/,"")),(l==="<"?i._start:i.endTime(i._repeat>=0))+(parseFloat(n.substr(1))||0)*(u?(a<0?i:r).totalDuration()/100:1)):a<0?(n in s||(s[n]=o),s[n]):(l=parseFloat(n.charAt(a-1)+n.substr(a+1)),u&&r&&(l=l/100*(Nt(r)?r[0]:r).totalDuration()),a>1?e(t,n.substr(0,a-1),r)+l:o+l)):n==null?o:+n},ia=function(t,n,r){var s=Hr(n[1]),i=(s?2:1)+(t<2?0:1),o=n[i],a,l;if(s&&(o.duration=n[1]),o.parent=r,t){for(a=o,l=r;l&&!("immediateRender"in a);)a=l.vars.defaults||{},l=rn(l.vars.inherit)&&l.parent;o.immediateRender=rn(a.immediateRender),t<2?o.runBackwards=1:o.startAt=n[i-1]}return new dt(n[0],o,n[i+1])},Ps=function(t,n){return t||t===0?n(t):n},Xa=function(t,n,r){return r<t?t:r>n?n:r},jt=function(t,n){return!xt(t)||!(n=f2.exec(t))?"":n[1]},k2=function(t,n,r){return Ps(r,function(s){return Xa(t,n,s)})},nh=[].slice,tk=function(t,n){return t&&Sr(t)&&"length"in t&&(!n&&!t.length||t.length-1 in t&&Sr(t[0]))&&!t.nodeType&&t!==hr},C2=function(t,n,r){return r===void 0&&(r=[]),t.forEach(function(s){var i;return xt(s)&&!n||tk(s,1)?(i=r).push.apply(i,Bn(s)):r.push(s)})||r},Bn=function(t,n,r){return He&&!n&&He.selector?He.selector(t):xt(t)&&!r&&(Jf||!uo())?nh.call((n||Gp).querySelectorAll(t),0):Nt(t)?C2(t,r):tk(t)?nh.call(t,0):t?[t]:[]},rh=function(t){return t=Bn(t)[0]||Na("Invalid scope")||{},function(n){var r=t.current||t.nativeElement||t;return Bn(n,r.querySelectorAll?r:r===t?Na("Invalid scope")||Gp.createElement("div"):t)}},nk=function(t){return t.sort(function(){return .5-Math.random()})},rk=function(t){if(et(t))return t;var n=Sr(t)?t:{each:t},r=Qs(n.ease),s=n.from||0,i=parseFloat(n.base)||0,o={},a=s>0&&s<1,l=isNaN(s)||a,u=n.axis,c=s,f=s;return xt(s)?c=f={center:.5,edges:.5,end:1}[s]||0:!a&&l&&(c=s[0],f=s[1]),function(h,p,g){var y=(g||n).length,_=o[y],x,v,w,C,S,k,T,R,P;if(!_){if(P=n.grid==="auto"?0:(n.grid||[1,Fn])[1],!P){for(T=-Fn;T<(T=g[P++].getBoundingClientRect().left)&&P<y;);P<y&&P--}for(_=o[y]=[],x=l?Math.min(P,y)*c-.5:s%P,v=P===Fn?0:l?y*f/P-.5:s/P|0,T=0,R=Fn,k=0;k<y;k++)w=k%P-x,C=v-(k/P|0),_[k]=S=u?Math.abs(u==="y"?C:w):FS(w*w+C*C),S>T&&(T=S),S<R&&(R=S);s==="random"&&nk(_),_.max=T-R,_.min=R,_.v=y=(parseFloat(n.amount)||parseFloat(n.each)*(P>y?y-1:u?u==="y"?y/P:P:Math.max(P,y/P))||0)*(s==="edges"?-1:1),_.b=y<0?i-y:i,_.u=jt(n.amount||n.each)||0,r=r&&y<0?z2(r):r}return y=(_[h]-_.min)/_.max||0,qe(_.b+(r?r(y):y)*_.v)+_.u}},sh=function(t){var n=Math.pow(10,((t+"").split(".")[1]||"").length);return function(r){var s=qe(Math.round(parseFloat(r)/t)*t*n);return(s-s%1)/n+(Hr(r)?0:jt(r))}},sk=function(t,n){var r=Nt(t),s,i;return!r&&Sr(t)&&(s=r=t.radius||Fn,t.values?(t=Bn(t.values),(i=!Hr(t[0]))&&(s*=s)):t=sh(t.increment)),Ps(n,r?et(t)?function(o){return i=t(o),Math.abs(i-o)<=s?i:o}:function(o){for(var a=parseFloat(i?o.x:o),l=parseFloat(i?o.y:0),u=Fn,c=0,f=t.length,h,p;f--;)i?(h=t[f].x-a,p=t[f].y-l,h=h*h+p*p):h=Math.abs(t[f]-a),h<u&&(u=h,c=f);return c=!s||u<=s?t[c]:o,i||c===o||Hr(o)?c:c+jt(o)}:sh(t))},ik=function(t,n,r,s){return Ps(Nt(t)?!n:r===!0?!!(r=0):!s,function(){return Nt(t)?t[~~(Math.random()*t.length)]:(r=r||1e-5)&&(s=r<1?Math.pow(10,(r+"").length-2):1)&&Math.floor(Math.round((t-r/2+Math.random()*(n-t+r*.99))/r)*r*s)/s})},E2=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(s){return n.reduce(function(i,o){return o(i)},s)}},T2=function(t,n){return function(r){return t(parseFloat(r))+(n||jt(r))}},I2=function(t,n,r){return ak(t,n,0,1,r)},ok=function(t,n,r){return Ps(r,function(s){return t[~~n(s)]})},R2=function e(t,n,r){var s=n-t;return Nt(t)?ok(t,e(0,t.length),n):Ps(r,function(i){return(s+(i-t)%s)%s+t})},P2=function e(t,n,r){var s=n-t,i=s*2;return Nt(t)?ok(t,e(0,t.length-1),n):Ps(r,function(o){return o=(i+(o-t)%i)%i||0,t+(o>s?i-o:o)})},Da=function(t){return t.replace(u2,function(n){var r=n.indexOf("[")+1,s=n.substring(r||7,r?n.indexOf("]"):n.length-1).split(c2);return ik(r?s:+s[0],r?0:+s[1],+s[2]||1e-5)})},ak=function(t,n,r,s,i){var o=n-t,a=s-r;return Ps(i,function(l){return r+((l-t)/o*a||0)})},j2=function e(t,n,r,s){var i=isNaN(t+n)?0:function(p){return(1-p)*t+p*n};if(!i){var o=xt(t),a={},l,u,c,f,h;if(r===!0&&(s=1)&&(r=null),o)t={p:t},n={p:n};else if(Nt(t)&&!Nt(n)){for(c=[],f=t.length,h=f-2,u=1;u<f;u++)c.push(e(t[u-1],t[u]));f--,i=function(g){g*=f;var y=Math.min(h,~~g);return c[y](g-y)},r=n}else s||(t=oo(Nt(t)?[]:{},t));if(!c){for(l in n)em.call(a,t,l,"get",n[l]);i=function(g){return sm(g,a)||(o?t.p:t)}}}return Ps(r,i)},sv=function(t,n,r){var s=t.labels,i=Fn,o,a,l;for(o in s)a=s[o]-n,a<0==!!r&&a&&i>(a=Math.abs(a))&&(l=o,i=a);return l},xn=function(t,n,r){var s=t.vars,i=s[n],o=He,a=t._ctx,l,u,c;if(i)return l=s[n+"Params"],u=s.callbackScope||t,r&&vs.length&&Bu(),a&&(He=a),c=l?i.apply(u,l):i.call(u),He=o,c},Uo=function(t){return ks(t),t.scrollTrigger&&t.scrollTrigger.kill(!!kt),t.progress()<1&&xn(t,"onInterrupt"),t},Oi,lk=[],uk=function(t){if(t)if(t=!t.name&&t.default||t,Kp()||t.headless){var n=t.name,r=et(t),s=n&&!r&&t.init?function(){this._props=[]}:t,i={init:Ma,render:sm,add:em,kill:G2,modifier:K2,rawVars:0},o={targetTest:0,get:0,getSetter:rm,aliases:{},register:0};if(uo(),t!==s){if(gn[n])return;Tn(s,Tn($u(t,i),o)),oo(s.prototype,oo(i,$u(t,o))),gn[s.prop=n]=s,t.targetTest&&(Xl.push(s),Qp[n]=1),n=(n==="css"?"CSS":n.charAt(0).toUpperCase()+n.substr(1))+"Plugin"}WS(n,s),t.register&&t.register(ln,s,on)}else lk.push(t)},je=255,Vo={aqua:[0,je,je],lime:[0,je,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,je],navy:[0,0,128],white:[je,je,je],olive:[128,128,0],yellow:[je,je,0],orange:[je,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[je,0,0],pink:[je,192,203],cyan:[0,je,je],transparent:[je,je,je,0]},wd=function(t,n,r){return t+=t<0?1:t>1?-1:0,(t*6<1?n+(r-n)*t*6:t<.5?r:t*3<2?n+(r-n)*(2/3-t)*6:n)*je+.5|0},ck=function(t,n,r){var s=t?Hr(t)?[t>>16,t>>8&je,t&je]:0:Vo.black,i,o,a,l,u,c,f,h,p,g;if(!s){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),Vo[t])s=Vo[t];else if(t.charAt(0)==="#"){if(t.length<6&&(i=t.charAt(1),o=t.charAt(2),a=t.charAt(3),t="#"+i+i+o+o+a+a+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return s=parseInt(t.substr(1,6),16),[s>>16,s>>8&je,s&je,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),s=[t>>16,t>>8&je,t&je]}else if(t.substr(0,3)==="hsl"){if(s=g=t.match(Zy),!n)l=+s[0]%360/360,u=+s[1]/100,c=+s[2]/100,o=c<=.5?c*(u+1):c+u-c*u,i=c*2-o,s.length>3&&(s[3]*=1),s[0]=wd(l+1/3,i,o),s[1]=wd(l,i,o),s[2]=wd(l-1/3,i,o);else if(~t.indexOf("="))return s=t.match($S),r&&s.length<4&&(s[3]=1),s}else s=t.match(Zy)||Vo.transparent;s=s.map(Number)}return n&&!g&&(i=s[0]/je,o=s[1]/je,a=s[2]/je,f=Math.max(i,o,a),h=Math.min(i,o,a),c=(f+h)/2,f===h?l=u=0:(p=f-h,u=c>.5?p/(2-f-h):p/(f+h),l=f===i?(o-a)/p+(o<a?6:0):f===o?(a-i)/p+2:(i-o)/p+4,l*=60),s[0]=~~(l+.5),s[1]=~~(u*100+.5),s[2]=~~(c*100+.5)),r&&s.length<4&&(s[3]=1),s},dk=function(t){var n=[],r=[],s=-1;return t.split(xs).forEach(function(i){var o=i.match(Li)||[];n.push.apply(n,o),r.push(s+=o.length+1)}),n.c=r,n},iv=function(t,n,r){var s="",i=(t+s).match(xs),o=n?"hsla(":"rgba(",a=0,l,u,c,f;if(!i)return t;if(i=i.map(function(h){return(h=ck(h,n,1))&&o+(n?h[0]+","+h[1]+"%,"+h[2]+"%,"+h[3]:h.join(","))+")"}),r&&(c=dk(t),l=r.c,l.join(s)!==c.c.join(s)))for(u=t.replace(xs,"1").split(Li),f=u.length-1;a<f;a++)s+=u[a]+(~l.indexOf(a)?i.shift()||o+"0,0,0,0)":(c.length?c:i.length?i:r).shift());if(!u)for(u=t.split(xs),f=u.length-1;a<f;a++)s+=u[a]+i[a];return s+u[f]},xs=function(){var e="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b",t;for(t in Vo)e+="|"+t+"\\b";return new RegExp(e+")","gi")}(),A2=/hsl[a]?\(/,fk=function(t){var n=t.join(" "),r;if(xs.lastIndex=0,xs.test(n))return r=A2.test(n),t[1]=iv(t[1],r),t[0]=iv(t[0],r,dk(t[1])),!0},La,yn=function(){var e=Date.now,t=500,n=33,r=e(),s=r,i=1e3/240,o=i,a=[],l,u,c,f,h,p,g=function y(_){var x=e()-s,v=_===!0,w,C,S,k;if((x>t||x<0)&&(r+=x-n),s+=x,S=s-r,w=S-o,(w>0||v)&&(k=++f.frame,h=S-f.time*1e3,f.time=S=S/1e3,o+=w+(w>=i?4:i-w),C=1),v||(l=u(y)),C)for(p=0;p<a.length;p++)a[p](S,h,k,_)};return f={time:0,frame:0,tick:function(){g(!0)},deltaRatio:function(_){return h/(1e3/(_||60))},wake:function(){VS&&(!Jf&&Kp()&&(hr=Jf=window,Gp=hr.document||{},En.gsap=ln,(hr.gsapVersions||(hr.gsapVersions=[])).push(ln.version),HS(Fu||hr.GreenSockGlobals||!hr.gsap&&hr||{}),lk.forEach(uk)),c=typeof requestAnimationFrame<"u"&&requestAnimationFrame,l&&f.sleep(),u=c||function(_){return setTimeout(_,o-f.time*1e3+1|0)},La=1,g(2))},sleep:function(){(c?cancelAnimationFrame:clearTimeout)(l),La=0,u=Ma},lagSmoothing:function(_,x){t=_||1/0,n=Math.min(x||33,t)},fps:function(_){i=1e3/(_||240),o=f.time*1e3+i},add:function(_,x,v){var w=x?function(C,S,k,T){_(C,S,k,T),f.remove(w)}:_;return f.remove(_),a[v?"unshift":"push"](w),uo(),w},remove:function(_,x){~(x=a.indexOf(_))&&a.splice(x,1)&&p>=x&&p--},_listeners:a},f}(),uo=function(){return!La&&yn.wake()},be={},N2=/^[\d.\-M][\d.\-,\s]/,M2=/["']/g,D2=function(t){for(var n={},r=t.substr(1,t.length-3).split(":"),s=r[0],i=1,o=r.length,a,l,u;i<o;i++)l=r[i],a=i!==o-1?l.lastIndexOf(","):l.length,u=l.substr(0,a),n[s]=isNaN(u)?u.replace(M2,"").trim():+u,s=l.substr(a+1).trim();return n},L2=function(t){var n=t.indexOf("(")+1,r=t.indexOf(")"),s=t.indexOf("(",n);return t.substring(n,~s&&s<r?t.indexOf(")",r+1):r)},O2=function(t){var n=(t+"").split("("),r=be[n[0]];return r&&n.length>1&&r.config?r.config.apply(null,~t.indexOf("{")?[D2(n[1])]:L2(t).split(",").map(YS)):be._CE&&N2.test(t)?be._CE("",t):r},z2=function(t){return function(n){return 1-t(1-n)}},Qs=function(t,n){return t&&(et(t)?t:be[t]||O2(t))||n},pi=function(t,n,r,s){r===void 0&&(r=function(l){return 1-n(1-l)}),s===void 0&&(s=function(l){return l<.5?n(l*2)/2:1-n((1-l)*2)/2});var i={easeIn:n,easeOut:r,easeInOut:s},o;return sn(t,function(a){be[a]=En[a]=i,be[o=a.toLowerCase()]=r;for(var l in i)be[o+(l==="easeIn"?".in":l==="easeOut"?".out":".inOut")]=be[a+"."+l]=i[l]}),i},hk=function(t){return function(n){return n<.5?(1-t(1-n*2))/2:.5+t((n-.5)*2)/2}},_d=function e(t,n,r){var s=n>=1?n:1,i=(r||(t?.3:.45))/(n<1?n:1),o=i/Xf*(Math.asin(1/s)||0),a=function(c){return c===1?1:s*Math.pow(2,-10*c)*l2((c-o)*i)+1},l=t==="out"?a:t==="in"?function(u){return 1-a(1-u)}:hk(a);return i=Xf/i,l.config=function(u,c){return e(t,u,c)},l},bd=function e(t,n){n===void 0&&(n=1.70158);var r=function(o){return o?--o*o*((n+1)*o+n)+1:0},s=t==="out"?r:t==="in"?function(i){return 1-r(1-i)}:hk(r);return s.config=function(i){return e(t,i)},s};sn("Linear,Quad,Cubic,Quart,Quint,Strong",function(e,t){var n=t<5?t+1:t;pi(e+",Power"+(n-1),t?function(r){return Math.pow(r,n)}:function(r){return r},function(r){return 1-Math.pow(1-r,n)},function(r){return r<.5?Math.pow(r*2,n)/2:1-Math.pow((1-r)*2,n)/2})});be.Linear.easeNone=be.none=be.Linear.easeIn;pi("Elastic",_d("in"),_d("out"),_d());(function(e,t){var n=1/t,r=2*n,s=2.5*n,i=function(a){return a<n?e*a*a:a<r?e*Math.pow(a-1.5/t,2)+.75:a<s?e*(a-=2.25/t)*a+.9375:e*Math.pow(a-2.625/t,2)+.984375};pi("Bounce",function(o){return 1-i(1-o)},i)})(7.5625,2.75);pi("Expo",function(e){return Math.pow(2,10*(e-1))*e+e*e*e*e*e*e*(1-e)});pi("Circ",function(e){return-(FS(1-e*e)-1)});pi("Sine",function(e){return e===1?1:-a2(e*i2)+1});pi("Back",bd("in"),bd("out"),bd());be.SteppedEase=be.steps=En.SteppedEase={config:function(t,n){t===void 0&&(t=1);var r=1/t,s=t+(n?0:1),i=n?1:0,o=1-Ne;return function(a){return((s*Xa(0,o,a)|0)+i)*r}}};Aa.ease=be["quad.out"];sn("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(e){return Xp+=e+","+e+"Params,"});var pk=function(t,n){this.id=o2++,t._gsap=this,this.target=t,this.harness=n,this.get=n?n.get:KS,this.set=n?n.getSetter:rm},Oa=function(){function e(n){this.vars=n,this._delay=+n.delay||0,(this._repeat=n.repeat===1/0?-2:n.repeat||0)&&(this._rDelay=n.repeatDelay||0,this._yoyo=!!n.yoyo||!!n.yoyoEase),this._ts=1,lo(this,+n.duration,1,1),this.data=n.data,He&&(this._ctx=He,He.data.push(this)),La||yn.wake()}var t=e.prototype;return t.delay=function(r){return r||r===0?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+r-this._delay),this._delay=r,this):this._delay},t.duration=function(r){return arguments.length?this.totalDuration(this._repeat>0?r+(r+this._rDelay)*this._repeat:r):this.totalDuration()&&this._dur},t.totalDuration=function(r){return arguments.length?(this._dirty=0,lo(this,this._repeat<0?r:(r-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(r,s){if(uo(),!arguments.length)return this._tTime;var i=this._dp;if(i&&i.smoothChildTiming&&this._ts){for(Cc(this,r),!i._dp||i.parent||JS(i,this);i&&i.parent;)i.parent._time!==i._start+(i._ts>=0?i._tTime/i._ts:(i.totalDuration()-i._tTime)/-i._ts)&&i.totalTime(i._tTime,!0),i=i.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&r<this._tDur||this._ts<0&&r>0||!this._tDur&&!r)&&mr(this._dp,this,this._start-this._delay)}return(this._tTime!==r||!this._dur&&!s||this._initted&&Math.abs(this._zTime)===Ne||!this._initted&&this._dur&&r||!r&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=r),GS(this,r,s)),this},t.time=function(r,s){return arguments.length?this.totalTime(Math.min(this.totalDuration(),r+nv(this))%(this._dur+this._rDelay)||(r?this._dur:0),s):this._time},t.totalProgress=function(r,s){return arguments.length?this.totalTime(this.totalDuration()*r,s):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>=0&&this._initted?1:0},t.progress=function(r,s){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-r:r)+nv(this),s):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(r,s){var i=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(r-1)*i,s):this._repeat?ao(this._tTime,i)+1:1},t.timeScale=function(r,s){if(!arguments.length)return this._rts===-Ne?0:this._rts;if(this._rts===r)return this;var i=this.parent&&this._ts?Uu(this.parent._time,this):this._tTime;return this._rts=+r||0,this._ts=this._ps||r===-Ne?0:this._rts,this.totalTime(Xa(-Math.abs(this._delay),this.totalDuration(),i),s!==!1),kc(this),v2(this)},t.paused=function(r){return arguments.length?(this._ps!==r&&(this._ps=r,r?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(uo(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Ne&&(this._tTime-=Ne)))),this):this._ps},t.startTime=function(r){if(arguments.length){this._start=qe(r);var s=this.parent||this._dp;return s&&(s._sort||!this.parent)&&mr(s,this,this._start-this._delay),this}return this._start},t.endTime=function(r){return this._start+(rn(r)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(r){var s=this.parent||this._dp;return s?r&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?Uu(s.rawTime(r),this):this._tTime:this._tTime},t.revert=function(r){r===void 0&&(r=p2);var s=kt;return kt=r,Zp(this)&&(this.timeline&&this.timeline.revert(r),this.totalTime(-.01,r.suppressEvents)),this.data!=="nested"&&r.kill!==!1&&this.kill(),kt=s,this},t.globalTime=function(r){for(var s=this,i=arguments.length?r:s.rawTime();s;)i=s._start+i/(Math.abs(s._ts)||1),s=s._dp;return!this.parent&&this._sat?this._sat.globalTime(r):i},t.repeat=function(r){return arguments.length?(this._repeat=r===1/0?-2:r,rv(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(r){if(arguments.length){var s=this._time;return this._rDelay=r,rv(this),s?this.time(s):this}return this._rDelay},t.yoyo=function(r){return arguments.length?(this._yoyo=r,this):this._yoyo},t.seek=function(r,s){return this.totalTime(Mn(this,r),rn(s))},t.restart=function(r,s){return this.play().totalTime(r?-this._delay:0,rn(s)),this._dur||(this._zTime=-Ne),this},t.play=function(r,s){return r!=null&&this.seek(r,s),this.reversed(!1).paused(!1)},t.reverse=function(r,s){return r!=null&&this.seek(r||this.totalDuration(),s),this.reversed(!0).paused(!1)},t.pause=function(r,s){return r!=null&&this.seek(r,s),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(r){return arguments.length?(!!r!==this.reversed()&&this.timeScale(-this._rts||(r?-Ne:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-Ne,this},t.isActive=function(){var r=this.parent||this._dp,s=this._start,i;return!!(!r||this._ts&&this._initted&&r.isActive()&&(i=r.rawTime(!0))>=s&&i<this.endTime(!0)-Ne)},t.eventCallback=function(r,s,i){var o=this.vars;return arguments.length>1?(s?(o[r]=s,i&&(o[r+"Params"]=i),r==="onUpdate"&&(this._onUpdate=s)):delete o[r],this):o[r]},t.then=function(r){var s=this,i=s._prom;return new Promise(function(o){var a=et(r)?r:QS,l=function(){var c=s.then;s.then=null,i&&i(),et(a)&&(a=a(s))&&(a.then||a===s)&&(s.then=c),o(a),s.then=c};s._initted&&s.totalProgress()===1&&s._ts>=0||!s._tTime&&s._ts<0?l():s._prom=l})},t.kill=function(){Uo(this)},e}();Tn(Oa.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Ne,_prom:0,_ps:!1,_rts:1});var Qt=function(e){zS(t,e);function t(r,s){var i;return r===void 0&&(r={}),i=e.call(this,r)||this,i.labels={},i.smoothChildTiming=!!r.smoothChildTiming,i.autoRemoveChildren=!!r.autoRemoveChildren,i._sort=rn(r.sortChildren),Ge&&mr(r.parent||Ge,Ar(i),s),r.reversed&&i.reverse(),r.paused&&i.paused(!0),r.scrollTrigger&&ZS(Ar(i),r.scrollTrigger),i}var n=t.prototype;return n.to=function(s,i,o){return ia(0,arguments,this),this},n.from=function(s,i,o){return ia(1,arguments,this),this},n.fromTo=function(s,i,o,a){return ia(2,arguments,this),this},n.set=function(s,i,o){return i.duration=0,i.parent=this,sa(i).repeatDelay||(i.repeat=0),i.immediateRender=!!i.immediateRender,new dt(s,i,Mn(this,o),1),this},n.call=function(s,i,o){return mr(this,dt.delayedCall(0,s,i),o)},n.staggerTo=function(s,i,o,a,l,u,c){return o.duration=i,o.stagger=o.stagger||a,o.onComplete=u,o.onCompleteParams=c,o.parent=this,new dt(s,o,Mn(this,l)),this},n.staggerFrom=function(s,i,o,a,l,u,c){return o.runBackwards=1,sa(o).immediateRender=rn(o.immediateRender),this.staggerTo(s,i,o,a,l,u,c)},n.staggerFromTo=function(s,i,o,a,l,u,c,f){return a.startAt=o,sa(a).immediateRender=rn(a.immediateRender),this.staggerTo(s,i,a,l,u,c,f)},n.render=function(s,i,o){var a=this._time,l=this._dirty?this.totalDuration():this._tDur,u=this._dur,c=s<=0?0:qe(s),f=this._zTime<0!=s<0&&(this._initted||!u),h,p,g,y,_,x,v,w,C,S,k,T;if(this!==Ge&&c>l&&s>=0&&(c=l),c!==this._tTime||o||f){if(a!==this._time&&u&&(c+=this._time-a,s+=this._time-a),h=c,C=this._start,w=this._ts,x=!w,f&&(u||(a=this._zTime),(s||!i)&&(this._zTime=s)),this._repeat){if(k=this._yoyo,_=u+this._rDelay,this._repeat<-1&&s<0)return this.totalTime(_*100+s,i,o);if(h=qe(c%_),c===l?(y=this._repeat,h=u):(S=qe(c/_),y=~~S,y&&y===S&&(h=u,y--),h>u&&(h=u)),S=ao(this._tTime,_),!a&&this._tTime&&S!==y&&this._tTime-S*_-this._dur<=0&&(S=y),k&&y&1&&(h=u-h,T=1),y!==S&&!this._lock){var R=k&&S&1,P=R===(k&&y&1);if(y<S&&(R=!R),a=R?0:c%u?u:c,this._lock=1,this.render(a||(T?0:qe(y*_)),i,!u)._lock=0,this._tTime=c,!i&&this.parent&&xn(this,"onRepeat"),this.vars.repeatRefresh&&!T&&(this.invalidate()._lock=1,S=y),a&&a!==this._time||x!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(u=this._dur,l=this._tDur,P&&(this._lock=2,a=R?u:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!T&&this.invalidate()),this._lock=0,!this._ts&&!x)return this}}if(this._hasPause&&!this._forcing&&this._lock<2&&(v=b2(this,qe(a),qe(h)),v&&(c-=h-(h=v._start))),this._tTime=c,this._time=h,this._act=!!w,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=s,a=0),!a&&c&&u&&!i&&!S&&(xn(this,"onStart"),this._tTime!==c))return this;if(h>=a&&s>=0)for(p=this._first;p;){if(g=p._next,(p._act||h>=p._start)&&p._ts&&v!==p){if(p.parent!==this)return this.render(s,i,o);if(p.render(p._ts>0?(h-p._start)*p._ts:(p._dirty?p.totalDuration():p._tDur)+(h-p._start)*p._ts,i,o),h!==this._time||!this._ts&&!x){v=0,g&&(c+=this._zTime=-Ne);break}}p=g}else{p=this._last;for(var E=s<0?s:h;p;){if(g=p._prev,(p._act||E<=p._end)&&p._ts&&v!==p){if(p.parent!==this)return this.render(s,i,o);if(p.render(p._ts>0?(E-p._start)*p._ts:(p._dirty?p.totalDuration():p._tDur)+(E-p._start)*p._ts,i,o||kt&&Zp(p)),h!==this._time||!this._ts&&!x){v=0,g&&(c+=this._zTime=E?-Ne:Ne);break}}p=g}}if(v&&!i&&(this.pause(),v.render(h>=a?0:-Ne)._zTime=h>=a?1:-1,this._ts))return this._start=C,kc(this),this.render(s,i,o);this._onUpdate&&!i&&xn(this,"onUpdate",!0),(c===l&&this._tTime>=this.totalDuration()||!c&&a)&&(C===this._start||Math.abs(w)!==Math.abs(this._ts))&&(this._lock||((s||!u)&&(c===l&&this._ts>0||!c&&this._ts<0)&&ks(this,1),!i&&!(s<0&&!a)&&(c||a||!l)&&(xn(this,c===l&&s>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(c<l&&this.timeScale()>0)&&this._prom())))}return this},n.add=function(s,i){var o=this;if(Hr(i)||(i=Mn(this,i,s)),!(s instanceof Oa)){if(Nt(s))return s.forEach(function(a){return o.add(a,i)}),this;if(xt(s))return this.addLabel(s,i);if(et(s))s=dt.delayedCall(0,s);else return this}return this!==s?mr(this,s,i):this},n.getChildren=function(s,i,o,a){s===void 0&&(s=!0),i===void 0&&(i=!0),o===void 0&&(o=!0),a===void 0&&(a=-Fn);for(var l=[],u=this._first;u;)u._start>=a&&(u instanceof dt?i&&l.push(u):(o&&l.push(u),s&&l.push.apply(l,u.getChildren(!0,i,o)))),u=u._next;return l},n.getById=function(s){for(var i=this.getChildren(1,1,1),o=i.length;o--;)if(i[o].vars.id===s)return i[o]},n.remove=function(s){return xt(s)?this.removeLabel(s):et(s)?this.killTweensOf(s):(s.parent===this&&Sc(this,s),s===this._recent&&(this._recent=this._last),Ys(this))},n.totalTime=function(s,i){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=qe(yn.time-(this._ts>0?s/this._ts:(this.totalDuration()-s)/-this._ts))),e.prototype.totalTime.call(this,s,i),this._forcing=0,this):this._tTime},n.addLabel=function(s,i){return this.labels[s]=Mn(this,i),this},n.removeLabel=function(s){return delete this.labels[s],this},n.addPause=function(s,i,o){var a=dt.delayedCall(0,i||Ma,o);return a.data="isPause",this._hasPause=1,mr(this,a,Mn(this,s))},n.removePause=function(s){var i=this._first;for(s=Mn(this,s);i;)i._start===s&&i.data==="isPause"&&ks(i),i=i._next},n.killTweensOf=function(s,i,o){for(var a=this.getTweensOf(s,o),l=a.length;l--;)os!==a[l]&&a[l].kill(s,i);return this},n.getTweensOf=function(s,i){for(var o=[],a=Bn(s),l=this._first,u=Hr(i),c;l;)l instanceof dt?m2(l._targets,a)&&(u?(!os||l._initted&&l._ts)&&l.globalTime(0)<=i&&l.globalTime(l.totalDuration())>i:!i||l.isActive())&&o.push(l):(c=l.getTweensOf(a,i)).length&&o.push.apply(o,c),l=l._next;return o},n.tweenTo=function(s,i){i=i||{};var o=this,a=Mn(o,s),l=i,u=l.startAt,c=l.onStart,f=l.onStartParams,h=l.immediateRender,p,g=dt.to(o,Tn({ease:i.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:i.duration||Math.abs((a-(u&&"time"in u?u.time:o._time))/o.timeScale())||Ne,onStart:function(){if(o.pause(),!p){var _=i.duration||Math.abs((a-(u&&"time"in u?u.time:o._time))/o.timeScale());g._dur!==_&&lo(g,_,0,1).render(g._time,!0,!0),p=1}c&&c.apply(g,f||[])}},i));return h?g.render(0):g},n.tweenFromTo=function(s,i,o){return this.tweenTo(i,Tn({startAt:{time:Mn(this,s)}},o))},n.recent=function(){return this._recent},n.nextLabel=function(s){return s===void 0&&(s=this._time),sv(this,Mn(this,s))},n.previousLabel=function(s){return s===void 0&&(s=this._time),sv(this,Mn(this,s),1)},n.currentLabel=function(s){return arguments.length?this.seek(s,!0):this.previousLabel(this._time+Ne)},n.shiftChildren=function(s,i,o){o===void 0&&(o=0);var a=this._first,l=this.labels,u;for(s=qe(s);a;)a._start>=o&&(a._start+=s,a._end+=s),a=a._next;if(i)for(u in l)l[u]>=o&&(l[u]+=s);return Ys(this)},n.invalidate=function(s){var i=this._first;for(this._lock=0;i;)i.invalidate(s),i=i._next;return e.prototype.invalidate.call(this,s)},n.clear=function(s){s===void 0&&(s=!0);for(var i=this._first,o;i;)o=i._next,this.remove(i),i=o;return this._dp&&(this._time=this._tTime=this._pTime=0),s&&(this.labels={}),Ys(this)},n.totalDuration=function(s){var i=0,o=this,a=o._last,l=Fn,u,c,f;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-s:s));if(o._dirty){for(f=o.parent;a;)u=a._prev,a._dirty&&a.totalDuration(),c=a._start,c>l&&o._sort&&a._ts&&!o._lock?(o._lock=1,mr(o,a,c-a._delay,1)._lock=0):l=c,c<0&&a._ts&&(i-=c,(!f&&!o._dp||f&&f.smoothChildTiming)&&(o._start+=qe(c/o._ts),o._time-=c,o._tTime-=c),o.shiftChildren(-c,!1,-1/0),l=0),a._end>i&&a._ts&&(i=a._end),a=u;lo(o,o===Ge&&o._time>i?o._time:i,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(s){if(Ge._ts&&(GS(Ge,Uu(s,Ge)),qS=yn.frame),yn.frame>=ev){ev+=bn.autoSleep||120;var i=Ge._first;if((!i||!i._ts)&&bn.autoSleep&&yn._listeners.length<2){for(;i&&!i._ts;)i=i._next;i||yn.sleep()}}},t}(Oa);Tn(Qt.prototype,{_lock:0,_hasPause:0,_forcing:0});var F2=function(t,n,r,s,i,o,a){var l=new on(this._pt,t,n,0,1,wk,null,i),u=0,c=0,f,h,p,g,y,_,x,v;for(l.b=r,l.e=s,r+="",s+="",(x=~s.indexOf("random("))&&(s=Da(s)),o&&(v=[r,s],o(v,t,n),r=v[0],s=v[1]),h=r.match(vd)||[];f=vd.exec(s);)g=f[0],y=s.substring(u,f.index),p?p=(p+1)%5:y.substr(-5)==="rgba("&&(p=1),g!==h[c++]&&(_=parseFloat(h[c-1])||0,l._pt={_next:l._pt,p:y||c===1?y:",",s:_,c:g.charAt(1)==="="?qi(_,g)-_:parseFloat(g)-_,m:p&&p<4?Math.round:0},u=vd.lastIndex);return l.c=u<s.length?s.substring(u,s.length):"",l.fp=a,(US.test(s)||x)&&(l.e=0),this._pt=l,l},em=function(t,n,r,s,i,o,a,l,u,c){et(s)&&(s=s(i||0,t,o));var f=t[n],h=r!=="get"?r:et(f)?u?t[n.indexOf("set")||!et(t["get"+n.substr(3)])?n:"get"+n.substr(3)](u):t[n]():f,p=et(f)?u?H2:vk:nm,g;if(xt(s)&&(~s.indexOf("random(")&&(s=Da(s)),s.charAt(1)==="="&&(g=qi(h,s)+(jt(h)||0),(g||g===0)&&(s=g))),!c||h!==s||ih)return!isNaN(h*s)&&s!==""?(g=new on(this._pt,t,n,+h||0,s-(h||0),typeof f=="boolean"?q2:xk,0,p),u&&(g.fp=u),a&&g.modifier(a,this,t),this._pt=g):(!f&&!(n in t)&&Yp(n,s),F2.call(this,t,n,h,s,p,l||bn.stringFilter,u))},B2=function(t,n,r,s,i){if(et(t)&&(t=oa(t,i,n,r,s)),!Sr(t)||t.style&&t.nodeType||Nt(t)||BS(t))return xt(t)?oa(t,i,n,r,s):t;var o={},a;for(a in t)o[a]=oa(t[a],i,n,r,s);return o},mk=function(t,n,r,s,i,o){var a,l,u,c;if(gn[t]&&(a=new gn[t]).init(i,a.rawVars?n[t]:B2(n[t],s,i,o,r),r,s,o)!==!1&&(r._pt=l=new on(r._pt,i,t,0,1,a.render,a,0,a.priority),r!==Oi))for(u=r._ptLookup[r._targets.indexOf(i)],c=a._props.length;c--;)u[a._props[c]]=l;return a},os,ih,tm=function e(t,n,r){var s=t.vars,i=s.ease,o=s.startAt,a=s.immediateRender,l=s.lazy,u=s.onUpdate,c=s.runBackwards,f=s.yoyoEase,h=s.keyframes,p=s.autoRevert,g=t._dur,y=t._startAt,_=t._targets,x=t.parent,v=x&&x.data==="nested"?x.vars.targets:_,w=t._overwrite==="auto"&&!Wp,C=t.timeline,S=s.easeReverse||f,k,T,R,P,E,M,D,$,U,V,J,te,B;if(C&&(!h||!i)&&(i="none"),t._ease=Qs(i,Aa.ease),t._rEase=S&&(Qs(S)||t._ease),t._from=!C&&!!s.runBackwards,t._from&&(t.ratio=1),!C||h&&!s.stagger){if($=_[0]?Gs(_[0]).harness:0,te=$&&s[$.prop],k=$u(s,Qp),y&&(y._zTime<0&&y.progress(1),n<0&&c&&a&&!p?y.render(-1,!0):y.revert(c&&g?Ql:h2),y._lazy=0),o){if(ks(t._startAt=dt.set(_,Tn({data:"isStart",overwrite:!1,parent:x,immediateRender:!0,lazy:!y&&rn(l),startAt:null,delay:0,onUpdate:u&&function(){return xn(t,"onUpdate")},stagger:0},o))),t._startAt._dp=0,t._startAt._sat=t,n<0&&(kt||!a&&!p)&&t._startAt.revert(Ql),a&&g&&n<=0&&r<=0){n&&(t._zTime=n);return}}else if(c&&g&&!y){if(n&&(a=!1),R=Tn({overwrite:!1,data:"isFromStart",lazy:a&&!y&&rn(l),immediateRender:a,stagger:0,parent:x},k),te&&(R[$.prop]=te),ks(t._startAt=dt.set(_,R)),t._startAt._dp=0,t._startAt._sat=t,n<0&&(kt?t._startAt.revert(Ql):t._startAt.render(-1,!0)),t._zTime=n,!a)e(t._startAt,Ne,Ne);else if(!n)return}for(t._pt=t._ptCache=0,l=g&&rn(l)||l&&!g,T=0;T<_.length;T++){if(E=_[T],D=E._gsap||Jp(_)[T]._gsap,t._ptLookup[T]=V={},Zf[D.id]&&vs.length&&Bu(),J=v===_?T:v.indexOf(E),$&&(U=new $).init(E,te||k,t,J,v)!==!1&&(t._pt=P=new on(t._pt,E,U.name,0,1,U.render,U,0,U.priority),U._props.forEach(function(z){V[z]=P}),U.priority&&(M=1)),!$||te)for(R in k)gn[R]&&(U=mk(R,k,t,J,E,v))?U.priority&&(M=1):V[R]=P=em.call(t,E,R,"get",k[R],J,v,0,s.stringFilter);t._op&&t._op[T]&&t.kill(E,t._op[T]),w&&t._pt&&(os=t,Ge.killTweensOf(E,V,t.globalTime(n)),B=!t.parent,os=0),t._pt&&l&&(Zf[D.id]=1)}M&&_k(t),t._onInit&&t._onInit(t)}t._onUpdate=u,t._initted=(!t._op||t._pt)&&!B,h&&n<=0&&C.render(Fn,!0,!0)},$2=function(t,n,r,s,i,o,a,l){var u=(t._pt&&t._ptCache||(t._ptCache={}))[n],c,f,h,p;if(!u)for(u=t._ptCache[n]=[],h=t._ptLookup,p=t._targets.length;p--;){if(c=h[p][n],c&&c.d&&c.d._pt)for(c=c.d._pt;c&&c.p!==n&&c.fp!==n;)c=c._next;if(!c)return ih=1,t.vars[n]="+=0",tm(t,a),ih=0,l?Na(n+" not eligible for reset. Try splitting into individual properties"):1;u.push(c)}for(p=u.length;p--;)f=u[p],c=f._pt||f,c.s=(s||s===0)&&!i?s:c.s+(s||0)+o*c.c,c.c=r-c.s,f.e&&(f.e=ot(r)+jt(f.e)),f.b&&(f.b=c.s+jt(f.b))},U2=function(t,n){var r=t[0]?Gs(t[0]).harness:0,s=r&&r.aliases,i,o,a,l;if(!s)return n;i=oo({},n);for(o in s)if(o in i)for(l=s[o].split(","),a=l.length;a--;)i[l[a]]=i[o];return i},V2=function(t,n,r,s){var i=n.ease||s||"power1.inOut",o,a;if(Nt(n))a=r[t]||(r[t]=[]),n.forEach(function(l,u){return a.push({t:u/(n.length-1)*100,v:l,e:i})});else for(o in n)a=r[o]||(r[o]=[]),o==="ease"||a.push({t:parseFloat(t),v:n[o],e:i})},oa=function(t,n,r,s,i){return et(t)?t.call(n,r,s,i):xt(t)&&~t.indexOf("random(")?Da(t):t},gk=Xp+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,easeReverse,autoRevert",yk={};sn(gk+",id,stagger,delay,duration,paused,scrollTrigger",function(e){return yk[e]=1});var dt=function(e){zS(t,e);function t(r,s,i,o){var a;typeof s=="number"&&(i.duration=s,s=i,i=null),a=e.call(this,o?s:sa(s))||this;var l=a.vars,u=l.duration,c=l.delay,f=l.immediateRender,h=l.stagger,p=l.overwrite,g=l.keyframes,y=l.defaults,_=l.scrollTrigger,x=s.parent||Ge,v=(Nt(r)||BS(r)?Hr(r[0]):"length"in s)?[r]:Bn(r),w,C,S,k,T,R,P,E;if(a._targets=v.length?Jp(v):Na("GSAP target "+r+" not found. https://gsap.com",!bn.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=p,g||h||Tl(u)||Tl(c)){s=a.vars;var M=s.easeReverse||s.yoyoEase;if(w=a.timeline=new Qt({data:"nested",defaults:y||{},targets:x&&x.data==="nested"?x.vars.targets:v}),w.kill(),w.parent=w._dp=Ar(a),w._start=0,h||Tl(u)||Tl(c)){if(k=v.length,P=h&&rk(h),Sr(h))for(T in h)~gk.indexOf(T)&&(E||(E={}),E[T]=h[T]);for(C=0;C<k;C++)S=$u(s,yk),S.stagger=0,M&&(S.easeReverse=M),E&&oo(S,E),R=v[C],S.duration=+oa(u,Ar(a),C,R,v),S.delay=(+oa(c,Ar(a),C,R,v)||0)-a._delay,!h&&k===1&&S.delay&&(a._delay=c=S.delay,a._start+=c,S.delay=0),w.to(R,S,P?P(C,R,v):0),w._ease=be.none;w.duration()?u=c=0:a.timeline=0}else if(g){sa(Tn(w.vars.defaults,{ease:"none"})),w._ease=Qs(g.ease||s.ease||"none");var D=0,$,U,V;if(Nt(g))g.forEach(function(J){return w.to(v,J,">")}),w.duration();else{S={};for(T in g)T==="ease"||T==="easeEach"||V2(T,g[T],S,g.easeEach);for(T in S)for($=S[T].sort(function(J,te){return J.t-te.t}),D=0,C=0;C<$.length;C++)U=$[C],V={ease:U.e,duration:(U.t-(C?$[C-1].t:0))/100*u},V[T]=U.v,w.to(v,V,D),D+=V.duration;w.duration()<u&&w.to({},{duration:u-w.duration()})}}u||a.duration(u=w.duration())}else a.timeline=0;return p===!0&&!Wp&&(os=Ar(a),Ge.killTweensOf(v),os=0),mr(x,Ar(a),i),s.reversed&&a.reverse(),s.paused&&a.paused(!0),(f||!u&&!g&&a._start===qe(x._time)&&rn(f)&&x2(Ar(a))&&x.data!=="nested")&&(a._tTime=-Ne,a.render(Math.max(0,-c)||0)),_&&ZS(Ar(a),_),a}var n=t.prototype;return n.render=function(s,i,o){var a=this._time,l=this._tDur,u=this._dur,c=s<0,f=s>l-Ne&&!c?l:s<Ne?0:s,h,p,g,y,_,x,v,w;if(!u)_2(this,s,i,o);else if(f!==this._tTime||!s||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==c||this._lazy){if(h=f,w=this.timeline,this._repeat){if(y=u+this._rDelay,this._repeat<-1&&c)return this.totalTime(y*100+s,i,o);if(h=qe(f%y),f===l?(g=this._repeat,h=u):(_=qe(f/y),g=~~_,g&&g===_?(h=u,g--):h>u&&(h=u)),x=this._yoyo&&g&1,x&&(h=u-h),_=ao(this._tTime,y),h===a&&!o&&this._initted&&g===_)return this._tTime=f,this;g!==_&&this.vars.repeatRefresh&&!x&&!this._lock&&h!==y&&this._initted&&(this._lock=o=1,this.render(qe(y*g),!0).invalidate()._lock=0)}if(!this._initted){if(ek(this,c?s:h,o,i,f))return this._tTime=0,this;if(a!==this._time&&!(o&&this.vars.repeatRefresh&&g!==_))return this;if(u!==this._dur)return this.render(s,i,o)}if(this._rEase){var C=h<a;if(C!==this._inv){var S=C?a:u-a;this._inv=C,this._from&&(this.ratio=1-this.ratio),this._invRatio=this.ratio,this._invTime=a,this._invRecip=S?(C?-1:1)/S:0,this._invScale=C?-this.ratio:1-this.ratio,this._invEase=C?this._rEase:this._ease}this.ratio=v=this._invRatio+this._invScale*this._invEase((h-this._invTime)*this._invRecip)}else this.ratio=v=this._ease(h/u);if(this._from&&(this.ratio=v=1-v),this._tTime=f,this._time=h,!this._act&&this._ts&&(this._act=1,this._lazy=0),!a&&f&&!i&&!_&&(xn(this,"onStart"),this._tTime!==f))return this;for(p=this._pt;p;)p.r(v,p.d),p=p._next;w&&w.render(s<0?s:w._dur*w._ease(h/this._dur),i,o)||this._startAt&&(this._zTime=s),this._onUpdate&&!i&&(c&&eh(this,s,i,o),xn(this,"onUpdate")),this._repeat&&g!==_&&this.vars.onRepeat&&!i&&this.parent&&xn(this,"onRepeat"),(f===this._tDur||!f)&&this._tTime===f&&(c&&!this._onUpdate&&eh(this,s,!0,!0),(s||!u)&&(f===this._tDur&&this._ts>0||!f&&this._ts<0)&&ks(this,1),!i&&!(c&&!a)&&(f||a||x)&&(xn(this,f===l?"onComplete":"onReverseComplete",!0),this._prom&&!(f<l&&this.timeScale()>0)&&this._prom()))}return this},n.targets=function(){return this._targets},n.invalidate=function(s){return(!s||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(s),e.prototype.invalidate.call(this,s)},n.resetTo=function(s,i,o,a,l){La||yn.wake(),this._ts||this.play();var u=Math.min(this._dur,(this._dp._time-this._start)*this._ts),c;return this._initted||tm(this,u),c=this._ease(u/this._dur),$2(this,s,i,o,a,c,u,l)?this.resetTo(s,i,o,a,1):(Cc(this,0),this.parent||XS(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},n.kill=function(s,i){if(i===void 0&&(i="all"),!s&&(!i||i==="all"))return this._lazy=this._pt=0,this.parent?Uo(this):this.scrollTrigger&&this.scrollTrigger.kill(!!kt),this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(s,i,os&&os.vars.overwrite!==!0)._first||Uo(this),this.parent&&o!==this.timeline.totalDuration()&&lo(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,l=s?Bn(s):a,u=this._ptLookup,c=this._pt,f,h,p,g,y,_,x;if((!i||i==="all")&&y2(a,l))return i==="all"&&(this._pt=0),Uo(this);for(f=this._op=this._op||[],i!=="all"&&(xt(i)&&(y={},sn(i,function(v){return y[v]=1}),i=y),i=U2(a,i)),x=a.length;x--;)if(~l.indexOf(a[x])){h=u[x],i==="all"?(f[x]=i,g=h,p={}):(p=f[x]=f[x]||{},g=i);for(y in g)_=h&&h[y],_&&((!("kill"in _.d)||_.d.kill(y)===!0)&&Sc(this,_,"_pt"),delete h[y]),p!=="all"&&(p[y]=1)}return this._initted&&!this._pt&&c&&Uo(this),this},t.to=function(s,i){return new t(s,i,arguments[2])},t.from=function(s,i){return ia(1,arguments)},t.delayedCall=function(s,i,o,a){return new t(i,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:s,onComplete:i,onReverseComplete:i,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},t.fromTo=function(s,i,o){return ia(2,arguments)},t.set=function(s,i){return i.duration=0,i.repeatDelay||(i.repeat=0),new t(s,i)},t.killTweensOf=function(s,i,o){return Ge.killTweensOf(s,i,o)},t}(Oa);Tn(dt.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});sn("staggerTo,staggerFrom,staggerFromTo",function(e){dt[e]=function(){var t=new Qt,n=nh.call(arguments,0);return n.splice(e==="staggerFromTo"?5:4,0,0),t[e].apply(t,n)}});var nm=function(t,n,r){return t[n]=r},vk=function(t,n,r){return t[n](r)},H2=function(t,n,r,s){return t[n](s.fp,r)},W2=function(t,n,r){return t.setAttribute(n,r)},rm=function(t,n){return et(t[n])?vk:qp(t[n])&&t.setAttribute?W2:nm},xk=function(t,n){return n.set(n.t,n.p,Math.round((n.s+n.c*t)*1e6)/1e6,n)},q2=function(t,n){return n.set(n.t,n.p,!!(n.s+n.c*t),n)},wk=function(t,n){var r=n._pt,s="";if(!t&&n.b)s=n.b;else if(t===1&&n.e)s=n.e;else{for(;r;)s=r.p+(r.m?r.m(r.s+r.c*t):Math.round((r.s+r.c*t)*1e4)/1e4)+s,r=r._next;s+=n.c}n.set(n.t,n.p,s,n)},sm=function(t,n){for(var r=n._pt;r;)r.r(t,r.d),r=r._next},K2=function(t,n,r,s){for(var i=this._pt,o;i;)o=i._next,i.p===s&&i.modifier(t,n,r),i=o},G2=function(t){for(var n=this._pt,r,s;n;)s=n._next,n.p===t&&!n.op||n.op===t?Sc(this,n,"_pt"):n.dep||(r=1),n=s;return!r},Y2=function(t,n,r,s){s.mSet(t,n,s.m.call(s.tween,r,s.mt),s)},_k=function(t){for(var n=t._pt,r,s,i,o;n;){for(r=n._next,s=i;s&&s.pr>n.pr;)s=s._next;(n._prev=s?s._prev:o)?n._prev._next=n:i=n,(n._next=s)?s._prev=n:o=n,n=r}t._pt=i},on=function(){function e(n,r,s,i,o,a,l,u,c){this.t=r,this.s=i,this.c=o,this.p=s,this.r=a||xk,this.d=l||this,this.set=u||nm,this.pr=c||0,this._next=n,n&&(n._prev=this)}var t=e.prototype;return t.modifier=function(r,s,i){this.mSet=this.mSet||this.set,this.set=Y2,this.m=r,this.mt=i,this.tween=s},e}();sn(Xp+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger,easeReverse",function(e){return Qp[e]=1});En.TweenMax=En.TweenLite=dt;En.TimelineLite=En.TimelineMax=Qt;Ge=new Qt({sortChildren:!1,defaults:Aa,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});bn.stringFilter=fk;var Xs=[],Jl={},Q2=[],ov=0,X2=0,Sd=function(t){return(Jl[t]||Q2).map(function(n){return n()})},oh=function(){var t=Date.now(),n=[];t-ov>2&&(Sd("matchMediaInit"),Xs.forEach(function(r){var s=r.queries,i=r.conditions,o,a,l,u;for(a in s)o=hr.matchMedia(s[a]).matches,o&&(l=1),o!==i[a]&&(i[a]=o,u=1);u&&(r.revert(),l&&n.push(r))}),Sd("matchMediaRevert"),n.forEach(function(r){return r.onMatch(r,function(s){return r.add(null,s)})}),ov=t,Sd("matchMedia"))},bk=function(){function e(n,r){this.selector=r&&rh(r),this.data=[],this._r=[],this.isReverted=!1,this.id=X2++,n&&this.add(n)}var t=e.prototype;return t.add=function(r,s,i){et(r)&&(i=s,s=r,r=et);var o=this,a=function(){var u=He,c=o.selector,f;return u&&u!==o&&u.data.push(o),i&&(o.selector=rh(i)),He=o,f=s.apply(o,arguments),et(f)&&o._r.push(f),He=u,o.selector=c,o.isReverted=!1,f};return o.last=a,r===et?a(o,function(l){return o.add(null,l)}):r?o[r]=a:a},t.ignore=function(r){var s=He;He=null,r(this),He=s},t.getTweens=function(){var r=[];return this.data.forEach(function(s){return s instanceof e?r.push.apply(r,s.getTweens()):s instanceof dt&&!(s.parent&&s.parent.data==="nested")&&r.push(s)}),r},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(r,s){var i=this;if(r?function(){for(var a=i.getTweens(),l=i.data.length,u;l--;)u=i.data[l],u.data==="isFlip"&&(u.revert(),u.getChildren(!0,!0,!1).forEach(function(c){return a.splice(a.indexOf(c),1)}));for(a.map(function(c){return{g:c._dur||c._delay||c._sat&&!c._sat.vars.immediateRender?c.globalTime(0):-1/0,t:c}}).sort(function(c,f){return f.g-c.g||-1/0}).forEach(function(c){return c.t.revert(r)}),l=i.data.length;l--;)u=i.data[l],u instanceof Qt?u.data!=="nested"&&(u.scrollTrigger&&u.scrollTrigger.revert(),u.kill()):!(u instanceof dt)&&u.revert&&u.revert(r);i._r.forEach(function(c){return c(r,i)}),i.isReverted=!0}():this.data.forEach(function(a){return a.kill&&a.kill()}),this.clear(),s)for(var o=Xs.length;o--;)Xs[o].id===this.id&&Xs.splice(o,1)},t.revert=function(r){this.kill(r||{})},e}(),J2=function(){function e(n){this.contexts=[],this.scope=n,He&&He.data.push(this)}var t=e.prototype;return t.add=function(r,s,i){Sr(r)||(r={matches:r});var o=new bk(0,i||this.scope),a=o.conditions={},l,u,c;He&&!o.selector&&(o.selector=He.selector),this.contexts.push(o),s=o.add("onMatch",s),o.queries=r;for(u in r)u==="all"?c=1:(l=hr.matchMedia(r[u]),l&&(Xs.indexOf(o)<0&&Xs.push(o),(a[u]=l.matches)&&(c=1),l.addListener?l.addListener(oh):l.addEventListener("change",oh)));return c&&s(o,function(f){return o.add(null,f)}),this},t.revert=function(r){this.kill(r||{})},t.kill=function(r){this.contexts.forEach(function(s){return s.kill(r,!0)})},e}(),Vu={registerPlugin:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.forEach(function(s){return uk(s)})},timeline:function(t){return new Qt(t)},getTweensOf:function(t,n){return Ge.getTweensOf(t,n)},getProperty:function(t,n,r,s){xt(t)&&(t=Bn(t)[0]);var i=Gs(t||{}).get,o=r?QS:YS;return r==="native"&&(r=""),t&&(n?o((gn[n]&&gn[n].get||i)(t,n,r,s)):function(a,l,u){return o((gn[a]&&gn[a].get||i)(t,a,l,u))})},quickSetter:function(t,n,r){if(t=Bn(t),t.length>1){var s=t.map(function(c){return ln.quickSetter(c,n,r)}),i=s.length;return function(c){for(var f=i;f--;)s[f](c)}}t=t[0]||{};var o=gn[n],a=Gs(t),l=a.harness&&(a.harness.aliases||{})[n]||n,u=o?function(c){var f=new o;Oi._pt=0,f.init(t,r?c+r:c,Oi,0,[t]),f.render(1,f),Oi._pt&&sm(1,Oi)}:a.set(t,l);return o?u:function(c){return u(t,l,r?c+r:c,a,1)}},quickTo:function(t,n,r){var s,i=ln.to(t,Tn((s={},s[n]="+=0.1",s.paused=!0,s.stagger=0,s),r||{})),o=function(l,u,c){return i.resetTo(n,l,u,c)};return o.tween=i,o},isTweening:function(t){return Ge.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=Qs(t.ease,Aa.ease)),tv(Aa,t||{})},config:function(t){return tv(bn,t||{})},registerEffect:function(t){var n=t.name,r=t.effect,s=t.plugins,i=t.defaults,o=t.extendTimeline;(s||"").split(",").forEach(function(a){return a&&!gn[a]&&!En[a]&&Na(n+" effect requires "+a+" plugin.")}),xd[n]=function(a,l,u){return r(Bn(a),Tn(l||{},i),u)},o&&(Qt.prototype[n]=function(a,l,u){return this.add(xd[n](a,Sr(l)?l:(u=l)&&{},this),u)})},registerEase:function(t,n){be[t]=Qs(n)},parseEase:function(t,n){return arguments.length?Qs(t,n):be},getById:function(t){return Ge.getById(t)},exportRoot:function(t,n){t===void 0&&(t={});var r=new Qt(t),s,i;for(r.smoothChildTiming=rn(t.smoothChildTiming),Ge.remove(r),r._dp=0,r._time=r._tTime=Ge._time,s=Ge._first;s;)i=s._next,(n||!(!s._dur&&s instanceof dt&&s.vars.onComplete===s._targets[0]))&&mr(r,s,s._start-s._delay),s=i;return mr(Ge,r,0),r},context:function(t,n){return t?new bk(t,n):He},matchMedia:function(t){return new J2(t)},matchMediaRefresh:function(){return Xs.forEach(function(t){var n=t.conditions,r,s;for(s in n)n[s]&&(n[s]=!1,r=1);r&&t.revert()})||oh()},addEventListener:function(t,n){var r=Jl[t]||(Jl[t]=[]);~r.indexOf(n)||r.push(n)},removeEventListener:function(t,n){var r=Jl[t],s=r&&r.indexOf(n);s>=0&&r.splice(s,1)},utils:{wrap:R2,wrapYoyo:P2,distribute:rk,random:ik,snap:sk,normalize:I2,getUnit:jt,clamp:k2,splitColor:ck,toArray:Bn,selector:rh,mapRange:ak,pipe:E2,unitize:T2,interpolate:j2,shuffle:nk},install:HS,effects:xd,ticker:yn,updateRoot:Qt.updateRoot,plugins:gn,globalTimeline:Ge,core:{PropTween:on,globals:WS,Tween:dt,Timeline:Qt,Animation:Oa,getCache:Gs,_removeLinkedListItem:Sc,reverting:function(){return kt},context:function(t){return t&&He&&(He.data.push(t),t._ctx=He),He},suppressOverwrites:function(t){return Wp=t}}};sn("to,from,fromTo,delayedCall,set,killTweensOf",function(e){return Vu[e]=dt[e]});yn.add(Qt.updateRoot);Oi=Vu.to({},{duration:0});var Z2=function(t,n){for(var r=t._pt;r&&r.p!==n&&r.op!==n&&r.fp!==n;)r=r._next;return r},eD=function(t,n){var r=t._targets,s,i,o;for(s in n)for(i=r.length;i--;)o=t._ptLookup[i][s],o&&(o=o.d)&&(o._pt&&(o=Z2(o,s)),o&&o.modifier&&o.modifier(n[s],t,r[i],s))},kd=function(t,n){return{name:t,headless:1,rawVars:1,init:function(s,i,o){o._onInit=function(a){var l,u;if(xt(i)&&(l={},sn(i,function(c){return l[c]=1}),i=l),n){l={};for(u in i)l[u]=n(i[u]);i=l}eD(a,i)}}}},ln=Vu.registerPlugin({name:"attr",init:function(t,n,r,s,i){var o,a,l;this.tween=r;for(o in n)l=t.getAttribute(o)||"",a=this.add(t,"setAttribute",(l||0)+"",n[o],s,i,0,0,o),a.op=o,a.b=l,this._props.push(o)},render:function(t,n){for(var r=n._pt;r;)kt?r.set(r.t,r.p,r.b,r):r.r(t,r.d),r=r._next}},{name:"endArray",headless:1,init:function(t,n){for(var r=n.length;r--;)this.add(t,r,t[r]||0,n[r],0,0,0,0,0,1)}},kd("roundProps",sh),kd("modifiers"),kd("snap",sk))||Vu;dt.version=Qt.version=ln.version="3.15.0";VS=1;Kp()&&uo();be.Power0;be.Power1;be.Power2;be.Power3;be.Power4;be.Linear;be.Quad;be.Cubic;be.Quart;be.Quint;be.Strong;be.Elastic;be.Back;be.SteppedEase;be.Bounce;be.Sine;be.Expo;be.Circ;/*!
|
|
52
|
+
* CSSPlugin 3.15.0
|
|
53
|
+
* https://gsap.com
|
|
54
|
+
*
|
|
55
|
+
* Copyright 2008-2026, GreenSock. All rights reserved.
|
|
56
|
+
* Subject to the terms at https://gsap.com/standard-license
|
|
57
|
+
* @author: Jack Doyle, jack@greensock.com
|
|
58
|
+
*/var av,as,Ki,im,Hs,lv,om,tD=function(){return typeof window<"u"},Wr={},Fs=180/Math.PI,Gi=Math.PI/180,_i=Math.atan2,uv=1e8,am=/([A-Z])/g,nD=/(left|right|width|margin|padding|x)/i,rD=/[\s,\(]\S/,yr={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},ah=function(t,n){return n.set(n.t,n.p,Math.round((n.s+n.c*t)*1e4)/1e4+n.u,n)},sD=function(t,n){return n.set(n.t,n.p,t===1?n.e:Math.round((n.s+n.c*t)*1e4)/1e4+n.u,n)},iD=function(t,n){return n.set(n.t,n.p,t?Math.round((n.s+n.c*t)*1e4)/1e4+n.u:n.b,n)},oD=function(t,n){return n.set(n.t,n.p,t===1?n.e:t?Math.round((n.s+n.c*t)*1e4)/1e4+n.u:n.b,n)},aD=function(t,n){var r=n.s+n.c*t;n.set(n.t,n.p,~~(r+(r<0?-.5:.5))+n.u,n)},Sk=function(t,n){return n.set(n.t,n.p,t?n.e:n.b,n)},kk=function(t,n){return n.set(n.t,n.p,t!==1?n.b:n.e,n)},lD=function(t,n,r){return t.style[n]=r},uD=function(t,n,r){return t.style.setProperty(n,r)},cD=function(t,n,r){return t._gsap[n]=r},dD=function(t,n,r){return t._gsap.scaleX=t._gsap.scaleY=r},fD=function(t,n,r,s,i){var o=t._gsap;o.scaleX=o.scaleY=r,o.renderTransform(i,o)},hD=function(t,n,r,s,i){var o=t._gsap;o[n]=r,o.renderTransform(i,o)},Qe="transform",an=Qe+"Origin",pD=function e(t,n){var r=this,s=this.target,i=s.style,o=s._gsap;if(t in Wr&&i){if(this.tfm=this.tfm||{},t!=="transform")t=yr[t]||t,~t.indexOf(",")?t.split(",").forEach(function(a){return r.tfm[a]=Mr(s,a)}):this.tfm[t]=o.x?o[t]:Mr(s,t),t===an&&(this.tfm.zOrigin=o.zOrigin);else return yr.transform.split(",").forEach(function(a){return e.call(r,a,n)});if(this.props.indexOf(Qe)>=0)return;o.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(an,n,"")),t=Qe}(i||n)&&this.props.push(t,n,i[t])},Ck=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},mD=function(){var t=this.props,n=this.target,r=n.style,s=n._gsap,i,o;for(i=0;i<t.length;i+=3)t[i+1]?t[i+1]===2?n[t[i]](t[i+2]):n[t[i]]=t[i+2]:t[i+2]?r[t[i]]=t[i+2]:r.removeProperty(t[i].substr(0,2)==="--"?t[i]:t[i].replace(am,"-$1").toLowerCase());if(this.tfm){for(o in this.tfm)s[o]=this.tfm[o];s.svg&&(s.renderTransform(),n.setAttribute("data-svg-origin",this.svgo||"")),i=om(),(!i||!i.isStart)&&!r[Qe]&&(Ck(r),s.zOrigin&&r[an]&&(r[an]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},Ek=function(t,n){var r={target:t,props:[],revert:mD,save:pD};return t._gsap||ln.core.getCache(t),n&&t.style&&t.nodeType&&n.split(",").forEach(function(s){return r.save(s)}),r},Tk,lh=function(t,n){var r=as.createElementNS?as.createElementNS((n||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):as.createElement(t);return r&&r.style?r:as.createElement(t)},wn=function e(t,n,r){var s=getComputedStyle(t);return s[n]||s.getPropertyValue(n.replace(am,"-$1").toLowerCase())||s.getPropertyValue(n)||!r&&e(t,co(n)||n,1)||""},cv="O,Moz,ms,Ms,Webkit".split(","),co=function(t,n,r){var s=n||Hs,i=s.style,o=5;if(t in i&&!r)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(cv[o]+t in i););return o<0?null:(o===3?"ms":o>=0?cv[o]:"")+t},uh=function(){tD()&&window.document&&(av=window,as=av.document,Ki=as.documentElement,Hs=lh("div")||{style:{}},lh("div"),Qe=co(Qe),an=Qe+"Origin",Hs.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Tk=!!co("perspective"),om=ln.core.reverting,im=1)},dv=function(t){var n=t.ownerSVGElement,r=lh("svg",n&&n.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),s=t.cloneNode(!0),i;s.style.display="block",r.appendChild(s),Ki.appendChild(r);try{i=s.getBBox()}catch{}return r.removeChild(s),Ki.removeChild(r),i},fv=function(t,n){for(var r=n.length;r--;)if(t.hasAttribute(n[r]))return t.getAttribute(n[r])},Ik=function(t){var n,r;try{n=t.getBBox()}catch{n=dv(t),r=1}return n&&(n.width||n.height)||r||(n=dv(t)),n&&!n.width&&!n.x&&!n.y?{x:+fv(t,["x","cx","x1"])||0,y:+fv(t,["y","cy","y1"])||0,width:0,height:0}:n},Rk=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&Ik(t))},Cs=function(t,n){if(n){var r=t.style,s;n in Wr&&n!==an&&(n=Qe),r.removeProperty?(s=n.substr(0,2),(s==="ms"||n.substr(0,6)==="webkit")&&(n="-"+n),r.removeProperty(s==="--"?n:n.replace(am,"-$1").toLowerCase())):r.removeAttribute(n)}},ls=function(t,n,r,s,i,o){var a=new on(t._pt,n,r,0,1,o?kk:Sk);return t._pt=a,a.b=s,a.e=i,t._props.push(r),a},hv={deg:1,rad:1,turn:1},gD={grid:1,flex:1},Es=function e(t,n,r,s){var i=parseFloat(r)||0,o=(r+"").trim().substr((i+"").length)||"px",a=Hs.style,l=nD.test(n),u=t.tagName.toLowerCase()==="svg",c=(u?"client":"offset")+(l?"Width":"Height"),f=100,h=s==="px",p=s==="%",g,y,_,x;if(s===o||!i||hv[s]||hv[o])return i;if(o!=="px"&&!h&&(i=e(t,n,r,"px")),x=t.getCTM&&Rk(t),(p||o==="%")&&(Wr[n]||~n.indexOf("adius")))return g=x?t.getBBox()[l?"width":"height"]:t[c],ot(p?i/g*f:i/100*g);if(a[l?"width":"height"]=f+(h?o:s),y=s!=="rem"&&~n.indexOf("adius")||s==="em"&&t.appendChild&&!u?t:t.parentNode,x&&(y=(t.ownerSVGElement||{}).parentNode),(!y||y===as||!y.appendChild)&&(y=as.body),_=y._gsap,_&&p&&_.width&&l&&_.time===yn.time&&!_.uncache)return ot(i/_.width*f);if(p&&(n==="height"||n==="width")){var v=t.style[n];t.style[n]=f+s,g=t[c],v?t.style[n]=v:Cs(t,n)}else(p||o==="%")&&!gD[wn(y,"display")]&&(a.position=wn(t,"position")),y===t&&(a.position="static"),y.appendChild(Hs),g=Hs[c],y.removeChild(Hs),a.position="absolute";return l&&p&&(_=Gs(y),_.time=yn.time,_.width=y[c]),ot(h?g*i/f:g&&i?f/g*i:0)},Mr=function(t,n,r,s){var i;return im||uh(),n in yr&&n!=="transform"&&(n=yr[n],~n.indexOf(",")&&(n=n.split(",")[0])),Wr[n]&&n!=="transform"?(i=Fa(t,s),i=n!=="transformOrigin"?i[n]:i.svg?i.origin:Wu(wn(t,an))+" "+i.zOrigin+"px"):(i=t.style[n],(!i||i==="auto"||s||~(i+"").indexOf("calc("))&&(i=Hu[n]&&Hu[n](t,n,r)||wn(t,n)||KS(t,n)||(n==="opacity"?1:0))),r&&!~(i+"").trim().indexOf(" ")?Es(t,n,i,r)+r:i},yD=function(t,n,r,s){if(!r||r==="none"){var i=co(n,t,1),o=i&&wn(t,i,1);o&&o!==r?(n=i,r=o):n==="borderColor"&&(r=wn(t,"borderTopColor"))}var a=new on(this._pt,t.style,n,0,1,wk),l=0,u=0,c,f,h,p,g,y,_,x,v,w,C,S;if(a.b=r,a.e=s,r+="",s+="",s.substring(0,6)==="var(--"&&(s=wn(t,s.substring(4,s.indexOf(")")))),s==="auto"&&(y=t.style[n],t.style[n]=s,s=wn(t,n)||s,y?t.style[n]=y:Cs(t,n)),c=[r,s],fk(c),r=c[0],s=c[1],h=r.match(Li)||[],S=s.match(Li)||[],S.length){for(;f=Li.exec(s);)_=f[0],v=s.substring(l,f.index),g?g=(g+1)%5:(v.substr(-5)==="rgba("||v.substr(-5)==="hsla(")&&(g=1),_!==(y=h[u++]||"")&&(p=parseFloat(y)||0,C=y.substr((p+"").length),_.charAt(1)==="="&&(_=qi(p,_)+C),x=parseFloat(_),w=_.substr((x+"").length),l=Li.lastIndex-w.length,w||(w=w||bn.units[n]||C,l===s.length&&(s+=w,a.e+=w)),C!==w&&(p=Es(t,n,y,w)||0),a._pt={_next:a._pt,p:v||u===1?v:",",s:p,c:x-p,m:g&&g<4||n==="zIndex"?Math.round:0});a.c=l<s.length?s.substring(l,s.length):""}else a.r=n==="display"&&s==="none"?kk:Sk;return US.test(s)&&(a.e=0),this._pt=a,a},pv={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},vD=function(t){var n=t.split(" "),r=n[0],s=n[1]||"50%";return(r==="top"||r==="bottom"||s==="left"||s==="right")&&(t=r,r=s,s=t),n[0]=pv[r]||r,n[1]=pv[s]||s,n.join(" ")},xD=function(t,n){if(n.tween&&n.tween._time===n.tween._dur){var r=n.t,s=r.style,i=n.u,o=r._gsap,a,l,u;if(i==="all"||i===!0)s.cssText="",l=1;else for(i=i.split(","),u=i.length;--u>-1;)a=i[u],Wr[a]&&(l=1,a=a==="transformOrigin"?an:Qe),Cs(r,a);l&&(Cs(r,Qe),o&&(o.svg&&r.removeAttribute("transform"),s.scale=s.rotate=s.translate="none",Fa(r,1),o.uncache=1,Ck(s)))}},Hu={clearProps:function(t,n,r,s,i){if(i.data!=="isFromStart"){var o=t._pt=new on(t._pt,n,r,0,0,xD);return o.u=s,o.pr=-10,o.tween=i,t._props.push(r),1}}},za=[1,0,0,1,0,0],Pk={},jk=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},mv=function(t){var n=wn(t,Qe);return jk(n)?za:n.substr(7).match($S).map(ot)},lm=function(t,n){var r=t._gsap||Gs(t),s=t.style,i=mv(t),o,a,l,u;return r.svg&&t.getAttribute("transform")?(l=t.transform.baseVal.consolidate().matrix,i=[l.a,l.b,l.c,l.d,l.e,l.f],i.join(",")==="1,0,0,1,0,0"?za:i):(i===za&&!t.offsetParent&&t!==Ki&&!r.svg&&(l=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent&&!t.getBoundingClientRect().width)&&(u=1,a=t.nextElementSibling,Ki.appendChild(t)),i=mv(t),l?s.display=l:Cs(t,"display"),u&&(a?o.insertBefore(t,a):o?o.appendChild(t):Ki.removeChild(t))),n&&i.length>6?[i[0],i[1],i[4],i[5],i[12],i[13]]:i)},ch=function(t,n,r,s,i,o){var a=t._gsap,l=i||lm(t,!0),u=a.xOrigin||0,c=a.yOrigin||0,f=a.xOffset||0,h=a.yOffset||0,p=l[0],g=l[1],y=l[2],_=l[3],x=l[4],v=l[5],w=n.split(" "),C=parseFloat(w[0])||0,S=parseFloat(w[1])||0,k,T,R,P;r?l!==za&&(T=p*_-g*y)&&(R=C*(_/T)+S*(-y/T)+(y*v-_*x)/T,P=C*(-g/T)+S*(p/T)-(p*v-g*x)/T,C=R,S=P):(k=Ik(t),C=k.x+(~w[0].indexOf("%")?C/100*k.width:C),S=k.y+(~(w[1]||w[0]).indexOf("%")?S/100*k.height:S)),s||s!==!1&&a.smooth?(x=C-u,v=S-c,a.xOffset=f+(x*p+v*y)-x,a.yOffset=h+(x*g+v*_)-v):a.xOffset=a.yOffset=0,a.xOrigin=C,a.yOrigin=S,a.smooth=!!s,a.origin=n,a.originIsAbsolute=!!r,t.style[an]="0px 0px",o&&(ls(o,a,"xOrigin",u,C),ls(o,a,"yOrigin",c,S),ls(o,a,"xOffset",f,a.xOffset),ls(o,a,"yOffset",h,a.yOffset)),t.setAttribute("data-svg-origin",C+" "+S)},Fa=function(t,n){var r=t._gsap||new pk(t);if("x"in r&&!n&&!r.uncache)return r;var s=t.style,i=r.scaleX<0,o="px",a="deg",l=getComputedStyle(t),u=wn(t,an)||"0",c,f,h,p,g,y,_,x,v,w,C,S,k,T,R,P,E,M,D,$,U,V,J,te,B,z,b,H,X,I,de,Se;return c=f=h=y=_=x=v=w=C=0,p=g=1,r.svg=!!(t.getCTM&&Rk(t)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(s[Qe]=(l.translate!=="none"?"translate3d("+(l.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(l.rotate!=="none"?"rotate("+l.rotate+") ":"")+(l.scale!=="none"?"scale("+l.scale.split(" ").join(",")+") ":"")+(l[Qe]!=="none"?l[Qe]:"")),s.scale=s.rotate=s.translate="none"),T=lm(t,r.svg),r.svg&&(r.uncache?(B=t.getBBox(),u=r.xOrigin-B.x+"px "+(r.yOrigin-B.y)+"px",te=""):te=!n&&t.getAttribute("data-svg-origin"),ch(t,te||u,!!te||r.originIsAbsolute,r.smooth!==!1,T)),S=r.xOrigin||0,k=r.yOrigin||0,T!==za&&(M=T[0],D=T[1],$=T[2],U=T[3],c=V=T[4],f=J=T[5],T.length===6?(p=Math.sqrt(M*M+D*D),g=Math.sqrt(U*U+$*$),y=M||D?_i(D,M)*Fs:0,v=$||U?_i($,U)*Fs+y:0,v&&(g*=Math.abs(Math.cos(v*Gi))),r.svg&&(c-=S-(S*M+k*$),f-=k-(S*D+k*U))):(Se=T[6],I=T[7],b=T[8],H=T[9],X=T[10],de=T[11],c=T[12],f=T[13],h=T[14],R=_i(Se,X),_=R*Fs,R&&(P=Math.cos(-R),E=Math.sin(-R),te=V*P+b*E,B=J*P+H*E,z=Se*P+X*E,b=V*-E+b*P,H=J*-E+H*P,X=Se*-E+X*P,de=I*-E+de*P,V=te,J=B,Se=z),R=_i(-$,X),x=R*Fs,R&&(P=Math.cos(-R),E=Math.sin(-R),te=M*P-b*E,B=D*P-H*E,z=$*P-X*E,de=U*E+de*P,M=te,D=B,$=z),R=_i(D,M),y=R*Fs,R&&(P=Math.cos(R),E=Math.sin(R),te=M*P+D*E,B=V*P+J*E,D=D*P-M*E,J=J*P-V*E,M=te,V=B),_&&Math.abs(_)+Math.abs(y)>359.9&&(_=y=0,x=180-x),p=ot(Math.sqrt(M*M+D*D+$*$)),g=ot(Math.sqrt(J*J+Se*Se)),R=_i(V,J),v=Math.abs(R)>2e-4?R*Fs:0,C=de?1/(de<0?-de:de):0),r.svg&&(te=t.getAttribute("transform"),r.forceCSS=t.setAttribute("transform","")||!jk(wn(t,Qe)),te&&t.setAttribute("transform",te))),Math.abs(v)>90&&Math.abs(v)<270&&(i?(p*=-1,v+=y<=0?180:-180,y+=y<=0?180:-180):(g*=-1,v+=v<=0?180:-180)),n=n||r.uncache,r.x=c-((r.xPercent=c&&(!n&&r.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-c)?-50:0)))?t.offsetWidth*r.xPercent/100:0)+o,r.y=f-((r.yPercent=f&&(!n&&r.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-f)?-50:0)))?t.offsetHeight*r.yPercent/100:0)+o,r.z=h+o,r.scaleX=ot(p),r.scaleY=ot(g),r.rotation=ot(y)+a,r.rotationX=ot(_)+a,r.rotationY=ot(x)+a,r.skewX=v+a,r.skewY=w+a,r.transformPerspective=C+o,(r.zOrigin=parseFloat(u.split(" ")[2])||!n&&r.zOrigin||0)&&(s[an]=Wu(u)),r.xOffset=r.yOffset=0,r.force3D=bn.force3D,r.renderTransform=r.svg?_D:Tk?Ak:wD,r.uncache=0,r},Wu=function(t){return(t=t.split(" "))[0]+" "+t[1]},Cd=function(t,n,r){var s=jt(n);return ot(parseFloat(n)+parseFloat(Es(t,"x",r+"px",s)))+s},wD=function(t,n){n.z="0px",n.rotationY=n.rotationX="0deg",n.force3D=0,Ak(t,n)},Ms="0deg",Mo="0px",Ds=") ",Ak=function(t,n){var r=n||this,s=r.xPercent,i=r.yPercent,o=r.x,a=r.y,l=r.z,u=r.rotation,c=r.rotationY,f=r.rotationX,h=r.skewX,p=r.skewY,g=r.scaleX,y=r.scaleY,_=r.transformPerspective,x=r.force3D,v=r.target,w=r.zOrigin,C="",S=x==="auto"&&t&&t!==1||x===!0;if(w&&(f!==Ms||c!==Ms)){var k=parseFloat(c)*Gi,T=Math.sin(k),R=Math.cos(k),P;k=parseFloat(f)*Gi,P=Math.cos(k),o=Cd(v,o,T*P*-w),a=Cd(v,a,-Math.sin(k)*-w),l=Cd(v,l,R*P*-w+w)}_!==Mo&&(C+="perspective("+_+Ds),(s||i)&&(C+="translate("+s+"%, "+i+"%) "),(S||o!==Mo||a!==Mo||l!==Mo)&&(C+=l!==Mo||S?"translate3d("+o+", "+a+", "+l+") ":"translate("+o+", "+a+Ds),u!==Ms&&(C+="rotate("+u+Ds),c!==Ms&&(C+="rotateY("+c+Ds),f!==Ms&&(C+="rotateX("+f+Ds),(h!==Ms||p!==Ms)&&(C+="skew("+h+", "+p+Ds),(g!==1||y!==1)&&(C+="scale("+g+", "+y+Ds),v.style[Qe]=C||"translate(0, 0)"},_D=function(t,n){var r=n||this,s=r.xPercent,i=r.yPercent,o=r.x,a=r.y,l=r.rotation,u=r.skewX,c=r.skewY,f=r.scaleX,h=r.scaleY,p=r.target,g=r.xOrigin,y=r.yOrigin,_=r.xOffset,x=r.yOffset,v=r.forceCSS,w=parseFloat(o),C=parseFloat(a),S,k,T,R,P;l=parseFloat(l),u=parseFloat(u),c=parseFloat(c),c&&(c=parseFloat(c),u+=c,l+=c),l||u?(l*=Gi,u*=Gi,S=Math.cos(l)*f,k=Math.sin(l)*f,T=Math.sin(l-u)*-h,R=Math.cos(l-u)*h,u&&(c*=Gi,P=Math.tan(u-c),P=Math.sqrt(1+P*P),T*=P,R*=P,c&&(P=Math.tan(c),P=Math.sqrt(1+P*P),S*=P,k*=P)),S=ot(S),k=ot(k),T=ot(T),R=ot(R)):(S=f,R=h,k=T=0),(w&&!~(o+"").indexOf("px")||C&&!~(a+"").indexOf("px"))&&(w=Es(p,"x",o,"px"),C=Es(p,"y",a,"px")),(g||y||_||x)&&(w=ot(w+g-(g*S+y*T)+_),C=ot(C+y-(g*k+y*R)+x)),(s||i)&&(P=p.getBBox(),w=ot(w+s/100*P.width),C=ot(C+i/100*P.height)),P="matrix("+S+","+k+","+T+","+R+","+w+","+C+")",p.setAttribute("transform",P),v&&(p.style[Qe]=P)},bD=function(t,n,r,s,i){var o=360,a=xt(i),l=parseFloat(i)*(a&&~i.indexOf("rad")?Fs:1),u=l-s,c=s+u+"deg",f,h;return a&&(f=i.split("_")[1],f==="short"&&(u%=o,u!==u%(o/2)&&(u+=u<0?o:-o)),f==="cw"&&u<0?u=(u+o*uv)%o-~~(u/o)*o:f==="ccw"&&u>0&&(u=(u-o*uv)%o-~~(u/o)*o)),t._pt=h=new on(t._pt,n,r,s,u,sD),h.e=c,h.u="deg",t._props.push(r),h},gv=function(t,n){for(var r in n)t[r]=n[r];return t},SD=function(t,n,r){var s=gv({},r._gsap),i="perspective,force3D,transformOrigin,svgOrigin",o=r.style,a,l,u,c,f,h,p,g;s.svg?(u=r.getAttribute("transform"),r.setAttribute("transform",""),o[Qe]=n,a=Fa(r,1),Cs(r,Qe),r.setAttribute("transform",u)):(u=getComputedStyle(r)[Qe],o[Qe]=n,a=Fa(r,1),o[Qe]=u);for(l in Wr)u=s[l],c=a[l],u!==c&&i.indexOf(l)<0&&(p=jt(u),g=jt(c),f=p!==g?Es(r,l,u,g):parseFloat(u),h=parseFloat(c),t._pt=new on(t._pt,a,l,f,h-f,ah),t._pt.u=g||0,t._props.push(l));gv(a,s)};sn("padding,margin,Width,Radius",function(e,t){var n="Top",r="Right",s="Bottom",i="Left",o=(t<3?[n,r,s,i]:[n+i,n+r,s+r,s+i]).map(function(a){return t<2?e+a:"border"+a+e});Hu[t>1?"border"+e:e]=function(a,l,u,c,f){var h,p;if(arguments.length<4)return h=o.map(function(g){return Mr(a,g,u)}),p=h.join(" "),p.split(h[0]).length===5?h[0]:p;h=(c+"").split(" "),p={},o.forEach(function(g,y){return p[g]=h[y]=h[y]||h[(y-1)/2|0]}),a.init(l,p,f)}});var Nk={name:"css",register:uh,targetTest:function(t){return t.style&&t.nodeType},init:function(t,n,r,s,i){var o=this._props,a=t.style,l=r.vars.startAt,u,c,f,h,p,g,y,_,x,v,w,C,S,k,T,R,P;im||uh(),this.styles=this.styles||Ek(t),R=this.styles.props,this.tween=r;for(y in n)if(y!=="autoRound"&&(c=n[y],!(gn[y]&&mk(y,n,r,s,t,i)))){if(p=typeof c,g=Hu[y],p==="function"&&(c=c.call(r,s,t,i),p=typeof c),p==="string"&&~c.indexOf("random(")&&(c=Da(c)),g)g(this,t,y,c,r)&&(T=1);else if(y.substr(0,2)==="--")u=(getComputedStyle(t).getPropertyValue(y)+"").trim(),c+="",xs.lastIndex=0,xs.test(u)||(_=jt(u),x=jt(c),x?_!==x&&(u=Es(t,y,u,x)+x):_&&(c+=_)),this.add(a,"setProperty",u,c,s,i,0,0,y),o.push(y),R.push(y,0,a[y]);else if(p!=="undefined"){if(l&&y in l?(u=typeof l[y]=="function"?l[y].call(r,s,t,i):l[y],xt(u)&&~u.indexOf("random(")&&(u=Da(u)),jt(u+"")||u==="auto"||(u+=bn.units[y]||jt(Mr(t,y))||""),(u+"").charAt(1)==="="&&(u=Mr(t,y))):u=Mr(t,y),h=parseFloat(u),v=p==="string"&&c.charAt(1)==="="&&c.substr(0,2),v&&(c=c.substr(2)),f=parseFloat(c),y in yr&&(y==="autoAlpha"&&(h===1&&Mr(t,"visibility")==="hidden"&&f&&(h=0),R.push("visibility",0,a.visibility),ls(this,a,"visibility",h?"inherit":"hidden",f?"inherit":"hidden",!f)),y!=="scale"&&y!=="transform"&&(y=yr[y],~y.indexOf(",")&&(y=y.split(",")[0]))),w=y in Wr,w){if(this.styles.save(y),P=c,p==="string"&&c.substring(0,6)==="var(--"){if(c=wn(t,c.substring(4,c.indexOf(")"))),c.substring(0,5)==="calc("){var E=t.style.perspective;t.style.perspective=c,c=wn(t,"perspective"),E?t.style.perspective=E:Cs(t,"perspective")}f=parseFloat(c)}if(C||(S=t._gsap,S.renderTransform&&!n.parseTransform||Fa(t,n.parseTransform),k=n.smoothOrigin!==!1&&S.smooth,C=this._pt=new on(this._pt,a,Qe,0,1,S.renderTransform,S,0,-1),C.dep=1),y==="scale")this._pt=new on(this._pt,S,"scaleY",S.scaleY,(v?qi(S.scaleY,v+f):f)-S.scaleY||0,ah),this._pt.u=0,o.push("scaleY",y),y+="X";else if(y==="transformOrigin"){R.push(an,0,a[an]),c=vD(c),S.svg?ch(t,c,0,k,0,this):(x=parseFloat(c.split(" ")[2])||0,x!==S.zOrigin&&ls(this,S,"zOrigin",S.zOrigin,x),ls(this,a,y,Wu(u),Wu(c)));continue}else if(y==="svgOrigin"){ch(t,c,1,k,0,this);continue}else if(y in Pk){bD(this,S,y,h,v?qi(h,v+c):c);continue}else if(y==="smoothOrigin"){ls(this,S,"smooth",S.smooth,c);continue}else if(y==="force3D"){S[y]=c;continue}else if(y==="transform"){SD(this,c,t);continue}}else y in a||(y=co(y)||y);if(w||(f||f===0)&&(h||h===0)&&!rD.test(c)&&y in a)_=(u+"").substr((h+"").length),f||(f=0),x=jt(c)||(y in bn.units?bn.units[y]:_),_!==x&&(h=Es(t,y,u,x)),this._pt=new on(this._pt,w?S:a,y,h,(v?qi(h,v+f):f)-h,!w&&(x==="px"||y==="zIndex")&&n.autoRound!==!1?aD:ah),this._pt.u=x||0,w&&P!==c?(this._pt.b=u,this._pt.e=P,this._pt.r=oD):_!==x&&x!=="%"&&(this._pt.b=u,this._pt.r=iD);else if(y in a)yD.call(this,t,y,u,v?v+c:c);else if(y in t)this.add(t,y,u||t[y],v?v+c:c,s,i);else if(y!=="parseTransform"){Yp(y,c);continue}w||(y in a?R.push(y,0,a[y]):typeof t[y]=="function"?R.push(y,2,t[y]()):R.push(y,1,u||t[y])),o.push(y)}}T&&_k(this)},render:function(t,n){if(n.tween._time||!om())for(var r=n._pt;r;)r.r(t,r.d),r=r._next;else n.styles.revert()},get:Mr,aliases:yr,getSetter:function(t,n,r){var s=yr[n];return s&&s.indexOf(",")<0&&(n=s),n in Wr&&n!==an&&(t._gsap.x||Mr(t,"x"))?r&&lv===r?n==="scale"?dD:cD:(lv=r||{})&&(n==="scale"?fD:hD):t.style&&!qp(t.style[n])?lD:~n.indexOf("-")?uD:rm(t,n)},core:{_removeProperty:Cs,_getMatrix:lm}};ln.utils.checkPrefix=co;ln.core.getStyleSaver=Ek;(function(e,t,n,r){var s=sn(e+","+t+","+n,function(i){Wr[i]=1});sn(t,function(i){bn.units[i]="deg",Pk[i]=1}),yr[s[13]]=e+","+t,sn(r,function(i){var o=i.split(":");yr[o[1]]=s[o[0]]})})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");sn("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(e){bn.units[e]="px"});ln.registerPlugin(Nk);var le=ln.registerPlugin(Nk)||ln;le.core.Tween;const Dr={fast:.18,base:.28,enterEase:"power3.out",exitEase:"power2.in"};function Xt(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}const Mk='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function yv(e){return Array.from(e.querySelectorAll(Mk)).filter(t=>{let n=t;for(;n&&n!==e.parentElement;){const r=window.getComputedStyle(n);if(r.display==="none"||r.visibility==="hidden")return!1;n=n.parentElement}return!0})}function mi(e){const t=m.useRef(null),n=m.useRef(!1),r=m.useRef(e);r.current=e;const s=m.useRef(null),i=m.useCallback(()=>{const a=s.current;a instanceof HTMLElement&&a.isConnected&&(a.tabIndex>=0||a.matches(Mk))&&a.focus(),s.current=null},[]);m.useEffect(()=>{const a=t.current;if(!a)return;const l=a.querySelector(":scope > *");if(s.current=document.activeElement,l){const f=yv(l)[0];f?f.focus():(l.hasAttribute("tabindex")||l.setAttribute("tabindex","-1"),l.focus())}function u(f){if(f.key!=="Tab"||!l)return;const h=yv(l);if(h.length===0){f.preventDefault();return}const p=h[0],g=h[h.length-1];f.shiftKey?(document.activeElement===p||!l.contains(document.activeElement))&&(f.preventDefault(),g.focus()):(document.activeElement===g||!l.contains(document.activeElement))&&(f.preventDefault(),p.focus())}if(document.addEventListener("keydown",u),Xt())return le.set(a,{opacity:1}),l&&le.set(l,{clearProps:"transform,opacity"}),()=>{document.removeEventListener("keydown",u)};const c=le.timeline();return c.fromTo(a,{opacity:0},{opacity:1,duration:Dr.fast,ease:"none"}),l&&c.fromTo(l,{y:14,scale:.97,opacity:0},{y:0,scale:1,opacity:1,duration:Dr.base,ease:Dr.enterEase},"<"),()=>{c.kill(),document.removeEventListener("keydown",u)}},[]);const o=m.useCallback(()=>{if(n.current)return;n.current=!0;const a=t.current;if(!a||Xt()){i(),r.current();return}const l=a.querySelector(":scope > *"),u=le.timeline({onComplete:()=>{i(),r.current()}});l&&u.to(l,{y:10,scale:.97,opacity:0,duration:Dr.fast,ease:Dr.exitEase}),u.to(a,{opacity:0,duration:Dr.fast,ease:"none"},"<")},[i]);return{rootRef:t,requestClose:o}}function um({size:e=18}){return d.jsxs("svg",{width:e,height:Math.round(e*1.2),viewBox:"0 0 10 12","aria-hidden":"true",focusable:"false",style:{display:"block",flexShrink:0},children:[d.jsx("rect",{x:"1",y:"2",width:"8",height:"7",fill:"#c97c5a"}),d.jsx("rect",{x:"0",y:"3",width:"1",height:"2",fill:"#c97c5a"}),d.jsx("rect",{x:"9",y:"3",width:"1",height:"2",fill:"#c97c5a"}),d.jsx("rect",{x:"2",y:"4",width:"2",height:"2",fill:"var(--bg)"}),d.jsx("rect",{x:"6",y:"4",width:"2",height:"2",fill:"var(--bg)"}),d.jsx("rect",{x:"2",y:"9",width:"2",height:"2",fill:"#c97c5a"}),d.jsx("rect",{x:"6",y:"9",width:"2",height:"2",fill:"#c97c5a"})]})}function Wn({size:e=16,children:t,...n}){return d.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:t})}function kD(e){return d.jsxs(Wn,{...e,children:[d.jsx("path",{d:"M12 20h9"}),d.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function Dk(e){return d.jsxs(Wn,{...e,children:[d.jsx("path",{d:"m7 11 2-2-2-2"}),d.jsx("path",{d:"M11 13h4"}),d.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"})]})}function Lk(e){return d.jsxs(Wn,{...e,children:[d.jsx("path",{d:"M12 8V4H8"}),d.jsx("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),d.jsx("path",{d:"M2 14h2"}),d.jsx("path",{d:"M20 14h2"}),d.jsx("path",{d:"M15 13v2"}),d.jsx("path",{d:"M9 13v2"})]})}function CD(e){return d.jsxs(Wn,{...e,children:[d.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),d.jsx("path",{d:"M9 3v18"})]})}function ED(e){return d.jsxs(Wn,{...e,children:[d.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),d.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function TD(e){return d.jsx(Wn,{...e,children:d.jsx("path",{d:"M22 12h-4l-3 9L9 3l-3 9H2"})})}function dh(e){return d.jsxs(Wn,{...e,children:[d.jsx("path",{d:"M18 6 6 18"}),d.jsx("path",{d:"m6 6 12 12"})]})}function ID(e){return d.jsx(Wn,{...e,children:d.jsx("path",{d:"M22 3H2l8 9.46V19l4 2v-8.54L22 3z"})})}function RD(e){return d.jsxs(Wn,{...e,children:[d.jsx("path",{d:"M12 5v14"}),d.jsx("path",{d:"m19 12-7 7-7-7"})]})}function PD(e){return d.jsxs(Wn,{...e,children:[d.jsx("circle",{cx:"11",cy:"11",r:"8"}),d.jsx("path",{d:"m21 21-4.35-4.35"})]})}function jD(e){return d.jsx(Wn,{...e,children:d.jsx("rect",{x:"5",y:"5",width:"14",height:"14",rx:"2",ry:"2",fill:"currentColor",stroke:"none"})})}function Ok({level:e=1,charging:t=!1,...n}){const r=Math.max(0,Math.min(1,e))*12;return d.jsxs(Wn,{...n,children:[d.jsx("rect",{width:"16",height:"10",x:"2",y:"7",rx:"2"}),d.jsx("line",{x1:"22",x2:"22",y1:"11",y2:"13"}),r>0?d.jsx("rect",{x:"4",y:"9",width:r,height:"6",rx:"1",fill:"currentColor",stroke:"none"}):null,t?d.jsx("path",{d:"M11 9.5 9 12h2l-2 2.5",stroke:"var(--bg, #000)",strokeWidth:1.4}):null]})}function fh(e){if(e.thinking)return!0;const t=e.lastActivityMs;return typeof t=="number"&&Number.isFinite(t)&&Date.now()-t<15e3}function AD(e){if(!e)return"";const t=e.replace(/\/$/,"").split("/");return t[t.length-1]||e}function ND(e){const t=new Map;for(const n of e){const r=n.sessionName??"?",s=n.windowIndex??0;t.has(r)||t.set(r,new Map);const i=t.get(r);i.has(s)||i.set(s,[]),i.get(s).push(n)}return[...t.entries()].sort(([n],[r])=>n.localeCompare(r,void 0,{numeric:!0})).map(([n,r])=>({sessionName:n,windows:[...r.entries()].sort(([s],[i])=>s-i).map(([s,i])=>({windowIndex:s,windowName:i[0]?.tmuxName||`window ${s}`,panes:[...i].sort((o,a)=>(o.paneIndex??0)-(a.paneIndex??0))}))}))}function MD({s:e,selected:t,onSelect:n,hotkey:r,workingOverrideId:s}){const i=e.kind==="terminal",o=e.kind==="codex",a=i?e.ccShell?`shell · ${e.cmd||"sh"}`:e.cmd||e.tmuxName||"shell":e.title||e.name||e.id,l=i?null:e.pending?"ask":fh(e)||e.id===s?"working":"sleeping",u=m.useRef(null),c=m.useRef(e.pending);return m.useEffect(()=>{e.pending&&!c.current&&u.current&&!Xt()&&le.fromTo(u.current,{boxShadow:"0 0 0 2px var(--accent)"},{boxShadow:"0 0 0 0 rgba(0,0,0,0)",duration:1.1,ease:"power2.out"}),c.current=e.pending},[e.pending]),d.jsxs("li",{ref:u,role:"option","aria-selected":t,tabIndex:0,className:"session-item","data-active":e.active?"true":"false","data-selected":t?"true":"false","data-kind":e.kind??"claude","data-pending":e.pending?"true":void 0,"data-hotkey":r,"data-hotkey-dir":r?"right":void 0,onClick:()=>n(e.id),onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),n(e.id))},children:[d.jsxs("div",{className:"session-top",children:[d.jsxs("span",{className:"pane-icon","data-kind":i?"terminal":o?"codex":"claude","data-active":e.active?"true":"false","data-state":l??void 0,"aria-label":i?"terminal pane":o?"Codex pane":"Claude pane",title:i?e.active?"active pane":"inactive pane":l==="ask"?"waiting on a question":l==="working"?"working…":"idle",children:[i?d.jsx(Dk,{size:15}):o?d.jsx(Lk,{size:14}):d.jsx(um,{size:14}),l==="ask"?d.jsx("span",{className:"pane-icon-badge pane-icon-ask","aria-hidden":"true",children:"?"}):l==="sleeping"?d.jsx("span",{className:"pane-icon-badge pane-icon-zzz","aria-hidden":"true",children:"z"}):null]}),d.jsx("span",{className:"session-name",children:a}),!i&&l==="working"?d.jsx("span",{className:"thinking-dot","aria-label":"working",title:"Working…"}):null,e.pending?d.jsx("span",{className:"ask-badge","aria-label":"pending question",children:"ASK"}):null,i&&e.cwd?d.jsx("span",{className:"meta-cwd meta-cwd-inline",children:AD(e.cwd)}):null]}),!i&&(e.model||e.ctxPct!=null)?d.jsxs("div",{className:"session-meta",children:[e.model?d.jsx("span",{className:"meta-model",children:e.model}):null,e.ctxPct!=null?d.jsxs("span",{className:"meta-ctx",children:["ctx:",Math.round(e.ctxPct),"%"]}):null]}):null]})}function DD({sessions:e,selectedId:t,onSelect:n,filter:r,collapsed:s,onToggleCollapse:i,hotkeyById:o,workingOverrideId:a}){const l=m.useMemo(()=>{const u=e.filter(c=>r==="all"?!0:r==="terminal"?c.kind==="terminal":r==="codex"?c.kind==="codex":c.kind!=="terminal"&&c.kind!=="codex");return ND(u)},[e,r]);return l.length===0?d.jsx("div",{className:"session-list",role:"listbox","aria-label":"Sessions",children:d.jsx("div",{className:"session-empty",children:r==="all"?"no tmux panes":`no ${r} sessions`})}):d.jsx("div",{className:"session-list",role:"listbox","aria-label":"Sessions",children:l.map(u=>{const c=s.has(u.sessionName),f=u.windows.reduce((h,p)=>h+p.panes.length,0);return d.jsxs("section",{className:"session-group","data-collapsed":c?"true":void 0,children:[d.jsxs("button",{type:"button",className:"session-group-head","aria-expanded":!c,onClick:()=>i(u.sessionName),children:[d.jsx("span",{className:"session-group-chevron","aria-hidden":"true",children:c?"▸":"▾"}),d.jsx("span",{className:"session-group-name",children:u.sessionName}),c?d.jsx("span",{className:"session-group-count",children:f}):null]}),c?null:u.windows.map(h=>d.jsxs("div",{className:"session-window",children:[d.jsxs("div",{className:"session-window-head",children:[d.jsx("span",{className:"window-idx",children:h.windowIndex}),d.jsx("span",{className:"window-name",children:h.windowName})]}),d.jsx("ul",{className:"session-pane-list",children:h.panes.map(p=>d.jsx(MD,{s:p,selected:p.id===t,onSelect:n,hotkey:o.get(p.id),workingOverrideId:a},p.id))})]},h.windowIndex))]},u.sessionName)})})}const LD={on:"Notifications on",off:"Enable notifications",denied:"Notifications blocked",unsupported:"Notifications unsupported",working:"Working…"};function OD({push:e}){const{status:t,supported:n,enable:r,disable:s}=e,i=t==="on",o=!n||t==="unsupported"||t==="working"||t==="denied",a=LD[t]??"Notifications",l=()=>{o||(i?s():r())};return d.jsx("button",{type:"button",className:"notify-bell","data-state":t,"aria-pressed":i,"aria-label":a,title:a,disabled:o,onClick:l,children:d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24","aria-hidden":"true",children:[d.jsx("path",{d:"M12 22a2.5 2.5 0 0 0 2.45-2h-4.9A2.5 2.5 0 0 0 12 22Zm7-5-1.6-1.6V10a5.4 5.4 0 0 0-4-5.2V4a1.4 1.4 0 0 0-2.8 0v.8A5.4 5.4 0 0 0 6.6 10v5.4L5 17v1h14Z",fill:i?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),t==="denied"||t==="unsupported"?d.jsx("line",{x1:"4",y1:"4",x2:"20",y2:"20",stroke:"currentColor",strokeWidth:"1.8"}):null]})})}function vv(e,t=""){return e!=null?`${Math.round(e)}${t}`:"—"}function zD({resources:e,conn:t,push:n}){const r=e.snapshot,s=r?.self??{},i=r?.system??{},o=!!r?.overLimit||!!e.warning,a=i.loadavg?.[0],l=r?.power;return d.jsxs("div",{className:"hud","data-warn":o?"true":"false",role:"status",children:[d.jsxs("span",{className:"hud-brand",children:[d.jsx(um,{size:18}),"claude control"]}),d.jsx("span",{className:`conn-dot conn-${t}`,title:t,"aria-label":t}),d.jsxs("span",{className:"hud-group",children:[d.jsx("span",{className:"hud-k",children:"cpu"}),d.jsx("span",{className:"hud-v",children:s.cpuPct!=null?`${s.cpuPct.toFixed(0)}%`:"—"})]}),d.jsxs("span",{className:"hud-group",children:[d.jsx("span",{className:"hud-k",children:"rss"}),d.jsx("span",{className:"hud-v",children:vv(s.rssMB,"m")})]}),d.jsxs("span",{className:"hud-group",children:[d.jsx("span",{className:"hud-k",children:"load"}),d.jsx("span",{className:"hud-v",children:a!=null?a.toFixed(2):"—"})]}),d.jsxs("span",{className:"hud-group",children:[d.jsx("span",{className:"hud-k",children:"mem"}),d.jsx("span",{className:"hud-v",children:vv(i.memUsedPct,"%")})]}),l&&l.hasBattery?d.jsxs("span",{className:"hud-group hud-battery","data-low":l.low?"true":void 0,"data-charging":l.charging?"true":void 0,title:`battery ${l.percent??"—"}%${l.charging?" · charging":""}${l.low?" · low":""}`,children:[d.jsx(Ok,{size:20,level:(l.percent??0)/100,charging:!!l.charging}),d.jsx("span",{className:"hud-v",children:l.percent!=null?`${l.percent}%`:"—"})]}):null,o?d.jsx("span",{className:"hud-warn-text",children:e.warning||"over limit"}):null,d.jsx("span",{className:"hud-spacer"}),d.jsx(OD,{push:n})]})}const FD={direction:"down",stagger:45,duration:300,exitOffset:50,easing:"cubic-bezier(0.34, 1.56, 0.64, 1)",bounce:.6,colorFade:280,skipUnchanged:!0,interrupt:!0},BD=" ",cm=e=>e===" "?BD:e,aa=new WeakMap;function zk(e){const t=aa.get(e);t&&(t.timers.forEach(n=>window.clearTimeout(n)),aa.delete(e),qu(e,t.target))}function Fk(e){const t=document.createElement("span");return t.className="char-face",t.textContent=cm(e),t}function Bk(e){const t=document.createElement("span");t.className="char-slot",t.dataset.char=e;const n=document.createElement("span");return n.className="char-sizer",n.textContent=cm(e),t.append(n,Fk(e)),t}function qu(e,t){e.classList.add("slot-text"),e.replaceChildren(...Array.from(t,Bk))}function $k(e,t,n={}){const{direction:r,stagger:s,duration:i,exitOffset:o,easing:a,bounce:l,color:u,colorFade:c,skipUnchanged:f,interrupt:h}={...FD,...n},p=aa.get(e);if(p&&!h){t!==p.target&&(p.pending={text:t,options:n});return}if(zk(e),!e.querySelector(".char-slot")){qu(e,t);return}const g=Array.from(e.querySelectorAll(".char-slot")),y=g.map(D=>D.dataset.char??"").join("");if(!h&&y===t)return;const _=Math.max(y.length,t.length),x=g.find(D=>(D.dataset.char??"")!=="")??g[0],v=getComputedStyle(e),w=Math.ceil(x?.getBoundingClientRect().height||x?.offsetHeight||e.getBoundingClientRect().height||parseFloat(v.lineHeight)||0)||Math.ceil(parseFloat(v.fontSize)*1.3)||18,C=u?v.color:"";for(let D=g.length;D<_;D++){const $=Bk("");e.appendChild($),g.push($)}const S=[],k={timers:S,target:t};aa.set(e,k);const T=r==="down"?w:-w,R=r==="down"?-w:w,P=(D,$)=>{const U=Math.sin((D+1)*12.9898+$*78.233)*43758.5453;return(U-Math.floor(U))*2-1};let E=0;for(let D=0;D<_;D++){const $=y[D]||"",U=t[D]||"";if($===U&&(f||$===""))continue;const V=g[D],J=V.querySelector(".char-sizer"),te=V.querySelector(".char-face"),B=V.getBoundingClientRect().width;J.textContent=cm(U);const z=J.getBoundingClientRect().width,b=Math.abs(z-B)>.5;b&&(V.style.width=`${B}px`),($===""||U==="")&&V.classList.add("is-resizing");const H=typeof u=="function"?u(D,_):u,X=U==="",I=Math.round(i*(X?.75:1)*(1+l*.45*P(D,1))),de=X?t.length*.5+(D-t.length)*.25:D,Se=Math.round(de*s*(1+l*.25*P(D,2))),me=(l*5*P(D,3)).toFixed(2),nt=`transform ${I}ms ${a}`,We=u?`${nt}, color ${c}ms linear ${I}ms`:nt,Pe=Fk(U);if(Pe.style.transformOrigin="50% 50%",Pe.style.transform=`translateY(${R}px) rotate(${me}deg)`,H&&(Pe.style.color=H),V.appendChild(Pe),V.offsetWidth,b){let Z=Se,se=I;X?(Z=Se+Math.round(I*.55),se=Math.max(140,Math.round(I*.6))):$===""&&(se=Math.max(140,Math.round(I*.45))),S.push(window.setTimeout(()=>{V.style.transition=`width ${se}ms cubic-bezier(0.2, 0, 0, 1)`,V.style.width=`${z}px`},Z)),E=Math.max(E,Z+se)}E=Math.max(E,Se+o+I+(u?c:0)),te&&S.push(window.setTimeout(()=>{te.style.transition=nt,te.style.transform=`translateY(${T}px) rotate(${-Number(me)}deg)`},Se)),S.push(window.setTimeout(()=>{Pe.style.transition=We,Pe.style.transform="translateY(0) rotate(0deg)",u&&(Pe.style.color=C);const Z=se=>{se.propertyName==="transform"&&(Pe.removeEventListener("transitionend",Z),V.dataset.char=U,V.style.removeProperty("transition"),V.style.removeProperty("width"),V.classList.remove("is-resizing"),V.querySelectorAll(".char-face").forEach(ie=>{ie!==Pe&&ie.remove()}))};Pe.addEventListener("transitionend",Z)},Se+o))}const M=E+80;S.push(window.setTimeout(()=>{const D=k.pending;aa.delete(e),qu(e,t),D&&$k(e,D.text,D.options)},M))}function $D(e,t=""){zk(e),e.classList.remove("slot-text"),e.textContent=t}const Uk=m.forwardRef(({text:e,options:t,"aria-label":n,...r},s)=>{const i=m.useRef(null),o=m.useRef(!1),a=m.useRef(!0),l=m.useRef(t);return m.useImperativeHandle(s,()=>i.current,[]),m.useEffect(()=>{l.current=t},[t]),m.useEffect(()=>{const u=i.current;if(u)return qu(u,e),o.current=!0,()=>{$D(u),o.current=!1,a.current=!0}},[]),m.useEffect(()=>{const u=i.current;if(!(!u||!o.current)){if(a.current){a.current=!1;return}$k(u,e,l.current)}},[e]),m.createElement("span",{...r,"aria-label":n??e,ref:i})});Uk.displayName="SlotText";const UD=(e,t)=>typeof e=="string"?e===t:JSON.stringify(e)===JSON.stringify(t),VD=(e,t)=>{if(!e||!t)return!1;const n=r=>{const{position:s,data:i,...o}=r||{};return o};return JSON.stringify(n(e.properties))===JSON.stringify(n(t.properties))&&UD(e.children,t.children)},Vk=(e,t)=>VD(e.node,t.node),dm=m.createContext(null),HD=()=>m.useContext(dm)!==null,WD=({children:e,...t})=>d.jsx(dm.Provider,{value:t,children:e}),qD=m.memo(WD,Vk),KD=({node:e,...t})=>d.jsx("pre",{...t}),GD=({node:e,...t})=>d.jsx("code",{...t}),fm=({node:e,components:{Pre:t,Code:n},code:r})=>d.jsx(t,{children:d.jsx(n,{node:e,children:r})}),YD=()=>null,QD=({node:e,components:{Pre:t,Code:n,SyntaxHighlighter:r,CodeHeader:s},language:i,code:o})=>{const a=m.useMemo(()=>({Pre:t,Code:n}),[t,n]);return d.jsxs(d.Fragment,{children:[d.jsx(s,{node:e,language:i,code:o}),d.jsx(i?r:fm,{node:e,components:a,language:i??"unknown",code:o})]})};var Hk={exports:{}};/*!
|
|
59
|
+
Copyright (c) 2018 Jed Watson.
|
|
60
|
+
Licensed under the MIT License (MIT), see
|
|
61
|
+
http://jedwatson.github.io/classnames
|
|
62
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",o=0;o<arguments.length;o++){var a=arguments[o];a&&(i=s(i,r(a)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var o="";for(var a in i)t.call(i,a)&&i[a]&&(o=s(o,a));return o}function s(i,o){return o?i?i+" "+o:i+o:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Hk);var XD=Hk.exports;const Wk=Va(XD),xv=({className:e,...t})=>({className:n,...r})=>({className:Wk(e,n),...t,...r}),JD=({node:e,components:{Pre:t,Code:n,SyntaxHighlighter:r,CodeHeader:s},componentsByLanguage:i={},children:o,...a})=>{const l=xv(m.useContext(dm)),u=ii(p=>d.jsx(t,{...l(p)})),c=xv(a),f=ii(p=>d.jsx(n,{...c(p)})),h=/language-(\w+)/.exec(a.className||"")?.[1]??"";return typeof o!="string"?d.jsx(fm,{node:e,components:{Pre:u,Code:f},code:o}):d.jsx(QD,{node:e,components:{Pre:u,Code:f,SyntaxHighlighter:i[h]?.SyntaxHighlighter??r,CodeHeader:i[h]?.CodeHeader??s},language:h||"unknown",code:o})},ZD=({node:e,components:t,componentsByLanguage:n,...r})=>HD()?d.jsx(JD,{node:e,components:t,componentsByLanguage:n,...r}):d.jsx(t.Code,{...r}),eL=m.memo(ZD,(e,t)=>e.components===t.components&&e.componentsByLanguage===t.componentsByLanguage&&Vk(e,t));function tL(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const nL=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rL=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sL={};function wv(e,t){return(sL.jsx?rL:nL).test(e)}const iL=/[ \t\n\f\r]/g;function oL(e){return typeof e=="object"?e.type==="text"?_v(e.value):!1:_v(e)}function _v(e){return e.replace(iL,"")===""}class Ja{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ja.prototype.normal={};Ja.prototype.property={};Ja.prototype.space=void 0;function qk(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Ja(n,r,t)}function hh(e){return e.toLowerCase()}class un{constructor(t,n){this.attribute=n,this.property=t}}un.prototype.attribute="";un.prototype.booleanish=!1;un.prototype.boolean=!1;un.prototype.commaOrSpaceSeparated=!1;un.prototype.commaSeparated=!1;un.prototype.defined=!1;un.prototype.mustUseProperty=!1;un.prototype.number=!1;un.prototype.overloadedBoolean=!1;un.prototype.property="";un.prototype.spaceSeparated=!1;un.prototype.space=void 0;let aL=0;const ce=gi(),ct=gi(),ph=gi(),q=gi(),Ae=gi(),Js=gi(),pn=gi();function gi(){return 2**++aL}const mh=Object.freeze(Object.defineProperty({__proto__:null,boolean:ce,booleanish:ct,commaOrSpaceSeparated:pn,commaSeparated:Js,number:q,overloadedBoolean:ph,spaceSeparated:Ae},Symbol.toStringTag,{value:"Module"})),Ed=Object.keys(mh);class hm extends un{constructor(t,n,r,s){let i=-1;if(super(t,n),bv(this,"space",s),typeof r=="number")for(;++i<Ed.length;){const o=Ed[i];bv(this,Ed[i],(r&mh[o])===mh[o])}}}hm.prototype.defined=!0;function bv(e,t,n){n&&(e[t]=n)}function _o(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new hm(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[hh(r)]=r,n[hh(i.attribute)]=r}return new Ja(t,n,e.space)}const Kk=_o({properties:{ariaActiveDescendant:null,ariaAtomic:ct,ariaAutoComplete:null,ariaBusy:ct,ariaChecked:ct,ariaColCount:q,ariaColIndex:q,ariaColSpan:q,ariaControls:Ae,ariaCurrent:null,ariaDescribedBy:Ae,ariaDetails:null,ariaDisabled:ct,ariaDropEffect:Ae,ariaErrorMessage:null,ariaExpanded:ct,ariaFlowTo:Ae,ariaGrabbed:ct,ariaHasPopup:null,ariaHidden:ct,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ae,ariaLevel:q,ariaLive:null,ariaModal:ct,ariaMultiLine:ct,ariaMultiSelectable:ct,ariaOrientation:null,ariaOwns:Ae,ariaPlaceholder:null,ariaPosInSet:q,ariaPressed:ct,ariaReadOnly:ct,ariaRelevant:null,ariaRequired:ct,ariaRoleDescription:Ae,ariaRowCount:q,ariaRowIndex:q,ariaRowSpan:q,ariaSelected:ct,ariaSetSize:q,ariaSort:null,ariaValueMax:q,ariaValueMin:q,ariaValueNow:q,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Gk(e,t){return t in e?e[t]:t}function Yk(e,t){return Gk(e,t.toLowerCase())}const lL=_o({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Js,acceptCharset:Ae,accessKey:Ae,action:null,allow:null,allowFullScreen:ce,allowPaymentRequest:ce,allowUserMedia:ce,alpha:ce,alt:null,as:null,async:ce,autoCapitalize:null,autoComplete:Ae,autoFocus:ce,autoPlay:ce,blocking:Ae,capture:null,charSet:null,checked:ce,cite:null,className:Ae,closedBy:null,colorSpace:null,cols:q,colSpan:q,command:null,commandFor:null,content:null,contentEditable:ct,controls:ce,controlsList:Ae,coords:q|Js,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ce,defer:ce,dir:null,dirName:null,disabled:ce,download:ph,draggable:ct,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ce,formTarget:null,headers:Ae,height:q,hidden:ph,high:q,href:null,hrefLang:null,htmlFor:Ae,httpEquiv:Ae,id:null,imageSizes:null,imageSrcSet:null,inert:ce,inputMode:null,integrity:null,is:null,isMap:ce,itemId:null,itemProp:Ae,itemRef:Ae,itemScope:ce,itemType:Ae,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ce,low:q,manifest:null,max:null,maxLength:q,media:null,method:null,min:null,minLength:q,multiple:ce,muted:ce,name:null,nonce:null,noModule:ce,noValidate:ce,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:ce,optimum:q,pattern:null,ping:Ae,placeholder:null,playsInline:ce,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ce,referrerPolicy:null,rel:Ae,required:ce,reversed:ce,rows:q,rowSpan:q,sandbox:Ae,scope:null,scoped:ce,seamless:ce,selected:ce,shadowRootClonable:ce,shadowRootCustomElementRegistry:ce,shadowRootDelegatesFocus:ce,shadowRootMode:null,shadowRootSerializable:ce,shape:null,size:q,sizes:null,slot:null,span:q,spellCheck:ct,src:null,srcDoc:null,srcLang:null,srcSet:null,start:q,step:null,style:null,tabIndex:q,target:null,title:null,translate:null,type:null,typeMustMatch:ce,useMap:null,value:ct,width:q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ae,axis:null,background:null,bgColor:null,border:q,borderColor:null,bottomMargin:q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ce,declare:ce,event:null,face:null,frame:null,frameBorder:null,hSpace:q,leftMargin:q,link:null,longDesc:null,lowSrc:null,marginHeight:q,marginWidth:q,noResize:ce,noHref:ce,noShade:ce,noWrap:ce,object:null,profile:null,prompt:null,rev:null,rightMargin:q,rules:null,scheme:null,scrolling:ct,standby:null,summary:null,text:null,topMargin:q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:q,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:ce,disablePictureInPicture:ce,disableRemotePlayback:ce,exportParts:Js,part:Ae,prefix:null,property:null,results:q,security:null,unselectable:null},space:"html",transform:Yk}),uL=_o({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",maskType:"mask-type",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:pn,accentHeight:q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:q,amplitude:q,arabicForm:null,ascent:q,attributeName:null,attributeType:null,azimuth:q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:q,by:null,calcMode:null,capHeight:q,className:Ae,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:q,diffuseConstant:q,direction:null,display:null,dur:null,divisor:q,dominantBaseline:null,download:ce,dx:null,dy:null,edgeMode:null,editable:null,elevation:q,enableBackground:null,end:null,event:null,exponent:q,externalResourcesRequired:null,fill:null,fillOpacity:q,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:Js,g2:Js,glyphName:Js,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:q,horizOriginX:q,horizOriginY:q,id:null,ideographic:q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:q,k:q,k1:q,k2:q,k3:q,k4:q,kernelMatrix:pn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:q,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:q,overlineThickness:q,paintOrder:null,panose1:null,path:null,pathLength:q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ae,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:q,pointsAtY:q,pointsAtZ:q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:pn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:pn,rev:pn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:pn,requiredFeatures:pn,requiredFonts:pn,requiredFormats:pn,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:q,specularExponent:q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:q,strikethroughThickness:q,string:null,stroke:null,strokeDashArray:pn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:q,strokeOpacity:q,strokeWidth:null,style:null,surfaceScale:q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:pn,tabIndex:q,tableValues:null,target:null,targetX:q,targetY:q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:pn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:q,underlineThickness:q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:q,values:null,vAlphabetic:q,vMathematical:q,vectorEffect:null,vHanging:q,vIdeographic:q,version:null,vertAdvY:q,vertOriginX:q,vertOriginY:q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Gk}),Qk=_o({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()}}),Xk=_o({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Yk}),Jk=_o({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),cL={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"},dL=/[A-Z]/g,Sv=/-[a-z]/g,fL=/^data[-\w.:]+$/i;function hL(e,t){const n=hh(t);let r=t,s=un;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&fL.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(Sv,mL);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!Sv.test(i)){let o=i.replace(dL,pL);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=hm}return new s(r,t)}function pL(e){return"-"+e.toLowerCase()}function mL(e){return e.charAt(1).toUpperCase()}const gL=qk([Kk,lL,Qk,Xk,Jk],"html"),pm=qk([Kk,uL,Qk,Xk,Jk],"svg");function yL(e){return e.join(" ").trim()}var mm={},kv=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,vL=/\n/g,xL=/^\s*/,wL=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,_L=/^:\s*/,bL=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,SL=/^[;\s]*/,kL=/^\s+|\s+$/g,CL=`
|
|
63
|
+
`,Cv="/",Ev="*",Bs="",EL="comment",TL="declaration";function IL(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 s(g){var y=g.match(vL);y&&(n+=y.length);var _=g.lastIndexOf(CL);r=~_?g.length-_:r+g.length}function i(){var g={line:n,column:r};return function(y){return y.position=new o(g),u(),y}}function o(g){this.start=g,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(g){var y=new Error(t.source+":"+n+":"+r+": "+g);if(y.reason=g,y.filename=t.source,y.line=n,y.column=r,y.source=e,!t.silent)throw y}function l(g){var y=g.exec(e);if(y){var _=y[0];return s(_),e=e.slice(_.length),y}}function u(){l(xL)}function c(g){var y;for(g=g||[];y=f();)y!==!1&&g.push(y);return g}function f(){var g=i();if(!(Cv!=e.charAt(0)||Ev!=e.charAt(1))){for(var y=2;Bs!=e.charAt(y)&&(Ev!=e.charAt(y)||Cv!=e.charAt(y+1));)++y;if(y+=2,Bs===e.charAt(y-1))return a("End of comment missing");var _=e.slice(2,y-2);return r+=2,s(_),e=e.slice(y),r+=2,g({type:EL,comment:_})}}function h(){var g=i(),y=l(wL);if(y){if(f(),!l(_L))return a("property missing ':'");var _=l(bL),x=g({type:TL,property:Tv(y[0].replace(kv,Bs)),value:_?Tv(_[0].replace(kv,Bs)):Bs});return l(SL),x}}function p(){var g=[];c(g);for(var y;y=h();)y!==!1&&(g.push(y),c(g));return g}return u(),p()}function Tv(e){return e?e.replace(kL,Bs):Bs}var RL=IL,PL=tu&&tu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(mm,"__esModule",{value:!0});mm.default=AL;const jL=PL(RL);function AL(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,jL.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:a}=i;s?t(o,a,i):a&&(n=n||{},n[o]=a)}),n}var Ec={};Object.defineProperty(Ec,"__esModule",{value:!0});Ec.camelCase=void 0;var NL=/^--[a-zA-Z0-9_-]+$/,ML=/-([a-z])/g,DL=/^[^-]+$/,LL=/^-(webkit|moz|ms|o|khtml)-/,OL=/^-(ms)-/,zL=function(e){return!e||DL.test(e)||NL.test(e)},FL=function(e,t){return t.toUpperCase()},Iv=function(e,t){return"".concat(t,"-")},BL=function(e,t){return t===void 0&&(t={}),zL(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(OL,Iv):e=e.replace(LL,Iv),e.replace(ML,FL))};Ec.camelCase=BL;var $L=tu&&tu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},UL=$L(mm),VL=Ec;function gh(e,t){var n={};return!e||typeof e!="string"||(0,UL.default)(e,function(r,s){r&&s&&(n[(0,VL.camelCase)(r,t)]=s)}),n}gh.default=gh;var HL=gh;const WL=Va(HL),Zk=e1("end"),gm=e1("start");function e1(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 qL(e){const t=gm(e),n=Zk(e);if(t&&n)return{start:t,end:n}}function la(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Rv(e.position):"start"in e||"end"in e?Rv(e):"line"in e||"column"in e?yh(e):""}function yh(e){return Pv(e&&e.line)+":"+Pv(e&&e.column)}function Rv(e){return yh(e&&e.start)+"-"+yh(e&&e.end)}function Pv(e){return e&&typeof e=="number"?e:1}class Dt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(o=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=a?a.line:void 0,this.name=la(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Dt.prototype.file="";Dt.prototype.name="";Dt.prototype.reason="";Dt.prototype.message="";Dt.prototype.stack="";Dt.prototype.column=void 0;Dt.prototype.line=void 0;Dt.prototype.ancestors=void 0;Dt.prototype.cause=void 0;Dt.prototype.fatal=void 0;Dt.prototype.place=void 0;Dt.prototype.ruleId=void 0;Dt.prototype.source=void 0;const ym={}.hasOwnProperty,KL=new Map,GL=/[A-Z]/g,YL=new Set(["table","tbody","thead","tfoot","tr"]),QL=new Set(["td","th"]),t1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function XL(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=iO(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=sO(n,t.jsx,t.jsxs)}const s={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"?pm:gL,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=n1(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function n1(e,t,n){if(t.type==="element")return JL(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ZL(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return tO(e,t,n);if(t.type==="mdxjsEsm")return eO(e,t);if(t.type==="root")return nO(e,t,n);if(t.type==="text")return rO(e,t)}function JL(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=pm,e.schema=s),e.ancestors.push(t);const i=s1(e,t.tagName,!1),o=oO(e,t);let a=xm(e,t);return YL.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!oL(l):!0})),r1(e,o,i,t),vm(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function ZL(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)}Ba(e,t.position)}function eO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ba(e,t.position)}function tO(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=pm,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:s1(e,t.name,!0),o=aO(e,t),a=xm(e,t);return r1(e,o,i,t),vm(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function nO(e,t,n){const r={};return vm(r,xm(e,t)),e.create(t,e.Fragment,r,n)}function rO(e,t){return t.value}function r1(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function vm(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function sO(e,t,n){return r;function r(s,i,o,a){const u=Array.isArray(o.children)?n:t;return a?u(i,o,a):u(i,o)}}function iO(e,t){return n;function n(r,s,i,o){const a=Array.isArray(i.children),l=gm(r);return t(s,i,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function oO(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&ym.call(t.properties,s)){const i=lO(e,s,t.properties[s]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&QL.has(t.tagName)?r=a:n[o]=a}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function aO(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Ba(e,t.position);else{const s=r.name;let i;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,i=e.evaluater.evaluateExpression(a.expression)}else Ba(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function xm(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:KL;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const u=s.get(l)||0;o=l+"-"+u,s.set(l,u+1)}}const a=n1(e,i,o);a!==void 0&&n.push(a)}return n}function lO(e,t,n){const r=hL(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?tL(n):yL(n)),r.property==="style"){let s=typeof n=="object"?n:uO(e,String(n));return e.stylePropertyNameCase==="css"&&(s=cO(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?cL[r.property]||r.property:r.attribute,n]}}function uO(e,t){try{return WL(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Dt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=t1+"#cannot-parse-style-attribute",s}}function s1(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,o;for(;++i<s.length;){const a=wv(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}r=o}else r=wv(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return ym.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ba(e)}function Ba(e,t){const n=new Dt("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=t1+"#cannot-handle-mdx-estrees-without-createevaluater",n}function cO(e){const t={};let n;for(n in e)ym.call(e,n)&&(t[dO(n)]=e[n]);return t}function dO(e){let t=e.replace(GL,fO);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function fO(e){return"-"+e.toLowerCase()}const Td={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"]},hO={};function wm(e,t){const n=hO,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return i1(e,r,s)}function i1(e,t,n){if(pO(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 jv(e.children,t,n)}return Array.isArray(e)?jv(e,t,n):""}function jv(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=i1(e[s],t,n);return r.join("")}function pO(e){return!!(e&&typeof e=="object")}const Av=document.createElement("i");function _m(e){const t="&"+e+";";Av.innerHTML=t;const n=Av.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Sn(e,t,n,r){const s=e.length;let i=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s: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);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function On(e,t){return e.length>0?(Sn(e,e.length,0,t),e):t}const Nv={}.hasOwnProperty;function o1(e){const t={};let n=-1;for(;++n<e.length;)mO(t,e[n]);return t}function mO(e,t){let n;for(n in t){const s=(Nv.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){Nv.call(s,o)||(s[o]=[]);const a=i[o];gO(s[o],Array.isArray(a)?a:a?[a]:[])}}}function gO(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Sn(e,0,0,r)}function a1(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 rr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const $t=js(/[A-Za-z]/),At=js(/[\dA-Za-z]/),yO=js(/[#-'*+\--9=?A-Z^-~]/);function Ku(e){return e!==null&&(e<32||e===127)}const vh=js(/\d/),vO=js(/[\dA-Fa-f]/),xO=js(/[!-/:-@[-`{-~]/);function oe(e){return e!==null&&e<-2}function Me(e){return e!==null&&(e<0||e===32)}function xe(e){return e===-2||e===-1||e===32}const Tc=js(/\p{P}|\p{S}/u),oi=js(/\s/);function js(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function bo(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&At(e.charCodeAt(n+1))&&At(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(o=String.fromCharCode(i,a),s=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function Ce(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return xe(l)?(e.enter(n),a(l)):t(l)}function a(l){return xe(l)&&i++<s?(e.consume(l),a):(e.exit(n),t(l))}}const wO={tokenize:_O};function _O(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Ce(e,t,"linePrefix")}function s(a){return e.enter("paragraph"),i(a)}function i(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 oe(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const bO={tokenize:SO},Mv={tokenize:kO};function SO(e){const t=this,n=[];let r=0,s,i,o;return a;function a(w){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,l,u)(w)}return u(w)}function l(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&v();const C=t.events.length;let S=C,k;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){k=t.events[S][1].end;break}x(r);let T=C;for(;T<t.events.length;)t.events[T][1].end={...k},T++;return Sn(t.events,S+1,0,t.events.slice(C)),t.events.length=T,u(w)}return a(w)}function u(w){if(r===n.length){if(!s)return h(w);if(s.currentConstruct&&s.currentConstruct.concrete)return g(w);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Mv,c,f)(w)}function c(w){return s&&v(),x(r),h(w)}function f(w){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,g(w)}function h(w){return t.containerState={},e.attempt(Mv,p,g)(w)}function p(w){return r++,n.push([t.currentConstruct,t.containerState]),h(w)}function g(w){if(w===null){s&&v(),x(0),e.consume(w);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),y(w)}function y(w){if(w===null){_(e.exit("chunkFlow"),!0),x(0),e.consume(w);return}return oe(w)?(e.consume(w),_(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(w),y)}function _(w,C){const S=t.sliceStream(w);if(C&&S.push(null),w.previous=i,i&&(i.next=w),i=w,s.defineSkip(w.start),s.write(S),t.parser.lazy[w.start.line]){let k=s.events.length;for(;k--;)if(s.events[k][1].start.offset<o&&(!s.events[k][1].end||s.events[k][1].end.offset>o))return;const T=t.events.length;let R=T,P,E;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(P){E=t.events[R][1].end;break}P=!0}for(x(r),k=T;k<t.events.length;)t.events[k][1].end={...E},k++;Sn(t.events,R+1,0,t.events.slice(T)),t.events.length=k}}function x(w){let C=n.length;for(;C-- >w;){const S=n[C];t.containerState=S[1],S[0].exit.call(t,e)}n.length=w}function v(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function kO(e,t,n){return Ce(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function fo(e){if(e===null||Me(e)||oi(e))return 1;if(Tc(e))return 2}function Ic(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const xh={name:"attention",resolveAll:CO,tokenize:EO};function CO(e,t){let n=-1,r,s,i,o,a,l,u,c;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 f={...e[r][1].end},h={...e[n][1].start};Dv(f,-l),Dv(h,l),o={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=On(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=On(u,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=On(u,Ic(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=On(u,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=On(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,Sn(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function EO(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=fo(r);let i;return o;function o(l){return i=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===i)return e.consume(l),a;const u=e.exit("attentionSequence"),c=fo(l),f=!c||c===2&&s||n.includes(l),h=!s||s===2&&c||n.includes(r);return u._open=!!(i===42?f:f&&(s||!h)),u._close=!!(i===42?h:h&&(c||!f)),t(l)}}function Dv(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const TO={name:"autolink",tokenize:IO};function IO(e,t,n){let r=0;return s;function s(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return $t(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||At(p)?(r=1,a(p)):u(p)}function a(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||At(p))&&r++<32?(e.consume(p),a):(r=0,u(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||Ku(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),c):yO(p)?(e.consume(p),u):n(p)}function c(p){return At(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,c):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||At(p))&&r++<63){const g=p===45?h:f;return e.consume(p),g}return n(p)}}const Za={partial:!0,tokenize:RO};function RO(e,t,n){return r;function r(i){return xe(i)?Ce(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||oe(i)?t(i):n(i)}}const l1={continuation:{tokenize:jO},exit:AO,name:"blockQuote",tokenize:PO};function PO(e,t,n){const r=this;return s;function s(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"),i}return n(o)}function i(o){return xe(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function jO(e,t,n){const r=this;return s;function s(o){return xe(o)?Ce(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(l1,t,n)(o)}}function AO(e){e.exit("blockQuote")}const u1={name:"characterEscape",tokenize:NO};function NO(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return xO(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const c1={name:"characterReference",tokenize:MO};function MO(e,t,n){const r=this;let s=0,i,o;return a;function a(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=At,c(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=vO,c):(e.enter("characterReferenceValue"),i=7,o=vh,c(f))}function c(f){if(f===59&&s){const h=e.exit("characterReferenceValue");return o===At&&!_m(r.sliceSerialize(h))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(f)&&s++<i?(e.consume(f),c):n(f)}}const Lv={partial:!0,tokenize:LO},Ov={concrete:!0,name:"codeFenced",tokenize:DO};function DO(e,t,n){const r=this,s={partial:!0,tokenize:S};let i=0,o=0,a;return l;function l(k){return u(k)}function u(k){const T=r.events[r.events.length-1];return i=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,a=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(k)}function c(k){return k===a?(o++,e.consume(k),c):o<3?n(k):(e.exit("codeFencedFenceSequence"),xe(k)?Ce(e,f,"whitespace")(k):f(k))}function f(k){return k===null||oe(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(Lv,y,C)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(k))}function h(k){return k===null||oe(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(k)):xe(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ce(e,p,"whitespace")(k)):k===96&&k===a?n(k):(e.consume(k),h)}function p(k){return k===null||oe(k)?f(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===null||oe(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(k)):k===96&&k===a?n(k):(e.consume(k),g)}function y(k){return e.attempt(s,C,_)(k)}function _(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),x}function x(k){return i>0&&xe(k)?Ce(e,v,"linePrefix",i+1)(k):v(k)}function v(k){return k===null||oe(k)?e.check(Lv,y,C)(k):(e.enter("codeFlowValue"),w(k))}function w(k){return k===null||oe(k)?(e.exit("codeFlowValue"),v(k)):(e.consume(k),w)}function C(k){return e.exit("codeFenced"),t(k)}function S(k,T,R){let P=0;return E;function E(V){return k.enter("lineEnding"),k.consume(V),k.exit("lineEnding"),M}function M(V){return k.enter("codeFencedFence"),xe(V)?Ce(k,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):D(V)}function D(V){return V===a?(k.enter("codeFencedFenceSequence"),$(V)):R(V)}function $(V){return V===a?(P++,k.consume(V),$):P>=o?(k.exit("codeFencedFenceSequence"),xe(V)?Ce(k,U,"whitespace")(V):U(V)):R(V)}function U(V){return V===null||oe(V)?(k.exit("codeFencedFence"),T(V)):R(V)}}}function LO(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Id={name:"codeIndented",tokenize:zO},OO={partial:!0,tokenize:FO};function zO(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),Ce(e,i,"linePrefix",5)(u)}function i(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?l(u):oe(u)?e.attempt(OO,o,l)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||oe(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),a)}function l(u){return e.exit("codeIndented"),t(u)}}function FO(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):oe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):Ce(e,i,"linePrefix",5)(o)}function i(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):oe(o)?s(o):n(o)}}const BO={name:"codeText",previous:UO,resolve:$O,tokenize:VO};function $O(e){let t=e.length-4,n=3,r,s;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;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function UO(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function VO(e,t,n){let r=0,s,i;return o;function o(f){return e.enter("codeText"),e.enter("codeTextSequence"),a(f)}function a(f){return f===96?(e.consume(f),r++,a):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(i=e.enter("codeTextSequence"),s=0,c(f)):oe(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||oe(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),u)}function c(f){return f===96?(e.consume(f),s++,c):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}class HO{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 s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Do(this.left,r),i.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),Do(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Do(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);Do(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Do(this.left,n.reverse())}}}function Do(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 d1(e){const t={};let n=-1,r,s,i,o,a,l,u;const c=new HO(e);for(;++n<c.length;){for(;n in t;)n=t[n];if(r=c.get(n),n&&r[1].type==="chunkFlow"&&c.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,WO(c,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=c.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(c.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...c.get(s)[1].start},a=c.slice(s,n),a.unshift(r),c.splice(s,n-s+1,a))}}return Sn(e,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function WO(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],u={};let c,f,h=-1,p=n,g=0,y=0;const _=[y];for(;p;){for(;e.get(++s)[1]!==p;);i.push(s),p._tokenizer||(c=r.sliceStream(p),p.next||c.push(null),f&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(c),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++h<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(y=h+1,_.push(y),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):_.pop(),h=_.length;h--;){const x=a.slice(_[h],_[h+1]),v=i.pop();l.push([v,v+x.length-1]),e.splice(v,2,x)}for(l.reverse(),h=-1;++h<l.length;)u[g+l[h][0]]=g+l[h][1],g+=l[h][1]-l[h][0]-1;return u}const qO={resolve:GO,tokenize:YO},KO={partial:!0,tokenize:QO};function GO(e){return d1(e),e}function YO(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(a)}function s(a){return a===null?i(a):oe(a)?e.check(KO,o,i)(a):(e.consume(a),s)}function i(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,s}}function QO(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ce(e,i,"linePrefix")}function i(o){if(o===null||oe(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 f1(e,t,n,r,s,i,o,a,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(x){return x===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(x),e.exit(i),h):x===null||x===32||x===41||Ku(x)?n(x):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),y(x))}function h(x){return x===62?(e.enter(i),e.consume(x),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===62?(e.exit("chunkString"),e.exit(a),h(x)):x===null||x===60||oe(x)?n(x):(e.consume(x),x===92?g:p)}function g(x){return x===60||x===62||x===92?(e.consume(x),p):p(x)}function y(x){return!c&&(x===null||x===41||Me(x))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(x)):c<u&&x===40?(e.consume(x),c++,y):x===41?(e.consume(x),c--,y):x===null||x===32||x===40||Ku(x)?n(x):(e.consume(x),x===92?_:y)}function _(x){return x===40||x===41||x===92?(e.consume(x),y):y(x)}}function h1(e,t,n,r,s,i){const o=this;let a=0,l;return u;function u(p){return e.enter(r),e.enter(s),e.consume(p),e.exit(s),e.enter(i),c}function c(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(i),e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):oe(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||oe(p)||a++>999?(e.exit("chunkString"),c(p)):(e.consume(p),l||(l=!xe(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),a++,f):f(p)}}function p1(e,t,n,r,s,i){let o;return a;function a(h){return h===34||h===39||h===40?(e.enter(r),e.enter(s),e.consume(h),e.exit(s),o=h===40?41:h,l):n(h)}function l(h){return h===o?(e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):(e.enter(i),u(h))}function u(h){return h===o?(e.exit(i),l(o)):h===null?n(h):oe(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Ce(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===o||h===null||oe(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:c)}function f(h){return h===o||h===92?(e.consume(h),c):c(h)}}function ua(e,t){let n;return r;function r(s){return oe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):xe(s)?Ce(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const XO={name:"definition",tokenize:ZO},JO={partial:!0,tokenize:ez};function ZO(e,t,n){const r=this;let s;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return h1.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return s=rr(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 Me(p)?ua(e,u)(p):u(p)}function u(p){return f1(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(JO,f,f)(p)}function f(p){return xe(p)?Ce(e,h,"whitespace")(p):h(p)}function h(p){return p===null||oe(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function ez(e,t,n){return r;function r(a){return Me(a)?ua(e,s)(a):n(a)}function s(a){return p1(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return xe(a)?Ce(e,o,"whitespace")(a):o(a)}function o(a){return a===null||oe(a)?t(a):n(a)}}const tz={name:"hardBreakEscape",tokenize:nz};function nz(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return oe(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const rz={name:"headingAtx",resolve:sz,tokenize:iz};function sz(e,t){let n=e.length-2,r=3,s,i;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&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Sn(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function iz(e,t,n){let r=0;return s;function s(c){return e.enter("atxHeading"),i(c)}function i(c){return e.enter("atxHeadingSequence"),o(c)}function o(c){return c===35&&r++<6?(e.consume(c),o):c===null||Me(c)?(e.exit("atxHeadingSequence"),a(c)):n(c)}function a(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||oe(c)?(e.exit("atxHeading"),t(c)):xe(c)?Ce(e,a,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),a(c))}function u(c){return c===null||c===35||Me(c)?(e.exit("atxHeadingText"),a(c)):(e.consume(c),u)}}const oz=["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"],zv=["pre","script","style","textarea"],az={concrete:!0,name:"htmlFlow",resolveTo:cz,tokenize:dz},lz={partial:!0,tokenize:hz},uz={partial:!0,tokenize:fz};function cz(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 dz(e,t,n){const r=this;let s,i,o,a,l;return u;function u(I){return c(I)}function c(I){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(I),f}function f(I){return I===33?(e.consume(I),h):I===47?(e.consume(I),i=!0,y):I===63?(e.consume(I),s=3,r.interrupt?t:b):$t(I)?(e.consume(I),o=String.fromCharCode(I),_):n(I)}function h(I){return I===45?(e.consume(I),s=2,p):I===91?(e.consume(I),s=5,a=0,g):$t(I)?(e.consume(I),s=4,r.interrupt?t:b):n(I)}function p(I){return I===45?(e.consume(I),r.interrupt?t:b):n(I)}function g(I){const de="CDATA[";return I===de.charCodeAt(a++)?(e.consume(I),a===de.length?r.interrupt?t:D:g):n(I)}function y(I){return $t(I)?(e.consume(I),o=String.fromCharCode(I),_):n(I)}function _(I){if(I===null||I===47||I===62||Me(I)){const de=I===47,Se=o.toLowerCase();return!de&&!i&&zv.includes(Se)?(s=1,r.interrupt?t(I):D(I)):oz.includes(o.toLowerCase())?(s=6,de?(e.consume(I),x):r.interrupt?t(I):D(I)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(I):i?v(I):w(I))}return I===45||At(I)?(e.consume(I),o+=String.fromCharCode(I),_):n(I)}function x(I){return I===62?(e.consume(I),r.interrupt?t:D):n(I)}function v(I){return xe(I)?(e.consume(I),v):E(I)}function w(I){return I===47?(e.consume(I),E):I===58||I===95||$t(I)?(e.consume(I),C):xe(I)?(e.consume(I),w):E(I)}function C(I){return I===45||I===46||I===58||I===95||At(I)?(e.consume(I),C):S(I)}function S(I){return I===61?(e.consume(I),k):xe(I)?(e.consume(I),S):w(I)}function k(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),l=I,T):xe(I)?(e.consume(I),k):R(I)}function T(I){return I===l?(e.consume(I),l=null,P):I===null||oe(I)?n(I):(e.consume(I),T)}function R(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||Me(I)?S(I):(e.consume(I),R)}function P(I){return I===47||I===62||xe(I)?w(I):n(I)}function E(I){return I===62?(e.consume(I),M):n(I)}function M(I){return I===null||oe(I)?D(I):xe(I)?(e.consume(I),M):n(I)}function D(I){return I===45&&s===2?(e.consume(I),J):I===60&&s===1?(e.consume(I),te):I===62&&s===4?(e.consume(I),H):I===63&&s===3?(e.consume(I),b):I===93&&s===5?(e.consume(I),z):oe(I)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(lz,X,$)(I)):I===null||oe(I)?(e.exit("htmlFlowData"),$(I)):(e.consume(I),D)}function $(I){return e.check(uz,U,X)(I)}function U(I){return e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),V}function V(I){return I===null||oe(I)?$(I):(e.enter("htmlFlowData"),D(I))}function J(I){return I===45?(e.consume(I),b):D(I)}function te(I){return I===47?(e.consume(I),o="",B):D(I)}function B(I){if(I===62){const de=o.toLowerCase();return zv.includes(de)?(e.consume(I),H):D(I)}return $t(I)&&o.length<8?(e.consume(I),o+=String.fromCharCode(I),B):D(I)}function z(I){return I===93?(e.consume(I),b):D(I)}function b(I){return I===62?(e.consume(I),H):I===45&&s===2?(e.consume(I),b):D(I)}function H(I){return I===null||oe(I)?(e.exit("htmlFlowData"),X(I)):(e.consume(I),H)}function X(I){return e.exit("htmlFlow"),t(I)}}function fz(e,t,n){const r=this;return s;function s(o){return oe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function hz(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Za,t,n)}}const pz={name:"htmlText",tokenize:mz};function mz(e,t,n){const r=this;let s,i,o;return a;function a(b){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(b),l}function l(b){return b===33?(e.consume(b),u):b===47?(e.consume(b),S):b===63?(e.consume(b),w):$t(b)?(e.consume(b),R):n(b)}function u(b){return b===45?(e.consume(b),c):b===91?(e.consume(b),i=0,g):$t(b)?(e.consume(b),v):n(b)}function c(b){return b===45?(e.consume(b),p):n(b)}function f(b){return b===null?n(b):b===45?(e.consume(b),h):oe(b)?(o=f,te(b)):(e.consume(b),f)}function h(b){return b===45?(e.consume(b),p):f(b)}function p(b){return b===62?J(b):b===45?h(b):f(b)}function g(b){const H="CDATA[";return b===H.charCodeAt(i++)?(e.consume(b),i===H.length?y:g):n(b)}function y(b){return b===null?n(b):b===93?(e.consume(b),_):oe(b)?(o=y,te(b)):(e.consume(b),y)}function _(b){return b===93?(e.consume(b),x):y(b)}function x(b){return b===62?J(b):b===93?(e.consume(b),x):y(b)}function v(b){return b===null||b===62?J(b):oe(b)?(o=v,te(b)):(e.consume(b),v)}function w(b){return b===null?n(b):b===63?(e.consume(b),C):oe(b)?(o=w,te(b)):(e.consume(b),w)}function C(b){return b===62?J(b):w(b)}function S(b){return $t(b)?(e.consume(b),k):n(b)}function k(b){return b===45||At(b)?(e.consume(b),k):T(b)}function T(b){return oe(b)?(o=T,te(b)):xe(b)?(e.consume(b),T):J(b)}function R(b){return b===45||At(b)?(e.consume(b),R):b===47||b===62||Me(b)?P(b):n(b)}function P(b){return b===47?(e.consume(b),J):b===58||b===95||$t(b)?(e.consume(b),E):oe(b)?(o=P,te(b)):xe(b)?(e.consume(b),P):J(b)}function E(b){return b===45||b===46||b===58||b===95||At(b)?(e.consume(b),E):M(b)}function M(b){return b===61?(e.consume(b),D):oe(b)?(o=M,te(b)):xe(b)?(e.consume(b),M):P(b)}function D(b){return b===null||b===60||b===61||b===62||b===96?n(b):b===34||b===39?(e.consume(b),s=b,$):oe(b)?(o=D,te(b)):xe(b)?(e.consume(b),D):(e.consume(b),U)}function $(b){return b===s?(e.consume(b),s=void 0,V):b===null?n(b):oe(b)?(o=$,te(b)):(e.consume(b),$)}function U(b){return b===null||b===34||b===39||b===60||b===61||b===96?n(b):b===47||b===62||Me(b)?P(b):(e.consume(b),U)}function V(b){return b===47||b===62||Me(b)?P(b):n(b)}function J(b){return b===62?(e.consume(b),e.exit("htmlTextData"),e.exit("htmlText"),t):n(b)}function te(b){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),B}function B(b){return xe(b)?Ce(e,z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):z(b)}function z(b){return e.enter("htmlTextData"),o(b)}}const bm={name:"labelEnd",resolveAll:xz,resolveTo:wz,tokenize:_z},gz={tokenize:bz},yz={tokenize:Sz},vz={tokenize:kz};function xz(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 s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&Sn(e,0,e.length,n),e}function wz(e,t){let n=e.length,r=0,s,i,o,a;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(o=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},c={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",u,t]],a=On(a,e.slice(i+1,i+r+3)),a=On(a,[["enter",c,t]]),a=On(a,Ic(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),a=On(a,[["exit",c,t],e[o-2],e[o-1],["exit",u,t]]),a=On(a,e.slice(o+1)),a=On(a,[["exit",l,t]]),Sn(e,i,e.length,a),e}function _z(e,t,n){const r=this;let s=r.events.length,i,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return a;function a(h){return i?i._inactive?f(h):(o=r.parser.defined.includes(rr(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),l):n(h)}function l(h){return h===40?e.attempt(gz,c,o?c:f)(h):h===91?e.attempt(yz,c,o?u:f)(h):o?c(h):f(h)}function u(h){return e.attempt(vz,c,f)(h)}function c(h){return t(h)}function f(h){return i._balanced=!0,n(h)}}function bz(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),s}function s(f){return Me(f)?ua(e,i)(f):i(f)}function i(f){return f===41?c(f):f1(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return Me(f)?ua(e,l)(f):c(f)}function a(f){return n(f)}function l(f){return f===34||f===39||f===40?p1(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):c(f)}function u(f){return Me(f)?ua(e,c)(f):c(f)}function c(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function Sz(e,t,n){const r=this;return s;function s(a){return h1.call(r,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(rr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function kz(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const Cz={name:"labelStartImage",resolveAll:bm.resolveAll,tokenize:Ez};function Ez(e,t,n){const r=this;return s;function s(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(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 Tz={name:"labelStartLink",resolveAll:bm.resolveAll,tokenize:Iz};function Iz(e,t,n){const r=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Rd={name:"lineEnding",tokenize:Rz};function Rz(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ce(e,t,"linePrefix")}}const Zl={name:"thematicBreak",tokenize:Pz};function Pz(e,t,n){let r=0,s;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return s=u,a(u)}function a(u){return u===s?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||oe(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===s?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),xe(u)?Ce(e,a,"whitespace")(u):a(u))}}const Gt={continuation:{tokenize:Mz},exit:Lz,name:"list",tokenize:Nz},jz={partial:!0,tokenize:Oz},Az={partial:!0,tokenize:Dz};function Nz(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return a;function a(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:vh(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Zl,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return vh(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"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Za,r.interrupt?n:c,e.attempt(jz,h,f))}function c(p){return r.containerState.initialBlankLine=!0,i++,h(p)}function f(p){return xe(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Mz(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Za,s,i);function s(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ce(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!xe(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(Az,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ce(e,e.attempt(Gt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Dz(e,t,n){const r=this;return Ce(e,s,"listItemIndent",r.containerState.size+1);function s(i){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(i):n(i)}}function Lz(e){e.exit(this.containerState.type)}function Oz(e,t,n){const r=this;return Ce(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!xe(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Fv={name:"setextUnderline",resolveTo:zz,tokenize:Fz};function zz(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function Fz(e,t,n){const r=this;let s;return i;function i(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),s=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===s?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),xe(u)?Ce(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||oe(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Bz={tokenize:$z};function $z(e){const t=this,n=e.attempt(Za,r,e.attempt(this.parser.constructs.flowInitial,s,Ce(e,e.attempt(this.parser.constructs.flow,s,e.attempt(qO,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Uz={resolveAll:g1()},Vz=m1("string"),Hz=m1("text");function m1(e){return{resolveAll:g1(e==="text"?Wz:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,o,a);return o;function o(c){return u(c)?i(c):a(c)}function a(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),i(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const f=s[c];let h=-1;if(f)for(;++h<f.length;){const p=f[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function g1(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function Wz(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],s=t.sliceStream(r);let i=s.length,o=-1,a=0,l;for(;i--;){const u=s[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(u===-2)l=!0,a++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const qz={42:Gt,43:Gt,45:Gt,48:Gt,49:Gt,50:Gt,51:Gt,52:Gt,53:Gt,54:Gt,55:Gt,56:Gt,57:Gt,62:l1},Kz={91:XO},Gz={[-2]:Id,[-1]:Id,32:Id},Yz={35:rz,42:Zl,45:[Fv,Zl],60:az,61:Fv,95:Zl,96:Ov,126:Ov},Qz={38:c1,92:u1},Xz={[-5]:Rd,[-4]:Rd,[-3]:Rd,33:Cz,38:c1,42:xh,60:[TO,pz],91:Tz,92:[tz,u1],93:bm,95:xh,96:BO},Jz={null:[xh,Uz]},Zz={null:[42,95]},eF={null:[]},tF=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Zz,contentInitial:Kz,disable:eF,document:qz,flow:Yz,flowInitial:Gz,insideSpan:Jz,string:Qz,text:Xz},Symbol.toStringTag,{value:"Module"}));function nF(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 s={},i=[];let o=[],a=[];const l={attempt:T(S),check:T(k),consume:v,enter:w,exit:C,interrupt:T(k,{interrupt:!0})},u={code:null,containerState:{},defineSkip:y,events:[],now:g,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:f};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function f(M){return o=On(o,M),_(),o[o.length-1]!==null?[]:(R(t,0),u.events=Ic(i,u.events,u),u.events)}function h(M,D){return sF(p(M),D)}function p(M){return rF(o,M)}function g(){const{_bufferIndex:M,_index:D,line:$,column:U,offset:V}=r;return{_bufferIndex:M,_index:D,line:$,column:U,offset:V}}function y(M){s[M.line]=M.column,E()}function _(){let M;for(;r._index<o.length;){const D=o[r._index];if(typeof D=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<D.length;)x(D.charCodeAt(r._bufferIndex));else x(D)}}function x(M){c=c(M)}function v(M){oe(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,E()):M!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=M}function w(M,D){const $=D||{};return $.type=M,$.start=g(),u.events.push(["enter",$,u]),a.push($),$}function C(M){const D=a.pop();return D.end=g(),u.events.push(["exit",D,u]),D}function S(M,D){R(M,D.from)}function k(M,D){D.restore()}function T(M,D){return $;function $(U,V,J){let te,B,z,b;return Array.isArray(U)?X(U):"tokenize"in U?X([U]):H(U);function H(me){return nt;function nt(We){const Pe=We!==null&&me[We],Z=We!==null&&me.null,se=[...Array.isArray(Pe)?Pe:Pe?[Pe]:[],...Array.isArray(Z)?Z:Z?[Z]:[]];return X(se)(We)}}function X(me){return te=me,B=0,me.length===0?J:I(me[B])}function I(me){return nt;function nt(We){return b=P(),z=me,me.partial||(u.currentConstruct=me),me.name&&u.parser.constructs.disable.null.includes(me.name)?Se():me.tokenize.call(D?Object.assign(Object.create(u),D):u,l,de,Se)(We)}}function de(me){return M(z,b),V}function Se(me){return b.restore(),++B<te.length?I(te[B]):J}}}function R(M,D){M.resolveAll&&!i.includes(M)&&i.push(M),M.resolve&&Sn(u.events,D,u.events.length-D,M.resolve(u.events.slice(D),u)),M.resolveTo&&(u.events=M.resolveTo(u.events,u))}function P(){const M=g(),D=u.previous,$=u.currentConstruct,U=u.events.length,V=Array.from(a);return{from:U,restore:J};function J(){r=M,u.previous=D,u.currentConstruct=$,u.events.length=U,a=V,E()}}function E(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function rF(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let o;if(n===s)o=[e[n].slice(r,i)];else{if(o=e.slice(n,s),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}i>0&&o.push(e[s].slice(0,i))}return o}function sF(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
|
|
64
|
+
`;break}case-3:{o=`\r
|
|
65
|
+
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,r.push(o)}return r.join("")}function iF(e){const r={constructs:o1([tF,...(e||{}).extensions||[]]),content:s(wO),defined:[],document:s(bO),flow:s(Bz),lazy:{},string:s(Vz),text:s(Hz)};return r;function s(i){return o;function o(a){return nF(r,i,a)}}}function oF(e){for(;!d1(e););return e}const Bv=/[\0\t\n\r]/g;function aF(){let e=1,t="",n=!0,r;return s;function s(i,o,a){const l=[];let u,c,f,h,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(Bv.lastIndex=f,u=Bv.exec(i),h=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(h),!u){t=i.slice(f);break}if(p===10&&f===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<h&&(l.push(i.slice(f,h)),e+=h-f),p){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}f=h+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const lF=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function uF(e){return e.replace(lF,cF)}function cF(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return a1(n.slice(i?2:1),i?16:10)}return _m(n)||e}const y1={}.hasOwnProperty;function dF(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),fF(n)(oF(iF(n).document().write(aF()(e,t,!0))))}function fF(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Tr),autolinkProtocol:P,autolinkEmail:P,atxHeading:i(rt),blockQuote:i(Z),characterEscape:P,characterReference:P,codeFenced:i(se),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(se,o),codeText:i(ie,o),codeTextData:P,data:P,codeFlowValue:P,definition:i(fe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(ut),hardBreakEscape:i(mt),hardBreakTrailing:i(mt),htmlFlow:i(Pn,o),htmlFlowData:P,htmlText:i(Pn,o),htmlTextData:P,image:i(Er),label:o,link:i(Tr),listItem:i(So),listItemValue:h,listOrdered:i(ae,f),listUnordered:i(ae),paragraph:i(yi),reference:I,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(rt),strong:i(ar),thematicBreak:i(jn)},exit:{atxHeading:l(),atxHeadingSequence:S,autolink:l(),autolinkEmail:Pe,autolinkProtocol:We,blockQuote:l(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:Se,characterReferenceMarkerNumeric:Se,characterReferenceValue:me,characterReference:nt,codeFenced:l(_),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:E,codeIndented:l(x),codeText:l(V),codeTextData:E,data:E,definition:l(),definitionDestinationString:C,definitionLabelString:v,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(D),hardBreakTrailing:l(D),htmlFlow:l($),htmlFlowData:E,htmlText:l(U),htmlTextData:E,image:l(te),label:z,labelText:B,lineEnding:M,link:l(J),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:de,resourceDestinationString:b,resourceTitleString:H,resource:X,setextHeading:l(R),setextHeadingLineSequence:T,setextHeadingText:k,strong:l(),thematicBreak:l()}};v1(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(O){let Q={type:"root",children:[]};const re={stack:[Q],tokenStack:[],config:t,enter:a,exit:u,buffer:o,resume:c,data:n},ue=[];let ke=-1;for(;++ke<O.length;)if(O[ke][1].type==="listOrdered"||O[ke][1].type==="listUnordered")if(O[ke][0]==="enter")ue.push(ke);else{const st=ue.pop();ke=s(O,st,ke)}for(ke=-1;++ke<O.length;){const st=t[O[ke][0]];y1.call(st,O[ke][1].type)&&st[O[ke][1].type].call(Object.assign({sliceSerialize:O[ke][2].sliceSerialize},re),O[ke][1])}if(re.tokenStack.length>0){const st=re.tokenStack[re.tokenStack.length-1];(st[1]||$v).call(re,void 0,st[0])}for(Q.position={start:Xr(O.length>0?O[0][1].start:{line:1,column:1,offset:0}),end:Xr(O.length>0?O[O.length-2][1].end:{line:1,column:1,offset:0})},ke=-1;++ke<t.transforms.length;)Q=t.transforms[ke](Q)||Q;return Q}function s(O,Q,re){let ue=Q-1,ke=-1,st=!1,cn,Lt,Et,Ir;for(;++ue<=re;){const it=O[ue];switch(it[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{it[0]==="enter"?ke++:ke--,Ir=void 0;break}case"lineEndingBlank":{it[0]==="enter"&&(cn&&!Ir&&!ke&&!Et&&(Et=ue),Ir=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ir=void 0}if(!ke&&it[0]==="enter"&&it[1].type==="listItemPrefix"||ke===-1&&it[0]==="exit"&&(it[1].type==="listUnordered"||it[1].type==="listOrdered")){if(cn){let j=ue;for(Lt=void 0;j--;){const F=O[j];if(F[1].type==="lineEnding"||F[1].type==="lineEndingBlank"){if(F[0]==="exit")continue;Lt&&(O[Lt][1].type="lineEndingBlank",st=!0),F[1].type="lineEnding",Lt=j}else if(!(F[1].type==="linePrefix"||F[1].type==="blockQuotePrefix"||F[1].type==="blockQuotePrefixWhitespace"||F[1].type==="blockQuoteMarker"||F[1].type==="listItemIndent"))break}Et&&(!Lt||Et<Lt)&&(cn._spread=!0),cn.end=Object.assign({},Lt?O[Lt][1].start:it[1].end),O.splice(Lt||ue,0,["exit",cn,it[2]]),ue++,re++}if(it[1].type==="listItemPrefix"){const j={type:"listItem",_spread:!1,start:Object.assign({},it[1].start),end:void 0};cn=j,O.splice(ue,0,["enter",j,it[2]]),ue++,re++,Et=void 0,Ir=!0}}}return O[Q][1]._spread=st,re}function i(O,Q){return re;function re(ue){a.call(this,O(ue),ue),Q&&Q.call(this,ue)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(O,Q,re){this.stack[this.stack.length-1].children.push(O),this.stack.push(O),this.tokenStack.push([Q,re||void 0]),O.position={start:Xr(Q.start),end:void 0}}function l(O){return Q;function Q(re){O&&O.call(this,re),u.call(this,re)}}function u(O,Q){const re=this.stack.pop(),ue=this.tokenStack.pop();if(ue)ue[0].type!==O.type&&(Q?Q.call(this,O,ue[0]):(ue[1]||$v).call(this,O,ue[0]));else throw new Error("Cannot close `"+O.type+"` ("+la({start:O.start,end:O.end})+"): it’s not open");re.position.end=Xr(O.end)}function c(){return wm(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function h(O){if(this.data.expectingFirstListItemValue){const Q=this.stack[this.stack.length-2];Q.start=Number.parseInt(this.sliceSerialize(O),10),this.data.expectingFirstListItemValue=void 0}}function p(){const O=this.resume(),Q=this.stack[this.stack.length-1];Q.lang=O}function g(){const O=this.resume(),Q=this.stack[this.stack.length-1];Q.meta=O}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const O=this.resume(),Q=this.stack[this.stack.length-1];Q.value=O.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const O=this.resume(),Q=this.stack[this.stack.length-1];Q.value=O.replace(/(\r?\n|\r)$/g,"")}function v(O){const Q=this.resume(),re=this.stack[this.stack.length-1];re.label=Q,re.identifier=rr(this.sliceSerialize(O)).toLowerCase()}function w(){const O=this.resume(),Q=this.stack[this.stack.length-1];Q.title=O}function C(){const O=this.resume(),Q=this.stack[this.stack.length-1];Q.url=O}function S(O){const Q=this.stack[this.stack.length-1];if(!Q.depth){const re=this.sliceSerialize(O).length;Q.depth=re}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function T(O){const Q=this.stack[this.stack.length-1];Q.depth=this.sliceSerialize(O).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function P(O){const re=this.stack[this.stack.length-1].children;let ue=re[re.length-1];(!ue||ue.type!=="text")&&(ue=qn(),ue.position={start:Xr(O.start),end:void 0},re.push(ue)),this.stack.push(ue)}function E(O){const Q=this.stack.pop();Q.value+=this.sliceSerialize(O),Q.position.end=Xr(O.end)}function M(O){const Q=this.stack[this.stack.length-1];if(this.data.atHardBreak){const re=Q.children[Q.children.length-1];re.position.end=Xr(O.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Q.type)&&(P.call(this,O),E.call(this,O))}function D(){this.data.atHardBreak=!0}function $(){const O=this.resume(),Q=this.stack[this.stack.length-1];Q.value=O}function U(){const O=this.resume(),Q=this.stack[this.stack.length-1];Q.value=O}function V(){const O=this.resume(),Q=this.stack[this.stack.length-1];Q.value=O}function J(){const O=this.stack[this.stack.length-1];if(this.data.inReference){const Q=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=Q,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function te(){const O=this.stack[this.stack.length-1];if(this.data.inReference){const Q=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=Q,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function B(O){const Q=this.sliceSerialize(O),re=this.stack[this.stack.length-2];re.label=uF(Q),re.identifier=rr(Q).toLowerCase()}function z(){const O=this.stack[this.stack.length-1],Q=this.resume(),re=this.stack[this.stack.length-1];if(this.data.inReference=!0,re.type==="link"){const ue=O.children;re.children=ue}else re.alt=Q}function b(){const O=this.resume(),Q=this.stack[this.stack.length-1];Q.url=O}function H(){const O=this.resume(),Q=this.stack[this.stack.length-1];Q.title=O}function X(){this.data.inReference=void 0}function I(){this.data.referenceType="collapsed"}function de(O){const Q=this.resume(),re=this.stack[this.stack.length-1];re.label=Q,re.identifier=rr(this.sliceSerialize(O)).toLowerCase(),this.data.referenceType="full"}function Se(O){this.data.characterReferenceType=O.type}function me(O){const Q=this.sliceSerialize(O),re=this.data.characterReferenceType;let ue;re?(ue=a1(Q,re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ue=_m(Q);const ke=this.stack[this.stack.length-1];ke.value+=ue}function nt(O){const Q=this.stack.pop();Q.position.end=Xr(O.end)}function We(O){E.call(this,O);const Q=this.stack[this.stack.length-1];Q.url=this.sliceSerialize(O)}function Pe(O){E.call(this,O);const Q=this.stack[this.stack.length-1];Q.url="mailto:"+this.sliceSerialize(O)}function Z(){return{type:"blockquote",children:[]}}function se(){return{type:"code",lang:null,meta:null,value:""}}function ie(){return{type:"inlineCode",value:""}}function fe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ut(){return{type:"emphasis",children:[]}}function rt(){return{type:"heading",depth:0,children:[]}}function mt(){return{type:"break"}}function Pn(){return{type:"html",value:""}}function Er(){return{type:"image",title:null,url:"",alt:null}}function Tr(){return{type:"link",title:null,url:"",children:[]}}function ae(O){return{type:"list",ordered:O.type==="listOrdered",start:null,spread:O._spread,children:[]}}function So(O){return{type:"listItem",spread:O._spread,checked:null,children:[]}}function yi(){return{type:"paragraph",children:[]}}function ar(){return{type:"strong",children:[]}}function qn(){return{type:"text",value:""}}function jn(){return{type:"thematicBreak"}}}function Xr(e){return{line:e.line,column:e.column,offset:e.offset}}function v1(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?v1(e,r):hF(e,r)}}function hF(e,t){let n;for(n in t)if(y1.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 $v(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+la({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+la({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+la({start:t.start,end:t.end})+") is still open")}function pF(e){const t=this;t.parser=n;function n(r){return dF(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function mF(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 gF(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
66
|
+
`}]}function yF(e,t){const n=t.value?t.value+`
|
|
67
|
+
`:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function vF(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function xF(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function wF(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=bo(r.toLowerCase()),i=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=i+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function _F(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 bF(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function x1(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 s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function SF(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return x1(e,t);const s={src:bo(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function kF(e,t){const n={src:bo(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 CF(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 EF(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return x1(e,t);const s={href:bo(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function TF(e,t){const n={href:bo(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 IF(e,t,n){const r=e.all(t),s=n?RF(n):w1(t),i={},o=[];if(typeof t.checked=="boolean"){const c=r[0];let f;c&&c.type==="element"&&c.tagName==="p"?f=c:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const c=r[a];(s||a!==0||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
|
|
68
|
+
`}),c.type==="element"&&c.tagName==="p"&&!s?o.push(...c.children):o.push(c)}const l=r[r.length-1];l&&(s||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
|
|
69
|
+
`});const u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)}function RF(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=w1(n[r])}return t}function w1(e){const t=e.spread;return t??e.children.length>1}function PF(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const o=r[s];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 i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function jF(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function AF(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function NF(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function MF(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=gm(t.children[1]),l=Zk(t.children[t.children.length-1]);a&&l&&(o.position={start:a,end:l}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function DF(e,t,n){const r=n?n.children:void 0,i=(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 u=[];for(;++l<a;){const f=t.children[l],h={},p=o?o[l]:void 0;p&&(h.align=p);let g={type:"element",tagName:i,properties:h,children:[]};f&&(g.children=e.all(f),e.patch(f,g),g=e.applyData(f,g)),u.push(g)}const c={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,c),e.applyData(t,c)}function LF(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Uv=9,Vv=32;function OF(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(Hv(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(Hv(t.slice(s),s>0,!1)),i.join("")}function Hv(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===Uv||i===Vv;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===Uv||i===Vv;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function zF(e,t){const n={type:"text",value:OF(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function FF(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const BF={blockquote:mF,break:gF,code:yF,delete:vF,emphasis:xF,footnoteReference:wF,heading:_F,html:bF,imageReference:SF,image:kF,inlineCode:CF,linkReference:EF,link:TF,listItem:IF,list:PF,paragraph:jF,root:AF,strong:NF,table:MF,tableCell:LF,tableRow:DF,text:zF,thematicBreak:FF,toml:Il,yaml:Il,definition:Il,footnoteDefinition:Il};function Il(){}const _1=-1,Rc=0,ca=1,Gu=2,Sm=3,km=4,Cm=5,Em=6,b1=7,S1=8,$F=typeof self=="object"?self:globalThis,Wv=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new $F[e](t)},UF=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,o]=t[s];switch(i){case Rc:case _1:return n(o,s);case ca:{const a=n([],s);for(const l of o)a.push(r(l));return a}case Gu:{const a=n({},s);for(const[l,u]of o)a[r(l)]=r(u);return a}case Sm:return n(new Date(o),s);case km:{const{source:a,flags:l}=o;return n(new RegExp(a,l),s)}case Cm:{const a=n(new Map,s);for(const[l,u]of o)a.set(r(l),r(u));return a}case Em:{const a=n(new Set,s);for(const l of o)a.add(r(l));return a}case b1:{const{name:a,message:l}=o;return n(Wv(a,l),s)}case S1:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);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(Wv(i,o),s)};return r},qv=e=>UF(new Map,e)(0),bi="",{toString:VF}={},{keys:HF}=Object,Lo=e=>{const t=typeof e;if(t!=="object"||!e)return[Rc,t];const n=VF.call(e).slice(8,-1);switch(n){case"Array":return[ca,bi];case"Object":return[Gu,bi];case"Date":return[Sm,bi];case"RegExp":return[km,bi];case"Map":return[Cm,bi];case"Set":return[Em,bi];case"DataView":return[ca,n]}return n.includes("Array")?[ca,n]:n.includes("Error")?[b1,n]:[Gu,n]},Rl=([e,t])=>e===Rc&&(t==="function"||t==="symbol"),WF=(e,t,n,r)=>{const s=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},i=o=>{if(n.has(o))return n.get(o);let[a,l]=Lo(o);switch(a){case Rc:{let c=o;switch(l){case"bigint":a=S1,c=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return s([_1],o)}return s([a,c],o)}case ca:{if(l){let h=o;return l==="DataView"?h=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(h=new Uint8Array(o)),s([l,[...h]],o)}const c=[],f=s([a,c],o);for(const h of o)c.push(i(h));return f}case Gu:{if(l)switch(l){case"BigInt":return s([l,o.toString()],o);case"Boolean":case"Number":case"String":return s([l,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const c=[],f=s([a,c],o);for(const h of HF(o))(e||!Rl(Lo(o[h])))&&c.push([i(h),i(o[h])]);return f}case Sm:return s([a,o.toISOString()],o);case km:{const{source:c,flags:f}=o;return s([a,{source:c,flags:f}],o)}case Cm:{const c=[],f=s([a,c],o);for(const[h,p]of o)(e||!(Rl(Lo(h))||Rl(Lo(p))))&&c.push([i(h),i(p)]);return f}case Em:{const c=[],f=s([a,c],o);for(const h of o)(e||!Rl(Lo(h)))&&c.push(i(h));return f}}const{message:u}=o;return s([a,{name:l,message:u}],o)};return i},Kv=(e,{json:t,lossy:n}={})=>{const r=[];return WF(!(t||n),!!t,new Map,r)(e),r},Yu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?qv(Kv(e,t)):structuredClone(e):(e,t)=>qv(Kv(e,t));function qF(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 KF(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function GF(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||qF,r=e.options.footnoteBackLabel||KF,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[l]);if(!u)continue;const c=e.all(u),f=String(u.identifier).toUpperCase(),h=bo(f.toLowerCase());let p=0;const g=[],y=e.footnoteCounts.get(f);for(;y!==void 0&&++p<=y;){g.length>0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(l,p);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const _=c[c.length-1];if(_&&_.type==="element"&&_.tagName==="p"){const v=_.children[_.children.length-1];v&&v.type==="text"?v.value+=" ":_.children.push({type:"text",value:" "}),_.children.push(...g)}else c.push(...g);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(c,!0)};e.patch(u,x),a.push(x)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Yu(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
|
70
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
71
|
+
`}]}}const Pc=function(e){if(e==null)return JF;if(typeof e=="function")return jc(e);if(typeof e=="object")return Array.isArray(e)?YF(e):QF(e);if(typeof e=="string")return XF(e);throw new Error("Expected function, string, or object as test")};function YF(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Pc(e[n]);return jc(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function QF(e){const t=e;return jc(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function XF(e){return jc(t);function t(n){return n&&n.type===e}}function jc(e){return t;function t(n,r,s){return!!(ZF(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function JF(){return!0}function ZF(e){return e!==null&&typeof e=="object"&&"type"in e}const k1=[],eB=!0,wh=!1,tB="skip";function C1(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=Pc(s),o=r?-1:1;a(e,void 0,[])();function a(l,u,c){const f=l&&typeof l=="object"?l:{};if(typeof f.type=="string"){const p=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=k1,g,y,_;if((!t||i(l,u,c[c.length-1]||void 0))&&(p=nB(n(l,c)),p[0]===wh))return p;if("children"in l&&l.children){const x=l;if(x.children&&p[0]!==tB)for(y=(r?x.children.length:-1)+o,_=c.concat(x);y>-1&&y<x.children.length;){const v=x.children[y];if(g=a(v,y,_)(),g[0]===wh)return g;y=typeof g[1]=="number"?g[1]:y+o}}return p}}}function nB(e){return Array.isArray(e)?e:typeof e=="number"?[eB,e]:e==null?k1:[e]}function Tm(e,t,n,r){let s,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,s=n):(i=t,o=n,s=r),C1(e,i,a,s);function a(l,u){const c=u[u.length-1],f=c?c.children.indexOf(l):void 0;return o(l,f,c)}}const _h={}.hasOwnProperty,rB={};function sB(e,t){const n=t||rB,r=new Map,s=new Map,i=new Map,o={...BF,...n.handlers},a={all:u,applyData:oB,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:l,options:n,patch:iB,wrap:lB};return Tm(e,function(c){if(c.type==="definition"||c.type==="footnoteDefinition"){const f=c.type==="definition"?r:s,h=String(c.identifier).toUpperCase();f.has(h)||f.set(h,c)}}),a;function l(c,f){const h=c.type,p=a.handlers[h];if(_h.call(a.handlers,h)&&p)return p(a,c,f);if(a.options.passThrough&&a.options.passThrough.includes(h)){if("children"in c){const{children:y,..._}=c,x=Yu(_);return x.children=a.all(c),x}return Yu(c)}return(a.options.unknownHandler||aB)(a,c,f)}function u(c){const f=[];if("children"in c){const h=c.children;let p=-1;for(;++p<h.length;){const g=a.one(h[p],c);if(g){if(p&&h[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=Gv(g.value)),!Array.isArray(g)&&g.type==="element")){const y=g.children[0];y&&y.type==="text"&&(y.value=Gv(y.value))}Array.isArray(g)?f.push(...g):f.push(g)}}}return f}}function iB(e,t){e.position&&(t.position=qL(e))}function oB(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=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"&&i&&Object.assign(n.properties,Yu(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function aB(e,t){const n=t.data||{},r="value"in t&&!(_h.call(n,"hProperties")||_h.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 lB(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
72
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
73
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
74
|
+
`}),n}function Gv(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Yv(e,t){const n=sB(e,t),r=n.one(e,void 0),s=GF(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
|
|
75
|
+
`},s),i}function uB(e,t){return e&&"run"in e?async function(n,r){const s=Yv(n,{file:r,...t});await e.run(s,r)}:function(n,r){return Yv(n,{file:r,...e||t})}}function Qv(e){if(e)throw e}var eu=Object.prototype.hasOwnProperty,E1=Object.prototype.toString,Xv=Object.defineProperty,Jv=Object.getOwnPropertyDescriptor,Zv=function(t){return typeof Array.isArray=="function"?Array.isArray(t):E1.call(t)==="[object Array]"},ex=function(t){if(!t||E1.call(t)!=="[object Object]")return!1;var n=eu.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&eu.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||eu.call(t,s)},tx=function(t,n){Xv&&n.name==="__proto__"?Xv(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},nx=function(t,n){if(n==="__proto__")if(eu.call(t,n)){if(Jv)return Jv(t,n).value}else return;return t[n]},cB=function e(){var t,n,r,s,i,o,a=arguments[0],l=1,u=arguments.length,c=!1;for(typeof a=="boolean"&&(c=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=nx(a,n),s=nx(t,n),a!==s&&(c&&s&&(ex(s)||(i=Zv(s)))?(i?(i=!1,o=r&&Zv(r)?r:[]):o=r&&ex(r)?r:{},tx(a,{name:n,newValue:e(c,o,s)})):typeof s<"u"&&tx(a,{name:n,newValue:s}));return a};const Pd=Va(cB);function bh(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 dB(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...s);function a(l,...u){const c=e[++i];let f=-1;if(l){o(l);return}for(;++f<s.length;)(u[f]===null||u[f]===void 0)&&(u[f]=s[f]);s=u,c?fB(c,a)(...u):o(null,...u)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function fB(e,t){let n;return r;function r(...o){const a=e.length>o.length;let l;a&&o.push(s);try{l=e.apply(this,o)}catch(u){const c=u;if(a&&n)throw c;return s(c)}a||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(o,...a){n||(n=!0,t(o,...a))}function i(o){s(null,o)}}const fr={basename:hB,dirname:pB,extname:mB,join:gB,sep:"/"};function hB(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');el(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,a=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),a>-1&&(e.codePointAt(s)===t.codePointAt(a--)?a<0&&(r=s):(a=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function pB(e){if(el(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 mB(e){el(e);let t=e.length,n=-1,r=0,s=-1,i=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?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function gB(...e){let t=-1,n;for(;++t<e.length;)el(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":yB(n)}function yB(e){el(e);const t=e.codePointAt(0)===47;let n=vB(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function vB(e,t){let n="",r=0,s=-1,i=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(!(s===o-1||i===1))if(s!==o-1&&i===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("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),r=o-s-1;s=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function el(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const xB={cwd:wB};function wB(){return"/"}function Sh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function _B(e){if(typeof e=="string")e=new URL(e);else if(!Sh(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 bB(e)}function bB(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 s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const jd=["history","path","basename","stem","extname","dirname"];class T1{constructor(t){let n;t?Sh(t)?n={path:t}:typeof t=="string"||SB(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":xB.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<jd.length;){const i=jd[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)jd.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?fr.basename(this.path):void 0}set basename(t){Nd(t,"basename"),Ad(t,"basename"),this.path=fr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?fr.dirname(this.path):void 0}set dirname(t){rx(this.basename,"dirname"),this.path=fr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?fr.extname(this.path):void 0}set extname(t){if(Ad(t,"extname"),rx(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=fr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Sh(t)&&(t=_B(t)),Nd(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?fr.basename(this.path,this.extname):void 0}set stem(t){Nd(t,"stem"),Ad(t,"stem"),this.path=fr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new Dt(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Ad(e,t){if(e&&e.includes(fr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+fr.sep+"`")}function Nd(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function rx(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function SB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const kB=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},CB={}.hasOwnProperty;class Im extends kB{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=dB()}copy(){const t=new Im;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Pd(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ld("data",this.frozen),this.namespace[t]=n,this):CB.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ld("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 s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Pl(t),r=this.parser||this.Parser;return Md("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Md("process",this.parser||this.Parser),Dd("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const a=Pl(t),l=r.parse(a);r.run(l,a,function(c,f,h){if(c||!f||!h)return u(c);const p=f,g=r.stringify(p,h);IB(g)?h.value=g:h.result=g,u(c,h)});function u(c,f){c||!f?o(c):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),Md("processSync",this.parser||this.Parser),Dd("processSync",this.compiler||this.Compiler),this.process(t,s),ix("processSync","process",n),r;function s(i,o){n=!0,Qv(i),r=o}}run(t,n,r){sx(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,a){const l=Pl(n);s.run(t,l,u);function u(c,f,h){const p=f||t;c?a(c):o?o(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),ix("runSync","run",r),s;function i(o,a){Qv(o),s=a,r=!0}}stringify(t,n){this.freeze();const r=Pl(n),s=this.compiler||this.Compiler;return Dd("stringify",s),sx(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Ld("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 i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...f]=u;l(c,f)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))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(u.plugins),u.settings&&(s.settings=Pd(!0,s.settings,u.settings))}function a(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const f=u[c];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===u){h=f;break}if(h===-1)r.push([u,...c]);else if(c.length>0){let[p,...g]=c;const y=r[h][1];bh(y)&&bh(p)&&(p=Pd(!0,y,p)),r[h]=[u,p,...g]}}}}const EB=new Im().freeze();function Md(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Dd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ld(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 sx(e){if(!bh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ix(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Pl(e){return TB(e)?e:new T1(e)}function TB(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function IB(e){return typeof e=="string"||RB(e)}function RB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const PB="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ox=[],ax={allowDangerousHtml:!0},jB=/^(https?|ircs?|mailto|xmpp)$/i,AB=[{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 NB(e){const t=MB(e),n=DB(e);return LB(t.runSync(t.parse(n),n),e)}function MB(e){const t=e.rehypePlugins||ox,n=e.remarkPlugins||ox,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...ax}:ax;return EB().use(pF).use(n).use(uB,r).use(t)}function DB(e){const t=e.children||"",n=new T1;return typeof t=="string"&&(n.value=t),n}function LB(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||OB;for(const c of AB)Object.hasOwn(t,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+PB+c.id,void 0);return Tm(e,u),XL(e,{Fragment:d.Fragment,components:s,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function u(c,f,h){if(c.type==="raw"&&h&&typeof f=="number")return o?h.children.splice(f,1):h.children[f]={type:"text",value:c.value},f;if(c.type==="element"){let p;for(p in Td)if(Object.hasOwn(Td,p)&&Object.hasOwn(c.properties,p)){const g=c.properties[p],y=Td[p];(y===null||y.includes(c.tagName))&&(c.properties[p]=l(String(g||""),p,c))}}if(c.type==="element"){let p=n?!n.includes(c.tagName):i?i.includes(c.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(c,f,h)),p&&h&&typeof f=="number")return a&&c.children?h.children.splice(f,1,...c.children):h.children.splice(f,1),f}}}function OB(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||jB.test(e.slice(0,t))?e:""}const{useSmooth:zB,useSmoothStatus:FB,withSmoothContextProvider:BB}=uM,$B=({components:e,componentsByLanguage:t,smooth:n=!0,preprocess:r,...s})=>{const i=fS(),{text:o}=zB(m.useMemo(()=>r?{...i,text:r(i.text)}:i,[i,r]),n),{pre:a=KD,code:l=GD,SyntaxHighlighter:u=fm,CodeHeader:c=YD}=e??{},f=m.useMemo(()=>({Pre:a,Code:l,SyntaxHighlighter:u,CodeHeader:c}),[a,l,u,c]),h=ii(p=>d.jsx(eL,{components:f,componentsByLanguage:t,...p}));return d.jsx(NB,{components:m.useMemo(()=>{const{pre:p,code:g,SyntaxHighlighter:y,CodeHeader:_,...x}=e??{};return{...x,pre:qD,code:h}},[h,e]),...s,children:o})},I1=m.forwardRef(({className:e,containerProps:t,containerComponent:n="div",...r},s)=>d.jsx(n,{"data-status":FB().type,...t,className:Wk(e,t?.className),ref:s,children:d.jsx($B,{...r})}));I1.displayName="MarkdownTextPrimitive";const UB=BB(I1);function lx(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function VB(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function HB(e,t,n){const s=Pc((n||{}).ignore||[]),i=WB(t);let o=-1;for(;++o<i.length;)C1(e,"text",a);function a(u,c){let f=-1,h;for(;++f<c.length;){const p=c[f],g=h?h.children:void 0;if(s(p,g?g.indexOf(p):void 0,h))return;h=p}if(h)return l(u,c)}function l(u,c){const f=c[c.length-1],h=i[o][0],p=i[o][1];let g=0;const _=f.children.indexOf(u);let x=!1,v=[];h.lastIndex=0;let w=h.exec(u.value);for(;w;){const C=w.index,S={index:w.index,input:w.input,stack:[...c,u]};let k=p(...w,S);if(typeof k=="string"&&(k=k.length>0?{type:"text",value:k}:void 0),k===!1?h.lastIndex=C+1:(g!==C&&v.push({type:"text",value:u.value.slice(g,C)}),Array.isArray(k)?v.push(...k):k&&v.push(k),g=C+w[0].length,x=!0),!h.global)break;w=h.exec(u.value)}return x?(g<u.value.length&&v.push({type:"text",value:u.value.slice(g)}),f.children.splice(_,1,...v)):v=[u],_+v.length}}function WB(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 s=n[r];t.push([qB(s[0]),KB(s[1])])}return t}function qB(e){return typeof e=="string"?new RegExp(VB(e),"g"):e}function KB(e){return typeof e=="function"?e:function(){return e}}const Od="phrasing",zd=["autolink","link","image","label"];function GB(){return{transforms:[t4],enter:{literalAutolink:QB,literalAutolinkEmail:Fd,literalAutolinkHttp:Fd,literalAutolinkWww:Fd},exit:{literalAutolink:e4,literalAutolinkEmail:ZB,literalAutolinkHttp:XB,literalAutolinkWww:JB}}}function YB(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Od,notInConstruct:zd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Od,notInConstruct:zd},{character:":",before:"[ps]",after:"\\/",inConstruct:Od,notInConstruct:zd}]}}function QB(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Fd(e){this.config.enter.autolinkProtocol.call(this,e)}function XB(e){this.config.exit.autolinkProtocol.call(this,e)}function JB(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 ZB(e){this.config.exit.autolinkEmail.call(this,e)}function e4(e){this.exit(e)}function t4(e){HB(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,n4],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,r4]],{ignore:["link","linkReference"]})}function n4(e,t,n,r,s){let i="";if(!R1(s)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!s4(n)))return!1;const o=i4(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function r4(e,t,n,r){return!R1(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function s4(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 i4(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 s=lx(e,"(");let i=lx(e,")");for(;r!==-1&&s>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function R1(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||oi(n)||Tc(n))&&(!t||n!==47)}P1.peek=p4;function o4(){this.buffer()}function a4(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function l4(){this.buffer()}function u4(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function c4(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=rr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function d4(e){this.exit(e)}function f4(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=rr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function h4(e){this.exit(e)}function p4(){return"["}function P1(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),a(),o(),i+=s.move("]"),i}function m4(){return{enter:{gfmFootnoteCallString:o4,gfmFootnoteCall:a4,gfmFootnoteDefinitionLabelString:l4,gfmFootnoteDefinition:u4},exit:{gfmFootnoteCallString:c4,gfmFootnoteCall:d4,gfmFootnoteDefinitionLabelString:f4,gfmFootnoteDefinition:h4}}}function g4(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:P1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,o){const a=i.createTracker(o);let l=a.move("[^");const u=i.enter("footnoteDefinition"),c=i.enter("label");return l+=a.move(i.safe(i.associationId(r),{before:l,after:"]"})),c(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((t?`
|
|
76
|
+
`:" ")+i.indentLines(i.containerFlow(r,a.current()),t?j1:y4))),u(),l}}function y4(e,t,n){return t===0?e:j1(e,t,n)}function j1(e,t,n){return(n?"":" ")+e}const v4=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];A1.peek=S4;function x4(){return{canContainEols:["delete"],enter:{strikethrough:_4},exit:{strikethrough:b4}}}function w4(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:v4}],handlers:{delete:A1}}}function _4(e){this.enter({type:"delete",children:[]},e)}function b4(e){this.exit(e)}function A1(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let o=s.move("~~");return o+=n.containerPhrasing(e,{...s.current(),before:o,after:"~"}),o+=s.move("~~"),i(),o}function S4(){return"~"}function k4(e){return e.length}function C4(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||k4,i=[],o=[],a=[],l=[];let u=0,c=-1;for(;++c<e.length;){const y=[],_=[];let x=-1;for(e[c].length>u&&(u=e[c].length);++x<e[c].length;){const v=E4(e[c][x]);if(n.alignDelimiters!==!1){const w=s(v);_[x]=w,(l[x]===void 0||w>l[x])&&(l[x]=w)}y.push(v)}o[c]=y,a[c]=_}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)i[f]=ux(r[f]);else{const y=ux(r);for(;++f<u;)i[f]=y}f=-1;const h=[],p=[];for(;++f<u;){const y=i[f];let _="",x="";y===99?(_=":",x=":"):y===108?_=":":y===114&&(x=":");let v=n.alignDelimiters===!1?1:Math.max(1,l[f]-_.length-x.length);const w=_+"-".repeat(v)+x;n.alignDelimiters!==!1&&(v=_.length+v+x.length,v>l[f]&&(l[f]=v),p[f]=v),h[f]=w}o.splice(1,0,h),a.splice(1,0,p),c=-1;const g=[];for(;++c<o.length;){const y=o[c],_=a[c];f=-1;const x=[];for(;++f<u;){const v=y[f]||"";let w="",C="";if(n.alignDelimiters!==!1){const S=l[f]-(_[f]||0),k=i[f];k===114?w=" ".repeat(S):k===99?S%2?(w=" ".repeat(S/2+.5),C=" ".repeat(S/2-.5)):(w=" ".repeat(S/2),C=w):C=" ".repeat(S)}n.delimiterStart!==!1&&!f&&x.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||f)&&x.push(" "),n.alignDelimiters!==!1&&x.push(w),x.push(v),n.alignDelimiters!==!1&&x.push(C),n.padding!==!1&&x.push(" "),(n.delimiterEnd!==!1||f!==u-1)&&x.push("|")}g.push(n.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return g.join(`
|
|
77
|
+
`)}function E4(e){return e==null?"":String(e)}function ux(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 T4(e,t,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),I4);return s(),o}function I4(e,t,n){return">"+(n?"":" ")+e}function R4(e,t){return cx(e,t.inConstruct,!0)&&!cx(e,t.notInConstruct,!1)}function cx(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 dx(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
|
|
78
|
+
`&&R4(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
79
|
+
`}function P4(e,t){const n=String(e);let r=n.indexOf(t),s=r,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>o&&(o=i):i=1,s=r+t.length,r=n.indexOf(t,s);return o}function j4(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 A4(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 N4(e,t,n,r){const s=A4(n),i=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if(j4(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(i,M4);return f(),h}const a=n.createTracker(r),l=s.repeat(Math.max(P4(i,s)+1,3)),u=n.enter("codeFenced");let c=a.move(l);if(e.lang){const f=n.enter(`codeFencedLang${o}`);c+=a.move(n.safe(e.lang,{before:c,after:" ",encode:["`"],...a.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${o}`);c+=a.move(" "),c+=a.move(n.safe(e.meta,{before:c,after:`
|
|
80
|
+
`,encode:["`"],...a.current()})),f()}return c+=a.move(`
|
|
81
|
+
`),i&&(c+=a.move(i+`
|
|
82
|
+
`)),c+=a.move(l),u(),c}function M4(e,t,n){return(n?"":" ")+e}function Rm(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 D4(e,t,n,r){const s=Rm(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("[");return u+=l.move(n.safe(n.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":`
|
|
83
|
+
`,...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),u+=l.move(" "+s),u+=l.move(n.safe(e.title,{before:u,after:s,...l.current()})),u+=l.move(s),a()),o(),u}function L4(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 $a(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Qu(e,t,n){const r=fo(e),s=fo(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}N1.peek=O4;function N1(e,t,n,r){const s=L4(n),i=n.enter("emphasis"),o=n.createTracker(r),a=o.move(s);let l=o.move(n.containerPhrasing(e,{after:s,before:a,...o.current()}));const u=l.charCodeAt(0),c=Qu(r.before.charCodeAt(r.before.length-1),u,s);c.inside&&(l=$a(u)+l.slice(1));const f=l.charCodeAt(l.length-1),h=Qu(r.after.charCodeAt(0),f,s);h.inside&&(l=l.slice(0,-1)+$a(f));const p=o.move(s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:c.outside},a+l+p}function O4(e,t,n){return n.options.emphasis||"*"}function z4(e,t){let n=!1;return Tm(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,wh}),!!((!e.depth||e.depth<3)&&wm(e)&&(t.options.setext||n))}function F4(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(z4(e,n)){const c=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...i.current(),before:`
|
|
84
|
+
`,after:`
|
|
85
|
+
`});return f(),c(),h+`
|
|
86
|
+
`+(s===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
|
|
87
|
+
`))+1))}const o="#".repeat(s),a=n.enter("headingAtx"),l=n.enter("phrasing");i.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
|
|
88
|
+
`,...i.current()});return/^[\t ]/.test(u)&&(u=$a(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),l(),a(),u}M1.peek=B4;function M1(e){return e.value||""}function B4(){return"<"}D1.peek=$4;function D1(e,t,n,r){const s=Rm(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("![");return u+=l.move(n.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),u+=l.move(" "+s),u+=l.move(n.safe(e.title,{before:u,after:s,...l.current()})),u+=l.move(s),a()),u+=l.move(")"),o(),u}function $4(){return"!"}L1.peek=U4;function L1(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const u=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),o();const c=n.stack;n.stack=[],o=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=c,i(),s==="full"||!u||u!==f?l+=a.move(f+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function U4(){return"!"}O1.peek=V4;function O1(e,t,n){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const o=n.unsafe[i],a=n.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(r);){let u=l.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(l.index+1)}}return s+r+s}function V4(){return"`"}function z1(e,t){const n=wm(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))}F1.peek=H4;function F1(e,t,n,r){const s=Rm(n),i=s==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(z1(e,n)){const c=n.stack;n.stack=[],a=n.enter("autolink");let f=o.move("<");return f+=o.move(n.containerPhrasing(e,{before:f,after:">",...o.current()})),f+=o.move(">"),a(),n.stack=c,f}a=n.enter("link"),l=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(l=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=o.move(" "+s),u+=o.move(n.safe(e.title,{before:u,after:s,...o.current()})),u+=o.move(s),l()),u+=o.move(")"),a(),u}function H4(e,t,n){return z1(e,n)?"<":"["}B1.peek=W4;function B1(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const u=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),o();const c=n.stack;n.stack=[],o=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=c,i(),s==="full"||!u||u!==f?l+=a.move(f+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function W4(){return"["}function Pm(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 q4(e){const t=Pm(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 K4(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 $1(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 G4(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?K4(n):Pm(n);const a=e.ordered?o==="."?")":".":q4(n);let l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const c=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&c&&(!c.children||!c.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),$1(n)===o&&c){let f=-1;for(;++f<e.children.length;){const h=e.children[f];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),n.bulletCurrent=o;const u=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=i,s(),u}function Y4(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 Q4(e,t,n,r){const s=Y4(n);let i=n.bulletCurrent||Pm(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(i+" ".repeat(o-i.length)),a.shift(o);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),c);return l(),u;function c(f,h,p){return h?(p?"":" ".repeat(o))+f:(p?i:i+" ".repeat(o-i.length))+f}}function X4(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),s(),o}const J4=Pc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Z4(e,t,n,r){return(e.children.some(function(o){return J4(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function e3(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}U1.peek=t3;function U1(e,t,n,r){const s=e3(n),i=n.enter("strong"),o=n.createTracker(r),a=o.move(s+s);let l=o.move(n.containerPhrasing(e,{after:s,before:a,...o.current()}));const u=l.charCodeAt(0),c=Qu(r.before.charCodeAt(r.before.length-1),u,s);c.inside&&(l=$a(u)+l.slice(1));const f=l.charCodeAt(l.length-1),h=Qu(r.after.charCodeAt(0),f,s);h.inside&&(l=l.slice(0,-1)+$a(f));const p=o.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:c.outside},a+l+p}function t3(e,t,n){return n.options.strong||"*"}function n3(e,t,n,r){return n.safe(e.value,r)}function r3(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 s3(e,t,n){const r=($1(n)+(n.options.ruleSpaces?" ":"")).repeat(r3(n));return n.options.ruleSpaces?r.slice(0,-1):r}const V1={blockquote:T4,break:dx,code:N4,definition:D4,emphasis:N1,hardBreak:dx,heading:F4,html:M1,image:D1,imageReference:L1,inlineCode:O1,link:F1,linkReference:B1,list:G4,listItem:Q4,paragraph:X4,root:Z4,strong:U1,text:n3,thematicBreak:s3};function i3(){return{enter:{table:o3,tableData:fx,tableHeader:fx,tableRow:l3},exit:{codeText:u3,table:a3,tableData:Bd,tableHeader:Bd,tableRow:Bd}}}function o3(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 a3(e){this.exit(e),this.data.inTable=void 0}function l3(e){this.enter({type:"tableRow",children:[]},e)}function Bd(e){this.exit(e)}function fx(e){this.enter({type:"tableCell",children:[]},e)}function u3(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,c3));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function c3(e,t){return t==="|"?t:e}function d3(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
89
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:o,tableCell:l,tableRow:a}};function o(p,g,y,_){return u(c(p,y,_),p.align)}function a(p,g,y,_){const x=f(p,y,_),v=u([x]);return v.slice(0,v.indexOf(`
|
|
90
|
+
`))}function l(p,g,y,_){const x=y.enter("tableCell"),v=y.enter("phrasing"),w=y.containerPhrasing(p,{..._,before:i,after:i});return v(),x(),w}function u(p,g){return C4(p,{align:g,alignDelimiters:r,padding:n,stringLength:s})}function c(p,g,y){const _=p.children;let x=-1;const v=[],w=g.enter("table");for(;++x<_.length;)v[x]=f(_[x],g,y);return w(),v}function f(p,g,y){const _=p.children;let x=-1;const v=[],w=g.enter("tableRow");for(;++x<_.length;)v[x]=l(_[x],p,g,y);return w(),v}function h(p,g,y){let _=V1.inlineCode(p,g,y);return y.stack.includes("tableCell")&&(_=_.replace(/\|/g,"\\$&")),_}}function f3(){return{exit:{taskListCheckValueChecked:hx,taskListCheckValueUnchecked:hx,paragraph:p3}}}function h3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:m3}}}function hx(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function p3(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 s=t.children;let i=-1,o;for(;++i<s.length;){const a=s[i];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 m3(e,t,n,r){const s=e.children[0],i=typeof e.checked=="boolean"&&s&&s.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);i&&a.move(o);let l=V1.listItem(e,t,n,{...r,...a.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(c){return c+o}}function g3(){return[GB(),m4(),x4(),i3(),f3()]}function y3(e){return{extensions:[YB(),g4(e),w4(),d3(e),h3()]}}const v3={tokenize:k3,partial:!0},H1={tokenize:C3,partial:!0},W1={tokenize:E3,partial:!0},q1={tokenize:T3,partial:!0},x3={tokenize:I3,partial:!0},K1={name:"wwwAutolink",tokenize:b3,previous:Y1},G1={name:"protocolAutolink",tokenize:S3,previous:Q1},Gr={name:"emailAutolink",tokenize:_3,previous:X1},Cr={};function w3(){return{text:Cr}}let Ls=48;for(;Ls<123;)Cr[Ls]=Gr,Ls++,Ls===58?Ls=65:Ls===91&&(Ls=97);Cr[43]=Gr;Cr[45]=Gr;Cr[46]=Gr;Cr[95]=Gr;Cr[72]=[Gr,G1];Cr[104]=[Gr,G1];Cr[87]=[Gr,K1];Cr[119]=[Gr,K1];function _3(e,t,n){const r=this;let s,i;return o;function o(f){return!kh(f)||!X1.call(r,r.previous)||jm(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(f))}function a(f){return kh(f)?(e.consume(f),a):f===64?(e.consume(f),l):n(f)}function l(f){return f===46?e.check(x3,c,u)(f):f===45||f===95||At(f)?(i=!0,e.consume(f),l):c(f)}function u(f){return e.consume(f),s=!0,l}function c(f){return i&&s&&$t(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function b3(e,t,n){const r=this;return s;function s(o){return o!==87&&o!==119||!Y1.call(r,r.previous)||jm(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(v3,e.attempt(H1,e.attempt(W1,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function S3(e,t,n){const r=this;let s="",i=!1;return o;function o(f){return(f===72||f===104)&&Q1.call(r,r.previous)&&!jm(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(f),e.consume(f),a):n(f)}function a(f){if($t(f)&&s.length<5)return s+=String.fromCodePoint(f),e.consume(f),a;if(f===58){const h=s.toLowerCase();if(h==="http"||h==="https")return e.consume(f),l}return n(f)}function l(f){return f===47?(e.consume(f),i?u:(i=!0,l)):n(f)}function u(f){return f===null||Ku(f)||Me(f)||oi(f)||Tc(f)?n(f):e.attempt(H1,e.attempt(W1,c),n)(f)}function c(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function k3(e,t,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),s):o===46&&r===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function C3(e,t,n){let r,s,i;return o;function o(u){return u===46||u===95?e.check(q1,l,a)(u):u===null||Me(u)||oi(u)||u!==45&&Tc(u)?l(u):(i=!0,e.consume(u),o)}function a(u){return u===95?r=!0:(s=r,r=void 0),e.consume(u),o}function l(u){return s||r||!i?n(u):t(u)}}function E3(e,t){let n=0,r=0;return s;function s(o){return o===40?(n++,e.consume(o),s):o===41&&r<n?i(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(q1,t,i)(o):o===null||Me(o)||oi(o)?t(o):(e.consume(o),s)}function i(o){return o===41&&r++,e.consume(o),s}}function T3(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),i):a===93?(e.consume(a),s):a===60||a===null||Me(a)||oi(a)?t(a):n(a)}function s(a){return a===null||a===40||a===91||Me(a)||oi(a)?t(a):r(a)}function i(a){return $t(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):$t(a)?(e.consume(a),o):n(a)}}function I3(e,t,n){return r;function r(i){return e.consume(i),s}function s(i){return At(i)?n(i):t(i)}}function Y1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Me(e)}function Q1(e){return!$t(e)}function X1(e){return!(e===47||kh(e))}function kh(e){return e===43||e===45||e===46||e===95||At(e)}function jm(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 R3={tokenize:O3,partial:!0};function P3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:M3,continuation:{tokenize:D3},exit:L3}},text:{91:{name:"gfmFootnoteCall",tokenize:N3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:j3,resolveTo:A3}}}}function j3(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const l=r.events[s][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 u=rr(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function A3(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)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function N3(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return a;function a(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(i>999||f===93&&!o||f===null||f===91||Me(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return s.includes(rr(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Me(f)||(o=!0),i++,e.consume(f),f===92?c:u}function c(f){return f===91||f===92||f===93?(e.consume(f),i++,u):u(f)}}function M3(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,a;return l;function l(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(g)}function c(g){if(o>999||g===93&&!a||g===null||g===91||Me(g))return n(g);if(g===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return i=rr(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Me(g)||(a=!0),o++,e.consume(g),g===92?f:c}function f(g){return g===91||g===92||g===93?(e.consume(g),o++,c):c(g)}function h(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),s.includes(i)||s.push(i),Ce(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function D3(e,t,n){return e.check(Za,t,e.attempt(R3,t,n))}function L3(e){e.exit("gfmFootnoteDefinition")}function O3(e,t,n){const r=this;return Ce(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function z3(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let u=l;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[l][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const c={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[l][1].end)},f={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[l][1].start)},h=[["enter",c,a],["enter",o[u][1],a],["exit",o[u][1],a],["enter",f,a]],p=a.parser.constructs.insideSpan.null;p&&Sn(h,h.length,0,Ic(p,o.slice(u+1,l),a)),Sn(h,h.length,0,[["exit",f,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",c,a]]),Sn(o,u-1,l-u+3,h),l=u+h.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function i(o,a,l){const u=this.previous,c=this.events;let f=0;return h;function h(g){return u===126&&c[c.length-1][1].type!=="characterEscape"?l(g):(o.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const y=fo(u);if(g===126)return f>1?l(g):(o.consume(g),f++,p);if(f<2&&!n)return l(g);const _=o.exit("strikethroughSequenceTemporary"),x=fo(g);return _._open=!x||x===2&&!!y,_._close=!y||y===2&&!!x,a(g)}}}class F3{constructor(){this.map=[]}add(t,n,r){B3(this,t,n,r)}consume(t){if(this.map.sort(function(i,o){return i[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 s=r.pop();for(;s;){for(const i of s)t.push(i);s=r.pop()}this.map.length=0}}function B3(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function $3(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function U3(){return{flow:{null:{name:"table",tokenize:V3,resolveAll:H3}}}}function V3(e,t,n){const r=this;let s=0,i=0,o;return a;function a(E){let M=r.events.length-1;for(;M>-1;){const U=r.events[M][1].type;if(U==="lineEnding"||U==="linePrefix")M--;else break}const D=M>-1?r.events[M][1].type:null,$=D==="tableHead"||D==="tableRow"?k:l;return $===k&&r.parser.lazy[r.now().line]?n(E):$(E)}function l(E){return e.enter("tableHead"),e.enter("tableRow"),u(E)}function u(E){return E===124||(o=!0,i+=1),c(E)}function c(E){return E===null?n(E):oe(E)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),p):n(E):xe(E)?Ce(e,c,"whitespace")(E):(i+=1,o&&(o=!1,s+=1),E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),o=!0,c):(e.enter("data"),f(E)))}function f(E){return E===null||E===124||Me(E)?(e.exit("data"),c(E)):(e.consume(E),E===92?h:f)}function h(E){return E===92||E===124?(e.consume(E),f):f(E)}function p(E){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(E):(e.enter("tableDelimiterRow"),o=!1,xe(E)?Ce(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):g(E))}function g(E){return E===45||E===58?_(E):E===124?(o=!0,e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),y):S(E)}function y(E){return xe(E)?Ce(e,_,"whitespace")(E):_(E)}function _(E){return E===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),x):E===45?(i+=1,x(E)):E===null||oe(E)?C(E):S(E)}function x(E){return E===45?(e.enter("tableDelimiterFiller"),v(E)):S(E)}function v(E){return E===45?(e.consume(E),v):E===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(E))}function w(E){return xe(E)?Ce(e,C,"whitespace")(E):C(E)}function C(E){return E===124?g(E):E===null||oe(E)?!o||s!==i?S(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(E)):S(E)}function S(E){return n(E)}function k(E){return e.enter("tableRow"),T(E)}function T(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),T):E===null||oe(E)?(e.exit("tableRow"),t(E)):xe(E)?Ce(e,T,"whitespace")(E):(e.enter("data"),R(E))}function R(E){return E===null||E===124||Me(E)?(e.exit("data"),T(E)):(e.consume(E),E===92?P:R)}function P(E){return E===92||E===124?(e.consume(E),R):R(E)}}function H3(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,u,c,f;const h=new F3;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(a=!1,l!==0&&(px(h,t,l,u,c),c=void 0,l=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(n,0,[["enter",u,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,f=void 0,i=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,c={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(n,0,[["enter",c,t]])),s=g.type==="tableDelimiterRow"?2:c?3:1):s&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],f=jl(h,t,i,s,void 0,f),i=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(o[0]=o[1],f=jl(h,t,i,s,void 0,f)),i=o,o=[i[1],n,0,0])):g.type==="tableHead"?(a=!0,l=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(l=n,i[1]!==0?(o[0]=o[1],f=jl(h,t,i,s,n,f)):o[1]!==0&&(f=jl(h,t,o,s,n,f)),s=0):s&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&px(h,t,l,u,c),h.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=$3(t.events,n))}return e}function jl(e,t,n,r,s,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},Si(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=Si(t.events,n[1]);if(i={type:o,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const u=Si(t.events,n[2]),c=Si(t.events,n[3]),f={type:a,start:Object.assign({},u),end:Object.assign({},c)};if(e.add(n[2],0,[["enter",f,t]]),r!==2){const h=t.events[n[2]],p=t.events[n[3]];if(h[1].end=Object.assign({},p[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,y=n[3]-n[2]-1;e.add(g,y,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return s!==void 0&&(i.end=Object.assign({},Si(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function px(e,t,n,r,s){const i=[],o=Si(t.events,n);s&&(s.end=Object.assign({},o),i.push(["exit",s,t])),r.end=Object.assign({},o),i.push(["exit",r,t]),e.add(n+1,0,i)}function Si(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const W3={name:"tasklistCheck",tokenize:K3};function q3(){return{text:{91:W3}}}function K3(e,t,n){const r=this;return s;function s(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return Me(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 oe(l)?t(l):xe(l)?e.check({tokenize:G3},t,n)(l):n(l)}}function G3(e,t,n){return Ce(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function Y3(e){return o1([w3(),P3(),z3(e),U3(),q3()])}const Q3={};function X3(e){const t=this,n=e||Q3,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(Y3(n)),i.push(g3()),o.push(y3(n))}const J3="modulepreload",Z3=function(e,t){return new URL(e,t).href},mx={},cr=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){const o=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");s=Promise.allSettled(n.map(u=>{if(u=Z3(u,r),u in mx)return;mx[u]=!0;const c=u.endsWith(".css"),f=c?'[rel="stylesheet"]':"";if(!!r)for(let g=o.length-1;g>=0;g--){const y=o[g];if(y.href===u&&(!c||y.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=c?"stylesheet":J3,c||(p.as="script"),p.crossOrigin="",p.href=u,l&&p.setAttribute("nonce",l),document.head.appendChild(p),c)return new Promise((g,y)=>{p.addEventListener("load",g),p.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},e$={ts:"typescript",typescript:"typescript",tsx:"typescript",js:"javascript",javascript:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",json:"json",jsonc:"json",sh:"bash",bash:"bash",shell:"bash",zsh:"bash",py:"python",python:"python",diff:"diff",patch:"diff",md:"markdown",markdown:"markdown",html:"xml",xml:"xml",css:"css"};function Am(e){return e?e$[e.trim().toLowerCase()]??null:null}let $d=null;async function t$(){return $d||($d=(async()=>{const{default:e}=await cr(async()=>{const{default:c}=await import("./core-CpT6tRRG.js");return{default:c}},[],import.meta.url),[t,n,r,s,i,o,a,l,u]=await Promise.all([cr(()=>import("./typescript-C2FFdlUC.js"),[],import.meta.url),cr(()=>import("./javascript-BKRaQes9.js"),[],import.meta.url),cr(()=>import("./json-DIYVocXf.js"),[],import.meta.url),cr(()=>import("./bash-I8pq0VWm.js"),[],import.meta.url),cr(()=>import("./python-sE43i1Pi.js"),[],import.meta.url),cr(()=>import("./diff-DiTmLxSS.js"),[],import.meta.url),cr(()=>import("./markdown-BrP960CR.js"),[],import.meta.url),cr(()=>import("./xml-BXBhIUeX.js"),[],import.meta.url),cr(()=>import("./css-DazXZka4.js"),[],import.meta.url)]);return e.registerLanguage("typescript",t.default),e.registerLanguage("javascript",n.default),e.registerLanguage("json",r.default),e.registerLanguage("bash",s.default),e.registerLanguage("python",i.default),e.registerLanguage("diff",o.default),e.registerLanguage("markdown",a.default),e.registerLanguage("xml",l.default),e.registerLanguage("css",u.default),e})()),$d}async function J1(e,t){const n=Am(e);if(!n)return null;try{const r=await t$(),{value:s}=r.highlight(t,{language:n,ignoreIllegals:!0});return s}catch{return null}}function n$(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n),t=t>>>0;return t.toString(36)}function r$(e,t){return"code-"+n$((e??"")+`
|
|
91
|
+
`+t)}const gx=8,Z1=m.createContext(null);function Nm(){const e=m.useContext(Z1);if(!e)throw new Error("useArtifactPanel must be used inside <ArtifactPanelProvider>");return e}function s$(e,t){const n=e.artifacts.findIndex(s=>s.id===t.id);if(n>=0)return{artifacts:[e.artifacts[n],...e.artifacts.filter((i,o)=>o!==n)],activeId:t.id};const r=[t,...e.artifacts];return{artifacts:r.length>gx?r.slice(0,gx):r,activeId:t.id}}function i$(e,t){const n=e.artifacts.findIndex(i=>i.id===t);if(n<0)return e;const r=e.artifacts.filter((i,o)=>o!==n);let s=e.activeId;if(e.activeId===t)if(r.length===0)s=null;else{const i=Math.min(n,r.length-1);s=r[i].id}return{artifacts:r,activeId:s}}function o$({children:e}){const[t,n]=m.useState({artifacts:[],activeId:null}),r=m.useCallback(a=>{n(l=>s$(l,a))},[]),s=m.useCallback(a=>{n(l=>({...l,activeId:a}))},[]),i=m.useCallback(a=>{n(l=>i$(l,a))},[]),o=m.useMemo(()=>({artifacts:t.artifacts,activeId:t.activeId,open:r,setActive:s,close:i}),[t,r,s,i]);return d.jsx(Z1.Provider,{value:o,children:e})}const a$=({language:e,code:t})=>{const{open:n}=Nm();if(!e)return null;const r=typeof t=="string"&&t.length>0,s=()=>{if(!r||typeof t!="string")return;const i=e||"code";n({id:r$(e,t),kind:"code",title:i,language:e,content:t})};return d.jsxs("div",{className:"aui-md-code-lang",children:[d.jsx("span",{className:"aui-md-code-lang-name",children:e}),r?d.jsx("button",{type:"button",className:"aui-md-code-open-btn",onClick:s,title:"Open in side panel","aria-label":`Open ${e} code in side panel`,children:"↗"}):null]})},l$=({components:e,language:t,code:n})=>{const{Pre:r,Code:s}=e,i=Am(t)!==null,[o,a]=m.useState(null);return m.useEffect(()=>{if(!i){a(null);return}let l=!0;return a(null),J1(t,n).then(u=>{l&&a(u)}).catch(()=>{l&&a(null)}),()=>{l=!1}},[i,t,n]),i&&o!=null?d.jsx(r,{children:d.jsx(s,{className:"hljs",dangerouslySetInnerHTML:{__html:o}})}):d.jsx(r,{children:d.jsx(s,{className:i?"hljs":void 0,children:n})})},u$=({node:e,...t})=>d.jsx("div",{className:"md-table-wrap",children:d.jsx("table",{...t})}),c$=()=>d.jsx(UB,{className:"aui-md",remarkPlugins:[X3],components:{CodeHeader:a$,SyntaxHighlighter:l$,table:u$}}),d$=m.memo(c$);function f$(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=!1,s=null;return tt(RM(e)).then(i=>i.ok?i.blob():null).then(i=>{!i||r||(s=URL.createObjectURL(i),n(s))}).catch(()=>{}),()=>{r=!0,s&&URL.revokeObjectURL(s),n(null)}},[e]),t}const h$=new Set([".jpg",".jpeg",".png",".gif",".webp",".avif",".heic",".heif",".svg"]),yx=/(?:^|\s)(\/[^\s]*\/\.claude-control\/uploads\/([^\s]+))/g;function p$(e){const t=[],n=new Set;let r;for(yx.lastIndex=0;(r=yx.exec(e))!==null;){const s=r[1].trim();if(n.has(s))continue;n.add(s);const i=r[2],o=i.slice(i.lastIndexOf(".")).toLowerCase();t.push({fullPath:s,basename:i,isImage:h$.has(o)})}return t}function eC({src:e,alt:t,onClose:n}){const r=m.useRef(null);m.useEffect(()=>{r.current?.focus()},[]);const s=m.useCallback(i=>{i.key==="Escape"&&(i.preventDefault(),n())},[n]);return d.jsx("div",{className:"lightbox-backdrop",role:"dialog","aria-modal":"true","aria-label":`Preview: ${t}`,ref:r,tabIndex:-1,onClick:n,onKeyDown:s,children:d.jsx("img",{className:"lightbox-img",src:e,alt:t,onClick:i=>i.stopPropagation()})})}function m$({ref_:e}){const[t,n]=m.useState(!1),r=f$(e.basename);return e.isImage?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"transcript-thumb-btn","aria-label":`Preview ${e.basename}`,title:e.basename,onClick:()=>n(!0),children:r?d.jsx("img",{className:"transcript-thumb",src:r,alt:e.basename,loading:"lazy"}):d.jsx("span",{className:"transcript-thumb transcript-thumb-loading","aria-hidden":"true"})}),t&&r?d.jsx(eC,{src:r,alt:e.basename,onClose:()=>n(!1)}):null]}):d.jsxs("a",{className:"transcript-file-chip",href:r??void 0,download:e.basename,"aria-label":`Download ${e.basename}`,title:e.basename,"aria-disabled":r?void 0:!0,children:[d.jsx("span",{className:"chip-icon","aria-hidden":"true",children:"📎"}),d.jsx("span",{className:"chip-name",children:e.basename})]})}function g$({text:e}){const t=p$(e);return t.length===0?null:d.jsx("div",{className:"transcript-attachments","aria-label":"Attachments",children:t.map(n=>d.jsx(m$,{ref_:n},n.fullPath))})}function y$(e){return e.trimStart().startsWith("Base directory for this skill:")}function v$(e){const n=e.trim().replace(/\/SKILL\.md$/i,"").split("/").filter(Boolean);return n[n.length-1]??"skill"}function x$(e){const t=e.split(`
|
|
92
|
+
`);if(t[0]?.trim()!=="---")return{entries:[],rest:e};const n=[];let r=-1;for(let i=1;i<t.length;i++){if(t[i].trim()==="---"){r=i;break}const o=t[i].indexOf(":");if(o!==-1){const a=t[i].slice(0,o).trim(),l=t[i].slice(o+1).trim();a&&n.push({key:a,value:l})}}if(r===-1)return{entries:[],rest:e};const s=t.slice(r+1).join(`
|
|
93
|
+
`);return{entries:n,rest:s}}function w$(e){const t=e.trimStart().split(`
|
|
94
|
+
`),s=(t[0]??"").match(/Base directory for this skill:\s*(.+)/)?.[1]??"",i=v$(s),o=t.slice(1).join(`
|
|
95
|
+
`).trimStart(),{entries:a,rest:l}=x$(o),u=a.find(f=>f.key==="name")?.value??null,c=a.find(f=>f.key==="description")?.value??null;return{name:u??i,description:c,frontmatter:a,body:l.trimStart()}}const _$={UserMessage:tl,AssistantMessage:kr,SystemMessage:kr};function b$({markdown:e}){const t=m.useMemo(()=>[{role:"assistant",id:"skill-body",content:[{type:"text",text:e}],metadata:{custom:{cockpitRole:"assistant"}}}],[e]),n=Ya({messages:t,isDisabled:!0,convertMessage:r=>r,onNew:async()=>{}});return d.jsx(Qa,{runtime:n,children:d.jsx(bt.Root,{className:"skill-body-thread",children:d.jsx(bt.Viewport,{className:"skill-body-viewport",children:d.jsx(bt.Messages,{components:_$})})})})}function S$({parsed:e,onClose:t}){return m.useEffect(()=>{const n=r=>{r.key==="Escape"&&(r.preventDefault(),t())};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),d.jsx("div",{className:"modal-backdrop",onClick:n=>{n.target===n.currentTarget&&t()},children:d.jsxs("div",{className:"modal modal-skill",role:"dialog","aria-modal":"true","aria-label":`Skill: ${e.name}`,children:[d.jsxs("div",{className:"modal-head",children:[d.jsxs("span",{className:"modal-title modal-title-skill",children:["🧩 Skill: ",e.name]}),d.jsx("button",{type:"button",className:"modal-close","aria-label":"Close skill detail",onClick:t,children:"✕"})]}),d.jsxs("div",{className:"modal-body skill-modal-body",children:[e.frontmatter.length>0&&d.jsx("dl",{className:"skill-fm",children:e.frontmatter.map(({key:n,value:r})=>d.jsxs("div",{className:"skill-fm-row",children:[d.jsx("dt",{className:"skill-fm-key",children:n}),d.jsx("dd",{className:"skill-fm-val",children:r})]},n))}),e.body.length>0&&d.jsx("div",{className:"skill-body-wrap",children:d.jsx(b$,{markdown:e.body})})]})]})})}function k$({text:e}){const[t,n]=m.useState(!1),r=m.useMemo(()=>w$(e),[e]);return d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",className:"skill-chip",onClick:()=>n(!0),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),n(!0))},title:r.description??`Skill: ${r.name}`,children:[d.jsx("span",{className:"skill-chip-icon","aria-hidden":"true",children:"🧩"}),d.jsx("span",{className:"skill-chip-name",children:r.name}),d.jsx("span",{className:"skill-chip-tag",children:"skill"})]}),t&&d.jsx(S$,{parsed:r,onClose:()=>n(!1)})]})}const C$=/^\s*working…?\s*$/i,E$=e=>typeof e.text=="string"&&C$.test(e.text)?d.jsxs("span",{className:"working-indicator",role:"status","aria-live":"polite",children:[d.jsx("span",{className:"working-claude","aria-hidden":"true",children:d.jsx(um,{size:14})}),d.jsx("span",{className:"shimmer-text",children:"Working…"})]}):typeof e.text=="string"&&y$(e.text)?d.jsx(k$,{text:e.text}):d.jsxs(d.Fragment,{children:[d.jsx(d$,{...e}),typeof e.text=="string"?d.jsx(g$,{text:e.text}):null]}),vx=90;function T$(e){const t=e.split(`
|
|
96
|
+
`);for(let n=t.length-1;n>=0;n--){const r=t[n].trim();if(r)return r.length>vx?r.slice(0,vx-1)+"…":r}return""}function I$(e){const t=LS(e);if(t==null||typeof t=="object"&&Object.keys(t).length===0)return"";try{return JSON.stringify(t,null,2)}catch{return String(t)}}const R$=({toolCallId:e,toolName:t,args:n,result:r})=>{const{open:s}=Nm(),[i,o]=m.useState(!1),a=GM(n),l=I$(n),u=YM(r),c=l.length>0||u!=null,f=LS(n),h=f&&typeof f=="object"&&"file_path"in f?String(f.file_path):void 0,p=h&&h.includes(".")?h.split(".").pop():void 0,g=u?.text??l,y=g.length>0,_=()=>{y&&s({id:e,kind:"tool",title:t+(a?` — ${a}`:""),language:p,content:g,filePath:h})},x=y?d.jsx("button",{type:"button",className:"tool-name tool-name-btn",onClick:_,title:"Open in side panel",children:t}):d.jsx("span",{className:"tool-name",children:t}),v=d.jsxs("span",{className:"tool-head",children:[c?d.jsx("button",{type:"button",className:"tool-arrow-btn","aria-expanded":i,"aria-label":i?"Collapse":"Expand",onClick:()=>o(w=>!w),children:d.jsx("span",{className:"tool-arrow","data-peek":i?"true":"false","aria-hidden":"true",children:"▸"})}):d.jsx("span",{className:"tool-arrow","aria-hidden":"true",children:"▸"}),x,a?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"tool-sep",children:"—"}),d.jsx("span",{className:"tool-input",children:a})]}):null]});return d.jsxs("div",{className:"block-tool",children:[d.jsx("div",{className:"block-tool-use",children:v}),c&&i?d.jsxs("div",{className:"block-tool-body",children:[l?d.jsx("pre",{className:"block-tool-args",children:l}):null,u!=null?d.jsx("div",{className:"block-tool-result","data-error":u.isError?"true":"false",children:u.text}):null]}):null]})},tC=m.createContext(null);function P$(){return m.useContext(tC)}function j$(){return d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[d.jsx("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"2"}),d.jsx("path",{d:"M5 15V5a2 2 0 0 1 2-2h10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function A$(){return d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:d.jsx("path",{d:"M5 12l5 5L19 6",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function nC(){return d.jsx(Ny.Root,{className:"msg-actions",children:d.jsxs(Ny.Copy,{className:"act-btn","aria-label":"Copy message",children:[d.jsxs("span",{className:"act-copy-idle",children:[d.jsx(j$,{})," copy"]}),d.jsxs("span",{className:"act-copy-done",children:[d.jsx(A$,{})," copied"]})]})})}const N$=new Set(["AskUserQuestion","ExitPlanMode"]);function M$(e){const t=[],n=[];function r(){if(n.length===0)return;if(n.filter(i=>e[i].type==="reasoning"||e[i].type==="tool-call").length>=2)t.push({groupKey:"group-thought",indices:[...n]});else for(const i of n)t.push({groupKey:void 0,indices:[i]});n.length=0}for(let s=0;s<e.length;s+=1){const i=e[s];i.type==="text"||i.type==="tool-call"&&i.toolName!==void 0&&N$.has(i.toolName)?(r(),t.push({groupKey:void 0,indices:[s]})):n.push(s)}return r(),t}function D$({text:e}){return!e||!e.trim()?null:d.jsx("div",{className:"cot-reasoning thinking-text",children:e})}const rC={Text:E$,Reasoning:D$,tools:{Fallback:R$}};function L$({indices:e,children:t}){const n=Nu(y=>y.id),r=P$(),s=!!r&&n===r,[i,o]=m.useState(!1),a=s||i,l=Nu(y=>y.content);let u=0,c=0,f="";for(const y of e){const _=l[y];_&&(_.type==="reasoning"?(u+=1,_.text?.trim()&&(f=_.text)):_.type==="tool-call"&&(c+=1))}const h=u+c,p=u>0?"chain of thought":`${c} tool call${c===1?"":"s"}`,g=T$(f);return d.jsxs("details",{className:"block-cot","data-thinking":s?"true":void 0,open:a,onToggle:y=>o(y.currentTarget.open),children:[d.jsxs("summary",{children:[d.jsx("span",{className:"cot-label",children:s?"thinking":p}),u>0?d.jsxs("span",{className:"cot-steps",children:["· ",h," step",h===1?"":"s"]}):null,g?d.jsx("span",{className:"cot-last",children:s?d.jsx(Uk,{text:g}):g}):null]}),a?d.jsx("div",{className:"cot-body",children:t}):null]})}function O$(){return d.jsx(Du.Unstable_PartsGrouped,{groupingFunction:M$,components:{...rC,Group:({groupKey:e,indices:t,children:n})=>e?d.jsx(L$,{indices:t,children:n}):d.jsx(d.Fragment,{children:n})}})}function tl(){return d.jsxs(Du.Root,{className:"msg-row","data-role":"user",children:[d.jsx("div",{className:"msg-body",children:d.jsx(Du.Parts,{components:rC})}),d.jsx(nC,{})]})}function kr(){const e=Nu(n=>n.metadata?.custom?.cockpitRole)??"assistant",t=Nu(n=>n.metadata?.custom?.working);return d.jsxs(Du.Root,{className:"msg-row","data-role":e,children:[d.jsx("div",{className:"msg-body",children:d.jsx(O$,{})}),!t&&d.jsx(nC,{})]})}function rs({children:e}){return d.jsx("kbd",{className:"kbd",children:e})}const xx=1.8;function z$(e){if(e.backend==="mlx"){const t=(e.model||"").replace(/^mlx-community\//,"").replace(/-Instruct-4bit$/i,"").replace(/-4bit$/i,"");return t?`MLX · ${t}`:"MLX"}return e.backend==="claude"?"claude -p":e.backend==="rules"?"rules":e.mode==="llm"?"llm":"rules"}function F$(e,t){const n=e.split(`
|
|
97
|
+
`),r=t.split(`
|
|
98
|
+
`),s=new Set(n),i=new Set(r),o=[];let a=0,l=0;for(;a<n.length||l<r.length;){const u=n[a],c=r[l];a>=n.length?(o.push({kind:"add",text:c}),l++):l>=r.length?(o.push({kind:"del",text:u}),a++):u===c?(o.push({kind:"same",text:u}),a++,l++):!i.has(u)&&s.has(c)?(o.push({kind:"del",text:u}),o.push({kind:"add",text:c}),a++,l++):i.has(u)?s.has(c)?(o.push({kind:"same",text:u}),a++,l++):(o.push({kind:"add",text:c}),l++):(o.push({kind:"del",text:u}),a++)}return o}function B$({original:e,result:t,onSend:n,onAccept:r,onClose:s}){const{rootRef:i,requestClose:o}=mi(s),[a,l]=m.useState(t.optimized),u=m.useRef(null),[c,f]=m.useState(!0),h=m.useRef(a);h.current=a;const p=m.useRef(n);p.current=n;const g=()=>f(!1);m.useEffect(()=>{u.current?.focus({preventScroll:!0})},[]),m.useEffect(()=>{if(!c)return;const x=setTimeout(()=>p.current(h.current),xx*1e3);return()=>clearTimeout(x)},[c]),m.useEffect(()=>{const x=v=>{v.key==="Escape"?(v.preventDefault(),o()):v.key==="Enter"&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),p.current(h.current))};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[o]);const y=F$(e,t.optimized),_=y.some(x=>x.kind!=="same");return d.jsx("div",{className:"modal-backdrop",ref:i,onClick:x=>{x.target===x.currentTarget&&o()},children:d.jsxs("div",{className:"modal modal-optimize",role:"dialog","aria-modal":!0,"aria-label":"Review enhanced prompt",children:[d.jsxs("div",{className:"modal-head",children:[d.jsxs("div",{className:"modal-head-group",children:[d.jsx("span",{className:"modal-title modal-title-optimize",children:"Enhanced prompt"}),d.jsx("span",{className:"optimize-mode-badge","data-mode":t.mode,children:z$(t)})]}),d.jsx("button",{type:"button",className:"modal-close","aria-label":"Close",onClick:o,children:"✕"})]}),d.jsxs("div",{className:"modal-body",onScroll:g,onWheel:g,onTouchMove:g,children:[d.jsxs("div",{className:"optimize-section",children:[d.jsx("span",{className:"optimize-section-label",children:"Suggestion"}),d.jsx("textarea",{ref:u,className:"optimize-suggestion",value:a,onChange:x=>{l(x.target.value),g()},rows:6,spellCheck:!1,autoComplete:"off"})]}),_?d.jsxs("div",{className:"optimize-section",children:[d.jsx("span",{className:"optimize-section-label",children:"Changes vs original"}),d.jsx("div",{className:"optimize-diff",children:y.map((x,v)=>d.jsxs("div",{className:x.kind==="add"?"diff-add":x.kind==="del"?"diff-del":"diff-same",children:[x.kind==="add"?"+ ":x.kind==="del"?"- ":" ",x.text||" "]},v))})]}):null,t.rationale.length>0?d.jsxs("div",{className:"optimize-section",children:[d.jsx("span",{className:"optimize-section-label",children:"Rationale"}),d.jsx("ul",{className:"optimize-list",children:t.rationale.map((x,v)=>d.jsx("li",{children:x},v))})]}):null,t.changes.length>0?d.jsxs("div",{className:"optimize-section",children:[d.jsx("span",{className:"optimize-section-label",children:"What changed"}),d.jsx("ul",{className:"optimize-list",children:t.changes.map((x,v)=>d.jsx("li",{children:x},v))})]}):null]}),d.jsxs("div",{className:"modal-foot",children:[d.jsx("button",{type:"button",className:"btn-secondary",onClick:o,children:"Discard"}),d.jsx("span",{className:"modal-foot-spacer"}),d.jsx("button",{type:"button",className:"btn-secondary",onClick:()=>r(a),onMouseEnter:g,children:"To Composer"}),d.jsx("button",{type:"button",className:`btn-primary btn-send${c?" btn-send-armed":""}`,style:c?{"--auto-send-secs":`${xx}s`}:void 0,onClick:()=>n(a),children:d.jsxs("span",{className:"btn-send-label",children:["Send ",d.jsx(rs,{children:"⌘/Ctrl+↵"})]})})]})]})})}const wx="(max-width:760px)";function Mm(){const[e,t]=m.useState(()=>typeof window>"u"?!1:window.matchMedia(wx).matches);return m.useEffect(()=>{if(typeof window>"u")return;const n=window.matchMedia(wx),r=s=>t(s.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}function $$({onPick:e,onClose:t,sessionId:n}){const{rootRef:r,requestClose:s}=mi(t),i=Mm(),[o,a]=m.useState([]),[l,u]=m.useState(!0),[c,f]=m.useState(""),h=m.useRef(null);m.useEffect(()=>{let _=!0;return u(!0),DS(n).then(x=>{_&&(a(x),u(!1))}).catch(()=>{_&&u(!1)}),()=>{_=!1}},[]),m.useEffect(()=>{requestAnimationFrame(()=>h.current?.focus())},[]),m.useEffect(()=>{const _=x=>{x.key==="Escape"&&(x.preventDefault(),s())};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[s]);const p=c.trim().toLowerCase(),g=p?o.filter(_=>_.name.toLowerCase().includes(p)||_.description.toLowerCase().includes(p)):o,y=d.jsxs("div",{className:"skill-browser","data-mode":i?"sheet":"modal",role:"dialog","aria-modal":"true","aria-label":"Skill browser",children:[d.jsxs("div",{className:"skill-browser-head",children:[d.jsx("span",{className:"skill-browser-title",children:"Skills"}),d.jsx("button",{type:"button",className:"modal-close","aria-label":"Close skill browser",onClick:s,children:"✕"})]}),d.jsx("div",{className:"skill-browser-search",children:d.jsx("input",{ref:h,type:"search",className:"skill-search-input",placeholder:"Search skills…",value:c,onChange:_=>f(_.currentTarget.value),"aria-label":"Search skills",autoComplete:"off",spellCheck:!1})}),d.jsx("div",{className:"skill-browser-list",role:"list",children:l?d.jsx("div",{className:"skill-browser-empty",children:"Loading…"}):g.length===0?d.jsx("div",{className:"skill-browser-empty",children:p?"No skills match your search.":"No skills found."}):g.map(_=>d.jsxs("button",{type:"button",className:"skill-card",role:"listitem",onClick:()=>e(_.name),title:`Prefill /${_.name}`,children:[d.jsxs("span",{className:"tool-head",children:[d.jsx("span",{className:"tool-arrow","aria-hidden":"true",children:"▸"}),d.jsx("span",{className:"tool-name skill-card-name",children:_.name}),_.description?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"tool-sep",children:"—"}),d.jsx("span",{className:"tool-input skill-card-desc",children:_.description})]}):null]}),_.source!=="user"?d.jsx("span",{className:"skill-source-tag",children:_.source}):null]},_.name))})]});return i?d.jsx("div",{className:"skill-browser-sheet-wrap",children:y}):d.jsx("div",{className:"modal-backdrop",ref:r,onClick:_=>{_.target===_.currentTarget&&s()},children:y})}function U$(){if(typeof window>"u")return null;const e=window;return e.AudioContext??e.webkitAudioContext??null}function V$(){const e=typeof window<"u"?window.MediaRecorder:void 0,t=[{mime:"audio/webm;codecs=opus",ext:"webm"},{mime:"audio/webm",ext:"webm"},{mime:"audio/mp4",ext:"mp4"},{mime:"audio/aac",ext:"aac"},{mime:"audio/ogg;codecs=opus",ext:"ogg"}];if(e&&typeof e.isTypeSupported=="function"){for(const n of t)if(e.isTypeSupported(n.mime))return n}return{mime:"",ext:"webm"}}function H$({onCommit:e,onClose:t,active:n}){const[r,s]=m.useState("starting"),[i,o]=m.useState(null),a=m.useRef(null),l=m.useRef(null),u=m.useRef(null),c=m.useRef(null),f=m.useRef([]),h=m.useRef({mime:"",ext:"webm"}),p=m.useRef(null),g=m.useRef(null),y=m.useRef(!1),_=m.useRef(!1),x=m.useRef(!0),v=m.useRef(null),w=m.useCallback(()=>{y.current=!1,g.current!=null&&cancelAnimationFrame(g.current),g.current=null},[]),C=m.useCallback(()=>{const P=p.current,E=u.current;if(!P||!E)return;const M=P.getContext("2d");if(!M)return;const D=new Uint8Array(E.fftSize),$=getComputedStyle(P).getPropertyValue("--accent").trim()||"#7aa2f7";y.current=!0;const U=()=>{if(!y.current)return;P.width!==P.clientWidth&&(P.width=P.clientWidth),E.getByteTimeDomainData(D);const V=P.width,J=P.height;M.clearRect(0,0,V,J),M.lineWidth=2,M.strokeStyle=$,M.beginPath();const te=V/D.length;for(let B=0;B<D.length;B+=1){const b=D[B]/128*J/2,H=B*te;B===0?M.moveTo(H,b):M.lineTo(H,b)}M.stroke(),g.current=requestAnimationFrame(U)};g.current=requestAnimationFrame(U)},[]),S=m.useCallback(()=>{w(),a.current?.getTracks().forEach(P=>P.stop()),a.current=null,l.current?.close().catch(()=>{}),l.current=null,u.current=null},[w]);m.useEffect(()=>(x.current=!0,()=>{x.current=!1,v.current?.abort(),v.current=null}),[]),m.useEffect(()=>{if(!n){_.current=!1,f.current=[],s("starting"),o(null);return}let P=!1;return _.current=!1,f.current=[],(async()=>{try{if(!navigator.mediaDevices?.getUserMedia)throw new Error("no-getusermedia");const E=await navigator.mediaDevices.getUserMedia({audio:!0});if(P){E.getTracks().forEach(U=>U.stop());return}a.current=E;const M=U$();if(M){const U=new M;l.current=U,U.state==="suspended"&&await U.resume();const V=U.createMediaStreamSource(E),J=U.createAnalyser();J.fftSize=512,V.connect(J),u.current=J}if(!("MediaRecorder"in window))throw new Error("no-mediarecorder");const D=V$();h.current=D;const $=D.mime?new MediaRecorder(E,{mimeType:D.mime}):new MediaRecorder(E);$.ondataavailable=U=>{U.data&&U.data.size>0&&f.current.push(U.data)},c.current=$,$.start(),s("recording"),C()}catch(E){const M=E instanceof Error?E.message:"",D=E instanceof Error?E.name:"";let $;M==="no-mediarecorder"?$="Audio recording isn't supported in this browser.":!window.isSecureContext||!navigator.mediaDevices?.getUserMedia?$="Microphone needs a secure (HTTPS) connection. You're on "+location.origin+" — serve over HTTPS (e.g. `tailscale serve --bg 4317`) so the browser allows the mic.":D==="NotAllowedError"||D==="SecurityError"?$='Microphone blocked. On iPhone/iPad: reset it in Settings → Apps → Safari → Microphone (or the "aA" → Website Settings menu), then reload. Add this app to your Home Screen so the permission persists across reloads.':D==="NotFoundError"||D==="NotReadableError"?$="No microphone available (or it's in use by another app).":$="Microphone permission denied or unavailable.",o($),s("error")}})(),()=>{P=!0,v.current?.abort(),v.current=null,w();try{c.current?.stop()}catch{}c.current=null,a.current?.getTracks().forEach(E=>E.stop()),a.current=null,l.current?.close().catch(()=>{}),l.current=null,u.current=null}},[n]);const k=m.useCallback(()=>{if(r==="recording"){try{c.current?.pause()}catch{}w(),s("paused")}else if(r==="paused"){try{c.current?.resume()}catch{}s("recording"),C()}},[r,w,C]),T=m.useCallback(()=>{if(_.current)return;_.current=!0;const P=c.current;if(!P){S(),e("");return}s("transcribing"),P.onstop=async()=>{const{mime:E,ext:M}=h.current,D=new Blob(f.current,{type:E||"audio/webm"});if(S(),D.size===0){e("");return}const $=new AbortController;v.current=$;try{const U=await CM(D,M,$.signal);x.current&&!$.signal.aborted&&e(U)}catch(U){if(U?.name==="AbortError")return;x.current&&!$.signal.aborted&&(o(U instanceof Error?U.message:"Transcription failed."),s("error"))}};try{P.stop()}catch{S(),e("")}},[S,e]),R=m.useCallback(()=>{_.current=!0,v.current?.abort(),v.current=null;const P=c.current;P&&(P.onstop=null);try{P?.stop()}catch{}c.current=null,S(),t()},[S,t]);return{status:r,errorMsg:i,canvasRef:p,pauseResume:k,stop:T,cancel:R}}const Ch=["#414868","#f7768e","#9ece6a","#e0af68","#7aa2f7","#bb9af7","#7dcfff","#a9b1d6"],Eh=["#565f89","#ff7a93","#b9f27c","#ff9e64","#9bb5ff","#c7a9ff","#a4daff","#c0caf5"];function W$(e){if(e<8)return Ch[e];if(e<16)return Eh[e-8];if(e>=232){const o=8+(e-232)*10;return`rgb(${o},${o},${o})`}const t=e-16,n=Math.floor(t/36),r=Math.floor(t%36/6),s=t%6,i=o=>o===0?0:o*40+55;return`rgb(${i(n)},${i(r)},${i(s)})`}function q$(e,t){for(let n=0;n<t.length;n+=1){const r=t[n];if(r===0)e.fg=void 0,e.bg=void 0,e.bold=!1,e.dim=!1,e.italic=!1,e.underline=!1;else if(r===1)e.bold=!0;else if(r===2)e.dim=!0;else if(r===3)e.italic=!0;else if(r===4)e.underline=!0;else if(r===22)e.bold=!1,e.dim=!1;else if(r===23)e.italic=!1;else if(r===24)e.underline=!1;else if(r>=30&&r<=37)e.fg=Ch[r-30];else if(r===39)e.fg=void 0;else if(r>=90&&r<=97)e.fg=Eh[r-90];else if(r>=40&&r<=47)e.bg=Ch[r-40];else if(r===49)e.bg=void 0;else if(r>=100&&r<=107)e.bg=Eh[r-100];else if(r===38||r===48){const s=r===38?"fg":"bg";t[n+1]===5?(e[s]=W$(t[n+2]??0),n+=2):t[n+1]===2&&(e[s]=`rgb(${t[n+2]??0},${t[n+3]??0},${t[n+4]??0})`,n+=4)}}}const Ud=/\x1b\[([0-9;]*)m/g,K$=/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g,G$=/\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b[@-Z\\-_]/g,Y$=/\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[@-Z\\-_]/g;function Q$(e){const t=String(e).split(`
|
|
99
|
+
`);for(;t.length&&t[t.length-1].replace(Y$,"").trim()==="";)t.pop();return t.join(`
|
|
100
|
+
`)}function X$(e){return e.replace(G$,"")}function J$(e){const t=String(e).replace(K$,""),n=[],r={};let s=0,i;Ud.lastIndex=0;const o=a=>{const l=X$(a);l&&n.push({text:l,...r})};for(;(i=Ud.exec(t))!==null;){i.index>s&&o(t.slice(s,i.index));const a=(i[1]===""?"0":i[1]).split(";").map(l=>Number(l)||0);q$(r,a),s=Ud.lastIndex}return s<t.length&&o(t.slice(s)),n}const _x=/(https?:\/\/[^\s'"`<>()\][]+)/g;function Z$(e){const t=[];let n=0,r;for(_x.lastIndex=0;(r=_x.exec(e))!==null;){let s=r[0],i="";const o=s.match(/[.,;:!?]+$/);o&&(i=o[0],s=s.slice(0,-i.length)),r.index>n&&t.push({text:e.slice(n,r.index)}),t.push({text:s,href:s}),i&&t.push({text:i}),n=r.index+r[0].length}return n<e.length&&t.push({text:e.slice(n)}),t.length?t:[{text:e}]}const bx=400,e5=800,t5=[{label:"↑",key:"Up",title:"Up"},{label:"↓",key:"Down",title:"Down"},{label:"←",key:"Left",title:"Left"},{label:"→",key:"Right",title:"Right"},"gap",{label:"Tab",key:"Tab",title:"Tab"},{label:"Esc",key:"Escape",title:"Escape"},"gap",{label:"^C",key:"C-c",title:"Interrupt (Ctrl-C)"},{label:"^D",key:"C-d",title:"EOF (Ctrl-D)"},{label:"^R",key:"C-r",title:"Reverse search (Ctrl-R)"},{label:"^Z",key:"C-z",title:"Suspend (Ctrl-Z)"},{label:"^L",key:"C-l",title:"Clear (Ctrl-L)"},"gap",{label:"Home",key:"Home",title:"Home"},{label:"End",key:"End",title:"End"},{label:"PgUp",key:"PPage",title:"Page Up"},{label:"PgDn",key:"NPage",title:"Page Down"}];function sC({output:e,requestCapture:t,clearOutput:n,sendKey:r,mods:s,onToggleMod:i}){const o=m.useRef(null),a=m.useRef(!0);m.useEffect(()=>{t(bx);const c=setInterval(()=>t(bx),e5);return()=>{clearInterval(c),n()}},[t,n]),m.useLayoutEffect(()=>{const c=o.current;c&&a.current&&(c.scrollTop=c.scrollHeight)},[e]);const l=()=>{const c=o.current;c&&(a.current=c.scrollHeight-c.scrollTop-c.clientHeight<24)},u=m.useMemo(()=>e==null?null:J$(Q$(e)).map((c,f)=>{const h={color:c.fg,background:c.bg,fontWeight:c.bold?700:void 0,fontStyle:c.italic?"italic":void 0,textDecoration:c.underline?"underline":void 0,opacity:c.dim?.7:void 0};return d.jsx("span",{style:h,children:Z$(c.text).map((p,g)=>p.href?d.jsx("a",{href:p.href,target:"_blank",rel:"noopener noreferrer",children:p.text},g):p.text)},f)}),[e]);return d.jsxs("div",{className:"terminal-view",children:[d.jsxs("div",{className:"terminal-view-head",children:[d.jsx("span",{className:"terminal-view-title",children:"terminal · cc-shell"}),d.jsx("button",{type:"button",className:"terminal-view-btn",onClick:()=>r("C-c"),title:"Interrupt (Ctrl-C)",children:"Stop"})]}),d.jsx("pre",{className:"terminal-view-body",ref:o,onScroll:l,children:u??d.jsxs("span",{className:"terminal-loading",children:[d.jsx("span",{className:"terminal-loading-spinner","aria-hidden":"true"}),"starting shell…"]})}),d.jsxs("div",{className:"terminal-key-bar",role:"toolbar","aria-label":"Terminal keys",children:[d.jsx("button",{type:"button",className:"terminal-key terminal-key-mod","aria-pressed":s.ctrl,"data-on":s.ctrl?"true":void 0,title:"Sticky Ctrl — applies to the next key",onMouseDown:c=>c.preventDefault(),onClick:()=>i("ctrl"),children:"Ctrl"}),d.jsx("button",{type:"button",className:"terminal-key terminal-key-mod","aria-pressed":s.alt,"data-on":s.alt?"true":void 0,title:"Sticky Opt/Meta — applies to the next key",onMouseDown:c=>c.preventDefault(),onClick:()=>i("alt"),children:"Opt"}),d.jsx("span",{className:"terminal-key-gap","aria-hidden":"true"}),t5.map((c,f)=>c==="gap"?d.jsx("span",{className:"terminal-key-gap","aria-hidden":"true"},`gap-${f}`):d.jsx("button",{type:"button",className:"terminal-key",title:c.title,"aria-label":c.title,onMouseDown:h=>h.preventDefault(),onClick:()=>r(c.key),children:c.label},c.key))]})]})}const n5={output:null,run:()=>!1,text:()=>!1,key:()=>!1,poll:()=>!1,clear:()=>{}},iC=m.createContext(n5),r5=()=>m.useContext(iC);function oC(e,t){if(e===t)return{removed:0,added:""};let n=0;const r=Math.min(e.length,t.length);for(;n<r&&e[n]===t[n];)n+=1;let s=0;const i=Math.min(e.length-n,t.length-n);for(;s<i&&e[e.length-1-s]===t[t.length-1-s];)s+=1;return{removed:e.length-n-s,added:t.slice(n,t.length-s)}}const Ua=e=>/^[a-z]$/i.test(e);function Xu(e,t){return Ua(t)?e.ctrl?`C-${t.toLowerCase()}`:e.alt?`M-${t.toLowerCase()}`:null:null}const s5={Enter:"Enter",Escape:"Escape"};function aC(e,t=!1){return e==="Tab"?t?"BTab":"Tab":s5[e]??null}const i5={ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Home:"Home",End:"End",PageUp:"PPage",PageDown:"NPage"};function lC(e,t){const n=i5[e];return n?`${t.ctrl?"C-":""}${t.alt?"M-":""}${t.shift?"S-":""}`+n:null}function o5(e,t){if(t<1)return null;let n=t-1;for(;n>=0&&/[A-Za-z0-9:_-]/.test(e[n]);)n-=1;const r=n;if(r<0)return null;const s=e[r];return s!=="/"&&s!=="@"||r>0&&!/\s/.test(e[r-1])?null:{trigger:s,query:e.slice(r+1,t),start:r,end:t}}const Ju=new Map,Al=new Map;function a5(e){const t=e??"",n=Ju.get(t);if(n)return Promise.resolve(n);const r=Al.get(t);if(r)return r;const s=DS(e).then(i=>(Ju.set(t,i),Al.delete(t),i)).catch(()=>(Al.delete(t),[]));return Al.set(t,s),s}const Zu=new Map,Nl=new Map;function l5(e){const t=e??"",n=Zu.get(t);if(n)return Promise.resolve(n);const r=Nl.get(t);if(r)return r;const s=AM(e).then(i=>(Zu.set(t,i),Nl.delete(t),i)).catch(()=>(Nl.delete(t),[]));return Nl.set(t,s),s}const u5=/^\/([A-Za-z0-9:_-]+)\s/,c5=4;function d5({file:e}){const[t,n]=m.useState(null),[r,s]=m.useState(!1);return m.useEffect(()=>{const i=URL.createObjectURL(e);return n(i),()=>URL.revokeObjectURL(i)},[e]),t?d.jsxs(d.Fragment,{children:[d.jsx("img",{className:"chip-thumb",src:t,alt:"",role:"button",tabIndex:0,title:"Open preview",onClick:()=>s(!0),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),s(!0))}}),r?d.jsx(eC,{src:t,alt:e.name,onClose:()=>s(!1)}):null]}):d.jsx("div",{className:"chip-thumb chip-thumb-empty"})}function f5({attachment:e}){const t=e.type==="image",n=e.status.type==="running";return d.jsxs(My.Root,{className:"attach-chip","data-pending":n,children:[t&&e.file?d.jsx(d5,{file:e.file}):d.jsx("span",{className:"chip-icon","aria-hidden":"true",children:e.type==="document"?"📄":"📎"}),d.jsx("span",{className:"chip-name",title:e.name,children:e.name}),n?d.jsx("span",{className:"chip-spinner","aria-hidden":"true"}):null,d.jsx(My.Remove,{className:"chip-remove","aria-label":`Remove ${e.name}`,children:"×"})]})}const Sx={optimizing:!1,review:null};function uC({disabled:e,sessionId:t,subAgentMode:n=!0,onSubAgentModeChange:r,onTerminalModeChange:s,working:i=!1,onStop:o}){const a=P0(),l=r5(),[u,c]=m.useState(!0),[f,h]=m.useState(!1),[p,g]=m.useState(!1),[y,_]=m.useState(!1),x=m.useRef(null),v=m.useCallback(()=>{_(!0),g(!0),s?.(!0)},[s]);m.useEffect(()=>{g(!1),_(!1),s?.(!1)},[t]),m.useEffect(()=>{const j=x.current;if(j)if(p){if(j.style.display="",Xt()){le.set(j,{opacity:1,scale:1,y:0});return}le.fromTo(j,{opacity:0,scale:.95,y:8},{opacity:1,scale:1,y:0,duration:.26,ease:"power3.out",transformOrigin:"bottom center"})}else Xt()?j.style.display="none":le.to(j,{opacity:0,scale:.95,y:8,duration:.18,ease:"power2.in",transformOrigin:"bottom center",onComplete:()=>{j.style.display="none"}})},[p,y]);const[w,C]=m.useState({}),S=t??"",{optimizing:k,review:T}=w[S]??Sx,R=m.useCallback((j,F)=>{C(ne=>({...ne,[j]:{...ne[j]??Sx,...F}}))},[]),P=m.useCallback(()=>{requestAnimationFrame(()=>{document.querySelector(".composer-input")?.focus()})},[]),E=m.useRef(null);m.useEffect(()=>{const j=E.current;if(j){if(k&&!Xt()){const F=le.to(j,{scale:1.08,duration:.5,ease:"sine.inOut",repeat:-1,yoyo:!0});return()=>{F.kill(),le.set(j,{scale:1})}}le.set(j,{scale:1})}},[k]);const[M,D]=m.useState(()=>Ju.get(t??"")??[]),[$,U]=m.useState(()=>Zu.get(t??"")??[]),[V,J]=m.useState(""),[te,B]=m.useState(0),[z,b]=m.useState(0),[H,X]=m.useState(!1);m.useEffect(()=>{let j=!0;const F=Ju.get(t??"");return F?D(F):a5(t).then(ne=>{j&&D(ne)}).catch(()=>{j&&D([])}),()=>{j=!1}},[t]),m.useEffect(()=>{let j=!0;const F=Zu.get(t??"");return F?U(F):l5(t).then(ne=>{j&&U(ne)}).catch(()=>{j&&U([])}),()=>{j=!1}},[t]),m.useEffect(()=>{const j=()=>{const F=a.getState().text??"";J(F),c(!F.trim());const ne=document.querySelector(".composer-input");ne&&B(ne.selectionStart??F.length)};return j(),a.subscribe(j)},[a]);const I=m.useCallback(j=>{j&&B(j.selectionStart??0)},[]),de=m.useMemo(()=>o5(V,te),[V,te]),Se=de?de.query:null;m.useEffect(()=>{b(0),X(!1)},[Se]);const me=m.useMemo(()=>{if(Se==null||H)return[];const j=Se.toLowerCase();return(de?.trigger==="@"?$:M).filter(ne=>ne.name.toLowerCase().includes(j)).sort((ne,ge)=>{const Ee=ne.name.toLowerCase().startsWith(j)?0:1,De=ge.name.toLowerCase().startsWith(j)?0:1;return Ee!==De?Ee-De:ne.name.localeCompare(ge.name)}).slice(0,c5)},[Se,H,de?.trigger,M,$]),nt=!p&&me.length>0,We=m.useMemo(()=>{const j=u5.exec(V);return j&&M.some(F=>F.name===j[1])?j[1]:null},[V,M]),Pe=m.useCallback(j=>{const F=de,ne=(F?.trigger==="@"?"@":"/")+j+" ";if(F){const ge=a.getState().text??"",Ee=ge.slice(0,F.start)+ne+ge.slice(F.end);a.setText(Ee);const De=F.start+ne.length;requestAnimationFrame(()=>{const Ie=document.querySelector(".composer-input");Ie&&(Ie.focus(),Ie.setSelectionRange(De,De),B(De))})}else a.setText(ne),requestAnimationFrame(()=>{document.querySelector(".composer-input")?.focus()});X(!0)},[a,de]),[Z,se]=m.useState(!1),ie=m.useRef(null),fe=m.useRef(null),ut=m.useRef(null),rt=m.useRef(!1),mt=m.useRef(!1),Pn=m.useCallback(()=>{e||se(!0)},[e]),Er=m.useCallback(()=>{const j=ie.current;j&&(j.style.height=j.offsetHeight+"px"),se(!1)},[]),Tr=96,ae={fade:.2,height:.22,btnStagger:.035,topStagger:.03,gap:.08,enterEase:Dr.enterEase,exitEase:Dr.exitEase};m.useLayoutEffect(()=>{const j=ie.current;if(j&&!(!Z&&!mt.current))if(Z&&(mt.current=!0),fe.current?.kill(),fe.current=null,Z){const F=ut.current,ne=j.querySelector(".composer-toolbar:not(.voice-toolbar)"),ge=j.querySelector(".composer-input-wrap");if(Xt()){F&&(F.style.display="flex"),ge&&le.set(ge,{display:"none"});return}const Ee=j.offsetHeight;j.style.height=`${Ee}px`,F&&(F.style.display="flex"),F&&F.querySelectorAll("*").forEach(Kt=>{Kt.style.position&&(Kt.style.position=""),Kt.style.visibility&&(Kt.style.visibility="")}),ge&&(ge.style.position="absolute",ge.style.visibility="hidden"),ne&&(ne.style.position="absolute",ne.style.visibility="hidden"),j.style.height="";const De=j.offsetHeight,Ie=Math.max(De,Tr);j.style.height=`${Ee}px`,ge&&(ge.style.position="",ge.style.visibility=""),ne&&(ne.style.position="",ne.style.visibility=""),j.offsetHeight;const ye=j.querySelector(".voice-status"),dn=j.querySelector(".voice-wave-inline"),Yr=j.querySelector(".voice-hint, .voice-error"),Ot=j.querySelector(".voice-toolbar"),ve=Ot?Array.from(Ot.querySelectorAll('button, [role="button"]')):[];ge&&le.set(ge,{clearProps:"display,position,visibility",opacity:1,y:0});const gt=[ye,dn,Yr].filter(Boolean);gt.length&&le.set(gt,{opacity:0,y:-16}),Ot&&le.set(Ot,{clearProps:"opacity,y"}),ve.length&&le.set(ve,{opacity:0,y:12});const Wt=ne?Array.from(ne.querySelectorAll('button, label, [role="button"]')):[],An=()=>{const Kt=j.querySelector(".voice-btn-cancel"),Nn=j.querySelector(".voice-btn-stop"),ko=j.querySelector(".voice-btn-pause"),lr=[Kt,Nn,ko].filter(Rr=>Rr!==null);lr.forEach(Rr=>{const As=parseFloat(Rr.style.opacity);(Rr.style.opacity===""||isNaN(As)||As>0)&&le.set(Rr,{opacity:0,y:12})});const vi=le.timeline({onComplete:()=>{rt.current=!0}});if(gt.length&&vi.to(gt,{opacity:1,y:0,duration:ae.fade,ease:ae.enterEase,stagger:ae.topStagger},0),lr.length){const Rr=gt.length?ae.fade+ae.topStagger*(gt.length-1):0,As=gt.length?Rr*.5:0;vi.to(lr,{opacity:1,y:0,duration:ae.fade,ease:ae.enterEase,stagger:ae.btnStagger},As)}else Ot&&vi.to(Ot,{opacity:1,y:0,duration:ae.fade,ease:ae.enterEase},gt.length?ae.topStagger*gt.length:0);fe.current=vi},fn=()=>{j.style.overflow="hidden",j.offsetHeight;const Kt=le.timeline({onComplete:()=>{j.style.height="",j.style.overflow="",ge&&le.set(ge,{display:"none"}),ne&&le.set(ne,{clearProps:"opacity,y"}),le.delayedCall(ae.gap,An)}});Kt.to(j,{height:Ie,duration:ae.height,ease:ae.exitEase},0),fe.current=Kt},qt=le.timeline({onComplete:fn});Wt.length?qt.to(Wt,{opacity:0,y:4,duration:ae.fade,ease:ae.exitEase,stagger:ae.btnStagger},0):ne&&qt.to(ne,{opacity:0,y:4,duration:ae.fade,ease:ae.exitEase},0),ge&&qt.to(ge,{opacity:0,y:6,duration:ae.fade,ease:ae.exitEase},0),fe.current=qt}else{rt.current=!1;const F=ut.current,ne=j.querySelector(".voice-toolbar"),ge=j.querySelector(".voice-status"),Ee=j.querySelector(".voice-wave-inline"),De=j.querySelector(".voice-hint, .voice-error"),Ie=j.querySelector(".composer-toolbar:not(.voice-toolbar)"),ye=j.querySelector(".composer-input-wrap");if(Xt()){F&&(F.style.display="none"),ye&&le.set(ye,{clearProps:"all"}),Ie&&le.set(Ie,{clearProps:"all"});return}const dn=j.offsetHeight;ye&&(ye.style.display="",ye.style.opacity="0"),F&&(F.style.position="absolute",F.style.visibility="hidden");const Yr=j.offsetHeight,Ot=Math.max(Yr,Tr);F&&(F.style.position="",F.style.visibility=""),ye&&(ye.style.display="none",ye.style.opacity=""),j.style.height=`${dn}px`,j.style.overflow="hidden",ye&&le.set(ye,{display:"",opacity:0,y:6}),Ie&&le.set(Ie,{opacity:0,y:4});const ve=Ie?Array.from(Ie.querySelectorAll('button, label, [role="button"]')):[];ve.length&&le.set(ve,{opacity:0,y:4}),j.offsetHeight;const gt=[ge,Ee,De].filter(Boolean),Wt=ne?Array.from(ne.querySelectorAll('button, [role="button"]')):[],An=()=>{F&&(F.style.display="none"),j.style.height=`${dn}px`,j.style.overflow="";const Nn=le.timeline({onComplete:()=>{j.style.height="",ye&&le.set(ye,{clearProps:"all"}),Ie&&le.set(Ie,{clearProps:"all"}),ve.length&&le.set(ve,{clearProps:"all"})}});if(Nn.to(j,{height:Ot,duration:ae.height,ease:ae.enterEase},0),ye&&Nn.to(ye,{opacity:1,y:0,duration:ae.fade,ease:ae.enterEase},0),ve.length){const ko=ye?ae.fade*.4:0;Nn.to(ve,{opacity:1,y:0,duration:ae.fade,ease:ae.enterEase,stagger:ae.btnStagger},ko)}else Ie&&Nn.to(Ie,{opacity:1,y:0,duration:ae.fade,ease:ae.enterEase},0);fe.current=Nn},fn=le.timeline({onComplete:()=>{le.delayedCall(ae.gap,An)}});Wt.length?fn.to(Wt,{opacity:0,y:8,duration:ae.fade,ease:ae.exitEase,stagger:ae.btnStagger},0):ne&&fn.to(ne,{opacity:0,y:8,duration:ae.fade,ease:ae.exitEase},0);const qt=Wt.length?ae.fade+ae.btnStagger*(Wt.length-1):0,Kt=Wt.length?qt*.5:0;gt.length?fn.to(gt,{opacity:0,y:-8,duration:ae.fade,ease:ae.exitEase,stagger:ae.topStagger},Kt):F&&fn.to(F,{opacity:0,y:-8,duration:ae.fade,ease:ae.exitEase},0),fe.current=fn}},[Z]),m.useEffect(()=>()=>{fe.current?.kill()},[]),m.useEffect(()=>{const j=F=>{F.key.toLowerCase()!=="s"||!(F.metaKey||F.ctrlKey)||F.shiftKey||F.altKey||e||document.querySelector('[aria-modal="true"]')||(F.preventDefault(),Z?Er():Pn())};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[e,Z,Pn,Er]),m.useEffect(()=>{const j=F=>{F.key.toLowerCase()!=="d"||!(F.metaKey||F.ctrlKey)||F.shiftKey||F.altKey||e||document.querySelector('[aria-modal="true"]')||p||(F.preventDefault(),r?.(!n))};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[e,p,n,r]);const So=m.useCallback(j=>{Er();const F=j.trim();if(!F)return;const ne=a.getState().text??"",ge=ne&&!/\s$/.test(ne)?" ":"";a.setText(ne+ge+F+" ")},[a,Er]);m.useEffect(()=>{h(!1),se(!1),fe.current?.kill(),fe.current=null,mt.current=!1,rt.current=!1;const j=ie.current;if(j){j.style.height="",j.style.overflow="";const F=j.querySelector(".composer-input-wrap"),ne=j.querySelector(".composer-toolbar:not(.voice-toolbar)");F&&le.set(F,{clearProps:"all"}),ne&&le.set(ne,{clearProps:"all"});const ge=ne?Array.from(ne.querySelectorAll('button, label, [role="button"]')):[];ge.length&&le.set(ge,{clearProps:"all"});const Ee=ut.current;Ee&&(Ee.style.display="none")}},[t]);const yi=m.useCallback(j=>{a.setText(`/${j} `),h(!1),requestAnimationFrame(()=>{document.querySelector(".composer-input")?.focus()})},[a]),ar=m.useCallback(async()=>{if(e||k)return;const j=a.getState().text??"";if(!j.trim())return;const F=S;R(F,{optimizing:!0});try{const ne=await kM(j);R(F,{optimizing:!1,review:{...ne,original:j}})}catch{R(F,{optimizing:!1})}},[a,e,k,S,R]),qn=m.useRef(null);m.useEffect(()=>{const j=F=>{if(!(F.key!=="Enter"||!(F.metaKey||F.ctrlKey)||F.altKey)&&!(e||p)&&!document.querySelector('[aria-modal="true"]')){if(Z){F.preventDefault(),qn.current?.();return}F.preventDefault(),F.shiftKey?(a.send(),P()):ar()}};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[e,p,Z,a,ar,P]);const[jn,O]=m.useState({ctrl:!1,alt:!1}),Q=m.useRef(jn);Q.current=jn;const re=m.useRef(l);re.current=l;const ue=m.useRef(""),ke=m.useCallback(j=>{O(F=>({...F,[j]:!F[j]}))},[]);m.useEffect(()=>{if(!p){ue.current="";return}a.setText(""),ue.current="",O({ctrl:!1,alt:!1});const j=()=>{const F=a.getState().text??"",ne=ue.current;if(F===ne)return;const{removed:ge,added:Ee}=oC(ne,F),De=Q.current;if((De.ctrl||De.alt)&&ge===0&&Ee.length===1&&Ua(Ee)){const ye=Xu(De,Ee);ye&&re.current.key(ye),O({ctrl:!1,alt:!1}),a.setText(ne);return}const Ie=Ee.indexOf(`
|
|
101
|
+
`);if(Ie!==-1){for(let ye=0;ye<ge;ye+=1)re.current.key("BSpace");Ee.slice(0,Ie)&&re.current.text(Ee.slice(0,Ie)),re.current.key("Enter"),ue.current="",a.setText("");return}for(let ye=0;ye<ge;ye+=1)re.current.key("BSpace");Ee&&re.current.text(Ee),ue.current=F};return a.subscribe(j)},[p,a]);const st=m.useRef(null),cn=m.useMemo(()=>new Set(M.map(j=>j.name)),[M]),Lt=m.useMemo(()=>new Set($.map(j=>j.name)),[$]);function Et(j,F,ne){const ge=/(^|\s)([/@])([A-Za-z0-9:_-]+)(\s)/g,Ee=[];let De=0,Ie=!1,ye=0,dn;for(;(dn=ge.exec(j))!==null;){const Yr=dn[2],Ot=dn[3];if(!(Yr==="/"&&F.has(Ot)||Yr==="@"&&ne.has(Ot)))continue;Ie=!0;const gt=dn.index,Wt=dn[1],An=dn[4],fn=gt+Wt.length,qt=fn+1+Ot.length;gt>De&&Ee.push(j.slice(De,gt)),Wt&&Ee.push(Wt),Ee.push(d.jsx("span",{className:"composer-pill","aria-hidden":"true",children:j.slice(fn,qt)},ye++)),Ee.push(j.slice(qt,qt+An.length)),De=qt+An.length}return De<j.length&&Ee.push(j.slice(De)),{nodes:Ee,hasPills:Ie}}const{nodes:Ir,hasPills:it}=m.useMemo(()=>Et(V,cn,Lt),[V,cn,Lt]);return m.useLayoutEffect(()=>{const j=document.querySelector(".composer-input"),F=st.current;!j||!F||(F.scrollTop=j.scrollTop,F.scrollLeft=j.scrollLeft)},[V]),d.jsxs(El.Root,{className:"composer",children:[nt?d.jsx("div",{className:"skill-ac",role:"listbox","aria-label":"Skill suggestions",children:me.map((j,F)=>d.jsx("button",{type:"button",role:"option","aria-selected":F===z,"data-on":F===z?"true":void 0,className:"skill-ac-item",onMouseDown:ne=>{ne.preventDefault(),Pe(j.name)},onMouseEnter:()=>b(F),children:d.jsxs("span",{className:"tool-head",children:[d.jsx("span",{className:"tool-arrow","aria-hidden":"true",children:"▸"}),d.jsx("span",{className:"tool-name skill-card-name",children:j.name}),j.description?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"tool-sep",children:"—"}),d.jsx("span",{className:"tool-input skill-card-desc",children:j.description})]}):null]})},j.name))}):null,y?d.jsx("div",{ref:x,className:"term-warm",children:d.jsx(sC,{output:l.output,requestCapture:l.poll,clearOutput:l.clear,sendKey:l.key,mods:jn,onToggleMod:ke})}):null,d.jsxs("div",{ref:ie,className:"composer-card","data-terminal":p?"true":void 0,"data-voice":Z?"true":void 0,children:[We?d.jsx("div",{className:"composer-skill-chip-row",children:d.jsxs("span",{className:"skill-chip composer-skill-chip",title:`Invoking /${We}`,children:[d.jsx("span",{className:"skill-chip-icon","aria-hidden":"true",children:"⌁"}),d.jsxs("span",{className:"skill-chip-name",children:["/",We]})]})}):null,d.jsx(h5,{active:Z,bodyRef:ut,onCommit:So,onClose:Er,stopRef:qn,phase2DoneRef:rt}),d.jsxs("div",{className:"composer-input-wrap","data-has-pills":it?"true":void 0,children:[d.jsx(El.Input,{className:"composer-input",placeholder:e&&!p?"Select a session…":" ",submitOnEnter:!1,onKeyUp:j=>I(j.currentTarget),onClick:j=>I(j.currentTarget),onSelect:j=>I(j.currentTarget),onScroll:j=>{const F=st.current;F&&(F.scrollTop=j.currentTarget.scrollTop,F.scrollLeft=j.currentTarget.scrollLeft)},onKeyDown:j=>{if(p){if(j.metaKey)return;if(j.key==="Escape"){j.preventDefault(),g(!1),s?.(!1),P();return}const F=jn,ne=j.ctrlKey||F.ctrl,ge=j.altKey||F.alt;if((ne||ge)&&j.key.length===1&&Ua(j.key)){j.preventDefault();const Ie=Xu({ctrl:ne,alt:ge},j.key);Ie&&l.key(Ie),(F.ctrl||F.alt)&&O({ctrl:!1,alt:!1});return}const Ee=lC(j.key,{ctrl:j.ctrlKey,alt:j.altKey,shift:j.shiftKey});if(Ee){j.preventDefault(),l.key(Ee);return}if(j.key==="Backspace"){j.preventDefault(),l.key("BSpace");const Ie=a.getState().text??"";if(Ie){const ye=Ie.slice(0,-1);a.setText(ye),ue.current=ye}return}if(j.key==="Delete"){j.preventDefault(),l.key("DC");return}const De=aC(j.key,j.shiftKey);De&&(j.preventDefault(),l.key(De),De==="Enter"&&(ue.current="",a.setText("")));return}if(u&&j.key==="!"){j.preventDefault(),v();return}if(nt){if(j.key==="ArrowDown"){j.preventDefault(),b(F=>(F+1)%me.length);return}if(j.key==="ArrowUp"){j.preventDefault(),b(F=>(F-1+me.length)%me.length);return}if(j.key==="Enter"&&!j.metaKey&&!j.ctrlKey){j.preventDefault(),Pe(me[z].name);return}if(j.key==="Tab"){j.preventDefault(),Pe(me[z].name);return}if(j.key==="Escape"){j.preventDefault(),X(!0);return}}if(j.key==="Enter"&&(j.metaKey||j.ctrlKey)){if(j.preventDefault(),e||k)return;j.shiftKey?(a.send(),P()):ar()}j.key.toLowerCase()==="o"&&(j.metaKey||j.ctrlKey)&&(j.preventDefault(),ar())},rows:1,disabled:e&&!p,autoComplete:"off",autoCorrect:p?"off":void 0,autoCapitalize:p?"none":void 0,spellCheck:p?!1:void 0}),d.jsx("div",{className:"composer-overlay","aria-hidden":"true",ref:st,children:Ir}),p?d.jsxs("div",{className:"composer-hint","aria-hidden":"true",children:[d.jsx("span",{className:"composer-hint-lead",children:"Keys go to the shell…"}),d.jsxs("span",{className:"composer-hint-keys",children:[d.jsx(rs,{children:"Tab"})," completes",d.jsx("span",{className:"composer-hint-dot",children:"·"}),d.jsx(rs,{children:"↑"})," history"]})]}):e?null:d.jsxs("div",{className:"composer-hint","aria-hidden":"true",children:[d.jsx("span",{className:"composer-hint-lead",children:"Reply…"}),d.jsxs("span",{className:"composer-hint-keys",children:[d.jsx(rs,{children:"⌘/Ctrl+↵"})," optimise",d.jsx("span",{className:"composer-hint-dot",children:"·"}),d.jsx(rs,{children:"⌘/Ctrl+⇧+↵"})," send raw",d.jsx("span",{className:"composer-hint-dot",children:"·"}),d.jsx(rs,{children:"↵"})," newline"]})]})]}),Z?null:d.jsx("div",{className:"composer-attachments",children:d.jsx(El.Attachments,{children:({attachment:j})=>d.jsx(f5,{attachment:j})})}),d.jsxs("div",{className:"composer-toolbar",children:[!p&&!Z?d.jsxs(d.Fragment,{children:[d.jsx(El.AddAttachment,{className:"composer-attach","aria-label":"Attach a file",title:"Attach a file",multiple:!0,disabled:e,children:d.jsx(p5,{})}),d.jsx("button",{type:"button",className:"composer-mic","aria-label":"Voice input",title:"Voice input",disabled:e,"data-hotkey":"⌘S",onClick:Pn,children:d.jsx(cC,{})})]}):null,Z?null:d.jsx("button",{type:"button",className:"composer-skills-btn composer-term-toggle","aria-label":"Terminal mode",title:"Terminal mode — run shell commands","aria-pressed":p,"data-on":p?"true":void 0,onClick:()=>{p?(g(!1),s?.(!1)):v()},children:d.jsx(m5,{})}),d.jsx("span",{className:"composer-toolbar-spacer"}),!p&&!Z?d.jsx("button",{type:"button",className:"composer-enhance composer-bypass","aria-label":"Send without optimising",title:"Send raw — skip the optimiser (⌘/Ctrl+⇧+↵)",disabled:e||k||u,onClick:()=>{a.send(),P()},children:d.jsx(kx,{})}):null,!p&&!Z?d.jsxs("label",{className:`composer-subagent-toggle${n?" composer-subagent-toggle--on":""}`,"aria-label":"Dispatch task in sub-agent","data-hotkey":"⌘D",title:n?"Sub-agent on — click to disable (⌘D)":"Sub-agent off — click to enable (⌘D)",children:[d.jsx("input",{type:"checkbox",className:"composer-subagent-checkbox",checked:!!n,disabled:e,onChange:j=>r?.(j.target.checked),"aria-label":"Dispatch task in sub-agent"}),d.jsx("span",{className:"composer-subagent-label",children:"Dispatch task in sub-agent"})]}):null,p&&!Z?d.jsx("button",{type:"button",className:"composer-send","data-terminal":"true","aria-label":"Send Enter",title:"Enter",onMouseDown:j=>j.preventDefault(),onClick:()=>l.key("Enter"),children:d.jsx(kx,{})}):Z?null:d.jsxs(d.Fragment,{children:[i?d.jsx("button",{type:"button",className:"composer-send","data-stop":"true","aria-label":"Stop (Esc)",title:"Stop the agent (Esc)",onClick:()=>o?.(),children:d.jsx(jD,{size:14})}):null,!i||!u?d.jsx("button",{type:"button",ref:E,className:"composer-send","data-queue":i?"true":void 0,"aria-label":"Optimise and send",title:"Optimise & send (⌘/Ctrl+↵)",disabled:e||k||u,"data-hotkey":"⌘↵",onClick:()=>void ar(),children:k?d.jsx("span",{className:"composer-enhance-spinner","aria-hidden":"true"}):d.jsx(g5,{})}):null]})]})]}),T?d.jsx(B$,{original:T.original,result:T,onSend:j=>{R(S,{review:null}),a.setText(j),requestAnimationFrame(()=>{e||a.send(),P()})},onAccept:j=>{a.setText(j),R(S,{review:null}),P()},onClose:()=>{R(S,{review:null}),P()}}):null,f?d.jsx($$,{onPick:yi,onClose:()=>h(!1),sessionId:t}):null]})}function h5({active:e,bodyRef:t,onCommit:n,onClose:r,stopRef:s,phase2DoneRef:i}){const{status:o,errorMsg:a,canvasRef:l,pauseResume:u,stop:c,cancel:f}=H$({active:e,onCommit:n,onClose:r});m.useEffect(()=>(s.current=c,()=>{s.current=null}),[c,s]);const h=m.useRef(null),p=o==="recording"||o==="paused";m.useLayoutEffect(()=>{const y=h.current;y&&!Xt()&&le.set(y,{opacity:0,y:12})},[]),m.useLayoutEffect(()=>{if(!p)return;const y=h.current;if(y&&i.current){if(Xt()){le.set(y,{opacity:1,y:0});return}le.fromTo(y,{opacity:0,y:8},{opacity:1,y:0,duration:.2,ease:Dr.enterEase})}},[p,i]);const g=o==="error"?"Microphone unavailable":o==="transcribing"?"Transcribing…":o==="paused"?"Paused":o==="starting"?"Starting…":"Listening…";return d.jsxs("div",{ref:t,className:"voice-inline-body","aria-live":"polite",children:[d.jsxs("div",{className:"voice-status",children:[d.jsx("span",{className:"voice-dot","data-on":o==="recording"?"true":void 0}),g]}),d.jsx("canvas",{ref:l,className:"voice-wave voice-wave-inline",height:64,"data-paused":o!=="recording"?"true":void 0}),o==="error"?d.jsx("div",{className:"voice-error",children:a||"Could not start recording."}):o!=="transcribing"?d.jsx("div",{className:"voice-hint",children:"Speak, then Stop & Transcribe (or ⌘/Ctrl+↵) to insert."}):null,d.jsxs("div",{className:"composer-toolbar voice-toolbar",children:[d.jsx("button",{type:"button",className:"btn-secondary voice-btn-cancel",onClick:f,disabled:o==="transcribing","aria-label":"Cancel voice recording",children:"Cancel"}),d.jsx("span",{className:"composer-toolbar-spacer"}),p?d.jsx("button",{ref:h,type:"button",className:"btn-secondary voice-btn-pause",onClick:u,"aria-label":o==="recording"?"Pause recording":"Resume recording",children:o==="recording"?"Pause":"Resume"}):null,d.jsx("button",{type:"button",className:"composer-send voice-btn-stop",onClick:c,disabled:o==="error"||o==="transcribing"||o==="starting","aria-label":"Stop recording and transcribe",title:"Stop & Transcribe (⌘/Ctrl+↵)",children:o==="transcribing"?d.jsx("span",{className:"composer-enhance-spinner","aria-hidden":"true"}):d.jsx(cC,{})})]})]})}function p5(){return d.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:d.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function kx(){return d.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:d.jsx("path",{d:"M12 19V5M6 11l6-6 6 6",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function m5(){return d.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:d.jsx("path",{d:"M5 8l4 4-4 4M12 16h7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function cC(){return d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[d.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3",fill:"currentColor"}),d.jsx("path",{d:"M6 11a6 6 0 0 0 12 0M12 17v3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function g5(){return d.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[d.jsx("path",{d:"M12 2 L13.5 9.5 L21 11 L13.5 12.5 L12 20 L10.5 12.5 L3 11 L10.5 9.5 Z",fill:"currentColor",opacity:"0.9"}),d.jsx("path",{d:"M19 2 L19.8 4.2 L22 5 L19.8 5.8 L19 8 L18.2 5.8 L16 5 L18.2 4.2 Z",fill:"currentColor",opacity:"0.6"})]})}const Cx=120;function y5(e){const t=e?.messages??[];for(let r=t.length-1;r>=0;r--){const s=(t[r]?.blocks??[]).filter(i=>i.kind==="text"||i.kind==="thinking").map(i=>i.text).join(" ").replace(/\s+/g," ").trim();if(s)return Ex(s)}const n=(e?.description??"").replace(/\s+/g," ").trim();return n?Ex(n):""}function Ex(e){return e.length>Cx?e.slice(0,Cx-1)+"…":e}function dC({subagents:e,onOpenAgent:t,viewingAgentId:n}){const r=e.filter(a=>a.status==="running");if(r.length===0)return null;const i=(n?r.find(a=>a.agentId===n)??null:null)??r[0],o=y5(i);return d.jsxs("div",{className:"subagent-strip",role:"list","aria-label":`${r.length} sub-agent${r.length===1?"":"s"} running`,children:[d.jsx("div",{className:"subagent-pills",children:r.map(a=>d.jsxs("button",{type:"button",role:"listitem",className:"subagent-pill","data-active":a.agentId===n?"true":void 0,onClick:()=>t(a.agentId),title:`View ${a.agentType||"sub-agent"}'s transcript`,children:[d.jsx("span",{className:"sa-dot","data-status":"running","aria-hidden":"true"}),d.jsx("span",{className:"subagent-pill-name",children:a.agentType||"sub-agent"})]},a.agentId))}),o?d.jsx("p",{className:"subagent-strip-caption","aria-live":"polite",children:o}):null]})}const v5={UserMessage:tl,AssistantMessage:kr,SystemMessage:kr};function Dm({messages:e}){const t=m.useMemo(()=>OS(e),[e]),n=Ya({messages:t,isDisabled:!0,convertMessage:r=>r,onNew:async()=>{}});return d.jsx(Qa,{runtime:n,children:d.jsx(bt.Root,{className:"sa-thread-root",children:d.jsxs(bt.Viewport,{className:"sa-thread-viewport",autoScroll:!0,children:[d.jsx(bt.Empty,{children:d.jsx("div",{className:"thread-empty",children:"no output yet…"})}),d.jsx(bt.Messages,{components:v5})]})})})}const x5={UserMessage:tl,AssistantMessage:kr,SystemMessage:kr},w5=[{label:"Plan with /plan-hard",insert:"/plan-hard "},{label:"Browse skills (/)",insert:"/"},{label:"Mention an agent (@)",insert:"@"},{label:"Dictate (⌘S)"},{label:"Run a shell command (>_)"}],_5=8e3;function b5({loading:e}){const[t,n]=m.useState(!0);return m.useEffect(()=>{if(!e){n(!0);return}const r=setTimeout(()=>n(!1),_5);return()=>clearTimeout(r)},[e]),!e||!t?null:d.jsx("div",{className:"thread-loading","aria-label":"Loading transcript","aria-live":"polite",children:d.jsx("span",{className:"thread-loading-spinner","aria-hidden":"true"})})}function S5(){const e=P0(),t=n=>{if(!n.insert)return;e.setText(n.insert),document.querySelector(".composer .composer-input")?.focus()};return d.jsx("div",{className:"thread-welcome-chips",role:"list",children:w5.map(n=>d.jsx("button",{type:"button",role:"listitem",className:"thread-welcome-chip","data-clickable":n.insert?"true":void 0,onClick:()=>t(n),children:n.label},n.label))})}function k5({hasSelection:e,loading:t=!1,sessionId:n,hiddenCount:r,onLoadEarlier:s,subAgentMode:i,onSubAgentModeChange:o,onTerminalModeChange:a,subagents:l,onOpenAgent:u,viewingAgent:c=null,onCloseAgent:f,working:h,onStop:p}){return d.jsxs(bt.Root,{className:"thread-root",children:[d.jsx("div",{className:"thread-fade","aria-hidden":"true"}),c?d.jsxs("div",{className:"agent-inline-view",children:[d.jsxs("div",{className:"agent-inline-head",children:[d.jsx("button",{type:"button",className:"agent-inline-back","aria-label":"Back to session",onClick:f,children:"‹ back"}),d.jsxs("span",{className:"agent-inline-title",children:[d.jsx("span",{className:"sa-dot","data-status":c.status,"aria-hidden":"true"}),d.jsx("span",{className:"agent-inline-name",children:c.agentType||"sub-agent"}),d.jsx("span",{className:"agent-inline-status",children:c.status==="running"?"· running":"· done"})]})]}),d.jsx(Dm,{messages:c.messages})]}):d.jsxs(d.Fragment,{children:[d.jsxs(bt.Viewport,{className:"thread-viewport",children:[e?d.jsx(bt.Empty,{children:t?d.jsx(b5,{loading:t}):d.jsxs("div",{className:"thread-welcome",children:[d.jsx("h1",{className:"thread-welcome-heading",children:"What are we shipping today?"}),d.jsx("p",{className:"thread-welcome-subtitle",children:"Talk to Claude — type a prompt, or use a skill / agent."}),d.jsx(S5,{})]})}):d.jsx("div",{className:"thread-empty",children:"select a session"}),e&&r>0?d.jsxs("button",{type:"button",className:"load-earlier",onClick:s,children:["Load earlier messages (",r," hidden)"]}):null,d.jsx(bt.Messages,{components:x5})]}),d.jsx("button",{type:"button",className:"scroll-to-bottom","aria-label":"Scroll to latest",title:"Scroll to latest (⌘.)","data-hotkey":"⌘.","data-hotkey-dir":"up",onClick:()=>{const g=document.querySelector(".thread-viewport");g&&g.scrollTo({top:g.scrollHeight,behavior:"smooth"})},children:d.jsx(RD,{size:18})})]}),d.jsx(dC,{subagents:l,onOpenAgent:u,viewingAgentId:c?.agentId??null}),d.jsx(uC,{disabled:!e,sessionId:n,subAgentMode:i,onSubAgentModeChange:o,onTerminalModeChange:a,working:h,onStop:p})]})}const C5=256*1024,Oo=40,Tx=90,E5=25,T5=15,I5=95;function R5(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const P5={UserMessage:tl,AssistantMessage:kr,SystemMessage:kr};function j5({markdown:e}){const t=m.useMemo(()=>[{role:"assistant",id:"skill-legend-body",content:[{type:"text",text:e}],metadata:{custom:{cockpitRole:"assistant"}}}],[e]),n=Ya({messages:t,isDisabled:!0,convertMessage:r=>r,onNew:async()=>{}});return d.jsx(Qa,{runtime:n,children:d.jsx(bt.Root,{className:"skill-body-thread",children:d.jsx(bt.Viewport,{className:"skill-body-viewport",children:d.jsx(bt.Messages,{components:P5})})})})}function A5({val:e}){const t=e.split(/,\s*/).map(n=>n.trim()).filter(Boolean);return t.length<=1?d.jsx("span",{className:"skill-fm-val",children:e}):d.jsx("span",{className:"skill-fm-val skill-fm-chips",children:t.map(n=>d.jsx("span",{className:"skill-fm-chip",children:n},n))})}function N5({artifact:e}){const t=e.skillFrontMatter??{},n=Object.entries(t);return d.jsxs("div",{className:"skill-legend",children:[e.skillSource?d.jsx("div",{className:"skill-legend-source-row",children:d.jsx("span",{className:"skill-legend-source-badge","data-source":e.skillSource,title:e.skillSource==="project"?"Project-local skill":e.skillSource==="plugin"?"Plugin skill":"User skill",children:e.skillSource})}):null,n.length>0&&d.jsx("dl",{className:"skill-fm",children:n.map(([r,s])=>d.jsxs("div",{className:"skill-fm-row",children:[d.jsx("dt",{className:"skill-fm-key",children:r}),d.jsx(A5,{val:s})]},r))}),e.content.length>0?d.jsx("div",{className:"skill-body-wrap",children:d.jsx(j5,{markdown:e.content})}):null]})}function Ix({language:e,content:t,artifactId:n}){const[r,s]=m.useState(null),i=t.length>C5,o=Am(e),a=!i&&o!==null;return m.useEffect(()=>{if(!a){s(null);return}let l=!0;return s(null),J1(e,t).then(u=>{l&&s(u)}).catch(()=>{l&&s(null)}),()=>{l=!1}},[n,t,a,e]),i?d.jsxs("div",{className:"artifact-body-wrap",children:[d.jsx("p",{className:"artifact-large-note",children:"(large file — shown as plain text)"}),d.jsx("pre",{className:"artifact-pre",children:d.jsx("code",{children:t})})]}):a&&r!==null?d.jsx("div",{className:"artifact-body-wrap",children:d.jsx("pre",{className:"artifact-pre",children:d.jsx("code",{className:"hljs",dangerouslySetInnerHTML:{__html:r}})})}):d.jsx("div",{className:"artifact-body-wrap",children:d.jsx("pre",{className:"artifact-pre",children:d.jsx("code",{className:a?"hljs":void 0,dangerouslySetInnerHTML:{__html:R5(t)}})})})}function M5(){const{artifacts:e,activeId:t,setActive:n,close:r}=Nm(),s=Mm(),i=m.useRef(null),o=m.useRef(null),a=m.useId(),[l,u]=m.useState(Oo),c=m.useRef(null),[f,h]=m.useState(!1),p=e.find(S=>S.id===t)??null,g=p!==null;m.useEffect(()=>{g&&u(Oo)},[g]);const y=m.useRef(!1);m.useEffect(()=>{const S=y.current;if(y.current=g,!S&&g&&requestAnimationFrame(()=>{const k=o.current?.querySelector('[role="tab"][aria-selected="true"]');k?k.focus():i.current?.focus()}),S&&!g){const k=document.querySelector(".thread-root");k&&(k.hasAttribute("tabindex")||k.setAttribute("tabindex","-1"),k.focus())}},[g]);const _=m.useCallback(S=>{S.key==="Escape"&&t&&(S.preventDefault(),r(t))},[t,r]),x=m.useCallback(S=>{if(S.key!=="ArrowLeft"&&S.key!=="ArrowRight")return;const k=Array.from(o.current?.querySelectorAll('[role="tab"]')??[]),T=document.activeElement,R=k.indexOf(T);if(R<0)return;const P=S.key==="ArrowRight"?k[(R+1)%k.length]:k[(R-1+k.length)%k.length];P?.focus();const E=P?.dataset.artifactId;E&&n(E)},[n]),v=m.useCallback(S=>{c.current={startY:S.clientY,startH:l},S.currentTarget.setPointerCapture(S.pointerId),h(!0)},[l]),w=m.useCallback(S=>{if(!c.current)return;const{startY:k,startH:T}=c.current,R=(k-S.clientY)/window.innerHeight*100,P=Math.min(I5,Math.max(T5,T+R));u(P)},[]),C=m.useCallback(S=>{c.current&&(S.currentTarget.releasePointerCapture(S.pointerId),c.current=null,h(!1),u(k=>{if(k<E5)return t&&r(t),Oo;const T=Math.abs(k-Oo),R=Math.abs(k-Tx);return T<=R?Oo:Tx}))},[t,r]);return g?s?d.jsxs("div",{className:"artifact-panel","data-mode":"sheet",style:{height:`${l}dvh`},"data-dragging":f?"true":"false",role:"region","aria-label":"Artifact panel",ref:i,tabIndex:-1,onKeyDown:_,children:[d.jsx("div",{className:"artifact-drag-handle",role:"separator","aria-label":"Resize panel",onPointerDown:v,onPointerMove:w,onPointerUp:C,children:d.jsx("div",{className:"artifact-drag-pip","aria-hidden":"true"})}),d.jsxs("div",{className:"artifact-panel-head",children:[d.jsx("div",{role:"tablist","aria-label":"Open artifacts",ref:o,className:"artifact-tablist",onKeyDown:x,children:e.map(S=>{const k=S.id===t,T=`artifact-tab-${S.id}`;return d.jsxs("div",{role:"presentation",className:"artifact-tab-wrap",children:[d.jsx("button",{role:"tab",id:T,className:"artifact-tab","aria-selected":k,tabIndex:k?0:-1,"data-artifact-id":S.id,onClick:()=>n(S.id),children:S.title}),d.jsx("button",{className:"artifact-tab-close","aria-label":`Close ${S.title}`,tabIndex:-1,onClick:R=>{R.stopPropagation(),r(S.id)},children:"✕"})]},S.id)})}),d.jsx("button",{className:"artifact-close-all","aria-label":"Close artifact panel",onClick:()=>t&&r(t),children:"×"})]}),p&&d.jsx("div",{role:"tabpanel",id:`${a}-body`,"aria-labelledby":`artifact-tab-${p.id}`,className:"artifact-panel-body",children:d.jsx(Ix,{language:p.language,content:p.content,artifactId:p.id})})]}):d.jsxs("div",{className:"artifact-panel",role:"region","aria-label":"Artifact panel",ref:i,tabIndex:-1,onKeyDown:_,children:[d.jsxs("div",{className:"artifact-panel-head",children:[d.jsx("div",{role:"tablist","aria-label":"Open artifacts",ref:o,className:"artifact-tablist",onKeyDown:x,children:e.map(S=>{const k=S.id===t,T=`artifact-tab-${S.id}`;return d.jsxs("div",{role:"presentation",className:"artifact-tab-wrap",children:[d.jsx("button",{role:"tab",id:T,className:"artifact-tab","aria-selected":k,tabIndex:k?0:-1,"data-artifact-id":S.id,onClick:()=>n(S.id),children:S.title}),d.jsx("button",{className:"artifact-tab-close","aria-label":`Close ${S.title}`,tabIndex:-1,onClick:R=>{R.stopPropagation(),r(S.id)},children:"✕"})]},S.id)})}),d.jsx("button",{className:"artifact-close-all","aria-label":"Close artifact panel",onClick:()=>t&&r(t),children:"×"})]}),p&&d.jsx("div",{role:"tabpanel",id:`${a}-body`,"aria-labelledby":`artifact-tab-${p.id}`,className:"artifact-panel-body",children:p.kind==="skill"?d.jsx(N5,{artifact:p}):d.jsx(Ix,{language:p.language,content:p.content,artifactId:p.id})})]}):null}const Rx=200,D5=2e3;function L5({sessionId:e,capture:t,requestCapture:n,clearCapture:r}){const s=m.useRef(null),i=m.useRef(!0);m.useEffect(()=>{n(Rx);const a=setInterval(()=>n(Rx),D5);return()=>{clearInterval(a),r()}},[e,n,r]),m.useLayoutEffect(()=>{const a=s.current;a&&i.current&&(a.scrollTop=a.scrollHeight)},[t]);const o=()=>{const a=s.current;a&&(i.current=a.scrollHeight-a.scrollTop-a.clientHeight<24)};return d.jsxs("div",{className:"live-pane",children:[d.jsx("div",{className:"live-pane-head",children:"live pane (no transcript)"}),d.jsx("pre",{className:"live-pane-body",ref:s,onScroll:o,children:t??"capturing live pane…"})]})}function O5(e){const[t,n]=m.useState(""),[r,s]=m.useState({ctrl:!1,alt:!1}),i=m.useRef(""),o=m.useRef(r);o.current=r;const a=m.useRef(e);a.current=e;const l=m.useCallback(h=>{s(p=>({...p,[h]:!p[h]}))},[]),u=m.useCallback(h=>{const p=i.current;if(h===p)return;const{removed:g,added:y}=oC(p,h),_=o.current,x=a.current;if((_.ctrl||_.alt)&&g===0&&y.length===1&&Ua(y)){const w=Xu(_,y);w&&x.sendKey(w),s({ctrl:!1,alt:!1}),n(p);return}const v=y.indexOf(`
|
|
102
|
+
`);if(v!==-1){for(let w=0;w<g;w+=1)x.sendKey("BSpace");y.slice(0,v)&&x.sendText(y.slice(0,v)),x.sendKey("Enter"),i.current="",n("");return}for(let w=0;w<g;w+=1)x.sendKey("BSpace");y&&x.sendText(y),i.current=h,n(h)},[]),c=m.useCallback(h=>u(h.target.value),[u]),f=m.useCallback(h=>{if(h.metaKey)return;const p=o.current,g=a.current,y=h.ctrlKey||p.ctrl,_=h.altKey||p.alt;if((y||_)&&h.key.length===1&&Ua(h.key)){h.preventDefault();const w=Xu({ctrl:y,alt:_},h.key);w&&g.sendKey(w),(p.ctrl||p.alt)&&s({ctrl:!1,alt:!1});return}const x=lC(h.key,{ctrl:h.ctrlKey,alt:h.altKey,shift:h.shiftKey});if(x){h.preventDefault(),g.sendKey(x);return}if(h.key==="Backspace"){h.preventDefault(),g.sendKey("BSpace");const w=i.current.slice(0,-1);i.current=w,n(w);return}if(h.key==="Delete"){h.preventDefault(),g.sendKey("DC");return}const v=aC(h.key,h.shiftKey);v&&(h.preventDefault(),g.sendKey(v),v==="Enter"&&(i.current="",n("")))},[]);return m.useMemo(()=>({value:t,onChange:c,onKeyDown:f,sticky:r,toggleMod:l}),[t,c,f,r,l])}function z5({sessionId:e,capture:t,requestCapture:n,clearCapture:r,sendText:s,sendKey:i}){const o=m.useMemo(()=>c=>n(c,!0),[n]),a=m.useMemo(()=>({sendText:c=>void s(c),sendKey:c=>void i(c)}),[s,i]),l=O5(a),u=m.useRef(null);return m.useEffect(()=>{const c=u.current;!c||Xt()||le.fromTo(c,{opacity:0,scale:.97},{opacity:1,scale:1,duration:.24,ease:"power3.out",transformOrigin:"center top"})},[]),d.jsxs("div",{className:"thread-root terminal-pane-root",ref:u,children:[d.jsx("div",{className:"thread-fade","aria-hidden":"true"}),d.jsx(sC,{output:t,requestCapture:o,clearOutput:r,sendKey:i,mods:l.sticky,onToggleMod:l.toggleMod},e),d.jsx("div",{className:"terminal-pane-input",children:d.jsx("textarea",{className:"composer-input","aria-label":"Terminal input",placeholder:"Keys go to the pane…",rows:1,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,value:l.value,onChange:l.onChange,onKeyDown:l.onKeyDown})})]})}function Px(e){return e.questions.map(()=>new Set)}function F5(e){return e.options.some(t=>typeof t.preview=="string"&&t.preview.length>0)}function B5({pending:e,capture:t,onAnswer:n,onCapture:r,onClose:s}){const{rootRef:i,requestClose:o}=mi(s),[a,l]=m.useState(()=>Px(e)),[u,c]=m.useState(()=>e.questions.map(()=>0)),f=m.useRef(null),h=m.useRef(null);m.useEffect(()=>{l(Px(e)),c(e.questions.map(()=>0))},[e]),m.useEffect(()=>(h.current=document.activeElement,(f.current?.querySelector('button:not([disabled]), [tabindex="0"]')??f.current)?.focus(),()=>{h.current?.focus?.()}),[]);const p=m.useMemo(()=>a.length>0&&a.every(v=>v.size>0),[a]),g=(v,w,C)=>{l(S=>{const k=S.map(R=>new Set(R)),T=k[v];return C?T.has(w)?T.delete(w):T.add(w):k[v]=new Set([w]),k})},y=(v,w,C)=>{c(S=>{const k=[...S];return k[v]=Math.max(0,Math.min(C-1,(S[v]??0)+w)),k})},_=v=>{if(v.key==="Escape"){v.preventDefault(),o();return}if(v.key!=="Tab")return;const w=f.current?.querySelectorAll('button:not([disabled]), [tabindex="0"]');if(!w||w.length===0)return;const C=w[0],S=w[w.length-1];v.shiftKey&&document.activeElement===C?(v.preventDefault(),S.focus()):!v.shiftKey&&document.activeElement===S&&(v.preventDefault(),C.focus())},x=()=>{p&&n(e.toolUseId,a.map(v=>[...v]))};return d.jsx("div",{className:"modal-backdrop",ref:i,onClick:v=>{v.target===v.currentTarget&&o()},children:d.jsxs("div",{ref:f,className:"modal",role:"dialog","aria-modal":"true","aria-label":"Question from Claude",tabIndex:-1,onKeyDown:_,children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",children:"Claude is asking"}),d.jsx("button",{type:"button",className:"modal-close","aria-label":"Close",onClick:o,children:"✕"})]}),d.jsxs("div",{className:"modal-body",children:[e.questions.map((v,w)=>{const C=F5(v),S=u[w]??0,k=v.options[S];return d.jsxs("div",{className:"question",children:[v.header?d.jsx("div",{className:"q-header",children:v.header}):null,d.jsx("div",{className:"q-text",children:v.question}),v.multiSelect?d.jsx("div",{className:"q-hint",children:"select one or more"}):null,C?d.jsxs("div",{className:"ask-split",children:[d.jsx("div",{className:"ask-split-list",role:"listbox","aria-multiselectable":!!v.multiSelect,"aria-label":v.question,children:v.options.map((T,R)=>{const P=a[w]?.has(T.label),E=R===S;return d.jsxs("div",{className:"ask-split-row","data-focused":E?"true":"false","data-selected":P?"true":"false",role:"option","aria-selected":P,tabIndex:E?0:-1,onMouseEnter:()=>c(M=>{const D=[...M];return D[w]=R,D}),onClick:()=>{c(M=>{const D=[...M];return D[w]=R,D}),g(w,T.label,!!v.multiSelect)},onKeyDown:M=>{M.key==="ArrowDown"?(M.preventDefault(),y(w,1,v.options.length)):M.key==="ArrowUp"?(M.preventDefault(),y(w,-1,v.options.length)):(M.key===" "||M.key==="Enter")&&(M.preventDefault(),g(w,T.label,!!v.multiSelect))},children:[d.jsx("span",{className:"ask-split-indicator",children:v.multiSelect?d.jsx("span",{className:"ask-check","aria-hidden":"true",children:P?"▣":"▢"}):d.jsx("span",{className:"ask-radio","aria-hidden":"true",children:P?"◉":"○"})}),d.jsxs("span",{className:"ask-split-text",children:[d.jsx("span",{className:"option-label",children:T.label}),T.description?d.jsx("span",{className:"option-desc",children:T.description}):null]})]},T.label)})}),d.jsx("div",{className:"ask-preview","aria-live":"polite","aria-label":"Option preview",children:k?.preview?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"ask-preview-label",children:k.label}),d.jsx("pre",{className:"ask-preview-content",children:k.preview})]}):d.jsx("div",{className:"ask-preview-empty",children:"no preview"})})]}):d.jsx("div",{className:"q-options",children:v.options.map(T=>{const R=a[w]?.has(T.label);return d.jsxs("button",{type:"button",className:"option-btn","data-on":R?"true":"false","aria-pressed":R,onClick:()=>g(w,T.label,!!v.multiSelect),children:[d.jsx("span",{className:"option-label",children:T.label}),T.description?d.jsx("span",{className:"option-desc",children:T.description}):null]},T.label)})})]},w)}),t!=null?d.jsx("pre",{className:"capture-output",children:t}):null]}),d.jsxs("div",{className:"modal-foot",children:[d.jsx("button",{type:"button",className:"btn-secondary",onClick:r,children:"Show Terminal"}),d.jsx("span",{className:"modal-foot-spacer"}),d.jsx("button",{type:"button",className:"btn-secondary",onClick:o,children:"Cancel"}),d.jsx("button",{type:"button",className:"btn-primary",disabled:!p,onClick:x,children:"Send Answer"})]})]})})}function $5({toast:e}){const[t,n]=m.useState(!1);return m.useEffect(()=>{if(!e)return;n(!0);const r=setTimeout(()=>n(!1),2200);return()=>clearTimeout(r)},[e]),e?d.jsx("div",{className:`toast ${t?"show":""} ${e.kind?`toast-${e.kind}`:""}`,role:"status","aria-live":"polite",children:e.text}):null}const jx="claude-control-update-dismissed";function U5(e){if(e.latest&&e.latest!==e.current)return`Update available — v${e.latest} (you’re on v${e.current}).`;const t=e.behind||1;return`Update available — ${t} new commit${t===1?"":"s"} (v${e.current}).`}function V5(){const[e,t]=m.useState(null),[n,r]=m.useState(!1);return m.useEffect(()=>{let s=!0;return AS().then(i=>{if(!s||!i?.updateAvailable)return;const o=i.latest??`behind-${i.behind??0}`;localStorage.getItem(jx)!==o&&t({current:i.current,latest:i.latest,behind:i.behind??0})}),()=>{s=!1}},[]),e?n?d.jsx("div",{className:"update-banner",role:"status",children:d.jsx("span",{children:"Updating… the page will reconnect shortly."})}):d.jsxs("div",{className:"update-banner",role:"status",children:[d.jsx("span",{children:U5(e)}),d.jsxs("span",{className:"update-actions",children:[d.jsx("button",{type:"button",className:"update-now",onClick:()=>{r(!0),yM()},children:"Update now"}),d.jsx("button",{type:"button",className:"update-dismiss","aria-label":"Dismiss update notice",onClick:()=>{localStorage.setItem(jx,e.latest??`behind-${e.behind}`),t(null)},children:"×"})]})]}):null}function H5({onClose:e,onToast:t}){const{rootRef:n,requestClose:r}=mi(e),[s,i]=m.useState(""),[o,a]=m.useState(""),[l,u]=m.useState(""),[c,f]=m.useState(""),[h,p]=m.useState("mlx"),[g,y]=m.useState(""),[_,x]=m.useState(0),[v,w]=m.useState(0),[C,S]=m.useState(null),[k,T]=m.useState(!0),[R,P]=m.useState(!1),[E,M]=m.useState(null),[D,$]=m.useState(()=>Date.now()),[U,V]=m.useState(!1),J=m.useRef(null);m.useEffect(()=>{let b=!0;return AS().then(H=>b&&H&&M(H)).catch(()=>{}),SM().then(H=>b&&S(H)).catch(()=>{}),()=>{b=!1}},[]),m.useEffect(()=>{let b=!0;return NS().then(H=>{b&&(i(H.launchCommand),a(H.defaultCwd),u(H.optimizeModel??""),f(H.claudeBin??""),p(H.optimizeBackend??"mlx"),y(H.mlxModel??""),x(H.transcriptFontSize??0),w(H.externalFontSize??0))}).catch(H=>t(`Load config failed: ${H.message}`,"error")).finally(()=>{b&&T(!1)}),()=>{b=!1}},[t]),m.useEffect(()=>{const b=H=>{H.key==="Escape"&&r()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[r]);const te=async b=>{const H=b.target.files?.[0];if(b.target.value="",!!H){if(H.type!=="image/png"){t("Icon must be a PNG image","error");return}V(!0);try{await _M(H),$(Date.now()),t("App icon updated — re-add to Home Screen to see it","ok")}catch(X){t(`Icon upload failed: ${X.message}`,"error")}finally{V(!1)}}},B=async()=>{V(!0);try{await bM(),$(Date.now()),t("App icon reset to default","ok")}catch(b){t(`Icon reset failed: ${b.message}`,"error")}finally{V(!1)}},z=async()=>{P(!0);try{const b=await EM({launchCommand:s,defaultCwd:o,optimizeModel:l,claudeBin:c,optimizeBackend:h,mlxModel:g,transcriptFontSize:_,externalFontSize:v});i(b.launchCommand),a(b.defaultCwd),u(b.optimizeModel??""),f(b.claudeBin??""),p(b.optimizeBackend??"mlx"),y(b.mlxModel??""),x(b.transcriptFontSize??0),w(b.externalFontSize??0);const H=C?.mlxModels.find(X=>X.id===b.mlxModel);b.optimizeBackend==="mlx"&&H&&H.installed===!1?t(`Downloading ${H.label} (${H.sizeGB} GB)… enhancer uses claude until ready`,"ok"):t("Config saved","ok"),r()}catch(b){t(`Save failed: ${b.message}`,"error")}finally{P(!1)}};return d.jsx("div",{className:"config-overlay",ref:n,role:"presentation",onClick:b=>{b.target===b.currentTarget&&r()},children:d.jsxs("div",{className:"config-modal",role:"dialog","aria-modal":"true","aria-label":"Settings",children:[d.jsxs("div",{className:"config-head",children:[d.jsx("span",{className:"config-title",children:"Settings"}),d.jsx("button",{type:"button",className:"config-close","aria-label":"Close settings",onClick:r,children:"×"})]}),d.jsxs("div",{className:"config-body",children:[d.jsxs("label",{className:"config-field",children:[d.jsx("span",{className:"config-label",children:"Launch command"}),d.jsx("input",{className:"config-input",type:"text",placeholder:"claude",value:s,disabled:k,onChange:b=>i(b.target.value),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),d.jsx("span",{className:"config-hint",children:"Run in each new session's pane."})]}),d.jsxs("label",{className:"config-field",children:[d.jsx("span",{className:"config-label",children:"Default cwd"}),d.jsx("input",{className:"config-input",type:"text",value:o,disabled:k,onChange:b=>a(b.target.value),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),d.jsx("span",{className:"config-hint",children:"Existing dir new sessions start in."})]}),d.jsxs("label",{className:"config-field",children:[d.jsx("span",{className:"config-label",children:"Enhancer backend"}),d.jsxs("select",{className:"config-input",value:h,disabled:k,onChange:b=>p(b.target.value),children:[d.jsx("option",{value:"mlx",children:"Local MLX (→ rules)"}),d.jsx("option",{value:"rules",children:"Rules only (offline)"})]}),d.jsxs("span",{className:"config-hint",children:["Powers ✨. ",d.jsx("code",{children:"mlx"})," = on-device, no key. (",d.jsx("code",{children:"claude -p"}),"is disabled — it spawned transcripts that corrupted session matching.)"]})]}),d.jsxs("label",{className:"config-field",children:[d.jsx("span",{className:"config-label",children:"Claude model"}),d.jsxs("select",{className:"config-input",value:l,disabled:k,onChange:b=>u(b.target.value),children:[l&&!C?.claudeModels.some(b=>b.id===l)?d.jsxs("option",{value:l,children:[l,C?" (custom)":""]}):null,(C?.claudeModels??[]).map(b=>d.jsxs("option",{value:b.id,children:[b.label,b.id===C?.recommendedClaudeModel?" · recommended":""]},b.id))]}),d.jsxs("span",{className:"config-hint",children:["For the ",d.jsx("code",{children:"claude -p"})," backend/fallback."]})]}),d.jsxs("label",{className:"config-field config-field--wide",children:[d.jsx("span",{className:"config-label",children:"MLX model"}),d.jsxs("select",{className:"config-input",value:g,disabled:k||h!=="mlx",onChange:b=>y(b.target.value),children:[g&&!C?.mlxModels.some(b=>b.id===g)?d.jsxs("option",{value:g,children:[g,C?" (custom)":""]}):null,(C?.mlxModels??[]).map(b=>d.jsxs("option",{value:b.id,children:[b.label," · ",b.sizeGB," GB",b.installed?" · downloaded":" · ⬇ download",b.id===C?.recommendedMlxModel?" · recommended":"",C&&b.minRamGB>C.machine.ramGB?` (needs ≥${b.minRamGB} GB)`:""]},b.id))]}),d.jsx("span",{className:"config-hint",children:C?`Your ${C.machine.appleSilicon?"Apple Silicon ":""}Mac has ${C.machine.ramGB} GB — recommended: ${C.mlxModels.find(b=>b.id===C.recommendedMlxModel)?.label??C.recommendedMlxModel}. Auto-downloads on first use.`:"On-device model for the ✨ enhancer. Auto-downloads on first use."})]}),d.jsxs("label",{className:"config-field",children:[d.jsx("span",{className:"config-label",children:"Transcript font size"}),d.jsxs("select",{className:"config-input",value:_,disabled:k,onChange:b=>x(Number(b.target.value)),children:[d.jsx("option",{value:0,children:"Default (auto)"}),[12,13,14,15,16,17,18].map(b=>d.jsxs("option",{value:b,children:[b,"px"]},b))]}),d.jsx("span",{className:"config-hint",children:"Base transcript size (iPad + desktop). Default uses the built-in CSS token."})]}),d.jsxs("label",{className:"config-field",children:[d.jsx("span",{className:"config-label",children:"External display font size"}),d.jsxs("select",{className:"config-input",value:v,disabled:k,onChange:b=>w(Number(b.target.value)),children:[d.jsx("option",{value:0,children:"Default (auto)"}),[12,13,14,15,16,17,18,19,20,21,22].map(b=>d.jsxs("option",{value:b,children:[b,"px"]},b))]}),d.jsx("span",{className:"config-hint",children:"Applies only when iPad drives an external monitor. Overrides base size on that display."})]}),d.jsxs("label",{className:"config-field config-field--wide",children:[d.jsx("span",{className:"config-label",children:"Claude CLI path (optional)"}),d.jsx("input",{className:"config-input",type:"text",placeholder:"auto-detected",value:c,disabled:k,onChange:b=>f(b.target.value),autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),d.jsxs("span",{className:"config-hint",children:["Path to the ",d.jsx("code",{children:"claude"})," binary. Blank = auto-detect."]})]}),d.jsxs("div",{className:"config-field config-field--wide",children:[d.jsx("span",{className:"config-label",children:"App icon"}),d.jsxs("div",{className:"config-icon-row",children:[d.jsx("img",{className:"config-icon-preview",src:`/api/icon?size=192&t=${D}`,alt:"Current home-screen icon",width:44,height:44}),d.jsxs("div",{className:"config-icon-actions",children:[d.jsx("button",{type:"button",className:"config-cancel",disabled:U,onClick:()=>J.current?.click(),children:U?"Working…":"Upload PNG"}),d.jsx("button",{type:"button",className:"config-cancel",disabled:U,onClick:B,children:"Reset"})]}),d.jsx("input",{ref:J,type:"file",accept:"image/png",hidden:!0,onChange:te})]}),d.jsx("span",{className:"config-hint",children:"Defaults to the Claude Control logo. Re-add to Home Screen after changing."})]})]}),d.jsxs("div",{className:"config-foot",children:[d.jsx("div",{className:"config-version",children:E?d.jsxs(d.Fragment,{children:[d.jsxs("span",{children:["claude-control v",E.current]}),E.updateAvailable&&E.latest?d.jsxs("span",{className:"config-version-update",children:["· update available: v",E.latest]}):null]}):null}),d.jsxs("div",{className:"config-actions",children:[d.jsx("button",{type:"button",className:"config-cancel",onClick:r,disabled:R,children:"Cancel"}),d.jsx("button",{type:"button",className:"config-save",onClick:z,disabled:k||R,children:R?"Saving…":"Save"})]})]})]})})}const Ax={all:"Showing all panes — tap to show only Claude",claude:"Showing Claude sessions — tap to show only Codex",codex:"Showing Codex sessions — tap to show only terminals",terminal:"Showing terminals — tap to show all"};function Nx(e=Date.now()){return`session-${e.toString(36).slice(-6)}`}function W5(e){return e==="claude"?"CC":e==="codex"?"CX":e==="terminal"?">_":null}function q5({onToast:e,filter:t,onCycleFilter:n}){const[r,s]=m.useState(!1),[i,o]=m.useState("claude"),[a,l]=m.useState(""),[u,c]=m.useState(""),[f,h]=m.useState(!1),[p,g]=m.useState(Nx),[y,_]=m.useState([]),x=m.useRef(null);m.useEffect(()=>{r&&(g(Nx()),l(""),c(""),o("claude"),_([]),TM().then(_).catch(()=>{}),setTimeout(()=>x.current?.focus(),0))},[r]);const v=m.useCallback(()=>{s(!1),l(""),c("")},[]),w=m.useCallback(async()=>{if(f)return;h(!0);const T=i==="codex"?void 0:a.trim()||p,R=u.trim()||void 0;e("Creating session…");try{const P=await MS({name:T,cwd:R,agent:i});e(`Session created → ${P.name}`,"ok"),v()}catch(P){e(`New session failed: ${P.message}`,"error")}finally{h(!1)}},[f,i,a,u,p,e,v]);function C(T){return y.find(R=>R.id===T)}if(!r){const T=W5(t);return d.jsxs("div",{className:"rail-head",children:[d.jsx("button",{type:"button",className:"rail-new",onClick:()=>s(!0),children:"+ New session"}),d.jsxs("button",{type:"button",className:"rail-filter","data-filter":t,"aria-label":Ax[t],title:Ax[t],onClick:n,children:[d.jsx(ID,{size:15}),T?d.jsx("span",{className:"rail-filter-tag",children:T}):null]})]})}const S=C("claude"),k=C("codex");return d.jsxs("form",{className:"rail-new-form","aria-label":"Create session",onSubmit:T=>{T.preventDefault(),w()},children:[d.jsx("div",{className:"rail-new-agent-toggle",role:"group","aria-label":"Agent type",children:["claude","codex"].map(T=>{const R=T==="claude"?S:k,P=R&&!R.available;return d.jsxs("button",{type:"button",className:"rail-new-agent-btn","data-active":i===T?"true":"false",disabled:f||!!P,title:P?R?.reason:void 0,"aria-pressed":i===T,onClick:()=>o(T),children:[T==="claude"?"Claude":"Codex",P?d.jsx("span",{className:"rail-new-agent-unavail","aria-hidden":"true",children:" ✕"}):null]},T)})}),i==="claude"?d.jsx("input",{ref:x,className:"rail-new-name",type:"text",value:a,placeholder:p,disabled:f,onChange:T=>l(T.target.value),onKeyDown:T=>{T.key==="Escape"&&(T.preventDefault(),v())},"aria-label":"Session name",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}):null,d.jsx("input",{className:"rail-new-cwd",type:"text",value:u,placeholder:"Working directory (default)",disabled:f,onChange:T=>c(T.target.value),onKeyDown:T=>{T.key==="Escape"&&(T.preventDefault(),v())},"aria-label":"Working directory",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1}),d.jsxs("div",{className:"rail-new-actions",children:[d.jsx("button",{type:"button",className:"rail-new-cancel",onClick:v,disabled:f,children:"Cancel"}),d.jsx("button",{type:"submit",className:"rail-new-create",disabled:f,children:f?"Creating…":"Create"})]})]})}const K5="frame";function G5(e){return e==="Escape"}function Y5({sessionId:e,label:t,visible:n,onClose:r}){const s=mM(e),i=m.useRef(null);m.useEffect(()=>{if(!n)return;const h=p=>{G5(p.key)&&r()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[r,n]);const o=()=>{n&&K5==="frame"&&i.current?.focus()},a=m.useRef(!1);m.useEffect(()=>{if(n)o();else if(a.current){try{i.current?.blur()}catch{}const h=document.querySelector(".detail-body")??document.body;h.setAttribute("tabindex","-1"),h.focus({preventScroll:!0})}a.current=n},[n]);const l=m.useRef(r);l.current=r;const u=m.useRef(h=>{(h.metaKey||h.ctrlKey)&&(h.key==="j"||h.key==="J")&&(h.preventDefault(),h.stopPropagation(),l.current())}),c=()=>{const h=i.current?.contentWindow;if(h)try{h.removeEventListener("keydown",u.current,!0),h.addEventListener("keydown",u.current,!0)}catch{}},f=()=>{o(),c()};return m.useEffect(()=>{c()},[]),d.jsxs("div",{className:"term-overlay","data-visible":n?"true":"false",role:"dialog","aria-modal":n?"true":"false","aria-hidden":n?void 0:"true","aria-label":`Raw terminal — ${t}`,children:[d.jsxs("header",{className:"term-head",children:[d.jsxs("span",{className:"term-title",children:[d.jsx("span",{"aria-hidden":"true",children:"⛶"})," ",t]}),d.jsxs("span",{className:"term-actions",children:[d.jsx("a",{className:"term-newtab",href:s,target:"_blank",rel:"noopener noreferrer",title:"Open in a new tab",children:"↗ New tab"}),d.jsx("button",{type:"button",className:"term-close","aria-label":"Close terminal",onClick:r,children:"✕"})]})]}),d.jsx("iframe",{ref:i,className:"term-frame",src:s,title:`Raw terminal for ${t}`,onLoad:f})]})}function Q5({children:e}){const[t,n]=m.useState("probing"),[r,s]=m.useState(null),[i,o]=m.useState(""),a=m.useCallback(async()=>{try{return(await tt("/api/health")).ok?(n("authed"),s(null),!0):!1}catch{return s("Cannot reach the server. Check the connection and retry."),!1}},[]);m.useEffect(()=>{let u=!1;return(async()=>{const c=await a();u||c||n("needs-token")})(),()=>{u=!0}},[a]),m.useEffect(()=>hM(()=>{n("needs-token"),o(""),s("Session expired — enter your access token again.")}),[]);const l=m.useCallback(async u=>{u.preventDefault();const c=i.trim();if(!c){s("Enter an access token.");return}n("submitting"),s(null),RS(c),await a()||(PS(),n("needs-token"),s("Invalid token."))},[i,a]);return t==="authed"?d.jsx(d.Fragment,{children:e}):t==="probing"?d.jsx("div",{className:"gate-root",role:"status","aria-live":"polite",children:d.jsxs("div",{className:"gate-card gate-card--probing",children:[d.jsx("span",{className:"gate-spinner","aria-hidden":"true"}),d.jsx("span",{className:"gate-probing-text",children:"Connecting…"})]})}):(bc(),d.jsx("div",{className:"gate-root",children:d.jsxs("form",{className:"gate-card",onSubmit:l,"aria-label":"Sign in",children:[d.jsxs("div",{className:"gate-brand",children:[d.jsx("span",{className:"gate-glyph","aria-hidden":"true",children:"◧"}),d.jsx("span",{className:"gate-title",children:"claude control"})]}),d.jsx("label",{className:"gate-label",htmlFor:"gate-token",children:"Access token"}),d.jsx("input",{id:"gate-token",className:"gate-input",type:"password",autoComplete:"current-password",autoFocus:!0,spellCheck:!1,value:i,onChange:u=>{o(u.target.value),r&&s(null)},"aria-invalid":r?!0:void 0,"aria-describedby":r?"gate-error":void 0,placeholder:"••••••••••••"}),r?d.jsx("p",{id:"gate-error",className:"gate-error",role:"alert",children:r}):null,d.jsx("button",{type:"submit",className:"gate-submit",disabled:t==="submitting",children:t==="submitting"?"Connecting…":"Connect"}),d.jsxs("p",{className:"gate-hint",children:["Find your token in ",d.jsx("code",{children:"~/.claude-control/token"})," on the server, or wherever ",d.jsx("code",{children:"CLAUDE_CONTROL_TOKEN"})," is set. It's also printed when the server starts."]})]})}))}const X5={UserMessage:tl,AssistantMessage:kr,SystemMessage:kr};function J5({markdown:e}){const t=m.useMemo(()=>[{role:"assistant",id:"plan",content:[{type:"text",text:e}],metadata:{custom:{cockpitRole:"assistant"}}}],[e]),n=Ya({messages:t,isDisabled:!0,convertMessage:r=>r,onNew:async()=>{}});return d.jsx(Qa,{runtime:n,children:d.jsx(bt.Root,{className:"plan-review",children:d.jsx(bt.Viewport,{className:"plan-review-viewport",children:d.jsx(bt.Messages,{components:X5})})})})}function Z5({prompt:e,onKey:t,onSelect:n,onClose:r,planMarkdown:s,agentName:i="Claude"}){const{rootRef:o,requestClose:a}=mi(r),l=!!e.multiSelect,u=m.useMemo(()=>l?null:e.options.find(M=>M.selected)?.key??e.options[0]?.key??null,[e,l]),[c,f]=m.useState(u),[h,p]=m.useState(null),g=m.useMemo(()=>new Set(e.options.filter(E=>E.checked).map(E=>E.label)),[JSON.stringify(e)]),[y,_]=m.useState(g),[x,v]=m.useState(!1),w=JSON.stringify(e);m.useEffect(()=>{l?(_(g),v(!1)):(f(u),p(null))},[w,u,l]);const C=E=>{h||(p(E),t(E))},S=()=>{c&&C(c)},k=E=>{_(M=>{const D=new Set(M);return D.has(E)?D.delete(E):D.add(E),D})},T=()=>{x||y.size===0||(v(!0),n?.([...y]))};m.useEffect(()=>{const E=M=>{if(l){if(x)return;if(M.key==="Escape"){M.preventDefault(),a();return}if(M.key==="Enter"){M.preventDefault(),T();return}const D=e.options.find($=>$.key===M.key);D&&(M.preventDefault(),k(D.label))}else{if(h)return;if(M.key==="Escape"){M.preventDefault(),a();return}if(M.key==="Enter"){M.preventDefault(),c&&C(c);return}e.options.some(D=>D.key===M.key)&&(M.preventDefault(),f(M.key))}};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[a,h,c,w,l,x,y]);const R=l?x:h!==null,P=!!s;return d.jsx("div",{className:"modal-backdrop",ref:o,onClick:E=>{E.target===E.currentTarget&&!R&&a()},children:d.jsxs("div",{className:P?"modal modal-plan":"modal",role:"dialog","aria-modal":"true","aria-label":P?"Review plan":"Terminal prompt",children:[d.jsxs("div",{className:"modal-head",children:[d.jsx("span",{className:"modal-title",children:P?"Review plan":`${i} needs a choice`}),d.jsx("button",{type:"button",className:"modal-close","aria-label":"Hide",onClick:a,children:"✕"})]}),d.jsxs("div",{className:"modal-body",children:[P?d.jsx(J5,{markdown:s}):null,d.jsxs("div",{className:"question",children:[P?null:d.jsx("div",{className:"q-text",children:e.question}),l?d.jsx("div",{className:"q-hint",children:"select one or more"}):null,l?d.jsx("div",{className:"q-options","aria-label":"Options",children:e.options.map(E=>{const M=y.has(E.label);return d.jsx("button",{type:"button",className:"option-btn","aria-pressed":M,"data-on":M?"true":"false",disabled:R,onClick:()=>k(E.label),children:d.jsxs("span",{className:"option-label",children:[E.key,". ",E.label]})},E.key)})}):d.jsx("div",{className:"q-options",role:"radiogroup","aria-label":"Options",children:e.options.map(E=>d.jsxs("button",{type:"button",className:"option-btn",role:"radio","aria-checked":c===E.key,"data-on":c===E.key?"true":"false","data-sending":h===E.key?"true":void 0,disabled:R,onClick:()=>f(E.key),children:[d.jsxs("span",{className:"option-label",children:[E.key,". ",E.label]}),h===E.key?d.jsxs("span",{className:"option-sending","aria-live":"polite",children:[d.jsx("span",{className:"working-spinner","aria-hidden":"true"})," sending…"]}):null]},E.key))})]})]}),d.jsxs("div",{className:"modal-foot",children:[d.jsxs("button",{type:"button",className:"btn-secondary",disabled:R,onClick:()=>l?a():C("Escape"),children:["Cancel ",d.jsx(rs,{children:"Esc"})]}),d.jsx("span",{className:"modal-foot-spacer"}),R?d.jsx("span",{className:"prompt-status",children:"submitting your answer…"}):null,d.jsxs("button",{type:"button",className:"btn-primary",disabled:R||(l?y.size===0:!c),onClick:l?T:S,children:["Confirm ",d.jsx(rs,{children:"↵"})]})]})]})})}const eU={active:"Active",completed:"Completed",all:"All"};function fC(e){return e.model?e.model:e.def?.model?e.def.model:null}function Lm({agentType:e,model:t}){return d.jsxs("span",{className:"agent-chip",children:[d.jsx("span",{className:"agent-chip-name",children:e||"sub-agent"}),t?d.jsx("span",{className:"agent-chip-model",children:t}):null]})}function tU({def:e,agentType:t}){if(!e)return d.jsx("div",{className:"agent-def",children:d.jsx("span",{className:"agent-def-no-def",children:t||"sub-agent"})});const n=new Set(["name","description","tools","model"]),r=Object.keys(e).filter(s=>!n.has(s));return d.jsxs("div",{className:"agent-def",children:[e.description?d.jsx("div",{className:"agent-def-row agent-def-desc",children:e.description}):null,e.tools?d.jsxs("div",{className:"agent-def-row",children:[d.jsx("span",{className:"agent-def-label",children:"tools"}),d.jsx("span",{className:"agent-def-val agent-def-tools",children:e.tools})]}):null,e.model?d.jsxs("div",{className:"agent-def-row",children:[d.jsx("span",{className:"agent-def-label",children:"model"}),d.jsx("span",{className:"agent-def-val",children:e.model})]}):null,r.map(s=>d.jsxs("div",{className:"agent-def-row",children:[d.jsx("span",{className:"agent-def-label",children:s}),d.jsx("span",{className:"agent-def-val",children:e[s]})]},s))]})}function nU({nested:e}){return!e||e.length===0?null:d.jsxs("div",{className:"agent-nested",children:[d.jsxs("span",{className:"agent-nested-label",children:["nested (",e.length,")"]}),d.jsx("div",{className:"agent-nested-list",children:e.map(t=>d.jsx(Lm,{agentType:t.agentType,model:t.model},t.agentId))})]})}function rU({agent:e}){const t=fC(e);return d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"sa-dot","data-status":e.status,"aria-hidden":"true"}),d.jsx(Lm,{agentType:e.agentType,model:t}),e.description?d.jsx("span",{className:"sa-desc",children:e.description}):null,d.jsx("span",{className:"sa-status",children:e.status==="running"?"· running":"· done"})]})}function sU({subagents:e,open:t,onClose:n,focusAgentId:r}){const[s,i]=m.useState("active"),[o,a]=m.useState(null);m.useEffect(()=>{t&&r&&a(r)},[t,r]);const l=e.filter(p=>p.status==="running").length,u={active:l,completed:e.length-l,all:e.length},c=o?e.find(p=>p.agentId===o)??null:null,f=m.useMemo(()=>e.filter(p=>s==="all"?!0:s==="active"?p.status==="running":p.status==="done"),[e,s]),h=m.useRef(null);if(m.useEffect(()=>{!t||!h.current||Xt()||le.fromTo(h.current,{x:28,opacity:0},{x:0,opacity:1,duration:.28,ease:"power3.out"})},[t,!!c]),!t)return null;if(c){const p=fC(c);return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"sa-backdrop","aria-hidden":"true",onClick:n}),d.jsxs("div",{className:"sa-panel",ref:h,role:"complementary","aria-label":"Sub-agent transcript",children:[d.jsxs("header",{className:"sa-panel-head",children:[d.jsx("button",{type:"button",className:"sa-back","aria-label":"Back to list",onClick:()=>a(null),children:"‹"}),d.jsxs("span",{className:"sa-panel-title sa-detail-title",children:[d.jsx("span",{className:"sa-dot","data-status":c.status,"aria-hidden":"true"}),d.jsx(Lm,{agentType:c.agentType,model:p}),d.jsx("span",{className:"sa-status",children:c.status==="running"?"· running":"· done"})]}),d.jsx("button",{type:"button",className:"sa-panel-close","aria-label":"Close",onClick:n,children:"×"})]}),d.jsx(tU,{def:c.def,agentType:c.agentType}),d.jsx(nU,{nested:c.nested}),d.jsx(Dm,{messages:c.messages})]})]})}return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"sa-backdrop","aria-hidden":"true",onClick:n}),d.jsxs("div",{className:"sa-panel",ref:h,role:"complementary","aria-label":"Sub-agents",children:[d.jsxs("header",{className:"sa-panel-head",children:[d.jsxs("span",{className:"sa-panel-title",children:["Sub-agents ",d.jsx("span",{className:"sa-count",children:e.length}),l?d.jsxs("span",{className:"sa-count-running",children:[l," running"]}):null]}),d.jsx("button",{type:"button",className:"sa-panel-close","aria-label":"Close sub-agents panel",onClick:n,children:"×"})]}),d.jsx("div",{className:"sa-tabs",role:"tablist",children:["active","completed","all"].map(p=>d.jsxs("button",{type:"button",role:"tab","aria-selected":s===p,className:"sa-tab","data-on":s===p?"true":void 0,onClick:()=>i(p),children:[eU[p],d.jsx("span",{className:"sa-tab-count",children:u[p]})]},p))}),d.jsx("div",{className:"sa-panel-body",children:f.length===0?d.jsxs("div",{className:"sa-empty",children:["No ",s==="all"?"":`${s} `,"sub-agents."]}):f.map(p=>d.jsxs("button",{type:"button",className:"sa-item-row",onClick:()=>a(p.agentId),children:[d.jsx(rU,{agent:p}),d.jsx("span",{className:"sa-chevron","aria-hidden":"true",children:"›"})]},p.agentId))})]})]})}const iU=3e3,Mx=10*6e4;function Dx({points:e,field:t,now:n,floor:r,color:s}){const a=n-Mx,l=e.filter(g=>g.t>=a),u=g=>(g-a)/Mx*300,c=Math.max(r,...l.map(g=>g[t]),1),f=g=>46-g/c*46,h=l.map(g=>`${u(g.t).toFixed(1)},${f(g[t]).toFixed(1)}`).join(" "),p=[2,4,6,8].map(g=>u(n-g*6e4));return d.jsxs("svg",{className:"proc-chart",viewBox:"0 0 300 46",preserveAspectRatio:"none","aria-hidden":"true",children:[p.map((g,y)=>d.jsx("line",{x1:g,y1:0,x2:g,y2:46,className:"proc-chart-grid"},y)),l.length>=2?d.jsxs(d.Fragment,{children:[d.jsx("polyline",{points:`${u(l[0].t).toFixed(1)},46 ${h} ${u(l[l.length-1].t).toFixed(1)},46`,fill:s,fillOpacity:"0.12",stroke:"none"}),d.jsx("polyline",{points:h,fill:"none",stroke:s,strokeWidth:"1.5",vectorEffect:"non-scaling-stroke"})]}):null]})}function oU({power:e,history:t,onClose:n,onToast:r}){const{rootRef:s,requestClose:i}=mi(n),[o,a]=m.useState(null),[l,u]=m.useState(null),[c,f]=m.useState(null),h=Date.now(),p=t.length?t[t.length-1]:null,g=p?.cpu??null,y=p?.mem??null,_=m.useCallback(()=>{PM().then(a).catch(v=>r(`ps failed: ${v.message}`,"error"))},[r]);m.useEffect(()=>{_();const v=setInterval(_,iU);return()=>clearInterval(v)},[_]),m.useEffect(()=>{const v=w=>{w.key==="Escape"&&i()};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[i]);const x=m.useCallback(async(v,w)=>{f(v);try{await jM(v,w?"SIGKILL":"SIGTERM"),r(`Sent ${w?"SIGKILL":"SIGTERM"} → ${v}`,"ok"),u(null),_()}catch(C){r(`kill ${v} failed: ${C.message}`,"error")}finally{f(null)}},[r,_]);return d.jsx("div",{className:"modal-backdrop",ref:s,onClick:v=>{v.target===v.currentTarget&&i()},children:d.jsxs("div",{className:"modal modal-process",role:"dialog","aria-modal":!0,"aria-label":"Processes & system",children:[d.jsxs("div",{className:"modal-head",children:[d.jsxs("div",{className:"modal-head-group",children:[d.jsx("span",{className:"modal-title",children:"Processes & system"}),e&&e.hasBattery?d.jsxs("span",{className:"proc-power","data-low":e.low?"true":void 0,children:[d.jsx(Ok,{size:20,level:(e.percent??0)/100,charging:!!e.charging}),e.percent!=null?`${e.percent}%`:"—",e.charging?" · charging":"",e.low?" · low":""]}):null]}),d.jsx("button",{type:"button",className:"modal-close","aria-label":"Close",onClick:i,children:d.jsx(dh,{size:16})})]}),d.jsxs("div",{className:"modal-body proc-body",children:[d.jsxs("div",{className:"proc-graphs",children:[d.jsxs("div",{className:"proc-graph",children:[d.jsxs("div",{className:"proc-graph-head",children:[d.jsx("span",{className:"proc-graph-label",children:"CPU"}),d.jsx("span",{className:"proc-graph-val",children:g!=null?`${g.toFixed(0)}%`:"—"})]}),d.jsx(Dx,{points:t,field:"cpu",now:h,floor:100,color:"var(--accent)"})]}),d.jsxs("div",{className:"proc-graph",children:[d.jsxs("div",{className:"proc-graph-head",children:[d.jsx("span",{className:"proc-graph-label",children:"MEM"}),d.jsx("span",{className:"proc-graph-val",children:y!=null?`${y.toFixed(0)}%`:"—"})]}),d.jsx(Dx,{points:t,field:"mem",now:h,floor:100,color:"var(--accent-2)"})]}),d.jsxs("div",{className:"proc-graph-axis",children:[d.jsx("span",{children:"10m ago"}),d.jsx("span",{children:"5m"}),d.jsx("span",{children:"now"})]})]}),d.jsxs("div",{className:"proc-row proc-head",children:[d.jsx("span",{className:"proc-pid",children:"PID"}),d.jsx("span",{className:"proc-cpu",children:"CPU%"}),d.jsx("span",{className:"proc-mem",children:"MEM"}),d.jsx("span",{className:"proc-cmd",children:"COMMAND"}),d.jsx("span",{className:"proc-act"})]}),o==null?d.jsx("div",{className:"proc-empty",children:"loading…"}):o.length===0?d.jsx("div",{className:"proc-empty",children:"no processes"}):o.map(v=>d.jsxs("div",{className:"proc-row",children:[d.jsx("span",{className:"proc-pid",children:v.pid}),d.jsx("span",{className:"proc-cpu","data-hot":v.cpu>=50?"true":void 0,children:v.cpu.toFixed(0)}),d.jsxs("span",{className:"proc-mem",children:[v.rssMB,"m"]}),d.jsx("span",{className:"proc-cmd",title:v.command,children:v.command}),d.jsx("span",{className:"proc-act",children:l===v.pid?d.jsxs("span",{className:"proc-confirm",children:[d.jsx("button",{type:"button",className:"proc-kill-yes",disabled:c===v.pid,title:"SIGTERM (shift-click for SIGKILL)",onClick:w=>x(v.pid,w.shiftKey),children:c===v.pid?"…":"Kill"}),d.jsx("button",{type:"button",className:"proc-kill-no",onClick:()=>u(null),children:"Cancel"})]}):d.jsx("button",{type:"button",className:"proc-kill","aria-label":`Kill process ${v.pid}`,title:"Kill process",onClick:()=>u(v.pid),children:d.jsx(dh,{size:14})})})]},v.pid))]})]})})}function Lx(e,t){let n=0;for(let r=0;r<e.length&&n<t.length;r++)e[r]===t[n]&&n++;return n===t.length}function aU(e,t){if(!t)return 1;const n=t.toLowerCase().trim(),r=e.label.toLowerCase(),s=[e.hint??"",e.keywords??"",e.group??""].join(" ").toLowerCase();if(r===n)return 1e3;if(r.startsWith(n))return 700-r.length;const i=r.indexOf(n);if(i>=0)return(i===0||!/[a-z0-9]/.test(r[i-1])?550:400)-r.length;const o=s.indexOf(n);return o>=0?220-o:Lx(r,n)?120:Lx(s,n)?60:0}function lU(e,t){const n=[],r=new Map;e.forEach((o,a)=>{const l=aU(o,t);if(l<=0)return;const u=o.group;r.has(u)||(r.set(u,[]),n.push(u)),r.get(u).push({cmd:o,score:l,i:a})});const s=n.map(o=>{const a=r.get(o).sort((l,u)=>u.score-l.score||l.i-u.i).map(l=>l.cmd);return{group:o,items:a}}),i=s.flatMap(o=>o.items);return{sections:s,flat:i}}function uU({commands:e,onClose:t}){const{rootRef:n,requestClose:r}=mi(t),[s,i]=m.useState(""),[o,a]=m.useState(0),l=m.useRef(null),u=m.useRef(null);m.useEffect(()=>{l.current?.focus({preventScroll:!0})},[]);const{sections:c,flat:f}=m.useMemo(()=>lU(e,s),[e,s]),h=m.useMemo(()=>{const y=new Map;return f.forEach((_,x)=>y.set(_.id,x)),y},[f]);m.useEffect(()=>{a(y=>f.length===0?0:Math.min(y,f.length-1))},[f.length]);const p=m.useCallback(y=>{i(y.target.value),a(0)},[]),g=m.useCallback(y=>{y&&(y.run(),r())},[r]);return m.useEffect(()=>{const y=_=>{const x=f.length;if(_.key==="Escape"){_.preventDefault(),r();return}if((_.metaKey||_.ctrlKey)&&/^[1-9]$/.test(_.key)){_.preventDefault(),g(f[Number(_.key)-1]);return}x!==0&&(_.key==="ArrowDown"||_.key==="Tab"&&!_.shiftKey?(_.preventDefault(),a(v=>(v+1)%x)):_.key==="ArrowUp"||_.key==="Tab"&&_.shiftKey?(_.preventDefault(),a(v=>(v-1+x)%x)):_.key==="Enter"&&(_.preventDefault(),g(f[o])))};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[f,o,g,r]),m.useEffect(()=>{const y=u.current;if(!y)return;y.querySelector(`[data-index="${o}"]`)?.scrollIntoView({block:"nearest"})},[o]),d.jsx("div",{className:"cmdk-backdrop",ref:n,onClick:y=>{y.target===y.currentTarget&&r()},children:d.jsxs("div",{className:"cmdk-panel",role:"dialog","aria-modal":!0,"aria-label":"Command palette",children:[d.jsxs("div",{className:"cmdk-search-row",children:[d.jsx("span",{className:"cmdk-search-icon","aria-hidden":!0,children:d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[d.jsx("circle",{cx:"6.5",cy:"6.5",r:"4.5",stroke:"currentColor",strokeWidth:"1.5"}),d.jsx("line",{x1:"10.5",y1:"10.5",x2:"14",y2:"14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}),d.jsx("input",{ref:l,className:"cmdk-input",type:"text",placeholder:"Search commands…",value:s,onChange:p,autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,autoComplete:"off"}),s&&d.jsx("button",{className:"cmdk-clear",onClick:()=>{i(""),a(0),l.current?.focus()},tabIndex:-1,"aria-label":"Clear search",children:"×"})]}),d.jsx("ul",{className:"cmdk-list",ref:u,role:"listbox","aria-label":"Commands",children:f.length===0?d.jsx("li",{className:"cmdk-empty",role:"option","aria-selected":!1,children:"No matches"}):c.map(y=>d.jsxs("li",{className:"cmdk-section",children:[y.group!==void 0&&d.jsx("div",{className:"cmdk-group-header",role:"presentation",children:y.group}),d.jsx("ul",{className:"cmdk-section-list",role:"presentation",children:y.items.map(_=>{const x=h.get(_.id)??0,v=x===o,w=_.hotkey??(x<9?`⌘${x+1}`:null);return d.jsxs("li",{className:`cmdk-row${v?" cmdk-row--active":""}`,role:"option","aria-selected":v,"data-index":x,onClick:()=>g(_),onMouseMove:()=>a(x),children:[d.jsx("span",{className:"cmdk-row-label",children:_.label}),_.hint&&d.jsx("span",{className:"cmdk-row-hint",children:_.hint}),w&&d.jsx("span",{className:"cmdk-row-key",children:w})]},_.id)})})]},y.group??"__ungrouped__"))})]})})}function hC(e=0){const[t,n]=m.useState(!1);return m.useEffect(()=>{if(typeof window>"u")return;let r=null,s=!1;const i=()=>{r!=null&&(clearTimeout(r),r=null),s&&(s=!1,n(!1))},o=u=>{u.key!=="Meta"&&u.key!=="Control"||s||r!=null||(r=setTimeout(()=>{r=null,s=!0,n(!0)},e))},a=u=>{(u.key==="Meta"||u.key==="Control")&&i()},l=()=>{document.hidden&&i()};return window.addEventListener("keydown",o),window.addEventListener("keyup",a),window.addEventListener("blur",i),document.addEventListener("visibilitychange",l),()=>{i(),window.removeEventListener("keydown",o),window.removeEventListener("keyup",a),window.removeEventListener("blur",i),document.removeEventListener("visibilitychange",l)}},[e]),t}function cU(e){return e.length*8.5+18}function Ox(){const e=document.querySelectorAll("[data-hotkey]"),t=[];e.forEach((i,o)=>{const a=i.getBoundingClientRect();if(a.width===0||a.height===0)return;const l=i.getAttribute("data-hotkey")??"",u=i.getAttribute("data-hotkey-dir"),c=28,f=6,h=cU(l);if(u==="right"){const _=a.top+a.height/2-c/2,x=a.right-8-h/2;t.push({key:`hint-${o}`,label:l,top:_,left:x,width:h,placedAbove:!1});return}const p=u==="down"?!1:u==="up"?!0:a.top>=c+f+4,g=p?a.top-c-f:a.bottom+f,y=a.left+a.width/2;t.push({key:`hint-${o}`,label:l,top:g,left:y,width:h,placedAbove:p})});const n=4,r=new Map;for(const i of t){const o=Math.round(i.top/8);r.has(o)||r.set(o,[]),r.get(o).push(i)}for(const i of r.values()){i.sort((o,a)=>o.left-a.left);for(let o=1;o<i.length;o++){const a=i[o-1].left+i[o-1].width/2;i[o].left-i[o].width/2<a+n&&(i[o].left=a+n+i[o].width/2)}}const s=6;for(const i of t)i.left=Math.max(i.width/2+s,Math.min(window.innerWidth-i.width/2-s,i.left));return t}function dU(){const e=hC(500),[t,n]=m.useState([]),r=m.useRef(null);return m.useEffect(()=>{if(!e){n([]),r.current!==null&&(cancelAnimationFrame(r.current),r.current=null);return}n(Ox());function s(){n(Ox())}return window.addEventListener("scroll",s,{capture:!0,passive:!0}),window.addEventListener("resize",s,{passive:!0}),()=>{window.removeEventListener("scroll",s,{capture:!0}),window.removeEventListener("resize",s)}},[e]),!e||t.length===0?null:eb.createPortal(d.jsx(d.Fragment,{children:t.map(s=>d.jsx("div",{className:"hotkey-hint","data-above":s.placedAbove?"true":"false",style:{position:"fixed",top:s.top,left:s.left,pointerEvents:"none"},"aria-hidden":"true",children:s.label},s.key))}),document.body)}const pC=typeof CSS<"u"&&"highlights"in CSS,mC="transcript-search",Th="transcript-search-active";function Ml(){pC&&(CSS.highlights.delete(mC),CSS.highlights.delete(Th))}function fU(e,t){const n=[],r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let s;for(;s=r.nextNode();)t&&t.contains(s)||s.data.trim()&&n.push(s);return n}function hU(e,t){if(!t)return[];const n=t.toLowerCase(),r=[];for(const s of e){const o=s.data.toLowerCase();let a=0;for(;a<=o.length-n.length;){const l=o.indexOf(n,a);if(l===-1)break;const u=document.createRange();u.setStart(s,l),u.setEnd(s,l+n.length),r.push({range:u,el:s.parentElement??document.body}),a=l+n.length}}return r}function zx(e,t){if(!pC)return;const n=e.map(r=>r.range);CSS.highlights.set(mC,new Highlight(...n)),e.length>0&&t>=0&&t<e.length?CSS.highlights.set(Th,new Highlight(e[t].range)):CSS.highlights.delete(Th)}function Fx(e){if(e.range.getBoundingClientRect){const t=e.range.getBoundingClientRect();if(t.width>0||t.height>0){e.el.scrollIntoView({block:"center"});return}}e.el.scrollIntoView({block:"center"})}function pU({open:e,onClose:t}){const[n,r]=m.useState(""),[s,i]=m.useState([]),[o,a]=m.useState(0),l=m.useRef(null),u=m.useRef(null),c=m.useRef(null),f=m.useRef(null),h=m.useRef(null),p=m.useCallback(S=>{const k=document.querySelector(".thread-viewport");if(!k){Ml(),i([]),a(0);return}const T=S.trim();if(!T){Ml(),i([]),a(0);return}const R=fU(k,u.current),P=hU(R,T);i(P),a(E=>{const M=P.length>0?Math.min(E,P.length-1):0;return zx(P,M),P.length>0&&Fx(P[M]),M})},[]),g=m.useCallback(S=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>p(S),120)},[p]);m.useEffect(()=>{if(!e)return;const S=document.querySelector(".thread-viewport");if(S)return f.current=new MutationObserver(()=>{h.current||(h.current=setTimeout(()=>{h.current=null;const k=l.current?.value??"";p(k)},200))}),f.current.observe(S,{childList:!0,subtree:!0,characterData:!0}),()=>{f.current?.disconnect(),f.current=null,h.current&&(clearTimeout(h.current),h.current=null)}},[e,p]),m.useEffect(()=>{e?(setTimeout(()=>l.current?.focus(),0),n.trim()&&g(n)):(Ml(),i([]),a(0),c.current&&clearTimeout(c.current))},[e]),m.useEffect(()=>()=>{Ml(),c.current&&clearTimeout(c.current)},[]);const y=m.useCallback(S=>{if(!s.length)return;const k=(S%s.length+s.length)%s.length;a(k),zx(s,k),Fx(s[k])},[s]),_=m.useCallback(()=>y(o+1),[y,o]),x=m.useCallback(()=>y(o-1),[y,o]),v=m.useCallback(S=>{S.key==="Escape"?(S.preventDefault(),t()):S.key==="Enter"&&(S.preventDefault(),S.shiftKey?x():_())},[t,_,x]);if(!e)return null;const w=s.length,C=w>0?o+1:0;return d.jsxs("div",{className:"transcript-search",ref:u,role:"search","aria-label":"Search transcript",children:[d.jsx("input",{ref:l,className:"transcript-search-input",type:"search",placeholder:"Search…",value:n,"aria-label":"Search query",onChange:S=>{r(S.target.value),g(S.target.value)},onKeyDown:v,autoComplete:"off",spellCheck:!1}),d.jsx("span",{className:"transcript-search-count","aria-live":"polite","aria-atomic":"true",children:w===0?n.trim()?"0":"":`${C}/${w}`}),d.jsx("button",{type:"button",className:"transcript-search-nav",title:"Previous match (Shift+Enter)","aria-label":"Previous match",onClick:x,disabled:w===0,children:"↑"}),d.jsx("button",{type:"button",className:"transcript-search-nav",title:"Next match (Enter)","aria-label":"Next match",onClick:_,disabled:w===0,children:"↓"}),d.jsx("button",{type:"button",className:"transcript-search-close",title:"Close search (Esc)","aria-label":"Close search",onClick:t,children:d.jsx(dh,{size:14})})]})}function mU(e){return e?e===!0?"Using a sub-agent":`Using the ${e} sub-agent`:""}function gU(e,t){const n=mU(t);return!n||!e?e:`${n}. ${e}`}function yU(e){return(e.blocks??[]).filter(t=>t.kind==="text").map(t=>t.text).join(" ")}const vU=18e5,gC="cc_drafts";function xU(){try{return JSON.parse(localStorage.getItem(gC)||"{}")||{}}catch{return{}}}function wU(e){try{localStorage.setItem(gC,JSON.stringify(e))}catch{}}const yC="cc_subagent";function Bx(){try{return JSON.parse(localStorage.getItem(yC)||"{}")||{}}catch{return{}}}function _U(e){try{localStorage.setItem(yC,JSON.stringify(e))}catch{}}const $x=150,bU=150;function SU(e){return typeof e.content=="string"?e.content:e.content.filter(t=>t.type==="text").map(t=>t.text).join(`
|
|
103
|
+
`)}function kU(){const e=FM(),t=UM(),[n,r]=m.useState(null),s=m.useRef(0),i=m.useCallback((A,L="")=>{r({id:++s.current,text:A,kind:L})},[]);m.useEffect(()=>{const A=()=>{const L=/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,K=L&&(window.screen.width>1200||window.innerWidth>1200);document.body.classList.toggle("is-ipad",L),document.body.classList.toggle("is-external-display",K)};return A(),window.addEventListener("resize",A),()=>window.removeEventListener("resize",A)},[]),m.useEffect(()=>{let A=0,L=0,K=!0;const G=()=>{if(!K)return;const Fe=document.body.classList.contains("is-external-display")&&L>0?L:A>0?A:0;Fe>0?document.documentElement.style.setProperty("--txt-transcript",`${Fe}px`):document.documentElement.style.removeProperty("--txt-transcript")};return NS().then(Le=>{K&&(A=Le.transcriptFontSize??0,L=Le.externalFontSize??0,G())}).catch(()=>{}),window.addEventListener("resize",G),()=>{K=!1,window.removeEventListener("resize",G)}},[]),m.useEffect(()=>{const A=L=>{const K=L.detail;K.ok?K.op==="answer"&&i("Answer sent →","ok"):i(`${K.op} failed: ${K.error??"error"}`,"error")};return window.addEventListener("cockpit:ack",A),()=>window.removeEventListener("cockpit:ack",A)},[i]);const o=m.useMemo(()=>s2(i),[i]),a=m.useMemo(()=>({output:e.shellOutput,run:e.sendShellInput,text:e.sendShellText,key:e.sendShellKey,poll:e.requestShellCapture,clear:e.clearShellOutput}),[e.shellOutput,e.sendShellInput,e.sendShellText,e.sendShellKey,e.requestShellCapture,e.clearShellOutput]),[l,u]=m.useState([]),c=m.useRef(0),f=m.useRef(!1),h=m.useCallback(A=>{f.current=A},[]),[p,g]=m.useState(null),y=m.useCallback(async A=>{const L=SU(A).trim(),K=(A.attachments??[]).map(zt=>n2(zt)).filter(zt=>!!zt),G=e.selectedId,Le=G!=null?E.current[G]??!0:!1,Be=!f.current&&L?gU(L,Le):L,hn=[Be,...K].filter(Boolean).join(" ");if(!hn)return;const Kn=e.sendReply(hn);if(i(Kn?"Sent →":"Not connected — reconnecting…",Kn?"ok":"error"),Kn&&G){const zt=Be||(K.length?`📎 ${K.length} attachment(s)`:hn);u(Gn=>[...Gn,{key:++c.current,sessionId:G,text:hn,label:zt,at:Date.now()}])}},[e,i]),_=m.useRef({});m.useEffect(()=>{const A=e.selectedId;if(!A)return;const L=e.messages,K=_.current[A],G=K==null?L.length:Math.min(K,L.length);if(L.length>G){const Le=[];for(let Fe=G;Fe<L.length;Fe++){if(L[Fe].role!=="user")continue;const Be=yU(L[Fe]).trim();Be&&Le.push(Be)}if(Le.length){const Fe=Be=>Be.replace(/\s+/g," ").trim();u(Be=>{const hn=[...Be];for(const Kn of Le){const zt=Fe(Kn),Gn=hn.map((Yn,Pr)=>({e:Yn,i:Pr})).filter(({e:Yn})=>Yn.sessionId===A);if(Gn.length===0)continue;const xi=Gn.find(({e:Yn})=>{const Pr=Fe(Yn.text),nl=Fe(Yn.label);return Pr===zt||nl===zt||zt.startsWith(nl)||Pr.startsWith(zt)})??Gn[0];hn.splice(xi.i,1)}return hn})}}_.current[A]=L.length},[e.selectedId,e.messages]),m.useEffect(()=>{if(l.length===0)return;const A=setInterval(()=>{const L=Date.now()-vU;u(K=>K.some(G=>G.at<L)?K.filter(G=>G.at>=L):K)},5e3);return()=>clearInterval(A)},[l.length]),m.useEffect(()=>{if(!p)return;if(e.selectedId!==p.sessionId||e.messages.length>p.baseCount){g(null);return}const A=setTimeout(()=>g(null),9e4);return()=>clearTimeout(A)},[p,e.selectedId,e.messages.length]);const[x,v]=m.useState($x);m.useEffect(()=>{v($x)},[e.selectedId]);const w=m.useMemo(()=>OS(e.messages),[e.messages]),C=Math.max(0,w.length-x),S=m.useMemo(()=>l.filter(A=>A.sessionId===e.selectedId),[l,e.selectedId]),k=m.useMemo(()=>{if(!e.prompt)return null;const A=e.messages;for(let L=A.length-1;L>=0;L--)for(const K of A[L].blocks??[])if(K.kind==="tool_use"&&K.name==="ExitPlanMode"){const G=K.input?.plan;if(typeof G=="string"&&G.trim())return G}return null},[e.prompt,e.messages]),T=m.useMemo(()=>{const A=C>0?w.slice(C):w.slice();for(const G of S){const Le={role:"user",id:`queued-${G.key}`,createdAt:new Date(G.at),content:[{type:"text",text:G.label}],metadata:{custom:{cockpitRole:"user",optimistic:!0}}};let Fe=A.length;for(let Be=0;Be<A.length;Be++){const hn=A[Be].createdAt;if(hn instanceof Date&&hn.getTime()>G.at){Fe=Be;break}}A.splice(Fe,0,Le)}const L=e.sessions.find(G=>G.id===e.selectedId);return(!!L&&fh(L)||p!==null&&p.sessionId===e.selectedId)&&A.push({role:"assistant",id:"optimistic-working",content:[{type:"text",text:"Working…"}],metadata:{custom:{cockpitRole:"assistant",working:!0}}}),A},[w,C,e.selectedId,e.sessions,S,p]),R=m.useCallback(()=>{v(A=>A+bU)},[]),P=Ya({messages:T,isDisabled:!e.selectedId,convertMessage:A=>A,onNew:y,adapters:{attachments:o}}),E=m.useRef(Bx()),[M,D]=m.useState(()=>Bx()),$=m.useCallback((A,L)=>{D(K=>{const G={...K,[A]:L};return E.current=G,_U(G),G})},[]),U=m.useRef(xU()),V=m.useRef(e.selectedId);m.useEffect(()=>{const A=P.thread.composer,L=()=>{const K=V.current;if(!K)return;const G=A.getState().text??"";G?U.current[K]=G:delete U.current[K],wU(U.current)};return A.subscribe(L)},[P]),m.useEffect(()=>{const A=P.thread.composer,L=e.selectedId,K=L?U.current[L]??"":"";V.current=L;try{A.reset(),K&&A.setText(K)}catch{}},[e.selectedId,P]);const[J,te]=m.useState(null),[B,z]=m.useState(!1),[b,H]=m.useState(!1),[X,I]=m.useState(!1),de=4,[Se,me]=m.useState([]),[nt,We]=m.useState(!1),Pe=m.useCallback(A=>{me(L=>{const K=[...L.filter(G=>G!==A),A];return K.length>de?K.slice(K.length-de):K})},[]);m.useEffect(()=>{We(!1);const A=e.selectedId;if(!A)return;const L=setTimeout(()=>{me(K=>K.includes(A)?[...K.filter(G=>G!==A),A]:K.length<de?[...K,A]:K)},500);return()=>clearTimeout(L)},[e.selectedId]);const Z=m.useCallback(()=>{const A=e.selectedId;A&&(Pe(A),We(!0))},[e.selectedId,Pe]),se=m.useCallback(()=>{const A=e.selectedId;A&&We(L=>(L||Pe(A),!L))},[e.selectedId,Pe]),[ie,fe]=m.useState(!1),[ut,rt]=m.useState(null),[mt,Pn]=m.useState(null),[Er,Tr]=m.useState(!1),[ae,So]=m.useState(null);m.useEffect(()=>{fe(!1),Pn(null)},[e.selectedId]);const yi=m.useCallback(A=>{Pn(L=>L===A?null:A)},[]),ar=m.useCallback(()=>Pn(null),[]),[qn,jn]=m.useState(null),O=m.useRef(null),Q=qn!==null;m.useEffect(()=>{Q&&O.current?.select()},[Q]);const re=m.useCallback(async()=>{const A=e.selectedId,L=(qn??"").trim();if(jn(null),!A||!L)return;const K=e.sessions.find(G=>G.id===A)?.name;if(L!==K)try{await IM(A,L),i("Renamed →","ok")}catch(G){i(`rename failed: ${G instanceof Error?G.message:"error"}`,"error")}},[e.selectedId,e.sessions,qn,i]),[ue,ke]=m.useState(!0),st=Mm(),cn=m.useRef(null),Lt=m.useRef(null),[Et,Ir]=m.useState(()=>{try{return localStorage.getItem("cc:railCollapsed")==="1"}catch{return!1}}),it=m.useCallback(()=>{Ir(A=>{const L=!A;try{localStorage.setItem("cc:railCollapsed",L?"1":"0")}catch{}return L})},[]),[j,F]=m.useState(()=>{try{const A=localStorage.getItem("cc:sessionFilter");return A==="claude"||A==="codex"||A==="terminal"?A:"all"}catch{return"all"}}),ne=m.useCallback(()=>{F(A=>{const L=A==="all"?"claude":A==="claude"?"codex":A==="codex"?"terminal":"all";try{localStorage.setItem("cc:sessionFilter",L)}catch{}return L})},[]),[ge,Ee]=m.useState(()=>{try{return new Set(JSON.parse(localStorage.getItem("cc:collapsedSessions")||"[]"))}catch{return new Set}}),De=m.useCallback(A=>{Ee(L=>{const K=new Set(L);K.has(A)?K.delete(A):K.add(A);try{localStorage.setItem("cc:collapsedSessions",JSON.stringify([...K]))}catch{}return K})},[]),Ie=m.useRef(!1);m.useEffect(()=>{const A=cn.current;if(!A)return;if(st){le.set(A,{clearProps:"width,flexBasis,opacity"});return}const L=Et?{width:0,flexBasis:0,opacity:0}:{width:300,flexBasis:300,opacity:1};if(Xt()||!Ie.current){le.set(A,L),Ie.current=!0;return}le.to(A,{...L,duration:.3,ease:"power3.out"})},[Et,st]),m.useEffect(()=>{const A=Lt.current;if(!A||!e.selectedId||Xt())return;const L=A.querySelector(".thread-viewport")??A.querySelector(".live-pane")??A.querySelector(".terminal-pane-root");L&&le.fromTo(L,{opacity:.35,y:6},{opacity:1,y:0,duration:.22,ease:"power3.out"})},[e.selectedId]),m.useEffect(()=>{if(!e.selectedId)return;let A=null,L=null,K=null,G=null,Le=0,Fe=0,Be=0,hn=0,Kn=!0,zt=!1,Gn=!0,xi=0;const Yn=()=>!!A&&A.scrollHeight-A.scrollTop-A.clientHeight<80,Pr=()=>{L&&(L.dataset.show=A&&!Yn()?"true":"")},nl=()=>{Fe||(Fe=requestAnimationFrame(()=>{Fe=0,A&&(Kn||Gn)&&!zt&&(A.scrollTop=A.scrollHeight)}))},Om=()=>{Gn&&(Gn=!1,clearTimeout(xi),Kn=Yn(),Pr())},zm=()=>{!zt&&!Gn&&(Kn=Yn()),Pr()},Mc=()=>{zt=!0,Om(),clearTimeout(Be)},Co=()=>{clearTimeout(Be),Be=window.setTimeout(()=>{zt=!1,Kn=Yn(),Pr()},160)},Fm=()=>{Mc(),Co()},Bm=()=>{if(A=document.querySelector(".thread-viewport"),L=document.querySelector(".scroll-to-bottom"),!A){hn++<40&&(Le=requestAnimationFrame(Bm));return}Kn=!0,Gn=!0,A.scrollTop=A.scrollHeight,Pr(),clearTimeout(xi),xi=window.setTimeout(Om,600),A.addEventListener("scroll",zm,{passive:!0}),A.addEventListener("touchstart",Mc,{passive:!0}),A.addEventListener("touchend",Co,{passive:!0}),A.addEventListener("touchcancel",Co,{passive:!0}),A.addEventListener("wheel",Fm,{passive:!0}),K=new MutationObserver(nl),K.observe(A,{childList:!0,subtree:!0,characterData:!0});const Dc=A.closest(".thread-root"),Lc=Dc?.querySelector(".composer")??null;if(Dc&&Lc&&"ResizeObserver"in window){const $m=()=>Dc.style.setProperty("--composer-h",`${Lc.offsetHeight}px`);$m(),G=new ResizeObserver($m),G.observe(Lc)}};return Le=requestAnimationFrame(Bm),()=>{cancelAnimationFrame(Le),cancelAnimationFrame(Fe),clearTimeout(Be),clearTimeout(xi),A&&(A.removeEventListener("scroll",zm),A.removeEventListener("touchstart",Mc),A.removeEventListener("touchend",Co),A.removeEventListener("touchcancel",Co),A.removeEventListener("wheel",Fm)),K&&K.disconnect(),G&&G.disconnect()}},[e.selectedId]);const ye=m.useCallback(A=>{e.select(A),ke(!1),window.location.hash=encodeURIComponent(A)},[e]);m.useEffect(()=>{if(!("serviceWorker"in navigator))return;const A=L=>{const K=L.data;K?.type==="open-session"&&K.id&&ye(K.id)};return navigator.serviceWorker.addEventListener("message",A),()=>navigator.serviceWorker.removeEventListener("message",A)},[ye]);const dn=typeof window<"u"&&(window.matchMedia?.("(display-mode: standalone)").matches||navigator.standalone===!0),Yr=t.iosHint&&!dn&&t.status!=="on",Ot=m.useRef(!1);m.useEffect(()=>{const A=()=>{const L=decodeURIComponent(window.location.hash.replace(/^#/,""));L&&L!==e.selectedId&&e.sessions.some(K=>K.id===L)&&(e.select(L),ke(!1))};if(!Ot.current&&e.sessions.length>0){Ot.current=!0;const L=decodeURIComponent(window.location.hash.replace(/^#/,""));L&&L!==e.selectedId&&e.sessions.some(K=>K.id===L)&&(e.select(L),st||ke(!1))}return window.addEventListener("hashchange",A),()=>window.removeEventListener("hashchange",A)},[e,e.sessions,e.selectedId,st]);const ve=e.sessions.find(A=>A.id===e.selectedId),gt=2e4,Wt=S.length>0&&S.some(A=>Date.now()-A.at<gt),An=!!ve&&fh(ve)||Wt,fn=m.useCallback(()=>{e.sendPromptKey("Escape"),i("Canceled →")},[e,i]),qt=e.selectedId!=null?M[e.selectedId]??!0:!0,Kt=m.useCallback(A=>{e.selectedId&&$(e.selectedId,A)},[e.selectedId,$]);m.useEffect(()=>{const A=L=>{(L.metaKey||L.ctrlKey)&&(L.key==="k"||L.key==="K")&&(L.preventDefault(),H(K=>!K))};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[]),m.useEffect(()=>{const A=L=>{if(!(L.metaKey||L.ctrlKey)||L.shiftKey||L.altKey)return;const K=L.key.toLowerCase();K==="b"?(L.preventDefault(),it()):K==="e"&&ve?(L.preventDefault(),jn(ve.name??ve.id)):K==="j"&&ve?(L.preventDefault(),se()):K==="u"&&e.subagents.length>0&&(L.preventDefault(),rt(null),fe(G=>!G))};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[ve,e.subagents.length,it,se]);const Nn=m.useMemo(()=>j==="terminal"?[]:e.sessions.filter(A=>A.kind!=="terminal"&&!ge.has(A.sessionName??"?")).sort((A,L)=>(A.sessionName??"").localeCompare(L.sessionName??"",void 0,{numeric:!0})||(A.windowIndex??0)-(L.windowIndex??0)||(A.paneIndex??0)-(L.paneIndex??0)),[e.sessions,j,ge]),ko=m.useMemo(()=>{const A=new Map;return Nn.slice(0,9).forEach((L,K)=>A.set(L.id,`⌘${K+1}`)),A},[Nn]);m.useEffect(()=>{const A=L=>{if(b||!(L.metaKey||L.ctrlKey)||L.shiftKey||L.altKey||!/^[1-9]$/.test(L.key))return;const K=Nn[Number(L.key)-1];if(K){L.preventDefault(),L.stopPropagation();const G=document.activeElement;G&&G.tagName==="IFRAME"&&G.blur();const Le=document.querySelector(".detail-body")??document.body;Le.setAttribute("tabindex","-1"),Le.focus({preventScroll:!0}),We(!1),ye(K.id);const Fe=requestAnimationFrame(()=>{const Be=document.querySelector(".detail-body")??document.body;Be.setAttribute("tabindex","-1"),Be.focus({preventScroll:!0})});return()=>cancelAnimationFrame(Fe)}};return window.addEventListener("keydown",A,!0),()=>window.removeEventListener("keydown",A,!0)},[Nn,b,ye,We]),m.useEffect(()=>{const A=L=>{if(L.key!=="Enter"||!(L.metaKey||L.ctrlKey)||L.shiftKey)return;const K=document.activeElement;if(K&&(K.tagName==="TEXTAREA"||K.tagName==="INPUT"||K.isContentEditable)||document.querySelector('[aria-modal="true"]'))return;const G=document.querySelector(".composer .composer-input");G&&(L.preventDefault(),G.focus())};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[]),m.useEffect(()=>{const A=L=>{L.key==="Escape"&&(document.querySelector('[aria-modal="true"]')||document.querySelector(".skill-ac")||f.current||An&&(L.preventDefault(),e.sendPromptKey("Escape"),i("Canceled →")))};return window.addEventListener("keydown",A,!0),()=>window.removeEventListener("keydown",A,!0)},[An,e,i]),m.useEffect(()=>{const A=L=>{if(!(L.key==="."||L.code==="Period")||!(L.metaKey||L.ctrlKey)||L.shiftKey||L.altKey||document.querySelector('[aria-modal="true"]'))return;const G=document.querySelector(".thread-viewport");G&&(L.preventDefault(),G.scrollTo({top:G.scrollHeight,behavior:"smooth"}))};return window.addEventListener("keydown",A,!0),()=>window.removeEventListener("keydown",A,!0)},[]);const lr=e.subagents.filter(A=>A.status==="running").length;m.useEffect(()=>{const A=L=>{L.key!=="/"||!(L.metaKey||L.ctrlKey)||L.shiftKey||L.altKey||(L.preventDefault(),L.stopPropagation(),I(K=>!K))};return window.addEventListener("keydown",A,!0),()=>window.removeEventListener("keydown",A,!0)},[]);const vi=m.useMemo(()=>{const A=G=>G?G.replace(/\/$/,"").split("/").pop()||G:"",L=[],K=[...e.sessions].sort((G,Le)=>{const Fe=G.kind==="terminal"?1:0,Be=Le.kind==="terminal"?1:0;return Fe!==Be?Fe-Be:(G.sessionName??"").localeCompare(Le.sessionName??"",void 0,{numeric:!0})||(G.windowIndex??0)-(Le.windowIndex??0)||(G.paneIndex??0)-(Le.paneIndex??0)});for(const G of K){const Le=G.kind==="terminal";L.push({id:`switch:${G.id}`,label:G.name||G.title||G.tmuxName||G.id,hint:[Le?"terminal":A(G.cwd),G.pending?"ASK":""].filter(Boolean).join(" · "),keywords:`${G.sessionName??""} ${G.cwd??""} ${G.id}`,group:Le?"Terminals":"Sessions",run:()=>ye(G.id)})}return L.push({id:"act:tmux-window",label:"View raw tmux window",hint:ve?ve.name||ve.id:"select a session first",group:"Actions",keywords:"terminal ttyd pane window",run:()=>Z()},{id:"act:new-session",label:"New session",group:"Actions",keywords:"create start claude",run:()=>{i("Creating session…"),MS({}).then(G=>i(`Session created → ${G.name}`,"ok")).catch(G=>i(`New session failed: ${G.message}`,"error"))}},{id:"act:processes",label:"Processes & system",group:"Actions",keywords:"ps aux kill cpu memory battery power",run:()=>Tr(!0)},{id:"act:settings",label:"Settings",group:"Actions",keywords:"config preferences model mlx",run:()=>z(!0)},{id:"act:toggle-sidebar",label:Et?"Show sidebar":"Hide sidebar (focus mode)",group:"Actions",keywords:"rail collapse focus",run:()=>it()},{id:"act:reload",label:"Reload app",group:"Actions",keywords:"refresh",run:()=>window.location.reload()}),L},[e.sessions,e.selectedId,ve,Et,ye,it,i,Z]),Rr=ve?.thinking&&w.length>0?w[w.length-1].id??null:null,As=m.useRef(null),{pull:Ac,refreshing:Nc}=qM(As),xC=hC(500);return d.jsx(Qa,{runtime:P,children:d.jsx(o$,{children:d.jsxs("div",{ref:As,className:"app","data-detail":e.selectedId&&!ue?"open":"closed","data-rail-collapsed":!st&&Et?"true":void 0,"data-cmd-held":xC?"true":void 0,children:[Ac>0||Nc?d.jsx("div",{className:"ptr-indicator",style:{transform:`translate(-50%, ${Math.round(Ac)}px)`},"data-ready":!Nc&&Ac>=KM?"true":void 0,"data-refreshing":Nc?"true":void 0,"aria-hidden":"true",children:d.jsx("span",{className:"ptr-spinner"})}):null,d.jsx("div",{className:"app-top-fade","aria-hidden":"true"}),d.jsx(zD,{resources:e.resources,conn:e.conn,push:t}),d.jsx(V5,{}),Yr?d.jsx("div",{className:"ios-push-hint",role:"note",children:"On iPhone/iPad, add this site to your Home Screen to receive push notifications."}):null,d.jsxs("div",{className:"app-body",children:[d.jsxs("aside",{className:"rail",ref:cn,children:[d.jsx(q5,{onToast:i,filter:j,onCycleFilter:ne}),d.jsx("div",{className:"rail-scroll",children:d.jsx(DD,{sessions:e.sessions,selectedId:e.selectedId,onSelect:ye,filter:j,collapsed:ge,onToggleCollapse:De,hotkeyById:ko,workingOverrideId:An?e.selectedId:null})}),d.jsxs("div",{className:"rail-foot",children:[d.jsx("button",{type:"button",className:"rail-foot-btn rail-foot-icon reload-foot","aria-label":"Reload app",title:"Reload app",onClick:()=>window.location.reload(),children:d.jsx("span",{className:"reload-glyph","aria-hidden":"true",children:"↻"})}),d.jsxs("button",{type:"button",className:"rail-foot-btn","aria-label":"Settings",title:"Settings",onClick:()=>z(!0),children:[d.jsx(ED,{size:16}),d.jsx("span",{children:"Settings"})]}),d.jsx("button",{type:"button",className:"rail-foot-btn rail-foot-icon","aria-label":"Processes & system",title:"Processes & system",onClick:()=>Tr(!0),children:d.jsx(TD,{size:16})})]})]}),d.jsxs("main",{className:"detail",children:[d.jsxs("header",{className:"detail-head",children:[d.jsx("button",{type:"button",className:"back-btn","aria-label":"Back to sessions",onClick:()=>ke(!0),children:"‹"}),d.jsx("div",{className:"detail-title",children:qn!==null?d.jsx("input",{ref:O,className:"detail-rename-input",type:"text",value:qn,"aria-label":"Session name",onChange:A=>jn(A.target.value),onKeyDown:A=>{A.key==="Enter"?(A.preventDefault(),re()):A.key==="Escape"&&(A.preventDefault(),jn(null))},onBlur:()=>void re()}):d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"detail-name",children:ve?.name||e.selectedId||"claude control"}),ve?.cwd?d.jsx("span",{className:"detail-cwd",title:ve.cwd,children:ve.cwd.replace(/\/$/,"").split("/").pop()||ve.cwd}):null]})}),d.jsxs("div",{className:"detail-actions",children:[ve&&qn===null?d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"detail-action","aria-label":"Rename session",title:"Rename session (⌘E)","data-hotkey":"⌘E","data-hotkey-dir":"down",onClick:()=>jn(ve.name??ve.id),children:d.jsx(kD,{})}),d.jsx("button",{type:"button",className:"detail-action","aria-label":"Open raw terminal",title:"Raw terminal (⌘J)","data-hotkey":"⌘J","data-hotkey-dir":"down",onClick:Z,children:d.jsx(Dk,{})}),d.jsx("button",{type:"button",className:"detail-action","aria-pressed":X,"data-on":X?"true":void 0,"aria-label":"Search transcript",title:"Search transcript (⌘/)","data-hotkey":"⌘/","data-hotkey-dir":"down",onClick:()=>I(A=>!A),children:d.jsx(PD,{})}),e.subagents.length>0?d.jsxs("button",{type:"button",className:"detail-action detail-action--count","aria-pressed":ie,"data-on":ie?"true":void 0,"data-running":lr>0?"true":void 0,"aria-label":lr>0?`${lr} sub-agent${lr===1?"":"s"} running`:"Sub-agents",title:"Sub-agents (⌘U)","data-hotkey":"⌘U","data-hotkey-dir":"down",onClick:()=>{rt(null),fe(A=>!A)},children:[d.jsx(Lk,{}),lr>0?d.jsx("span",{className:"detail-action-count",children:lr}):null]}):null]}):null,d.jsx("button",{type:"button",className:"detail-action focus-toggle","aria-pressed":Et,"aria-label":Et?"Show sidebar":"Focus mode (hide sidebar)",title:Et?"Show sidebar (⌘B)":"Focus mode (hide sidebar) (⌘B)","data-hotkey":"⌘B","data-hotkey-dir":"down",onClick:it,children:d.jsx(CD,{})})]})]}),d.jsx("div",{className:"detail-body",ref:Lt,children:d.jsx(iC.Provider,{value:a,children:ve&&ve.kind==="terminal"?d.jsx(z5,{sessionId:ve.id,capture:e.capture,requestCapture:e.requestCapture,clearCapture:e.clearCapture,sendText:e.sendPaneText,sendKey:e.sendPaneKey}):ve&&!ve.transcriptPath?d.jsxs("div",{className:"thread-root",children:[d.jsx("div",{className:"thread-fade","aria-hidden":"true"}),(()=>{const A=mt?e.subagents.find(L=>L.agentId===mt)??null:null;return A?d.jsxs("div",{className:"agent-inline-view",children:[d.jsxs("div",{className:"agent-inline-head",children:[d.jsx("button",{type:"button",className:"agent-inline-back","aria-label":"Back to live pane",onClick:ar,children:"‹ back"}),d.jsxs("span",{className:"agent-inline-title",children:[d.jsx("span",{className:"sa-dot","data-status":A.status,"aria-hidden":"true"}),d.jsx("span",{className:"agent-inline-name",children:A.agentType||"sub-agent"}),d.jsx("span",{className:"agent-inline-status",children:A.status==="running"?"· running":"· done"})]})]}),d.jsx(Dm,{messages:A.messages})]}):d.jsxs(d.Fragment,{children:[d.jsx(L5,{sessionId:ve.id,capture:e.capture,requestCapture:e.requestCapture,clearCapture:e.clearCapture}),S.length>0?d.jsx("div",{className:"live-pending","aria-label":"Queued sends",children:S.map(L=>d.jsxs("div",{className:"live-pending-bubble",children:[d.jsx("span",{className:"live-pending-dot","aria-hidden":"true"}),L.label]},L.key))}):null]})})(),d.jsx(dC,{subagents:e.subagents,onOpenAgent:yi,viewingAgentId:mt}),d.jsx(uC,{disabled:!1,sessionId:e.selectedId,subAgentMode:qt,onSubAgentModeChange:Kt,onTerminalModeChange:h,working:An,onStop:fn})]}):d.jsxs("div",{className:"detail-split",children:[d.jsx(tC.Provider,{value:Rr,children:d.jsx(k5,{hasSelection:!!e.selectedId,loading:!e.messagesLoaded,sessionId:e.selectedId,hiddenCount:C,onLoadEarlier:R,subAgentMode:qt,onSubAgentModeChange:Kt,onTerminalModeChange:h,subagents:e.subagents,onOpenAgent:yi,viewingAgent:mt?e.subagents.find(A=>A.agentId===mt)??null:null,onCloseAgent:ar,working:An,onStop:fn})}),d.jsx(M5,{}),d.jsx(pU,{open:X,onClose:()=>I(!1)})]})})})]})]}),e.pending&&e.pending.toolUseId!==J?d.jsx(B5,{pending:e.pending,capture:e.capture,onAnswer:(A,L)=>{e.sendAnswer(A,L),te(A),e.clearCapture(),e.selectedId&&g({sessionId:e.selectedId,baseCount:e.messages.length})},onCapture:e.requestCapture,onClose:()=>{te(e.pending?.toolUseId??null),e.clearCapture()}},e.pending.toolUseId):null,B?d.jsx(H5,{onClose:()=>z(!1),onToast:i}):null,Se.map(A=>d.jsx(Y5,{sessionId:A,visible:A===e.selectedId&&nt,label:e.sessions.find(L=>L.id===A)?.name??A,onClose:()=>We(!1)},A)),d.jsx(sU,{subagents:e.subagents,open:ie&&e.subagents.length>0,onClose:()=>fe(!1),focusAgentId:ut}),Er?d.jsx(oU,{power:e.resources.snapshot?.power??null,history:e.resourceHistory,onClose:()=>Tr(!1),onToast:i}):null,b?d.jsx(uU,{commands:vi,onClose:()=>H(!1)}):null,e.prompt&&!e.pending&&JSON.stringify(e.prompt)!==ae?d.jsx(Z5,{prompt:e.prompt,agentName:ve?.kind==="codex"?"Codex":"Claude",planMarkdown:k,onKey:A=>e.sendPromptKey(A),onSelect:A=>e.selectedId?e.sendPromptSelect(e.selectedId,A):!1,onClose:()=>So(JSON.stringify(e.prompt))}):null,d.jsx(dU,{}),d.jsx($5,{toast:n})]})})})}function CU(){return d.jsx(Q5,{children:d.jsx(kU,{})})}const vC=document.getElementById("root");if(!vC)throw new Error("#root not found");tb(vC).render(d.jsx(m.StrictMode,{children:d.jsx(CU,{})}));export{Va as g};
|