@ycodium-ai/plugin-conversation 0.2.2098 → 0.2.2106

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/assets/ui.js CHANGED
@@ -1,4 +1,4 @@
1
- var JD=Object.create;var af=Object.defineProperty;var ZD=Object.getOwnPropertyDescriptor;var e1=Object.getOwnPropertyNames;var t1=Object.getPrototypeOf,n1=Object.prototype.hasOwnProperty;var o1=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var sf=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},An=(e,t)=>{for(var n in t)af(e,n,{get:t[n],enumerable:!0})},Gb=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of e1(t))!n1.call(e,r)&&r!==n&&af(e,r,{get:()=>t[r],enumerable:!(o=ZD(t,r))||o.enumerable});return e};var Sd=(e,t,n)=>(n=e!=null?JD(t1(e)):{},Gb(t||!e||!e.__esModule?af(n,"default",{value:e,enumerable:!0}):n,e)),jb=e=>Gb(af({},"__esModule",{value:!0}),e);var df={};An(df,{Activity:()=>a1,Children:()=>ah,Component:()=>Ui,Fragment:()=>Ja,Profiler:()=>i1,PureComponent:()=>s1,StrictMode:()=>l1,Suspense:()=>ih,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>d1,__COMPILER_RUNTIME:()=>c1,act:()=>u1,cache:()=>f1,cacheSignal:()=>p1,captureOwnerStack:()=>m1,cloneElement:()=>lf,createContext:()=>Ht,createElement:()=>Te,createRef:()=>g1,default:()=>hn,forwardRef:()=>Wn,isValidElement:()=>sh,lazy:()=>h1,memo:()=>ue,startTransition:()=>v1,unstable_useCacheRefresh:()=>x1,use:()=>Ut,useActionState:()=>y1,useCallback:()=>B,useContext:()=>fn,useDebugValue:()=>C1,useDeferredValue:()=>b1,useEffect:()=>q,useEffectEvent:()=>lh,useId:()=>Wr,useImperativeHandle:()=>Gr,useInsertionEffect:()=>wd,useLayoutEffect:()=>ye,useMemo:()=>z,useOptimistic:()=>I1,useReducer:()=>Za,useRef:()=>_,useState:()=>G,useSyncExternalStore:()=>xa,useTransition:()=>S1,version:()=>w1});var Xb,hn,a1,ah,Ui,Ja,i1,s1,l1,ih,d1,c1,u1,f1,p1,m1,lf,Ht,Te,g1,Wn,sh,h1,ue,v1,x1,Ut,y1,B,fn,C1,b1,q,lh,Wr,Gr,wd,ye,z,I1,Za,_,G,xa,S1,w1,me=o1(()=>{Xb=window.__ycodiumPluginHost.react,hn=Xb,{Activity:a1,Children:ah,Component:Ui,Fragment:Ja,Profiler:i1,PureComponent:s1,StrictMode:l1,Suspense:ih,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:d1,__COMPILER_RUNTIME:c1,act:u1,cache:f1,cacheSignal:p1,captureOwnerStack:m1,cloneElement:lf,createContext:Ht,createElement:Te,createRef:g1,forwardRef:Wn,isValidElement:sh,lazy:h1,memo:ue,startTransition:v1,unstable_useCacheRefresh:x1,use:Ut,useActionState:y1,useCallback:B,useContext:fn,useDebugValue:C1,useDeferredValue:b1,useEffect:q,useEffectEvent:lh,useId:Wr,useImperativeHandle:Gr,useInsertionEffect:wd,useLayoutEffect:ye,useMemo:z,useOptimistic:I1,useReducer:Za,useRef:_,useState:G,useSyncExternalStore:xa,useTransition:S1,version:w1}=Xb});var w0=sf(To=>{"use strict";var bB=(me(),jb(df));function S0(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function ci(){}var wo={d:{f:ci,r:function(){throw Error(S0(522))},D:ci,C:ci,L:ci,m:ci,X:ci,S:ci,M:ci},p:0,findDOMNode:null},IB=Symbol.for("react.portal");function SB(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:IB,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}var fc=bB.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function jf(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}To.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=wo;To.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(S0(299));return SB(e,t,null,n)};To.flushSync=function(e){var t=fc.T,n=wo.p;try{if(fc.T=null,wo.p=2,e)return e()}finally{fc.T=t,wo.p=n,wo.d.f()}};To.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,wo.d.C(e,t))};To.prefetchDNS=function(e){typeof e=="string"&&wo.d.D(e)};To.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,o=jf(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,a=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?wo.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:o,integrity:r,fetchPriority:a}):n==="script"&&wo.d.X(e,{crossOrigin:o,integrity:r,fetchPriority:a,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};To.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=jf(t.as,t.crossOrigin);wo.d.M(e,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&wo.d.M(e)};To.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,o=jf(n,t.crossOrigin);wo.d.L(e,n,{crossOrigin:o,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};To.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=jf(t.as,t.crossOrigin);wo.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else wo.d.m(e)};To.requestFormReset=function(e){wo.d.r(e)};To.unstable_batchedUpdates=function(e,t){return e(t)};To.useFormState=function(e,t,n){return fc.H.useFormState(e,t,n)};To.useFormStatus=function(){return fc.H.useHostTransitionStatus()};To.version="19.2.6"});var pc=sf((cZ,L0)=>{"use strict";function T0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(T0)}catch(e){console.error(e)}}T0(),L0.exports=w0()});var _M=sf(NM=>{"use strict";var ad=(me(),jb(df));function AK(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var EK=typeof Object.is=="function"?Object.is:AK,MK=ad.useState,RK=ad.useEffect,NK=ad.useLayoutEffect,_K=ad.useDebugValue;function DK(e,t){var n=t(),o=MK({inst:{value:n,getSnapshot:t}}),r=o[0].inst,a=o[1];return NK(function(){r.value=n,r.getSnapshot=t,eC(r)&&a({inst:r})},[e,n,t]),RK(function(){return eC(r)&&a({inst:r}),e(function(){eC(r)&&a({inst:r})})},[e]),_K(n),n}function eC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!EK(e,n)}catch{return!0}}function OK(e,t){return t()}var FK=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?OK:DK;NM.useSyncExternalStore=ad.useSyncExternalStore!==void 0?ad.useSyncExternalStore:FK});var OM=sf((sle,DM)=>{"use strict";DM.exports=_M()});var Qb=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
1
+ var d1=Object.create;var hf=Object.defineProperty;var c1=Object.getOwnPropertyDescriptor;var u1=Object.getOwnPropertyNames;var f1=Object.getPrototypeOf,p1=Object.prototype.hasOwnProperty;var m1=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var vf=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},Mn=(e,t)=>{for(var n in t)hf(e,n,{get:t[n],enumerable:!0})},nI=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of u1(t))!p1.call(e,r)&&r!==n&&hf(e,r,{get:()=>t[r],enumerable:!(o=c1(t,r))||o.enumerable});return e};var Rd=(e,t,n)=>(n=e!=null?d1(f1(e)):{},nI(t||!e||!e.__esModule?hf(n,"default",{value:e,enumerable:!0}):n,e)),oI=e=>nI(hf({},"__esModule",{value:!0}),e);var yf={};Mn(yf,{Activity:()=>h1,Children:()=>ch,Component:()=>qi,Fragment:()=>ii,Profiler:()=>v1,PureComponent:()=>x1,StrictMode:()=>y1,Suspense:()=>uh,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>C1,__COMPILER_RUNTIME:()=>b1,act:()=>I1,cache:()=>S1,cacheSignal:()=>w1,captureOwnerStack:()=>T1,cloneElement:()=>xf,createContext:()=>Ut,createElement:()=>we,createRef:()=>k1,default:()=>mn,forwardRef:()=>qn,isValidElement:()=>fh,lazy:()=>L1,memo:()=>de,startTransition:()=>P1,unstable_useCacheRefresh:()=>A1,use:()=>Kt,useActionState:()=>E1,useCallback:()=>B,useContext:()=>ln,useDebugValue:()=>M1,useDeferredValue:()=>R1,useEffect:()=>K,useEffectEvent:()=>ph,useId:()=>Xr,useImperativeHandle:()=>Yr,useInsertionEffect:()=>Nd,useLayoutEffect:()=>xe,useMemo:()=>z,useOptimistic:()=>N1,useReducer:()=>si,useRef:()=>D,useState:()=>G,useSyncExternalStore:()=>ka,useTransition:()=>_1,version:()=>D1});var aI,mn,h1,ch,qi,ii,v1,x1,y1,uh,C1,b1,I1,S1,w1,T1,xf,Ut,we,k1,qn,fh,L1,de,P1,A1,Kt,E1,B,ln,M1,R1,K,ph,Xr,Yr,Nd,xe,z,N1,si,D,G,ka,_1,D1,ge=m1(()=>{aI=window.__ycodiumPluginHost.react,mn=aI,{Activity:h1,Children:ch,Component:qi,Fragment:ii,Profiler:v1,PureComponent:x1,StrictMode:y1,Suspense:uh,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:C1,__COMPILER_RUNTIME:b1,act:I1,cache:S1,cacheSignal:w1,captureOwnerStack:T1,cloneElement:xf,createContext:Ut,createElement:we,createRef:k1,forwardRef:qn,isValidElement:fh,lazy:L1,memo:de,startTransition:P1,unstable_useCacheRefresh:A1,use:Kt,useActionState:E1,useCallback:B,useContext:ln,useDebugValue:M1,useDeferredValue:R1,useEffect:K,useEffectEvent:ph,useId:Xr,useImperativeHandle:Yr,useInsertionEffect:Nd,useLayoutEffect:xe,useMemo:z,useOptimistic:N1,useReducer:si,useRef:D,useState:G,useSyncExternalStore:ka,useTransition:_1,version:D1}=aI});var N0=vf(wo=>{"use strict";var RB=(ge(),oI(yf));function R0(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function xi(){}var So={d:{f:xi,r:function(){throw Error(R0(522))},D:xi,C:xi,L:xi,m:xi,X:xi,S:xi,M:xi},p:0,findDOMNode:null},NB=Symbol.for("react.portal");function _B(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:NB,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}var yc=RB.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function tp(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}wo.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=So;wo.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(R0(299));return _B(e,t,null,n)};wo.flushSync=function(e){var t=yc.T,n=So.p;try{if(yc.T=null,So.p=2,e)return e()}finally{yc.T=t,So.p=n,So.d.f()}};wo.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,So.d.C(e,t))};wo.prefetchDNS=function(e){typeof e=="string"&&So.d.D(e)};wo.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,o=tp(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,a=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?So.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:o,integrity:r,fetchPriority:a}):n==="script"&&So.d.X(e,{crossOrigin:o,integrity:r,fetchPriority:a,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};wo.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=tp(t.as,t.crossOrigin);So.d.M(e,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&So.d.M(e)};wo.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,o=tp(n,t.crossOrigin);So.d.L(e,n,{crossOrigin:o,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};wo.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=tp(t.as,t.crossOrigin);So.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else So.d.m(e)};wo.requestFormReset=function(e){So.d.r(e)};wo.unstable_batchedUpdates=function(e,t){return e(t)};wo.useFormState=function(e,t,n){return yc.H.useFormState(e,t,n)};wo.useFormStatus=function(){return yc.H.useHostTransitionStatus()};wo.version="19.2.6"});var Cc=vf((CZ,D0)=>{"use strict";function _0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_0)}catch(e){console.error(e)}}_0(),D0.exports=N0()});var QM=vf(jM=>{"use strict";var md=(ge(),oI(yf));function $K(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var HK=typeof Object.is=="function"?Object.is:$K,UK=md.useState,KK=md.useEffect,qK=md.useLayoutEffect,VK=md.useDebugValue;function WK(e,t){var n=t(),o=UK({inst:{value:n,getSnapshot:t}}),r=o[0].inst,a=o[1];return qK(function(){r.value=n,r.getSnapshot=t,iC(r)&&a({inst:r})},[e,n,t]),KK(function(){return iC(r)&&a({inst:r}),e(function(){iC(r)&&a({inst:r})})},[e]),VK(n),n}function iC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!HK(e,n)}catch{return!0}}function GK(e,t){return t()}var jK=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?GK:WK;jM.useSyncExternalStore=md.useSyncExternalStore!==void 0?md.useSyncExternalStore:jK});var YM=vf((Rle,XM)=>{"use strict";XM.exports=QM()});var rI=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
2
2
  @layer properties;
3
3
  :root, :host {
4
4
  --radius-lg: var(--radius);
@@ -258,9 +258,6 @@ var JD=Object.create;var af=Object.defineProperty;var ZD=Object.getOwnPropertyDe
258
258
  .-my-1 {
259
259
  margin-block: calc(var(--spacing, 0.25rem) * -1);
260
260
  }
261
- .-ms-2\\.5 {
262
- margin-inline-start: calc(var(--spacing, 0.25rem) * -2.5);
263
- }
264
261
  .-ms-3\\.5 {
265
262
  margin-inline-start: calc(var(--spacing, 0.25rem) * -3.5);
266
263
  }
@@ -615,12 +612,18 @@ var JD=Object.create;var af=Object.defineProperty;var ZD=Object.getOwnPropertyDe
615
612
  .max-w-3xl {
616
613
  max-width: var(--container-3xl, 48rem);
617
614
  }
615
+ .max-w-36 {
616
+ max-width: calc(var(--spacing, 0.25rem) * 36);
617
+ }
618
618
  .max-w-40 {
619
619
  max-width: calc(var(--spacing, 0.25rem) * 40);
620
620
  }
621
621
  .max-w-42 {
622
622
  max-width: calc(var(--spacing, 0.25rem) * 42);
623
623
  }
624
+ .max-w-44 {
625
+ max-width: calc(var(--spacing, 0.25rem) * 44);
626
+ }
624
627
  .max-w-48 {
625
628
  max-width: calc(var(--spacing, 0.25rem) * 48);
626
629
  }
@@ -3665,74 +3668,74 @@ var JD=Object.create;var af=Object.defineProperty;var ZD=Object.getOwnPropertyDe
3665
3668
  }
3666
3669
  }
3667
3670
  }
3668
- `;me();me();var Yb=Ht(null),Jb=Yb.Provider,Zb=Ht(""),eI=Zb.Provider;function cf(){return fn(Zb)}function Xo(){let e=fn(Yb);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var dh="conversation";var ch="__ycodiumConversationBridge",tI="ycodium.conversation.rebindable-bridge.v1";me();function nI(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=nI(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function oI(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=nI(e))&&(o&&(o+=" "),o+=t);return o}var rI=oI;var T1=(e,t)=>{let n=new Array(e.length+t.length);for(let o=0;o<e.length;o++)n[o]=e[o];for(let o=0;o<t.length;o++)n[e.length+o]=t[o];return n},L1=(e,t)=>({classGroupId:e,validator:t}),fI=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var aI=[],k1="arbitrary..",P1=e=>{let t=E1(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return A1(i);let s=i.split("-"),l=s[0]===""&&s.length>1?1:0;return pI(s,l,t)},getConflictingClassGroupIds:(i,s)=>{if(s){let l=o[i],d=n[i];return l?d?T1(d,l):l:d||aI}return n[i]||aI}}},pI=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let d=pI(e,t+1,a);if(d)return d}let i=n.validators;if(i===null)return;let s=t===0?e.join("-"):e.slice(t).join("-"),l=i.length;for(let d=0;d<l;d++){let c=i[d];if(c.validator(s))return c.classGroupId}},A1=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(":"),o=t.slice(0,n);return o?k1+o:void 0})(),E1=e=>{let{theme:t,classGroups:n}=e;return M1(n,t)},M1=(e,t)=>{let n=fI();for(let o in e){let r=e[o];ph(r,n,o,t)}return n},ph=(e,t,n,o)=>{let r=e.length;for(let a=0;a<r;a++){let i=e[a];R1(i,t,n,o)}},R1=(e,t,n,o)=>{if(typeof e=="string"){N1(e,t,n);return}if(typeof e=="function"){_1(e,t,n,o);return}D1(e,t,n,o)},N1=(e,t,n)=>{let o=e===""?t:mI(t,e);o.classGroupId=n},_1=(e,t,n,o)=>{if(O1(e)){ph(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(L1(n,e))},D1=(e,t,n,o)=>{let r=Object.entries(e),a=r.length;for(let i=0;i<a;i++){let[s,l]=r[i];ph(l,mI(t,s),n,o)}},mI=(e,t)=>{let n=e,o=t.split("-"),r=o.length;for(let a=0;a<r;a++){let i=o[a],s=n.nextPart.get(i);s||(s=fI(),n.nextPart.set(i,s)),n=s}return n},O1=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,F1=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null),r=(a,i)=>{n[a]=i,t++,t>e&&(t=0,o=n,n=Object.create(null))};return{get(a){let i=n[a];if(i!==void 0)return i;if((i=o[a])!==void 0)return r(a,i),i},set(a,i){a in n?n[a]=i:r(a,i)}}};var B1=[],iI=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),z1=e=>{let{prefix:t,experimentalParseClassName:n}=e,o=r=>{let a=[],i=0,s=0,l=0,d,c=r.length;for(let g=0;g<c;g++){let v=r[g];if(i===0&&s===0){if(v===":"){a.push(r.slice(l,g)),l=g+1;continue}if(v==="/"){d=g;continue}}v==="["?i++:v==="]"?i--:v==="("?s++:v===")"&&s--}let f=a.length===0?r:r.slice(l),p=f,m=!1;f.endsWith("!")?(p=f.slice(0,-1),m=!0):f.startsWith("!")&&(p=f.slice(1),m=!0);let h=d&&d>l?d-l:void 0;return iI(a,m,p,h)};if(t){let r=t+":",a=o;o=i=>i.startsWith(r)?a(i.slice(r.length)):iI(B1,!1,i,void 0,!0)}if(n){let r=o;o=a=>n({className:a,parseClassName:r})}return o},$1=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((n,o)=>{t.set(n,1e6+o)}),n=>{let o=[],r=[];for(let a=0;a<n.length;a++){let i=n[a],s=i[0]==="[",l=t.has(i);s||l?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(i)):r.push(i)}return r.length>0&&(r.sort(),o.push(...r)),o}},H1=e=>({cache:F1(e.cacheSize),parseClassName:z1(e),sortModifiers:$1(e),postfixLookupClassGroupIds:U1(e),...P1(e)}),U1=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let o=0;o<n.length;o++)t[n[o]]=!0;return t},K1=/\s+/,q1=(e,t)=>{let{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:i}=t,s=[],l=e.trim().split(K1),d="";for(let c=l.length-1;c>=0;c-=1){let f=l[c],{isExternal:p,modifiers:m,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:v}=n(f);if(p){d=f+(d.length>0?" "+d:d);continue}let x=!!v,y;if(x){let L=g.substring(0,v);y=o(L);let I=y&&i[y]?o(g):void 0;I&&I!==y&&(y=I,x=!1)}else y=o(g);if(!y){if(!x){d=f+(d.length>0?" "+d:d);continue}if(y=o(g),!y){d=f+(d.length>0?" "+d:d);continue}x=!1}let C=m.length===0?"":m.length===1?m[0]:a(m).join(":"),w=h?C+"!":C,k=w+y;if(s.indexOf(k)>-1)continue;s.push(k);let S=r(y,x);for(let L=0;L<S.length;++L){let I=S[L];s.push(w+I)}d=f+(d.length>0?" "+d:d)}return d},V1=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=gI(n))&&(r&&(r+=" "),r+=o);return r},gI=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=gI(e[o]))&&(n&&(n+=" "),n+=t);return n},sI=(e,...t)=>{let n,o,r,a,i=l=>{let d=t.reduce((c,f)=>f(c),e());return n=H1(d),o=n.cache.get,r=n.cache.set,a=s,s(l)},s=l=>{let d=o(l);if(d)return d;let c=q1(l,n);return r(l,c),c};return a=i,(...l)=>a(V1(...l))},W1=[],Dn=e=>{let t=n=>n[e]||W1;return t.isThemeGetter=!0,t},hI=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,vI=/^\((?:(\w[\w-]*):)?(.+)\)$/i,G1=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,j1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Q1=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,X1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Y1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,J1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ei=e=>G1.test(e),it=e=>!!e&&!Number.isNaN(Number(e)),jr=e=>!!e&&Number.isInteger(Number(e)),uh=e=>e.endsWith("%")&&it(e.slice(0,-1)),ya=e=>j1.test(e),xI=()=>!0,Z1=e=>Q1.test(e)&&!X1.test(e),mh=()=>!1,eO=e=>Y1.test(e),tO=e=>J1.test(e),nO=e=>!Le(e)&&!ke(e),oO=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),rO=e=>ti(e,bI,mh),Le=e=>hI.test(e),Ki=e=>ti(e,II,Z1),lI=e=>ti(e,fO,it),aO=e=>ti(e,wI,xI),iO=e=>ti(e,SI,mh),dI=e=>ti(e,yI,mh),sO=e=>ti(e,CI,tO),uf=e=>ti(e,TI,eO),ke=e=>vI.test(e),Td=e=>qi(e,II),lO=e=>qi(e,SI),cI=e=>qi(e,yI),dO=e=>qi(e,bI),cO=e=>qi(e,CI),ff=e=>qi(e,TI,!0),uO=e=>qi(e,wI,!0),ti=(e,t,n)=>{let o=hI.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},qi=(e,t,n=!1)=>{let o=vI.exec(e);return o?o[1]?t(o[1]):n:!1},yI=e=>e==="position"||e==="percentage",CI=e=>e==="image"||e==="url",bI=e=>e==="length"||e==="size"||e==="bg-size",II=e=>e==="length",fO=e=>e==="number",SI=e=>e==="family-name",wI=e=>e==="number"||e==="weight",TI=e=>e==="shadow";var uI=()=>{let e=Dn("color"),t=Dn("font"),n=Dn("text"),o=Dn("font-weight"),r=Dn("tracking"),a=Dn("leading"),i=Dn("breakpoint"),s=Dn("container"),l=Dn("spacing"),d=Dn("radius"),c=Dn("shadow"),f=Dn("inset-shadow"),p=Dn("text-shadow"),m=Dn("drop-shadow"),h=Dn("blur"),g=Dn("perspective"),v=Dn("aspect"),x=Dn("ease"),y=Dn("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...w(),ke,Le],S=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],I=()=>[ke,Le,l],T=()=>[ei,"full","auto",...I()],E=()=>[jr,"none","subgrid",ke,Le],A=()=>["auto",{span:["full",jr,ke,Le]},jr,ke,Le],N=()=>[jr,"auto",ke,Le],R=()=>["auto","min","max","fr",ke,Le],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],K=()=>["auto",...I()],O=()=>[ei,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],oe=()=>[ei,"screen","full","dvw","lvw","svw","min","max","fit",...I()],ee=()=>[ei,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],W=()=>[e,ke,Le],qe=()=>[...w(),cI,dI,{position:[ke,Le]}],ve=()=>["no-repeat",{repeat:["","x","y","space","round"]}],fe=()=>["auto","cover","contain",dO,rO,{size:[ke,Le]}],Ne=()=>[uh,Td,Ki],Ae=()=>["","none","full",d,ke,Le],ae=()=>["",it,Td,Ki],Ee=()=>["solid","dashed","dotted","double"],xe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[it,uh,cI,dI],Ie=()=>["","none",h,ke,Le],st=()=>["none",it,ke,Le],dt=()=>["none",it,ke,Le],lt=()=>[it,ke,Le],ct=()=>[ei,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ya],breakpoint:[ya],color:[xI],container:[ya],"drop-shadow":[ya],ease:["in","out","in-out"],font:[nO],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ya],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ya],shadow:[ya],spacing:["px",it],text:[ya],"text-shadow":[ya],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ei,Le,ke,v]}],container:["container"],"container-type":[{"@container":["","normal","size",ke,Le]}],"container-named":[oO],columns:[{columns:[it,Le,ke,s]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[jr,"auto",ke,Le]}],basis:[{basis:[ei,"full","auto",s,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[it,ei,"auto","initial","none",Le]}],grow:[{grow:["",it,ke,Le]}],shrink:[{shrink:["",it,ke,Le]}],order:[{order:[jr,"first","last","none",ke,Le]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:K()}],mx:[{mx:K()}],my:[{my:K()}],ms:[{ms:K()}],me:[{me:K()}],mbs:[{mbs:K()}],mbe:[{mbe:K()}],mt:[{mt:K()}],mr:[{mr:K()}],mb:[{mb:K()}],ml:[{ml:K()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:O()}],"inline-size":[{inline:["auto",...oe()]}],"min-inline-size":[{"min-inline":["auto",...oe()]}],"max-inline-size":[{"max-inline":["none",...oe()]}],"block-size":[{block:["auto",...ee()]}],"min-block-size":[{"min-block":["auto",...ee()]}],"max-block-size":[{"max-block":["none",...ee()]}],w:[{w:[s,"screen",...O()]}],"min-w":[{"min-w":[s,"screen","none",...O()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...O()]}],h:[{h:["screen","lh",...O()]}],"min-h":[{"min-h":["screen","lh","none",...O()]}],"max-h":[{"max-h":["screen","lh",...O()]}],"font-size":[{text:["base",n,Td,Ki]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,uO,aO]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",uh,Le]}],"font-family":[{font:[lO,iO,t]}],"font-features":[{"font-features":[Le]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,ke,Le]}],"line-clamp":[{"line-clamp":[it,"none",ke,lI]}],leading:[{leading:[a,...I()]}],"list-image":[{"list-image":["none",ke,Le]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ke,Le]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[it,"from-font","auto",ke,Ki]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[it,"auto",ke,Le]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"tab-size":[{tab:[jr,ke,Le]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke,Le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke,Le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:qe()}],"bg-repeat":[{bg:ve()}],"bg-size":[{bg:fe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},jr,ke,Le],radial:["",ke,Le],conic:[jr,ke,Le]},cO,sO]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:Ne()}],"gradient-via-pos":[{via:Ne()}],"gradient-to-pos":[{to:Ne()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:Ae()}],"rounded-s":[{"rounded-s":Ae()}],"rounded-e":[{"rounded-e":Ae()}],"rounded-t":[{"rounded-t":Ae()}],"rounded-r":[{"rounded-r":Ae()}],"rounded-b":[{"rounded-b":Ae()}],"rounded-l":[{"rounded-l":Ae()}],"rounded-ss":[{"rounded-ss":Ae()}],"rounded-se":[{"rounded-se":Ae()}],"rounded-ee":[{"rounded-ee":Ae()}],"rounded-es":[{"rounded-es":Ae()}],"rounded-tl":[{"rounded-tl":Ae()}],"rounded-tr":[{"rounded-tr":Ae()}],"rounded-br":[{"rounded-br":Ae()}],"rounded-bl":[{"rounded-bl":Ae()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ee(),"hidden","none"]}],"divide-style":[{divide:[...Ee(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-bs":[{"border-bs":W()}],"border-color-be":[{"border-be":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...Ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[it,ke,Le]}],"outline-w":[{outline:["",it,Td,Ki]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",c,ff,uf]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",f,ff,uf]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[it,Ki]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",p,ff,uf]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[it,ke,Le]}],"mix-blend":[{"mix-blend":[...xe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":xe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[it]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[ke,Le]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[it]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:qe()}],"mask-repeat":[{mask:ve()}],"mask-size":[{mask:fe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ke,Le]}],filter:[{filter:["","none",ke,Le]}],blur:[{blur:Ie()}],brightness:[{brightness:[it,ke,Le]}],contrast:[{contrast:[it,ke,Le]}],"drop-shadow":[{"drop-shadow":["","none",m,ff,uf]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",it,ke,Le]}],"hue-rotate":[{"hue-rotate":[it,ke,Le]}],invert:[{invert:["",it,ke,Le]}],saturate:[{saturate:[it,ke,Le]}],sepia:[{sepia:["",it,ke,Le]}],"backdrop-filter":[{"backdrop-filter":["","none",ke,Le]}],"backdrop-blur":[{"backdrop-blur":Ie()}],"backdrop-brightness":[{"backdrop-brightness":[it,ke,Le]}],"backdrop-contrast":[{"backdrop-contrast":[it,ke,Le]}],"backdrop-grayscale":[{"backdrop-grayscale":["",it,ke,Le]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[it,ke,Le]}],"backdrop-invert":[{"backdrop-invert":["",it,ke,Le]}],"backdrop-opacity":[{"backdrop-opacity":[it,ke,Le]}],"backdrop-saturate":[{"backdrop-saturate":[it,ke,Le]}],"backdrop-sepia":[{"backdrop-sepia":["",it,ke,Le]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ke,Le]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[it,"initial",ke,Le]}],ease:[{ease:["linear","initial",x,ke,Le]}],delay:[{delay:[it,ke,Le]}],animate:[{animate:["none",y,ke,Le]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,ke,Le]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:st()}],"rotate-x":[{"rotate-x":st()}],"rotate-y":[{"rotate-y":st()}],"rotate-z":[{"rotate-z":st()}],scale:[{scale:dt()}],"scale-x":[{"scale-x":dt()}],"scale-y":[{"scale-y":dt()}],"scale-z":[{"scale-z":dt()}],"scale-3d":["scale-3d"],skew:[{skew:lt()}],"skew-x":[{"skew-x":lt()}],"skew-y":[{"skew-y":lt()}],transform:[{transform:[ke,Le,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ct()}],"translate-x":[{"translate-x":ct()}],"translate-y":[{"translate-y":ct()}],"translate-z":[{"translate-z":ct()}],"translate-none":["translate-none"],zoom:[{zoom:[jr,ke,Le]}],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ke,Le]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":W()}],"scrollbar-track-color":[{"scrollbar-track":W()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ke,Le]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[it,Td,Ki,lI]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},pO=(e,{cacheSize:t,prefix:n,experimentalParseClassName:o,extend:r={},override:a={}})=>(ll(e,"cacheSize",t),ll(e,"prefix",n),ll(e,"experimentalParseClassName",o),pf(e.theme,a.theme),pf(e.classGroups,a.classGroups),pf(e.conflictingClassGroups,a.conflictingClassGroups),pf(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),ll(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),ll(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),mf(e.theme,r.theme),mf(e.classGroups,r.classGroups),mf(e.conflictingClassGroups,r.conflictingClassGroups),mf(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),fh(e,r,"postfixLookupClassGroups"),fh(e,r,"orderSensitiveModifiers"),e),ll=(e,t,n)=>{n!==void 0&&(e[t]=n)},pf=(e,t)=>{if(t)for(let n in t)ll(e,n,t[n])},mf=(e,t)=>{if(t)for(let n in t)fh(e,t,n)},fh=(e,t,n)=>{let o=t[n];o!==void 0&&(e[n]=e[n]?e[n].concat(o):o)},LI=(e,...t)=>typeof e=="function"?sI(uI,e,...t):sI(()=>pO(uI(),e),...t);var mO=LI({extend:{classGroups:{"font-size":[{text:["chat","chat-row","chat-code","chat-dense","chat-meta","control-1","control-2","control-3","control-4","control-5"]}]}}});function F(...e){return mO(rI(e))}me();var gh=Ht(!0);var hh=Ht(void 0);function ni(){let e=Ut(gh);return Ut(hh)??e}me();var gf=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();var kI=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var PI=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase());var vh=e=>{let t=PI(e);return t.charAt(0).toUpperCase()+t.slice(1)};me();var AI={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var EI=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var MI=Wn(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:a,iconNode:i,...s},l)=>Te("svg",{ref:l,...AI,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:gf("lucide",r),...!a&&!EI(s)&&{"aria-hidden":"true"},...s},[...i.map(([d,c])=>Te(d,c)),...Array.isArray(a)?a:[a]]));var j=(e,t)=>{let n=Wn(({className:o,...r},a)=>Te(MI,{ref:a,iconNode:t,className:gf(`lucide-${kI(vh(e))}`,`lucide-${e}`,o),...r}));return n.displayName=vh(e),n};var gO=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ld=j("arrow-down",gO);var hO=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],kd=j("arrow-up-right",hO);var vO=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Pd=j("arrow-up",vO);var xO=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],Ad=j("blocks",xO);var yO=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],dl=j("bookmark",yO);var CO=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Vi=j("bot",CO);var bO=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Io=j("check",bO);var IO=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],pn=j("chevron-down",IO);var SO=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Wi=j("chevron-left",SO);var wO=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Uo=j("chevron-right",wO);var TO=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ed=j("chevron-up",TO);var LO=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Md=j("chevrons-left",LO);var kO=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Rd=j("chevrons-right",kO);var PO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],So=j("circle-alert",PO);var AO=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Gi=j("copy",AO);var EO=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Yo=j("ellipsis",EO);var MO=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Nd=j("eye",MO);var RO=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],ji=j("file-code",RO);var NO=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Qi=j("file-text",NO);var _O=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],_d=j("file",_O);var DO=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],oi=j("folder",DO);var OO=[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]],Dd=j("frame",OO);var FO=[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]],Od=j("git-branch-plus",FO);var BO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Fd=j("globe",BO);var zO=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Bd=j("grip-vertical",zO);var $O=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],zd=j("hammer",$O);var HO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Xi=j("image",HO);var UO=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Ca=j("layers",UO);var KO=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],$d=j("list-ordered",KO);var qO=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],Yi=j("list-todo",qO);var VO=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Hd=j("list",VO);var WO=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],ri=j("lock-open",WO);var GO=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Ud=j("lock",GO);var jO=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],Ji=j("message-circle",jO);var QO=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Zi=j("message-square",QO);var XO=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Kd=j("minimize-2",XO);var YO=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],Qr=j("mouse-pointer-click",YO);var JO=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],qd=j("package",JO);var ZO=[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]],es=j("paintbrush",ZO);var eF=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Ro=j("paperclip",eF);var tF=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Xr=j("pen-line",tF);var nF=[["path",{d:"M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13",key:"orapub"}],["path",{d:"m8 6 2-2",key:"115y1s"}],["path",{d:"m18 16 2-2",key:"ee94s4"}],["path",{d:"m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17",key:"cfq27r"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Vd=j("pencil-ruler",nF);var oF=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Wd=j("pencil",oF);var rF=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],ts=j("puzzle",rF);var aF=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],ns=j("rotate-ccw",aF);var iF=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],os=j("search",iF);var sF=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Gd=j("send",sF);var lF=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],jd=j("settings",lF);var dF=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],cl=j("sliders-horizontal",dF);var cF=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],ai=j("sparkles",cF);var uF=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],No=j("square-pen",uF);var fF=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Qd=j("square",fF);var pF=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],rs=j("star",pF);var mF=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ba=j("terminal",mF);var gF=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],Xd=j("text-quote",gF);var hF=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Yr=j("user-round",hF);var vF=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Yd=j("wrench",vF);var xF=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],jt=j("x",xF);var yF=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],as=j("zap",yF);me();function De(){return{t:Xo().i18n.usePluginTranslation()}}me();var CF=new Set(["Select","AlertDialog","Dialog","DropdownMenu","Menu","Popover","Tooltip","Combobox"]);function J(e){let t=n=>{let o=Xo(),r=cf(),a=ni(),i=o.ui[e];return Te(i,{...n,...CF.has(e)&&!a?{open:!1}:{},className:`${r} ${typeof n.className=="string"?n.className:""}`})};return t.displayName=e,t}var q9=J("useLinkContextMenu"),Ia=J("ProviderInstanceIcon"),RI=J("UserAvatar"),ul=J("Badge"),te=J("Button"),V9=J("Label"),hf=J("Input"),NI=J("Textarea"),W9=J("Switch"),Jd=J("Separator"),G9=J("Skeleton"),vf=J("Spinner"),j9=J("ScrollArea"),Q9=J("Card"),X9=J("CardAction"),Y9=J("CardContent"),J9=J("CardDescription"),Z9=J("CardFooter"),eQ=J("CardHeader"),tQ=J("CardTitle"),nQ=J("Empty"),oQ=J("EmptyContent"),rQ=J("EmptyDescription"),aQ=J("EmptyHeader"),iQ=J("EmptyMedia"),sQ=J("EmptyTitle"),lQ=J("InputGroup"),dQ=J("InputGroupAddon"),cQ=J("InputGroupInput"),uQ=J("DocumentPanel"),fQ=J("MasterDetail"),xf=J("Select"),pQ=J("SelectContent"),yf=J("SelectItem"),Cf=J("SelectPopup"),_I=J("SelectTrigger"),bf=J("SelectValue"),Zd=J("Toggle"),DI=J("ToggleGroup"),OI=J("AlertDialog"),FI=J("AlertDialogClose"),BI=J("AlertDialogDescription"),zI=J("AlertDialogFooter"),$I=J("AlertDialogHeader"),HI=J("AlertDialogPopup"),UI=J("AlertDialogTitle"),If=J("Dialog"),mQ=J("DialogClose"),Sf=J("DialogDescription"),wf=J("DialogFooter"),Tf=J("DialogHeader"),Lf=J("DialogPopup"),KI=J("DialogPanel"),kf=J("DialogTitle"),gQ=J("DialogTrigger"),hQ=J("DropdownMenu"),vQ=J("DropdownMenuContent"),xQ=J("DropdownMenuItem"),yQ=J("DropdownMenuTrigger"),Jo=J("Menu"),ec=J("MenuGroup"),CQ=J("MenuGroupLabel"),Zo=J("MenuItem"),er=J("MenuPopup"),Sa=J("MenuRadioGroup"),Cr=J("MenuRadioItem"),ii=J("MenuSeparator"),tr=J("MenuTrigger"),fl=J("Popover"),pl=J("PopoverPopup"),ml=J("PopoverTrigger"),qI=J("Table"),VI=J("TableBody"),si=J("TableCell"),is=J("TableHead"),WI=J("TableHeader"),Pf=J("TableRow"),Qe=J("Tooltip"),Xe=J("TooltipPopup"),Ye=J("TooltipTrigger"),GI=J("Collapsible"),jI=J("CollapsiblePanel"),QI=J("CollapsibleTrigger"),tc=J("Alert"),nc=J("AlertAction"),Af=J("AlertDescription"),xh=J("AlertTitle"),Ef=J("Kbd"),Mf=J("Command"),Rf=J("CommandGroup"),Nf=J("CommandItem"),_f=J("CommandList"),XI=J("Combobox"),YI=J("ComboboxEmpty"),JI=J("ComboboxInput"),gl=J("ComboboxItem"),ZI=J("ComboboxListVirtualized"),eS=J("TooltipProvider"),tS=J("StyledDiffCodeView"),nS=J("DevBackdropArt"),nr=J("Markdown"),oS=J("DiffView");var{jsx:u,jsxs:b,Fragment:be}=window.__ycodiumPluginHost.jsxRuntime;function rS({mode:e,onModeChange:t}){let{t:n}=De();return b(DI,{className:"shrink-0","data-view-mode-toggle":!0,size:"xs","aria-label":n("trajectory.toggleLabel"),variant:"segmented",value:[e],onValueChange:o=>{let r=o[0];(r==="chat"||r==="trajectory")&&t(r)},children:[b(Zd,{value:"chat","aria-label":n("trajectory.toggleChat"),children:[u(Zi,{"aria-hidden":!0}),n("trajectory.toggleChat")]}),b(Zd,{value:"trajectory","aria-label":n("trajectory.toggleTrajectory"),children:[u($d,{"aria-hidden":!0}),n("trajectory.toggleTrajectory")]})]})}function aS({mode:e,visible:t,chat:n,trajectory:o}){let r=e==="chat"?"chat":"trajectory";return u("div",{className:"relative flex min-h-0 flex-1 flex-col","aria-hidden":t?void 0:!0,inert:t?void 0:!0,"data-chat-view-pane":r,"data-pane-visible":t?"true":"false",children:u(hh,{value:t,children:r==="chat"?n:o})})}me();function co(){return{t:Xo().i18n.usePluginTranslation()}}function iS(e){if(e.cacheDisjoint!==!0)return null;let t=e.cachedInputTokens,n=e.inputTokens;if(t===void 0||n===void 0)return null;let o=t+n;if(o<=0)return null;if(t>=o)return"100%";let r=t/o*100;for(let a=0;a<=3;a+=1){let i=r.toFixed(a);if(Number.parseFloat(i)<100)return`${i}%`}return"99.9%"}function sS(e){let t,n,o,r=!0,a=!1;for(let i of e)i!==void 0&&(a=!0,i.cacheDisjoint!==!0&&(r=!1),i.outputTokens!==void 0&&(t=(t??0)+i.outputTokens),i.inputTokens!==void 0&&(n=(n??0)+i.inputTokens),i.cachedInputTokens!==void 0&&(o=(o??0)+i.cachedInputTokens));if(!(t===void 0&&n===void 0&&o===void 0))return{...a&&r?{cacheDisjoint:!0}:{},...t!==void 0?{outputTokens:t}:{},...n!==void 0?{inputTokens:n}:{},...o!==void 0?{cachedInputTokens:o}:{}}}function oc(e){return e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}var bF=ue(function({item:t,ordinal:n,usage:o,onSelect:r}){return b("button",{type:"button","data-turn-navigator-row":t.sectionKey,onClick:()=>r(t),className:"flex w-full cursor-pointer items-start gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent",children:[u("span",{className:"shrink-0 pt-px font-mono text-[10px] text-muted-foreground tabular-nums",children:n}),b("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[u("span",{className:"line-clamp-2 min-w-0 font-medium text-chat leading-snug",children:t.userText}),t.assistantText?b("span",{className:"flex items-baseline gap-2",children:[u("span",{className:"line-clamp-1 min-w-0 flex-1 text-[11px] text-muted-foreground leading-snug",children:t.assistantText}),o?.outputTokens!==void 0?u("span",{className:"shrink-0 font-mono text-[9px] text-muted-foreground tabular-nums",children:oc(o.outputTokens)}):null]}):null]})]})});function IF({totals:e}){let{t}=co();if(!e)return null;let n=iS(e),o=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:oc(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:oc(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:n===null?oc(e.cachedInputTokens):`${oc(e.cachedInputTokens)} (${n})`}].filter(r=>r!==null);return o.length===0?null:b("div",{className:"flex items-baseline gap-2 border-t px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:t("turnNavigator.usage")}),o.map(r=>b("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:[r.label," ",r.value]},r.label))]})}var SF=ue(function({getText:t,size:n="xs",variant:o="outline",className:r}){let{t:a}=co(),i=Xo().writeClipboard,[s,l]=G(!1),d=a("turnNavigator.copyMarkdown");return b(Qe,{children:[u(Ye,{render:u(te,{"aria-label":d,disabled:s,onClick:()=>{i(t()).then(()=>{l(!0),window.setTimeout(()=>l(!1),1e3)})},type:"button",size:n,variant:o,className:F("text-muted-foreground hover:text-foreground",r)}),children:s?u(Io,{className:"size-3 text-primary"}):u(Gi,{className:"size-3"})}),u(Xe,{children:u("p",{children:d})})]})});function lS({items:e,totalTurnCount:t,bottomInset:n,usageByTurnId:o,onSelect:r,exportMarkdown:a,onDownload:i,placement:s="float"}){let{t:l}=co(),[d,c]=G(!1),f=z(()=>e.map((g,v)=>({item:g,ordinal:v+1})).reverse(),[e]),p=z(()=>sS(f.map(({item:g})=>g.turnId===null?void 0:o.get(g.turnId))),[f,o]);if(e.length===0)return null;let m=t??e.length,h=l("turnNavigator.open",{count:m});return b(fl,{onOpenChange:c,open:d,children:[b(ml,{render:u(te,{"aria-label":h,className:F("gap-1.5 rounded-full px-3",s==="float"&&"absolute right-3 z-40"),"data-testid":"turn-navigator-pill",size:"xs",style:s==="float"?{bottom:n+12}:void 0,title:h,variant:"glass"}),children:[u(Hd,{"aria-hidden":!0}),u("span",{className:"font-mono font-semibold text-[11px] tabular-nums",children:m})]}),u(pl,{align:"end",className:"w-80 flex-col",side:"top",children:b("div",{className:"flex max-h-[min(60vh,26rem)] flex-col",children:[b("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.title")}),u("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums",children:m})]}),u("div",{className:F("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:f.map(({item:g,ordinal:v})=>u(bF,{item:g,onSelect:x=>{c(!1),r(x)},ordinal:v,usage:g.turnId===null?void 0:o.get(g.turnId)},g.sectionKey))}),u(IF,{totals:p}),b("div",{className:"flex items-center gap-1 border-t px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.export")}),u(SF,{size:"icon-xs",getText:a,variant:"ghost"}),u(te,{"aria-label":l("turnNavigator.downloadMarkdown"),onClick:()=>i("md"),size:"xs",title:l("turnNavigator.downloadMarkdown"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".md"})}),u(te,{"aria-label":l("turnNavigator.downloadJson"),onClick:()=>i("json"),size:"xs",title:l("turnNavigator.downloadJson"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".json"})})]})]})})]})}me();function dS(e,t,n,o={}){if(t!==null)for(let r=0;r<e.length;r+=1){let a=e[r];if(a===void 0)continue;let i=n(a);if(i!==null)return i===t?{anchorIndex:r,anchorOffset:o.anchorOffset??16}:void 0}}me();function ss(e){if(!Number.isFinite(e)||e<0)return"0ms";if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<1e4)return`${(e/1e3).toFixed(1)}s`;if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n===0?`${t}m`:n===60?`${t+1}m`:`${t}m ${n}s`}function wF(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function TF(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function LF(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var yh=TF(LF()),cS=new Map;function uS(e,t){let n=`${e}:${t?"seconds":"minutes"}`,o=cS.get(n);if(o)return o;let r=new Intl.DateTimeFormat(yh,wF(e,t));return cS.set(n,r),r}function Ch(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var kF=new Intl.DateTimeFormat(void 0,{month:"long"});function PF(e){let t=e%100;if(t>=11&&t<=13)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}function AF(e,t){let n=Ch(e);return n?uS(t,!1).format(n):""}function Jr(e,t){let n=Ch(e);if(!n)return"";let o=AF(e,t),r=n.getDate(),a=kF.format(n),i=n.getFullYear();return`${o}, ${r}${PF(r)} ${a} ${i}`}var EF=new Intl.DateTimeFormat(yh,{month:"numeric",day:"numeric"}),MF=new Intl.DateTimeFormat(yh,{month:"numeric",day:"numeric",year:"numeric"});function li(e,t,n=Date.now()){let o=Ch(e);if(!o)return"";let r=uS(t,!1).format(o),a=new Date(n),i=new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()).getTime(),l=Math.round((i-s)/864e5);return l<=0?r:l===1?`yesterday at ${r}`:`${(o.getFullYear()===a.getFullYear()?EF:MF).format(o)} ${r}`}me();me();async function RF(e,t){if(typeof window>"u"||typeof navigator>"u"||!navigator.clipboard?.writeText)throw new Error(`Clipboard API is unavailable while copying ${t}.`);if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch(n){throw new Error(`Failed to copy ${t} to the clipboard.`,{cause:n})}}function Df({timeout:e=2e3,target:t="text",onCopy:n,onError:o}={}){let[r,a]=G(!1),i=_(null),s=_(n),l=_(o),d=_(t),c=_(e);s.current=n,l.current=o,d.current=t,c.current=e;let f=B((p,m)=>{RF(p,d.current).then(h=>{h&&(i.current&&clearTimeout(i.current),a(!0),s.current?.(m),c.current!==0&&(i.current=setTimeout(()=>{a(!1),i.current=null},c.current)))},h=>{l.current?.(h instanceof Error?h:new Error(String(h)),m)})},[]);return q(()=>()=>{i.current&&clearTimeout(i.current)},[]),{copyToClipboard:f,isCopied:r}}function Dt(){let e=Xo().i18n.usePluginTranslation();return{t:(t,n)=>e(t,n)}}var fS=1e3;function NF({title:e,description:t}){return b("span",{role:"status",className:"dropdown-glass pointer-events-none fixed z-100 rounded-md px-2 py-1 text-balance text-popover-foreground text-xs shadow-xl shadow-black/25",children:[e,t?u("span",{className:"block text-muted-foreground",children:t}):null]})}var hl=ue(function({text:t,size:n="xs",variant:o="outline",className:r,toastAnchor:a="above"}){let{t:i}=Dt(),s=_(null),[l,d]=G(null),c=_(null),f=(h,g)=>{let v=s.current?.getBoundingClientRect();v&&(c.current&&clearTimeout(c.current),d({top:a==="above"?Math.max(4,v.top-(g===void 0?26:40)):Math.min(window.innerHeight-26,v.bottom+4),left:Math.max(4,v.left+v.width/2),title:h,description:g}),c.current=setTimeout(()=>d(null),fS))};q(()=>()=>{c.current&&clearTimeout(c.current)},[]);let{copyToClipboard:p,isCopied:m}=Df({onCopy:()=>f(i("copyButton.copied")),onError:h=>f(i("copyButton.failedToCopy"),h.message),timeout:fS});return b(Qe,{children:[u(Ye,{render:u(te,{"aria-label":i("copyButton.copyToClipboard"),disabled:m,onClick:()=>p(t),ref:s,type:"button",size:n,variant:o,className:F("text-muted-foreground hover:text-foreground",r)}),children:m?u(Io,{className:"size-3 text-primary"}):u(Gi,{className:"size-3"})}),u(Xe,{children:u("p",{children:i("copyButton.copyToClipboard")})}),l?u("span",{"aria-hidden":!0,className:"pointer-events-none fixed",style:{top:l.top,left:l.left},children:u("span",{className:"relative block -translate-x-1/2",children:u(NF,{title:l.title,description:l.description})})}):null]})});function _F(e){return e<1e3?Math.round(e).toLocaleString():e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function Of({label:e,children:t}){let[n,o]=G(!1);return b(Qe,{open:n,onOpenChange:o,children:[u(Ye,{render:u("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm"}),"aria-label":e,onClick:()=>o(r=>!r),children:t}),u(Xe,{children:e})]})}var pS=ue(function({footer:t,timestampFormat:n,copyText:o}){let{t:r}=Dt(),a=t.state,i=r(a==="completed"?"timeline.completed":a==="error"?"timeline.error":a==="interrupted"?"timeline.interrupted":"timeline.unknown");return b("div",{"data-turn-summary":t.turnId,className:"chat-process-meta flex min-w-0 items-center gap-2 px-1 text-muted-foreground",children:[b("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1",children:[a!=="unknown"?b(Of,{label:i,children:[a==="completed"?u(Io,{className:"size-icon-1 text-success","aria-hidden":!0}):a==="error"?u(jt,{className:"size-icon-1 text-destructive","aria-hidden":!0}):u(Qd,{className:"size-3","aria-hidden":!0}),u("span",{className:"sr-only",children:i})]}):null,t.completedAt?u(Of,{label:Jr(t.completedAt,n),children:u("time",{dateTime:t.completedAt,children:li(t.completedAt,n)})}):null,t.workingElapsedMs!==void 0?b(Of,{label:r("timeline.workingTime",{duration:ss(t.workingElapsedMs)}),children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),ss(t.workingElapsedMs)]}):null,t.outputTokens!==void 0?b(Of,{label:`${r("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),_F(t.outputTokens)]}):null]}),o?u(hl,{text:o,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});me();me();function mS(e){if(e<1e3)return String(e);if(e<1e6){let n=e/1e3;return`${n<10?n.toFixed(1).replace(/\.0$/,""):Math.round(n)}k`}if(e<1e9){let n=e/1e6;return`${n<10?n.toFixed(1).replace(/\.0$/,""):Math.round(n)}m`}let t=e/1e9;return`${t<10?t.toFixed(1).replace(/\.0$/,""):Math.round(t)}b`}var gS=ue(function(t){let{additions:n,deletions:o,className:r,showParentheses:a=!1,layout:i="aligned"}=t,{t:s}=Dt(),l=new Intl.ListFormat(void 0,{type:"unit"}).format([s("changedFiles.additions",{count:n}),s("changedFiles.deletions",{count:o})]);return b(be,{children:[a&&u("span",{className:"text-muted-foreground/70",children:"("}),b("span",{role:"group","aria-label":l,className:F(i==="inline"?"inline-flex items-center gap-1 tabular-nums align-middle":"inline-grid grid-cols-[4ch_4ch] gap-2 text-right tabular-nums align-middle",r),children:[b("span",{"aria-hidden":"true",className:"font-mono text-success",children:["+",mS(n)]}),b("span",{"aria-hidden":"true",className:"font-mono text-destructive",children:["-",mS(o)]})]}),a&&u("span",{className:"text-muted-foreground/70",children:")"})]})});function hS(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}function DF(e){let t=e,n,o,r=t.match(/:(\d+)$/);if(!r?.[1])return{path:t,line:void 0,column:void 0};n=r[1],t=t.slice(0,-r[0].length);let a=t.match(/:(\d+)$/);return a?.[1]?(o=a[1],t=t.slice(0,-a[0].length)):(o=n,n=void 0),{path:t,line:o,column:n}}function vS(e){return e.replaceAll("\\","/")}function xS(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function OF(e){return e.replace(/[\\/]+$/,"")}function FF(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function BF(e){return e.replace(/^\.\/+/,"").replace(/^\/+/,"")}function zF(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function Ff(e,t){let{path:n,line:o,column:r}=DF(e),a=xS(vS(n)),i=a;if(t){let s=xS(vS(OF(t))),l=FF(s),d=a.toLowerCase(),c=s.toLowerCase(),f=`${c}/`,p=`${l.toLowerCase()}/`;if(d===c)i=l;else if(d.startsWith(f)){let m=a.slice(s.length+1);i=`${l}/${m}`}else if(!zF(a)){let m=BF(a);i=d.startsWith(p)?a:`${l}/${m}`}}return o?`${i}:${o}${r?`:${r}`:""}`:i}function yS(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function CS(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}var Bf="chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left";function rc({children:e}){return u("span",{"aria-hidden":!0,className:"flex size-4 shrink-0 items-center justify-center",children:e})}function ac({status:e}){return u("span",{"aria-hidden":!0,className:"flex size-2 shrink-0 items-center justify-center",children:e===null?null:u("span",{className:F("block size-2 rounded-full",e==="failed"?"bg-destructive":e==="success"?"bg-success":"border border-muted-foreground/60")})})}function zf({state:e,variant:t="inline",className:n,children:o}){return b("div",{"data-process-state":e,"data-process-kind":t,className:F("chat-process-shell relative min-w-0 overflow-hidden",t==="tool"?"rounded-lg bg-card":"rounded-md",n),children:[e==="running"?u("span",{"aria-hidden":!0,className:"chat-process-shell-pulse animate-status-pulse"}):null,o]})}me();var vl=new Map,bS=24,$F=4e3;function bh(e){let t=vl.get(e);if(t)return t;let n={values:new Map,listeners:new Set};if(vl.set(e,n),vl.size>bS){for(let[o,r]of vl)if(r.listeners.size===0&&o!==e&&(vl.delete(o),vl.size<=bS))break}return n}function Ih(e,t,n){return bh(e).values.get(t)??n}function ic(e,t,n,o=!0){let r=bh(e);if(r.values.get(t)!==n){if(r.values.delete(t),r.values.set(t,n),r.values.size>$F){let a=r.values.keys().next().value;a!==void 0&&r.values.delete(a)}o&&r.listeners.forEach(a=>a())}}function xl(e,t,n){let o=B(s=>{let l=bh(e);return l.listeners.add(s),()=>l.listeners.delete(s)},[e]),r=B(()=>Ih(e,t,n),[e,t,n]),a=xa(o,r,r),i=B(s=>ic(e,t,s),[e,t]);return[a,i]}function $f({name:e,className:t}){switch(e){case"bot":return u(Vi,{className:t,"aria-hidden":!0});case"check":return u(Io,{className:t,"aria-hidden":!0});case"circle-alert":return u(So,{className:t,"aria-hidden":!0});case"eye":return u(Nd,{className:t,"aria-hidden":!0});case"globe":return u(Fd,{className:t,"aria-hidden":!0});case"hammer":return u(zd,{className:t,"aria-hidden":!0});case"message-circle":return u(Ji,{className:t,"aria-hidden":!0});case"search":return u(os,{className:t,"aria-hidden":!0});case"square-pen":return u(No,{className:t,"aria-hidden":!0});case"terminal":return u(ba,{className:t,"aria-hidden":!0});case"wrench":return u(Yd,{className:t,"aria-hidden":!0});case"x":return u(jt,{className:t,"aria-hidden":!0});case"zap":return u(as,{className:t,"aria-hidden":!0})}}function HF(e){switch(e){case"read":return"eye";case"edit":return"square-pen";case"command":return"terminal";case"search":return"globe";case"code-search":return"search";case"other":return"wrench";case"dynamic-tool":return"hammer";case"agent-tool":return"bot";case"tone-tool":return"zap";case"mixed":case null:return"hammer"}}function Sh(e,t){let n=new Map;for(let o of e){let r=t(o);n.set(r,(n.get(r)??0)+1)}return Array.from(n,([o,r])=>({action:o,icon:HF(o),count:r}))}function wh(e,t){let n;for(let o of Sh(e,t))(!n||o.count>n.count)&&(n=o);return n?.icon??"wrench"}var yl=20;function Cl(e){return hS(e)}function IS(e,t,n){let o=e.toolLabel,r=n.resolveToolCommand(e);if(r&&o?.descriptive&&!o.path&&o.detail?.trim())return o.detail.replace(/\s+/g," ").trim();for(let p of[e.rawCommand,e.command]){let m=n.parseToolCommandInput(p)?.description;if(m)return m.replace(/\s+/g," ").trim()}if(r)return r.replace(/\s+/g," ").trim();let a=typeof e.toolData=="object"&&e.toolData!==null&&!Array.isArray(e.toolData)?e.toolData:null,i=typeof a?.toolName=="string"?a.toolName:typeof a?.name=="string"?a.name:void 0,s=o?.name??i??e.toolTitle??e.label,l=o?.path??e.changedFiles?.[0],d=l?Ff(l,t):void 0,c=[s.trim().toLowerCase()==="tool"?void 0:s,d,o?.detail??e.detail],f=[];for(let p of c){let m=p?.replace(/\s+/g," ").trim();m&&!f.some(h=>h.toLowerCase()===m.toLowerCase())&&f.push(m)}return f.join(" ")||null}function SS({entry:e,failed:t}){let n=e.toolLabel?.diffStat;return!n||t||Th(e)?null:u(gS,{...n,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function Th(e){return e.toolLifecycleStatus==="declined"||e.toolLifecycleStatus==="stopped"}function UF({entry:e,failed:t=!1,derive:n}){return t?u(So,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive"}):u($f,{name:wh([e],n.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function KF({entries:e,failed:t,derive:n}){let{t:o}=Dt(),r=z(()=>Sh(e,n.toolGroupAction),[e,n]),a=r.length===1;return a&&r[0].count<2?null:u("span",{className:"chat-process-meta flex shrink-0 items-center gap-2 tabular-nums","aria-label":o("toolGroup.calls",{count:e.length}),children:r.map(({action:i,icon:s,count:l})=>b("span",{"aria-hidden":!0,className:"flex items-center gap-1",children:[a?null:u($f,{name:s,className:F("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive":"text-icon-muted")}),l]},i))})}function wS({entry:e}){let t=Ut(Tn),n=e.detail??e.command??e.rawCommand??e.toolLabel?.detail,o=JSON.stringify([e.id,e.sourceActivityKind,e.toolLifecycleStatus]),r=t.renderToolCallDetail?.({entry:e,threadRef:t.threadRef,threadKey:t.threadKey,workspaceRoot:t.workspaceRoot,revision:o,onOpenFileDiff:t.onOpenFileDiff});return u("div",{className:"min-w-0 space-y-2 p-3",children:r!==void 0?u(be,{children:r}):u("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:n??""})})}var qF=ue(function(t){let{entry:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}=t,s=Ut(Tn).derive,{t:l}=Dt(),[d,c]=xl(o,`call:${Cl(n)}`,!1),f=s.workEntryIndicatesFailure(n),p=Th(n),m=s.resolveWorkEntryStatus(n),h=m==="failed"||m==="running"?m:null,g=Wr();return b("div",{"data-tool-call-id":n.toolCallId??n.id,"data-tool-identity":Cl(n),className:"border-b border-border/50 last:border-b-0",children:[b("button",{type:"button","aria-expanded":d,"aria-controls":g,onClick:()=>{a?.(),c(!d)},className:F("chat-tool-member-row chat-tool-summary flex w-full min-w-0 items-center gap-1.5 px-3 text-left hover:bg-accent/20",f?"text-destructive":"text-muted-foreground"),children:[u(ac,{status:h}),u(rc,{children:u(UF,{entry:n,failed:f,derive:s})}),b("span",{className:"flex min-w-0 flex-1 items-center",children:[u("span",{className:"truncate",children:IS(n,r,s)??l("toolGroup.calls",{count:1})}),u(SS,{entry:n,failed:f})]}),f||p?u("span",{className:"chat-process-meta shrink-0",children:f?l("toolGroup.failed",{count:1}):l("toolGroup.cancelled",{count:1})}):null,u(pn,{"aria-hidden":!0,className:F("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),d?u("div",{id:g,children:u(wS,{entry:n})}):null]})});function VF({threadKey:e,stateKey:t,maxHeight:n,children:o}){let r=_(null);return ye(()=>{let a=r.current;if(!a)return;a.scrollTop=Ih(e,`${t}:scroll`,0);let i=()=>{ic(e,`${t}:scroll`,a.scrollTop,!1)};return a.addEventListener("scroll",i,{passive:!0}),()=>a.removeEventListener("scroll",i)},[e,t]),u("div",{ref:r,"data-slot":"scroll-area-viewport",className:"min-w-0 overflow-y-auto overscroll-y-contain",style:{maxHeight:n},children:o})}var TS=ue(function({entries:t,groupId:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}){let s=Ut(Tn).derive,{t:l}=Dt(),[d,c]=xl(o,`group:${n}`,!1),[f,p]=xl(o,`group-page:${n}`,0),m=Wr(),h=_(null),[g,v]=G(null),x=t.at(-1),y=z(()=>t.filter(O=>s.workEntryIndicatesFailure(O)),[t,s]),C=z(()=>t.filter(Th),[t]),w=t.filter(O=>O.toolLifecycleStatus==="inProgress").length,k=y[0]??C[0],S=k??x,L=Math.max(0,Math.ceil(t.length/yl)-1),I=Math.min(f,L),T=I*yl,E=t.slice(T,T+yl),A=t.length>1;if(ye(()=>{if(!g)return;let O=h.current,oe=Array.from(O?.querySelectorAll("[data-tool-identity]")??[]).find(W=>W.dataset.toolIdentity===g.id);if(!oe)return;let ee=oe.closest('[data-slot="scroll-area-viewport"]');ee&&(ee.scrollTop+=oe.getBoundingClientRect().top-ee.getBoundingClientRect().top),oe.querySelector("button")?.focus({preventScroll:!0})},[g]),!x||!S)return null;let N=O=>{a?.(),p(O)},R={threadKey:o,workspaceRoot:r,onDisclosureChange:a},$=CS(t.map(O=>yS(s.resolveWorkEntryStatus(O)))),H=wh(t,s.toolGroupAction),K=$==="failed"?"failed":$==="running"?"running":"success";return u(zf,{state:$,variant:"tool",children:b("section",{ref:h,"data-tool-group-id":n,className:"min-w-0",children:[b("div",{className:"flex min-w-0 items-center",children:[b("button",{type:"button","aria-expanded":d,"aria-controls":m,onClick:()=>{a?.(),c(!d),!A&&!d&&ic(o,`call:${Cl(x)}`,!0)},className:F(Bf,"flex-1",k?"text-destructive":"text-muted-foreground"),children:[u(ac,{status:K}),u(rc,{children:u($f,{name:H,className:F("size-icon-1 shrink-0 stroke-[1.8] opacity-70",y.length>0?"text-destructive":"text-icon-muted")})}),b("span",{className:F("flex min-w-0 flex-1 items-center",d&&A?"chat-process-text":"chat-tool-summary"),children:[u("span",{className:"truncate",children:d&&A?l("toolGroup.calls",{count:t.length}):IS(S,r,s)??l("toolGroup.calls",{count:1})}),d&&A?null:u(SS,{entry:S,failed:s.workEntryIndicatesFailure(S)})]}),w>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.running",{count:w})}):null,y.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.failed",{count:y.length})}):null,C.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.cancelled",{count:C.length})}):null,d&&A?null:u(KF,{entries:t,failed:y.length>0,derive:s}),u(pn,{"aria-hidden":!0,className:F("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),k&&A?u("button",{type:"button",className:"chat-process-meta me-2 min-h-8 shrink-0 rounded-control-4 px-1 text-destructive underline [@media(pointer:coarse)]:min-h-11",onClick:()=>{a?.(),c(!0),p(Math.floor(t.indexOf(k)/yl)),ic(o,`call:${Cl(k)}`,!0),v({id:Cl(k)})},children:l("toolGroup.showFailure")}):null]}),d?u("div",{id:m,className:"border-t border-border/50",children:A?b(be,{children:[t.length>yl?b("div",{className:"chat-process-meta flex items-center gap-1 border-b border-border/40 px-2 py-1 text-muted-foreground",children:[u("span",{className:"min-w-0 flex-1 tabular-nums",children:l("toolGroup.pageRange",{from:T+1,to:Math.min(T+yl,t.length),count:t.length})}),[{label:l("toolGroup.firstPage"),target:0,disabled:I===0,Icon:Md},{label:l("toolGroup.previousPage"),target:I-1,disabled:I===0,Icon:Wi},{label:l("toolGroup.nextPage"),target:I+1,disabled:I===L,Icon:Uo},{label:l("toolGroup.lastPage"),target:L,disabled:I===L,Icon:Rd}].map(({label:O,target:oe,disabled:ee,Icon:W})=>u("button",{type:"button","aria-label":O,disabled:ee,onClick:()=>N(oe),className:"flex size-7 items-center justify-center rounded-control-3 disabled:opacity-64 [@media(pointer:coarse)]:size-11",children:u(W,{"aria-hidden":!0,className:"size-icon-1"})},O))]}):null,u(VF,{threadKey:o,stateKey:`group-scroll:${n}:${I}`,maxHeight:"min(320px, 50dvh)",children:u("div",{className:"space-y-0.5 py-1",children:E.map(O=>u(qF,{entry:O,...R},Cl(O)))})})]}):u(wS,{entry:x})}):null]})})});function WF(e,t,n){let o=n-t;if(Math.abs(o)<1)return null;let r=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+o));return Math.abs(r-e.scrollTop)<1?null:r}function LS(e){let{viewport:t,anchor:n,row:o,scrollToOffset:r}=e,a=n.getBoundingClientRect().top,i=!0,s=null,l=()=>{if(s=null,!i||!n.isConnected||!t.contains(n))return;let f=WF(t,a,n.getBoundingClientRect().top);f!==null&&r(f),a=n.getBoundingClientRect().top},d=()=>{i&&s===null&&(s=requestAnimationFrame(l))},c=typeof ResizeObserver>"u"?null:new ResizeObserver(d);return c?.observe(o),d(),{schedule:d,stop:()=>{i=!1,c?.disconnect(),s!==null&&cancelAnimationFrame(s),s=null}}}me();function Lh(e,t){for(let n of e.querySelectorAll("[data-timeline-row-id]"))if(n.dataset.timelineRowId===t)return n;return null}function kS(e,t){let n=0,o=e.length,r=-1;for(;n<o;){let a=Math.floor((n+o)/2),s=e[a].getBoundingClientRect();Math.max(s.bottom,s.top+1)>t?(r=a,o=a):n=a+1}return r}function GF(e){let t=e.getBoundingClientRect().top,n=e.querySelectorAll("[data-timeline-turn-section]"),o=a=>{let i=a.querySelectorAll("[data-timeline-row-id]"),s=kS(i,t),l=s<0?void 0:i[s],d=l?.dataset.timelineRowId;return!l||d===void 0?null:{rowId:d,offsetPx:Math.max(0,Math.round(t-l.getBoundingClientRect().top))}};if(n.length===0)return o(e);let r=kS(n,t);if(r<0)return null;for(let a=r;a<n.length;a+=1){let i=o(n[a]);if(i)return i}return null}function PS(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}var kh=class extends Ui{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function AS({inputKey:e,onBeforeInputChange:t,handleRef:n,onAttach:o,className:r,children:a,onScroll:i}){let s=_(null);Gr(n,()=>({get node(){return s.current},measure:()=>{let d=s.current;return d?{scroll:d.scrollTop,scrollLength:d.clientHeight,contentLength:d.scrollHeight,topOf:c=>{let f=Lh(d,c);return f===null?null:PS(f,d)},heightOf:c=>{let f=Lh(d,c);return f===null?null:f.offsetHeight},rowAtScroll:()=>GF(d)}:null},scrollToEnd:d=>{let c=s.current;if(c){if(d?.animated){c.scrollTo({top:c.scrollHeight,behavior:"smooth"});return}c.scrollTop=c.scrollHeight-c.clientHeight}},scrollToRow:(d,c)=>{let f=s.current;if(!f)return!1;let p=Lh(f,d);return p?(f.scrollTop=Math.max(0,PS(p,f)-(c?.viewOffset??0)),!0):!1},scrollToOffset:d=>{let c=s.current;c&&(c.scrollTop=Math.max(0,d))}}),[]);let l=B(d=>{s.current=d,o(d)},[o]);return u(kh,{inputKey:e,onBeforeInputChange:t,children:u("div",{ref:l,className:r,style:{position:"relative"},onScroll:i,children:a})})}me();var ES=ue(function({sectionKey:t,rowKeyPrefix:n,rows:o,renderRow:r,sectionRef:a}){return u("div",{className:"session-turn","data-timeline-turn-section":t,ref:a,children:o.map(i=>u("div",{className:"transcript-col min-w-0 overflow-x-clip",children:r(i)},`${n}:${i.id}`))})});function jF(e){for(let t of e)switch(t.kind){case"turn-identity":return t.turnId;case"working":return t.turnId??null;case"message":if(t.message.role==="assistant")return t.message.turnId;break;case"tool-group":if(t.entries[0]?.turnId!==void 0)return t.entries[0].turnId??null;break;case"work":if(t.groupedEntries[0]?.turnId!==void 0)return t.groupedEntries[0].turnId??null;break;case"turn-plan":return t.turnPlan.turnId;case"proposed-plan":return t.proposedPlan.turnId;case"turn-summary":return t.footer.turnId}return null}function MS(e,t){let n=[];for(let o of t){if(o.end<=o.start)continue;let r=e.slice(o.start,o.end);n.push({key:o.key,turnId:jF(r),firstRowIndex:o.start,rows:r})}return n}function RS(e,t){let n=Math.max(0,Math.min(t,e)),o=e-n;return{startIndex:o,hasHiddenOlder:o>0}}function sc(e,t,n){let o=e.findIndex(r=>r.rows.some(a=>a.id===t));return o<0?n:Math.max(n,e.length-o)}me();me();var _S=100,QF=new Map,NS=new Map,Ah=e=>typeof e=="function"?e():e,XF=(e,t)=>typeof t=="function"?t(e):t;function YF(e,t,n){let o=e.get(t);return o===void 0&&(o={values:new Map,limit:Math.max(1,n)},e.set(t,o)),o}function JF(e,t){let n=NS.get(e);return n===void 0&&(n={values:new Map,limit:Math.max(1,t)},NS.set(e,n)),n}function ZF(e,t){if(!(e.values.size<=e.limit)){for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.committed||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}}}function Ph(e,t,n){e.values.get(t)===n&&(e.values.delete(t),e.values.set(t,n))}function DS(e,t,n){let o=e.values.get(t);return o===void 0&&(o={value:Ah(n),subscribers:new Set,leases:0,alive:!0,committed:!1},e.values.set(t,o)),o}function lc(e){queueMicrotask(()=>ZF(e))}function Ln(e,t,n,o=_S){let r=Math.max(1,o),a=YF(QF,e,r),i=DS(a,t,n),s=B(f=>i.alive?(a.limit=r,i.committed=!0,Ph(a,t,i),i.leases+=1,i.subscribers.add(f),lc(a),()=>{i.subscribers.delete(f),i.leases=Math.max(0,i.leases-1),lc(a)}):()=>{},[r,i,a,t]),l=B(()=>i.value,[i]),d=xa(s,l,l),c=B(f=>{if(!i.alive||a.values.get(t)!==i)return;let p=i.value,m=XF(p,f);if(!Object.is(m,p)){i.value=m,Ph(a,t,i);for(let h of i.subscribers)h();lc(a)}},[i,a,t]);return[d,c]}function En(e,t,n,o=_S){let r=Math.max(1,o),a=JF(e,r),i=DS(a,t,()=>({current:Ah(n)}));return q(()=>{if(!(!i.alive||a.values.get(t)!==i))return a.limit=r,i.committed=!0,Ph(a,t,i),i.leases+=1,lc(a),()=>{i.leases=Math.max(0,i.leases-1),lc(a)}},[r,i,a,t]),i.value}function dc(e,t){let n=_(null);return(n.current===null||n.current.key!==e)&&(n.current={key:e,ref:{current:Ah(t)}}),n.current.ref}var ls=3,e2=ls;function OS(e){let[t,n]=Ln("timeline-reveal-window",e,ls),o=B(()=>{n(s=>s+e2)},[n]),r=B(s=>{n(l=>s>l?s:l)},[n]),a=B(()=>{n(ls)},[n]),i=B(s=>{n(l=>Math.min(l,Math.max(ls,s)))},[n]);return{revealedCount:t,revealOlder:o,revealAtLeast:r,compactTo:i,reset:a}}function FS({root:e,minimumCount:t,canCompact:n,onCompact:o}){let r=e.ownerDocument,a=new Set,i,s=!1,l=()=>e.scrollHeight-e.clientHeight-e.scrollTop<=2,d=()=>{if(i=void 0,r.hidden||a.size>0||!n()||e.clientHeight<=0||!l())return;let x=r.getSelection();if(x&&!x.isCollapsed){for(let L=0;L<x.rangeCount;L+=1)if(x.getRangeAt(L).intersectsNode(e))return}let y=e.querySelectorAll("[data-timeline-turn-section]"),C=e.getBoundingClientRect().top-32,w=0,k=Math.max(0,y.length-t);for(;w<k;){let L=Math.floor((w+k)/2),I=y[L].getBoundingClientRect().bottom;if(!Number.isFinite(I))return;I<=C?w=L+1:k=L}if(w===0)return;let S=r.activeElement;if(S){for(let L=0;L<w;L+=1)if(y[L].contains(S))return}o(y.length-w)},c=()=>{i===void 0&&(i=setTimeout(d,400))},f=()=>{clearTimeout(i),i=setTimeout(d,400)},p=()=>{let x=l();!x||!s?f():c(),s=x},m=x=>{a.add(x.pointerId),f()},h=x=>{a.delete(x.pointerId),f()},g=()=>{a.clear(),f()},v=["wheel","keydown","focusin","focusout"];for(let x of v)e.addEventListener(x,f,{passive:!0});return e.addEventListener("scroll",p,{passive:!0}),e.addEventListener("pointerdown",m,!0),r.addEventListener("pointerup",h,!0),r.addEventListener("pointercancel",h,!0),r.addEventListener("selectionchange",f),r.addEventListener("visibilitychange",c),r.defaultView?.addEventListener("blur",g),c(),{schedule:c,disconnect:()=>{clearTimeout(i);for(let x of v)e.removeEventListener(x,f);e.removeEventListener("scroll",p),e.removeEventListener("pointerdown",m,!0),r.removeEventListener("pointerup",h,!0),r.removeEventListener("pointercancel",h,!0),r.removeEventListener("selectionchange",f),r.removeEventListener("visibilitychange",c),r.defaultView?.removeEventListener("blur",g)}}}me();me();function BS(e){let t=_(e);t.current=e;let n=_(!1),o=_(null),r=_(null),a=_(0),i=B(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),s=B(()=>{if(!n.current||!t.current||r.current!==null||o.current===null)return;let c=++a.current;r.current=requestAnimationFrame(f=>{if(c!==a.current||(r.current=null,!n.current||!t.current))return;let p=o.current;o.current=null,p?.(f)})},[]),l=B(c=>{o.current=c,s()},[s]),d=B(()=>{o.current=null,i()},[i]);return ye(()=>(n.current=!0,s(),()=>{n.current=!1,i()}),[e,i,s]),z(()=>({request:l,cancel:d}),[l,d])}function zS({root:e,topInsetPx:t,onActiveSectionChange:n,active:o}){let r=_(o);r.current=o;let a=BS(o),i=_(new Map),s=_(null),l=_(null),d=_(n);d.current=n;let c=B(()=>{if(!r.current||!e)return;let g=e.scrollTop+t,v=null,x=Number.NEGATIVE_INFINITY,y=null,C=Number.POSITIVE_INFINITY;for(let[k,S]of i.current){if(!S.isConnected)continue;let L=S.offsetTop;L<C&&(C=L,y=k),L<=g&&L>=x&&(x=L,v=k)}let w=v??y;w!==l.current&&(l.current=w,d.current(w))},[e,t]),f=B(()=>{r.current&&a.request(c)},[a,c]);q(()=>{if(!o||!e||typeof IntersectionObserver>"u")return;let g=!0,v=new IntersectionObserver(()=>{!g||!r.current||f()},{root:e,rootMargin:`-${t}px 0px 0px 0px`,threshold:0});s.current=v;for(let x of i.current.values())v.observe(x);return f(),()=>{g=!1,v.disconnect(),s.current=null,a.cancel()}},[o,a,f,e,t]);let p=_(new Map),m=B(g=>{let v=p.current.get(g);if(v)return v;let x=y=>{let C=i.current.get(g);C&&C!==y&&(s.current?.unobserve(C),i.current.delete(g)),y?(i.current.set(g,y),s.current?.observe(y)):p.current.delete(g)};return p.current.set(g,x),x},[]),h=B(()=>{r.current&&(l.current=null,f())},[f]);return z(()=>({observeSection:m,refresh:h}),[m,h])}function cc(e,t,n="duration"){let o=`<${n}></${n}>`,r=`<${n}/>`,a=s=>{let l=e.indexOf(s);return l<0?null:[e.slice(0,l),e.slice(l+s.length)]},i=a(o)??a(r);return i===null?b(be,{children:[e,t]}):b(be,{children:[i[0],t,i[1]]})}me();function $S(){let e=Xo(),t=r=>r instanceof Error?r.message:void 0,n=(r,a)=>a!==void 0&&a.length>0?`${r}: ${a}`:r,o=(r,a,i)=>e.notify(r,a,i);return{error:(r,a,i)=>{let s=i?.description??t(a);o(n(r,s),"error",s)},warning:(r,a,i)=>{let s=i?.description??t(a);o(n(r,s),"warning",s)},success:(r,a,i)=>{let s=a??i?.description;o(n(r,s),"success",s)}}}function Hf(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function Eh(e){let t=e.trimEnd().split(/\r?\n/),n=t[0]&&/^\s{0,3}#{1,6}\s+/.test(t[0])?t.slice(1):[...t];for(;n[0]?.trim().length===0;)n.shift();if(n[0]?.match(/^\s{0,3}#{1,6}\s+(.+)$/)?.[1]?.trim().toLowerCase()==="summary")for(n.shift();n[0]?.trim().length===0;)n.shift();return n.join(`
3669
- `)}function HS(e,t){let n=t?.maxLines??8,o=Eh(e).trimEnd().split(/\r?\n/).map(s=>s.trimEnd()),r=[],a=0,i=!1;for(let s of o){let l=s.trim().length>0;if(l&&a>=n){i=!0;break}r.push(s),l&&(a+=1)}for(;r.length>0&&r.at(-1)?.trim().length===0;)r.pop();return r.length===0?Hf(e)??"Plan preview unavailable.":(i&&r.push("","..."),r.join(`
3670
- `))}function t2(e){let t=e.toLowerCase().replace(/[`'".,!?()[\]{}]+/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"plan"}function US(e){let t=Hf(e);return`${t2(t??"plan")}.md`}function KS(e){return`${e.trimEnd()}
3671
- `}function qS(e,t){let n=new Blob([t],{type:"text/markdown;charset=utf-8"}),o=URL.createObjectURL(n),r=document.createElement("a");r.href=o,r.download=e,r.click(),window.setTimeout(()=>{URL.revokeObjectURL(o)},0)}var VS=ue(function({planMarkdown:t,environmentId:n,threadRef:o,cwd:r,workspaceRoot:a,onSavePlanToWorkspace:i}){let{t:s}=Dt(),l=$S(),[d,c]=G(!1),[f,p]=G(!1),[m,h]=G(""),[g,v]=G(!1),{copyToClipboard:x,isCopied:y}=Df({target:"plan",onError:H=>{l.error(s("proposedPlan.couldNotCopy"),H,{description:s("proposedPlan.copyErrorDescription")})}}),C=Wr(),w=Hf(t)??s("proposedPlan.defaultTitle"),k=t.split(`
3672
- `).length,S=t.length>900||k>20,L=Eh(t),I=S?HS(t,{maxLines:10}):null,T=US(t),E=KS(t),A=()=>{qS(T,E)},N=()=>{x(E)},R=()=>{if(!a){l.error(s("proposedPlan.workspacePathUnavailable"),s("proposedPlan.workspacePathUnavailableDescription"));return}h(H=>H.length>0?H:T),p(!0)},$=()=>{let H=m.trim();if(!(!a||i===null)){if(!H){l.warning(s("proposedPlan.enterWorkspacePath"));return}v(!0),(async()=>{let K=await i({environmentId:n,workspaceRoot:a,relativePath:H,contents:E});if(v(!1),K.ok){p(!1),l.success(s("proposedPlan.savedToWorkspace"),K.relativePath);return}l.error(s("proposedPlan.couldNotSave"),void 0,{description:s("proposedPlan.saveErrorDescription")})})()}};return b("div",{className:"rounded-[24px] border border-border/80 bg-card/70 p-4 sm:p-5",children:[b("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[b("div",{className:"flex min-w-0 items-center gap-2",children:[u(ul,{variant:"secondary",children:s("proposedPlan.badge")}),u("p",{className:"truncate text-sm font-medium text-foreground",children:w})]}),b(Jo,{children:[u(tr,{render:u(te,{"aria-label":s("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:u(Yo,{"aria-hidden":"true",className:"size-4"})}),b(er,{align:"end",children:[u(Zo,{onClick:N,children:s(y?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),u(Zo,{onClick:A,children:s("proposedPlan.downloadAsMarkdown")}),i!==null?u(Zo,{onClick:R,disabled:!a||g,children:s("proposedPlan.saveToWorkspace")}):null]})]})]}),b("div",{className:"mt-4",children:[b("div",{className:F("relative",S&&!d&&"max-h-104 overflow-hidden"),children:[S&&!d?u(nr,{text:I??"",cwd:r,threadRef:o,isStreaming:!1}):u(nr,{text:L,cwd:r,threadRef:o,isStreaming:!1}),S&&!d?u("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-24 bg-linear-to-t from-card/95 via-card/80 to-transparent"}):null]}),S?u("div",{className:"mt-4 flex justify-center",children:u(te,{size:"sm",variant:"outline","data-scroll-anchor-ignore":!0,onClick:()=>c(H=>!H),children:s(d?"proposedPlan.collapse":"proposedPlan.expand")})}):null]}),u(If,{open:f,onOpenChange:H=>{g||p(H)},children:b(Lf,{className:"max-w-xl",children:[b(Tf,{children:[u(kf,{children:s("proposedPlan.saveToWorkspace")}),u(Sf,{children:cc(s("proposedPlan.pathHint"),u("code",{children:a??s("proposedPlan.theWorkspace")}),"path")})]}),u(KI,{className:"space-y-3",children:b("label",{htmlFor:C,className:"grid gap-1.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:s("proposedPlan.workspacePath")}),u(hf,{id:C,value:m,onChange:H=>h(H.target.value),placeholder:T,spellCheck:!1,disabled:g})]})}),b(wf,{children:[u(te,{variant:"outline",size:"sm",onClick:()=>p(!1),disabled:g,children:s("proposedPlan.cancel")}),u(te,{size:"sm",onClick:()=>{$()},disabled:g,children:s(g?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});function WS({timeline:e,previousOverlayHeight:t,overlayHeight:n,followingEnd:o}){e&&o&&n>t&&e.scrollToEnd({animated:!1})}function GS({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}me();var Uf=class extends Ui{state={failed:!1,error:null};static getDerivedStateFromError(t){return{failed:!0,error:t instanceof Error?t:new Error(String(t))}}componentDidUpdate(t){this.state.failed&&t.resetKey!==this.props.resetKey&&this.setState({failed:!1,error:null})}render(){if(!this.state.failed)return this.props.children;let{fallback:t}=this.props;return typeof t=="function"?t(this.state.error):t}};function n2({error:e,className:t}){let{t:n}=Dt();return b(Qe,{children:[b(Ye,{render:u("div",{className:F("flex min-h-6 min-w-0 items-center gap-1.5 px-0.5 py-0.5 text-destructive",t)}),children:[u(So,{"aria-hidden":!0,className:"size-4 shrink-0"}),u("span",{className:"min-w-0 flex-1 truncate",children:n("timeline.entryUnavailable")})]}),u(Xe,{className:"max-w-xs whitespace-pre-wrap font-mono text-[11px]",children:e.message})]})}function jS(e){return u(n2,{error:e})}me();function Mh(e,t){let n=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name}]:[]);if(n.length===0)return null;let o=n.findIndex(r=>r.id===t);return o<0?null:{images:n.map(r=>({src:r.src,name:r.name})),index:o}}function di(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||o2.has(t)?"text":"file"}var o2=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function QS(e){return!Number.isFinite(e)||e<=0?"0 KB":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}var r2="<ycodium-system>";function Rh(e){return e.startsWith(r2)}var a2=/<ycodium-system>[\s\S]*?<\/ycodium-system>/g;function XS(e){let t=e.match(a2);return t&&t.length>0?t:[e]}function YS(e){let t=e.match(/<plugin-instruction>\n([\s\S]*?)\n<\/plugin-instruction>/)?.[1];if(t===void 0)return null;try{let n=JSON.parse(t);if(n===null||typeof n!="object"||Array.isArray(n))return null;let o=n;return typeof o.pluginId!="string"||typeof o.title!="string"||typeof o.body!="string"?null:{pluginId:o.pluginId,title:o.title,body:o.body}}catch{return null}}function JS(e){switch(e){case"image":return Xi;case"pdf":return Qi;case"text":return ji;case"file":return Ro}}var i2=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/;function uc(e){let t=i2.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=s2(t[1]??"");return{promptText:n,contextCount:o.length,contexts:o}}function s2(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3671
+ `;ge();ge();var iI=Ut(null),sI=iI.Provider,lI=Ut(""),dI=lI.Provider;function Cf(){return ln(lI)}function nr(){let e=ln(iI);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var mh="conversation";var gh="__ycodiumConversationBridge",cI="ycodium.conversation.rebindable-bridge.v1";ge();function uI(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=uI(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function fI(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=uI(e))&&(o&&(o+=" "),o+=t);return o}var pI=fI;var O1=(e,t)=>{let n=new Array(e.length+t.length);for(let o=0;o<e.length;o++)n[o]=e[o];for(let o=0;o<t.length;o++)n[e.length+o]=t[o];return n},F1=(e,t)=>({classGroupId:e,validator:t}),bI=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var mI=[],B1="arbitrary..",z1=e=>{let t=H1(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return $1(i);let s=i.split("-"),l=s[0]===""&&s.length>1?1:0;return II(s,l,t)},getConflictingClassGroupIds:(i,s)=>{if(s){let l=o[i],d=n[i];return l?d?O1(d,l):l:d||mI}return n[i]||mI}}},II=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let d=II(e,t+1,a);if(d)return d}let i=n.validators;if(i===null)return;let s=t===0?e.join("-"):e.slice(t).join("-"),l=i.length;for(let d=0;d<l;d++){let c=i[d];if(c.validator(s))return c.classGroupId}},$1=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(":"),o=t.slice(0,n);return o?B1+o:void 0})(),H1=e=>{let{theme:t,classGroups:n}=e;return U1(n,t)},U1=(e,t)=>{let n=bI();for(let o in e){let r=e[o];xh(r,n,o,t)}return n},xh=(e,t,n,o)=>{let r=e.length;for(let a=0;a<r;a++){let i=e[a];K1(i,t,n,o)}},K1=(e,t,n,o)=>{if(typeof e=="string"){q1(e,t,n);return}if(typeof e=="function"){V1(e,t,n,o);return}W1(e,t,n,o)},q1=(e,t,n)=>{let o=e===""?t:SI(t,e);o.classGroupId=n},V1=(e,t,n,o)=>{if(G1(e)){xh(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(F1(n,e))},W1=(e,t,n,o)=>{let r=Object.entries(e),a=r.length;for(let i=0;i<a;i++){let[s,l]=r[i];xh(l,SI(t,s),n,o)}},SI=(e,t)=>{let n=e,o=t.split("-"),r=o.length;for(let a=0;a<r;a++){let i=o[a],s=n.nextPart.get(i);s||(s=bI(),n.nextPart.set(i,s)),n=s}return n},G1=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,j1=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null),r=(a,i)=>{n[a]=i,t++,t>e&&(t=0,o=n,n=Object.create(null))};return{get(a){let i=n[a];if(i!==void 0)return i;if((i=o[a])!==void 0)return r(a,i),i},set(a,i){a in n?n[a]=i:r(a,i)}}};var Q1=[],gI=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),X1=e=>{let{prefix:t,experimentalParseClassName:n}=e,o=r=>{let a=[],i=0,s=0,l=0,d,c=r.length;for(let g=0;g<c;g++){let v=r[g];if(i===0&&s===0){if(v===":"){a.push(r.slice(l,g)),l=g+1;continue}if(v==="/"){d=g;continue}}v==="["?i++:v==="]"?i--:v==="("?s++:v===")"&&s--}let f=a.length===0?r:r.slice(l),p=f,m=!1;f.endsWith("!")?(p=f.slice(0,-1),m=!0):f.startsWith("!")&&(p=f.slice(1),m=!0);let h=d&&d>l?d-l:void 0;return gI(a,m,p,h)};if(t){let r=t+":",a=o;o=i=>i.startsWith(r)?a(i.slice(r.length)):gI(Q1,!1,i,void 0,!0)}if(n){let r=o;o=a=>n({className:a,parseClassName:r})}return o},Y1=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((n,o)=>{t.set(n,1e6+o)}),n=>{let o=[],r=[];for(let a=0;a<n.length;a++){let i=n[a],s=i[0]==="[",l=t.has(i);s||l?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(i)):r.push(i)}return r.length>0&&(r.sort(),o.push(...r)),o}},J1=e=>({cache:j1(e.cacheSize),parseClassName:X1(e),sortModifiers:Y1(e),postfixLookupClassGroupIds:Z1(e),...z1(e)}),Z1=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let o=0;o<n.length;o++)t[n[o]]=!0;return t},eO=/\s+/,tO=(e,t)=>{let{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:i}=t,s=[],l=e.trim().split(eO),d="";for(let c=l.length-1;c>=0;c-=1){let f=l[c],{isExternal:p,modifiers:m,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:v}=n(f);if(p){d=f+(d.length>0?" "+d:d);continue}let x=!!v,y;if(x){let k=g.substring(0,v);y=o(k);let I=y&&i[y]?o(g):void 0;I&&I!==y&&(y=I,x=!1)}else y=o(g);if(!y){if(!x){d=f+(d.length>0?" "+d:d);continue}if(y=o(g),!y){d=f+(d.length>0?" "+d:d);continue}x=!1}let C=m.length===0?"":m.length===1?m[0]:a(m).join(":"),S=h?C+"!":C,L=S+y;if(s.indexOf(L)>-1)continue;s.push(L);let w=r(y,x);for(let k=0;k<w.length;++k){let I=w[k];s.push(S+I)}d=f+(d.length>0?" "+d:d)}return d},nO=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=wI(n))&&(r&&(r+=" "),r+=o);return r},wI=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=wI(e[o]))&&(n&&(n+=" "),n+=t);return n},hI=(e,...t)=>{let n,o,r,a,i=l=>{let d=t.reduce((c,f)=>f(c),e());return n=J1(d),o=n.cache.get,r=n.cache.set,a=s,s(l)},s=l=>{let d=o(l);if(d)return d;let c=tO(l,n);return r(l,c),c};return a=i,(...l)=>a(nO(...l))},oO=[],Fn=e=>{let t=n=>n[e]||oO;return t.isThemeGetter=!0,t},TI=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,kI=/^\((?:(\w[\w-]*):)?(.+)\)$/i,rO=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,aO=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,iO=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,sO=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,lO=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,dO=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,li=e=>rO.test(e),it=e=>!!e&&!Number.isNaN(Number(e)),Jr=e=>!!e&&Number.isInteger(Number(e)),hh=e=>e.endsWith("%")&&it(e.slice(0,-1)),La=e=>aO.test(e),LI=()=>!0,cO=e=>iO.test(e)&&!sO.test(e),yh=()=>!1,uO=e=>lO.test(e),fO=e=>dO.test(e),pO=e=>!Te(e)&&!ke(e),mO=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),gO=e=>di(e,EI,yh),Te=e=>TI.test(e),Vi=e=>di(e,MI,cO),vI=e=>di(e,SO,it),hO=e=>di(e,NI,LI),vO=e=>di(e,RI,yh),xI=e=>di(e,PI,yh),xO=e=>di(e,AI,fO),bf=e=>di(e,_I,uO),ke=e=>kI.test(e),_d=e=>Wi(e,MI),yO=e=>Wi(e,RI),yI=e=>Wi(e,PI),CO=e=>Wi(e,EI),bO=e=>Wi(e,AI),If=e=>Wi(e,_I,!0),IO=e=>Wi(e,NI,!0),di=(e,t,n)=>{let o=TI.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Wi=(e,t,n=!1)=>{let o=kI.exec(e);return o?o[1]?t(o[1]):n:!1},PI=e=>e==="position"||e==="percentage",AI=e=>e==="image"||e==="url",EI=e=>e==="length"||e==="size"||e==="bg-size",MI=e=>e==="length",SO=e=>e==="number",RI=e=>e==="family-name",NI=e=>e==="number"||e==="weight",_I=e=>e==="shadow";var CI=()=>{let e=Fn("color"),t=Fn("font"),n=Fn("text"),o=Fn("font-weight"),r=Fn("tracking"),a=Fn("leading"),i=Fn("breakpoint"),s=Fn("container"),l=Fn("spacing"),d=Fn("radius"),c=Fn("shadow"),f=Fn("inset-shadow"),p=Fn("text-shadow"),m=Fn("drop-shadow"),h=Fn("blur"),g=Fn("perspective"),v=Fn("aspect"),x=Fn("ease"),y=Fn("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...S(),ke,Te],w=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],I=()=>[ke,Te,l],T=()=>[li,"full","auto",...I()],E=()=>[Jr,"none","subgrid",ke,Te],A=()=>["auto",{span:["full",Jr,ke,Te]},Jr,ke,Te],N=()=>[Jr,"auto",ke,Te],R=()=>["auto","min","max","fr",ke,Te],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...I()],F=()=>[li,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],oe=()=>[li,"screen","full","dvw","lvw","svw","min","max","fit",...I()],ee=()=>[li,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],W=()=>[e,ke,Te],Ze=()=>[...S(),yI,xI,{position:[ke,Te]}],ue=()=>["no-repeat",{repeat:["","x","y","space","round"]}],pe=()=>["auto","cover","contain",CO,gO,{size:[ke,Te]}],Fe=()=>[hh,_d,Vi],Le=()=>["","none","full",d,ke,Te],ie=()=>["",it,_d,Vi],Ie=()=>["solid","dashed","dotted","double"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[it,hh,yI,xI],be=()=>["","none",h,ke,Te],rt=()=>["none",it,ke,Te],dt=()=>["none",it,ke,Te],st=()=>[it,ke,Te],ct=()=>[li,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[La],breakpoint:[La],color:[LI],container:[La],"drop-shadow":[La],ease:["in","out","in-out"],font:[pO],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[La],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[La],shadow:[La],spacing:["px",it],text:[La],"text-shadow":[La],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",li,Te,ke,v]}],container:["container"],"container-type":[{"@container":["","normal","size",ke,Te]}],"container-named":[mO],columns:[{columns:[it,Te,ke,s]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[Jr,"auto",ke,Te]}],basis:[{basis:[li,"full","auto",s,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[it,li,"auto","initial","none",Te]}],grow:[{grow:["",it,ke,Te]}],shrink:[{shrink:["",it,ke,Te]}],order:[{order:[Jr,"first","last","none",ke,Te]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mbs:[{mbs:H()}],mbe:[{mbe:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],"inline-size":[{inline:["auto",...oe()]}],"min-inline-size":[{"min-inline":["auto",...oe()]}],"max-inline-size":[{"max-inline":["none",...oe()]}],"block-size":[{block:["auto",...ee()]}],"min-block-size":[{"min-block":["auto",...ee()]}],"max-block-size":[{"max-block":["none",...ee()]}],w:[{w:[s,"screen",...F()]}],"min-w":[{"min-w":[s,"screen","none",...F()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",n,_d,Vi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,IO,hO]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",hh,Te]}],"font-family":[{font:[yO,vO,t]}],"font-features":[{"font-features":[Te]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,ke,Te]}],"line-clamp":[{"line-clamp":[it,"none",ke,vI]}],leading:[{leading:[a,...I()]}],"list-image":[{"list-image":["none",ke,Te]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ke,Te]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[it,"from-font","auto",ke,Vi]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[it,"auto",ke,Te]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"tab-size":[{tab:[Jr,ke,Te]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke,Te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke,Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Ze()}],"bg-repeat":[{bg:ue()}],"bg-size":[{bg:pe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Jr,ke,Te],radial:["",ke,Te],conic:[Jr,ke,Te]},bO,xO]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:Fe()}],"gradient-via-pos":[{via:Fe()}],"gradient-to-pos":[{to:Fe()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:Le()}],"rounded-s":[{"rounded-s":Le()}],"rounded-e":[{"rounded-e":Le()}],"rounded-t":[{"rounded-t":Le()}],"rounded-r":[{"rounded-r":Le()}],"rounded-b":[{"rounded-b":Le()}],"rounded-l":[{"rounded-l":Le()}],"rounded-ss":[{"rounded-ss":Le()}],"rounded-se":[{"rounded-se":Le()}],"rounded-ee":[{"rounded-ee":Le()}],"rounded-es":[{"rounded-es":Le()}],"rounded-tl":[{"rounded-tl":Le()}],"rounded-tr":[{"rounded-tr":Le()}],"rounded-br":[{"rounded-br":Le()}],"rounded-bl":[{"rounded-bl":Le()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-bs":[{"border-bs":ie()}],"border-w-be":[{"border-be":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ie(),"hidden","none"]}],"divide-style":[{divide:[...Ie(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-bs":[{"border-bs":W()}],"border-color-be":[{"border-be":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...Ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[it,ke,Te]}],"outline-w":[{outline:["",it,_d,Vi]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",c,If,bf]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",f,If,bf]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[it,Vi]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",p,If,bf]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[it,ke,Te]}],"mix-blend":[{"mix-blend":[...ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ve()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[it]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[ke,Te]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[it]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Ze()}],"mask-repeat":[{mask:ue()}],"mask-size":[{mask:pe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ke,Te]}],filter:[{filter:["","none",ke,Te]}],blur:[{blur:be()}],brightness:[{brightness:[it,ke,Te]}],contrast:[{contrast:[it,ke,Te]}],"drop-shadow":[{"drop-shadow":["","none",m,If,bf]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",it,ke,Te]}],"hue-rotate":[{"hue-rotate":[it,ke,Te]}],invert:[{invert:["",it,ke,Te]}],saturate:[{saturate:[it,ke,Te]}],sepia:[{sepia:["",it,ke,Te]}],"backdrop-filter":[{"backdrop-filter":["","none",ke,Te]}],"backdrop-blur":[{"backdrop-blur":be()}],"backdrop-brightness":[{"backdrop-brightness":[it,ke,Te]}],"backdrop-contrast":[{"backdrop-contrast":[it,ke,Te]}],"backdrop-grayscale":[{"backdrop-grayscale":["",it,ke,Te]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[it,ke,Te]}],"backdrop-invert":[{"backdrop-invert":["",it,ke,Te]}],"backdrop-opacity":[{"backdrop-opacity":[it,ke,Te]}],"backdrop-saturate":[{"backdrop-saturate":[it,ke,Te]}],"backdrop-sepia":[{"backdrop-sepia":["",it,ke,Te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ke,Te]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[it,"initial",ke,Te]}],ease:[{ease:["linear","initial",x,ke,Te]}],delay:[{delay:[it,ke,Te]}],animate:[{animate:["none",y,ke,Te]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,ke,Te]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:rt()}],"rotate-x":[{"rotate-x":rt()}],"rotate-y":[{"rotate-y":rt()}],"rotate-z":[{"rotate-z":rt()}],scale:[{scale:dt()}],"scale-x":[{"scale-x":dt()}],"scale-y":[{"scale-y":dt()}],"scale-z":[{"scale-z":dt()}],"scale-3d":["scale-3d"],skew:[{skew:st()}],"skew-x":[{"skew-x":st()}],"skew-y":[{"skew-y":st()}],transform:[{transform:[ke,Te,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ct()}],"translate-x":[{"translate-x":ct()}],"translate-y":[{"translate-y":ct()}],"translate-z":[{"translate-z":ct()}],"translate-none":["translate-none"],zoom:[{zoom:[Jr,ke,Te]}],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ke,Te]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":W()}],"scrollbar-track-color":[{"scrollbar-track":W()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ke,Te]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[it,_d,Vi,vI]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},wO=(e,{cacheSize:t,prefix:n,experimentalParseClassName:o,extend:r={},override:a={}})=>(fl(e,"cacheSize",t),fl(e,"prefix",n),fl(e,"experimentalParseClassName",o),Sf(e.theme,a.theme),Sf(e.classGroups,a.classGroups),Sf(e.conflictingClassGroups,a.conflictingClassGroups),Sf(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),fl(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),fl(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),wf(e.theme,r.theme),wf(e.classGroups,r.classGroups),wf(e.conflictingClassGroups,r.conflictingClassGroups),wf(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),vh(e,r,"postfixLookupClassGroups"),vh(e,r,"orderSensitiveModifiers"),e),fl=(e,t,n)=>{n!==void 0&&(e[t]=n)},Sf=(e,t)=>{if(t)for(let n in t)fl(e,n,t[n])},wf=(e,t)=>{if(t)for(let n in t)vh(e,t,n)},vh=(e,t,n)=>{let o=t[n];o!==void 0&&(e[n]=e[n]?e[n].concat(o):o)},DI=(e,...t)=>typeof e=="function"?hI(CI,e,...t):hI(()=>wO(CI(),e),...t);var TO=DI({extend:{classGroups:{"font-size":[{text:["chat","chat-row","chat-code","chat-dense","chat-meta","control-1","control-2","control-3","control-4","control-5"]}]}}});function O(...e){return TO(pI(e))}ge();var Ch=Ut(!0);var bh=Ut(void 0);function ci(){let e=Kt(Ch);return Kt(bh)??e}ge();var Tf=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();var OI=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var FI=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase());var Ih=e=>{let t=FI(e);return t.charAt(0).toUpperCase()+t.slice(1)};ge();var BI={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var zI=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var $I=qn(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:a,iconNode:i,...s},l)=>we("svg",{ref:l,...BI,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:Tf("lucide",r),...!a&&!zI(s)&&{"aria-hidden":"true"},...s},[...i.map(([d,c])=>we(d,c)),...Array.isArray(a)?a:[a]]));var j=(e,t)=>{let n=qn(({className:o,...r},a)=>we($I,{ref:a,iconNode:t,className:Tf(`lucide-${OI(Ih(e))}`,`lucide-${e}`,o),...r}));return n.displayName=Ih(e),n};var kO=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Dd=j("arrow-down",kO);var LO=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Od=j("arrow-up-right",LO);var PO=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Fd=j("arrow-up",PO);var AO=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],Bd=j("blocks",AO);var EO=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],pl=j("bookmark",EO);var MO=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Pa=j("bot",MO);var RO=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],bo=j("check",RO);var NO=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],dn=j("chevron-down",NO);var _O=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Gi=j("chevron-left",_O);var DO=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Go=j("chevron-right",DO);var OO=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],zd=j("chevron-up",OO);var FO=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],$d=j("chevrons-left",FO);var BO=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Hd=j("chevrons-right",BO);var zO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Io=j("circle-alert",zO);var $O=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],ji=j("copy",$O);var HO=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],or=j("ellipsis",HO);var UO=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Ud=j("eye",UO);var KO=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],Qi=j("file-code",KO);var qO=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Xi=j("file-text",qO);var VO=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],Kd=j("file",VO);var WO=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ui=j("folder",WO);var GO=[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]],qd=j("frame",GO);var jO=[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]],Vd=j("git-branch-plus",jO);var QO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Wd=j("globe",QO);var XO=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Gd=j("grip-vertical",XO);var YO=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],jd=j("hammer",YO);var JO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Yi=j("image",JO);var ZO=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Aa=j("layers",ZO);var eF=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],Qd=j("list-ordered",eF);var tF=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],Ji=j("list-todo",tF);var nF=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Xd=j("list",nF);var oF=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],fi=j("lock-open",oF);var rF=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Yd=j("lock",rF);var aF=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],Zi=j("message-circle",aF);var iF=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],es=j("message-square",iF);var sF=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Jd=j("minimize-2",sF);var lF=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],Zr=j("mouse-pointer-click",lF);var dF=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Zd=j("package",dF);var cF=[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]],ts=j("paintbrush",cF);var uF=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],_o=j("paperclip",uF);var fF=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],ea=j("pen-line",fF);var pF=[["path",{d:"M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13",key:"orapub"}],["path",{d:"m8 6 2-2",key:"115y1s"}],["path",{d:"m18 16 2-2",key:"ee94s4"}],["path",{d:"m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17",key:"cfq27r"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],ns=j("pencil-ruler",pF);var mF=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],ec=j("pencil",mF);var gF=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],os=j("puzzle",gF);var hF=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],rs=j("rotate-ccw",hF);var vF=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],as=j("search",vF);var xF=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],tc=j("send",xF);var yF=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],nc=j("settings",yF);var CF=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],ml=j("sliders-horizontal",CF);var bF=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],pi=j("sparkles",bF);var IF=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Do=j("square-pen",IF);var SF=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],oc=j("square",SF);var wF=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],is=j("star",wF);var TF=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Ea=j("terminal",TF);var kF=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],rc=j("text-quote",kF);var LF=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],ta=j("user-round",LF);var PF=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],ac=j("wrench",PF);var AF=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],jt=j("x",AF);var EF=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ss=j("zap",EF);ge();function De(){return{t:nr().i18n.usePluginTranslation()}}ge();var MF=new Set(["Select","AlertDialog","Dialog","DropdownMenu","Menu","Popover","Tooltip","Combobox"]);function Y(e){let t=n=>{let o=nr(),r=Cf(),a=ci(),i=o.ui[e];return we(i,{...n,...MF.has(e)&&!a?{open:!1}:{},className:`${r} ${typeof n.className=="string"?n.className:""}`})};return t.displayName=e,t}var eQ=Y("useLinkContextMenu"),Ir=Y("ProviderInstanceIcon"),HI=Y("UserAvatar"),gl=Y("Badge"),ne=Y("Button"),tQ=Y("Label"),kf=Y("Input"),UI=Y("Textarea"),nQ=Y("Switch"),Lf=Y("Separator"),oQ=Y("Skeleton"),Pf=Y("Spinner"),rQ=Y("ScrollArea"),aQ=Y("Card"),iQ=Y("CardAction"),sQ=Y("CardContent"),lQ=Y("CardDescription"),dQ=Y("CardFooter"),cQ=Y("CardHeader"),uQ=Y("CardTitle"),fQ=Y("Empty"),pQ=Y("EmptyContent"),mQ=Y("EmptyDescription"),gQ=Y("EmptyHeader"),hQ=Y("EmptyMedia"),vQ=Y("EmptyTitle"),xQ=Y("InputGroup"),yQ=Y("InputGroupAddon"),CQ=Y("InputGroupInput"),bQ=Y("DocumentPanel"),IQ=Y("MasterDetail"),hl=Y("Select"),SQ=Y("SelectContent"),vl=Y("SelectItem"),xl=Y("SelectPopup"),KI=Y("SelectTrigger"),yl=Y("SelectValue"),ic=Y("Toggle"),qI=Y("ToggleGroup"),VI=Y("AlertDialog"),WI=Y("AlertDialogClose"),GI=Y("AlertDialogDescription"),jI=Y("AlertDialogFooter"),QI=Y("AlertDialogHeader"),XI=Y("AlertDialogPopup"),YI=Y("AlertDialogTitle"),Af=Y("Dialog"),wQ=Y("DialogClose"),Ef=Y("DialogDescription"),Mf=Y("DialogFooter"),Rf=Y("DialogHeader"),Nf=Y("DialogPopup"),JI=Y("DialogPanel"),_f=Y("DialogTitle"),TQ=Y("DialogTrigger"),kQ=Y("DropdownMenu"),LQ=Y("DropdownMenuContent"),PQ=Y("DropdownMenuItem"),AQ=Y("DropdownMenuTrigger"),Oo=Y("Menu"),sc=Y("MenuGroup"),EQ=Y("MenuGroupLabel"),rr=Y("MenuItem"),Fo=Y("MenuPopup"),Sr=Y("MenuRadioGroup"),jo=Y("MenuRadioItem"),mi=Y("MenuSeparator"),Bo=Y("MenuTrigger"),Cl=Y("Popover"),bl=Y("PopoverPopup"),Il=Y("PopoverTrigger"),ZI=Y("Table"),eS=Y("TableBody"),gi=Y("TableCell"),ls=Y("TableHead"),tS=Y("TableHeader"),Df=Y("TableRow"),Ve=Y("Tooltip"),We=Y("TooltipPopup"),Ge=Y("TooltipTrigger"),nS=Y("Collapsible"),oS=Y("CollapsiblePanel"),rS=Y("CollapsibleTrigger"),lc=Y("Alert"),dc=Y("AlertAction"),Of=Y("AlertDescription"),Sh=Y("AlertTitle"),Ff=Y("Kbd"),Bf=Y("Command"),zf=Y("CommandGroup"),$f=Y("CommandItem"),Hf=Y("CommandList"),aS=Y("Combobox"),iS=Y("ComboboxEmpty"),sS=Y("ComboboxInput"),Sl=Y("ComboboxItem"),lS=Y("ComboboxListVirtualized"),dS=Y("TooltipProvider"),cS=Y("StyledDiffCodeView"),uS=Y("DevBackdropArt"),ar=Y("Markdown"),fS=Y("DiffView");var{jsx:u,jsxs:b,Fragment:Ce}=window.__ycodiumPluginHost.jsxRuntime;function pS({mode:e,onModeChange:t}){let{t:n}=De();return b(qI,{className:"shrink-0","data-view-mode-toggle":!0,size:"xs","aria-label":n("trajectory.toggleLabel"),variant:"segmented",value:[e],onValueChange:o=>{let r=o[0];(r==="chat"||r==="trajectory")&&t(r)},children:[b(ic,{value:"chat","aria-label":n("trajectory.toggleChat"),children:[u(es,{"aria-hidden":!0}),n("trajectory.toggleChat")]}),b(ic,{value:"trajectory","aria-label":n("trajectory.toggleTrajectory"),children:[u(Qd,{"aria-hidden":!0}),n("trajectory.toggleTrajectory")]})]})}function mS({mode:e,visible:t,chat:n,trajectory:o}){let r=e==="chat"?"chat":"trajectory";return u("div",{className:"relative flex min-h-0 flex-1 flex-col","aria-hidden":t?void 0:!0,inert:t?void 0:!0,"data-chat-view-pane":r,"data-pane-visible":t?"true":"false",children:u(bh,{value:t,children:r==="chat"?n:o})})}ge();function po(){return{t:nr().i18n.usePluginTranslation()}}function gS(e){if(e.cacheDisjoint!==!0)return null;let t=e.cachedInputTokens,n=e.inputTokens;if(t===void 0||n===void 0)return null;let o=t+n;if(o<=0)return null;if(t>=o)return"100%";let r=t/o*100;for(let a=0;a<=3;a+=1){let i=r.toFixed(a);if(Number.parseFloat(i)<100)return`${i}%`}return"99.9%"}function hS(e){let t,n,o,r=!0,a=!1;for(let i of e)i!==void 0&&(a=!0,i.cacheDisjoint!==!0&&(r=!1),i.outputTokens!==void 0&&(t=(t??0)+i.outputTokens),i.inputTokens!==void 0&&(n=(n??0)+i.inputTokens),i.cachedInputTokens!==void 0&&(o=(o??0)+i.cachedInputTokens));if(!(t===void 0&&n===void 0&&o===void 0))return{...a&&r?{cacheDisjoint:!0}:{},...t!==void 0?{outputTokens:t}:{},...n!==void 0?{inputTokens:n}:{},...o!==void 0?{cachedInputTokens:o}:{}}}function cc(e){return e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}var RF=de(function({item:t,ordinal:n,usage:o,onSelect:r}){return b("button",{type:"button","data-turn-navigator-row":t.sectionKey,onClick:()=>r(t),className:"flex w-full cursor-pointer items-start gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent",children:[u("span",{className:"shrink-0 pt-px font-mono text-[10px] text-muted-foreground tabular-nums",children:n}),b("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[u("span",{className:"line-clamp-2 min-w-0 font-medium text-chat leading-snug",children:t.userText}),t.assistantText?b("span",{className:"flex items-baseline gap-2",children:[u("span",{className:"line-clamp-1 min-w-0 flex-1 text-[11px] text-muted-foreground leading-snug",children:t.assistantText}),o?.outputTokens!==void 0?u("span",{className:"shrink-0 font-mono text-[9px] text-muted-foreground tabular-nums",children:cc(o.outputTokens)}):null]}):null]})]})});function NF({totals:e}){let{t}=po();if(!e)return null;let n=gS(e),o=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:cc(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:cc(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:n===null?cc(e.cachedInputTokens):`${cc(e.cachedInputTokens)} (${n})`}].filter(r=>r!==null);return o.length===0?null:b("div",{className:"flex items-baseline gap-2 border-t px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:t("turnNavigator.usage")}),o.map(r=>b("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:[r.label," ",r.value]},r.label))]})}var _F=de(function({getText:t,size:n="xs",variant:o="outline",className:r}){let{t:a}=po(),i=nr().writeClipboard,[s,l]=G(!1),d=a("turnNavigator.copyMarkdown");return b(Ve,{children:[u(Ge,{render:u(ne,{"aria-label":d,disabled:s,onClick:()=>{i(t()).then(()=>{l(!0),window.setTimeout(()=>l(!1),1e3)})},type:"button",size:n,variant:o,className:O("text-muted-foreground hover:text-foreground",r)}),children:s?u(bo,{className:"size-3 text-primary"}):u(ji,{className:"size-3"})}),u(We,{children:u("p",{children:d})})]})});function vS({items:e,totalTurnCount:t,bottomInset:n,usageByTurnId:o,onSelect:r,exportMarkdown:a,onDownload:i,placement:s="float"}){let{t:l}=po(),[d,c]=G(!1),f=z(()=>e.map((g,v)=>({item:g,ordinal:v+1})).reverse(),[e]),p=z(()=>hS(f.map(({item:g})=>g.turnId===null?void 0:o.get(g.turnId))),[f,o]);if(e.length===0)return null;let m=t??e.length,h=l("turnNavigator.open",{count:m});return b(Cl,{onOpenChange:c,open:d,children:[b(Il,{render:u(ne,{"aria-label":h,className:O("gap-1.5 rounded-full px-3",s==="float"&&"absolute right-3 z-40"),"data-testid":"turn-navigator-pill",size:"xs",style:s==="float"?{bottom:n+12}:void 0,title:h,variant:"glass"}),children:[u(Xd,{"aria-hidden":!0}),u("span",{className:"font-mono font-semibold text-[11px] tabular-nums",children:m})]}),u(bl,{align:"end",className:"w-80 flex-col",side:"top",children:b("div",{className:"flex max-h-[min(60vh,26rem)] flex-col",children:[b("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.title")}),u("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums",children:m})]}),u("div",{className:O("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:f.map(({item:g,ordinal:v})=>u(RF,{item:g,onSelect:x=>{c(!1),r(x)},ordinal:v,usage:g.turnId===null?void 0:o.get(g.turnId)},g.sectionKey))}),u(NF,{totals:p}),b("div",{className:"flex items-center gap-1 border-t px-2 py-1.5",children:[u("span",{className:"flex-1 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.14em]",children:l("turnNavigator.export")}),u(_F,{size:"icon-xs",getText:a,variant:"ghost"}),u(ne,{"aria-label":l("turnNavigator.downloadMarkdown"),onClick:()=>i("md"),size:"xs",title:l("turnNavigator.downloadMarkdown"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".md"})}),u(ne,{"aria-label":l("turnNavigator.downloadJson"),onClick:()=>i("json"),size:"xs",title:l("turnNavigator.downloadJson"),variant:"ghost",children:u("span",{className:"font-mono text-[10px]",children:".json"})})]})]})})]})}ge();function xS(e,t,n,o={}){if(t!==null)for(let r=0;r<e.length;r+=1){let a=e[r];if(a===void 0)continue;let i=n(a);if(i!==null)return i===t?{anchorIndex:r,anchorOffset:o.anchorOffset??16}:void 0}}ge();function ds(e){if(!Number.isFinite(e)||e<0)return"0ms";if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<1e4)return`${(e/1e3).toFixed(1)}s`;if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n===0?`${t}m`:n===60?`${t+1}m`:`${t}m ${n}s`}function DF(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function OF(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function FF(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var wh=OF(FF()),yS=new Map;function CS(e,t){let n=`${e}:${t?"seconds":"minutes"}`,o=yS.get(n);if(o)return o;let r=new Intl.DateTimeFormat(wh,DF(e,t));return yS.set(n,r),r}function Th(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var BF=new Intl.DateTimeFormat(void 0,{month:"long"});function zF(e){let t=e%100;if(t>=11&&t<=13)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}function $F(e,t){let n=Th(e);return n?CS(t,!1).format(n):""}function na(e,t){let n=Th(e);if(!n)return"";let o=$F(e,t),r=n.getDate(),a=BF.format(n),i=n.getFullYear();return`${o}, ${r}${zF(r)} ${a} ${i}`}var HF=new Intl.DateTimeFormat(wh,{month:"numeric",day:"numeric"}),UF=new Intl.DateTimeFormat(wh,{month:"numeric",day:"numeric",year:"numeric"});function hi(e,t,n=Date.now()){let o=Th(e);if(!o)return"";let r=CS(t,!1).format(o),a=new Date(n),i=new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()).getTime(),l=Math.round((i-s)/864e5);return l<=0?r:l===1?`yesterday at ${r}`:`${(o.getFullYear()===a.getFullYear()?HF:UF).format(o)} ${r}`}ge();ge();async function KF(e,t){if(typeof window>"u"||typeof navigator>"u"||!navigator.clipboard?.writeText)throw new Error(`Clipboard API is unavailable while copying ${t}.`);if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch(n){throw new Error(`Failed to copy ${t} to the clipboard.`,{cause:n})}}function Uf({timeout:e=2e3,target:t="text",onCopy:n,onError:o}={}){let[r,a]=G(!1),i=D(null),s=D(n),l=D(o),d=D(t),c=D(e);s.current=n,l.current=o,d.current=t,c.current=e;let f=B((p,m)=>{KF(p,d.current).then(h=>{h&&(i.current&&clearTimeout(i.current),a(!0),s.current?.(m),c.current!==0&&(i.current=setTimeout(()=>{a(!1),i.current=null},c.current)))},h=>{l.current?.(h instanceof Error?h:new Error(String(h)),m)})},[]);return K(()=>()=>{i.current&&clearTimeout(i.current)},[]),{copyToClipboard:f,isCopied:r}}function Dt(){let e=nr().i18n.usePluginTranslation();return{t:(t,n)=>e(t,n)}}var bS=1e3;function qF({title:e,description:t}){return b("span",{role:"status",className:"dropdown-glass pointer-events-none fixed z-100 rounded-md px-2 py-1 text-balance text-popover-foreground text-xs shadow-xl shadow-black/25",children:[e,t?u("span",{className:"block text-muted-foreground",children:t}):null]})}var wl=de(function({text:t,size:n="xs",variant:o="outline",className:r,toastAnchor:a="above"}){let{t:i}=Dt(),s=D(null),[l,d]=G(null),c=D(null),f=(h,g)=>{let v=s.current?.getBoundingClientRect();v&&(c.current&&clearTimeout(c.current),d({top:a==="above"?Math.max(4,v.top-(g===void 0?26:40)):Math.min(window.innerHeight-26,v.bottom+4),left:Math.max(4,v.left+v.width/2),title:h,description:g}),c.current=setTimeout(()=>d(null),bS))};K(()=>()=>{c.current&&clearTimeout(c.current)},[]);let{copyToClipboard:p,isCopied:m}=Uf({onCopy:()=>f(i("copyButton.copied")),onError:h=>f(i("copyButton.failedToCopy"),h.message),timeout:bS});return b(Ve,{children:[u(Ge,{render:u(ne,{"aria-label":i("copyButton.copyToClipboard"),disabled:m,onClick:()=>p(t),ref:s,type:"button",size:n,variant:o,className:O("text-muted-foreground hover:text-foreground",r)}),children:m?u(bo,{className:"size-3 text-primary"}):u(ji,{className:"size-3"})}),u(We,{children:u("p",{children:i("copyButton.copyToClipboard")})}),l?u("span",{"aria-hidden":!0,className:"pointer-events-none fixed",style:{top:l.top,left:l.left},children:u("span",{className:"relative block -translate-x-1/2",children:u(qF,{title:l.title,description:l.description})})}):null]})});function VF(e){return e<1e3?Math.round(e).toLocaleString():e<1e6?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function Kf({label:e,children:t}){let[n,o]=G(!1);return b(Ve,{open:n,onOpenChange:o,children:[u(Ge,{render:u("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm"}),"aria-label":e,onClick:()=>o(r=>!r),children:t}),u(We,{children:e})]})}var IS=de(function({footer:t,timestampFormat:n,copyText:o}){let{t:r}=Dt(),a=t.state,i=r(a==="completed"?"timeline.completed":a==="error"?"timeline.error":a==="interrupted"?"timeline.interrupted":"timeline.unknown");return b("div",{"data-turn-summary":t.turnId,className:"chat-process-meta flex min-w-0 items-center gap-2 px-1 text-muted-foreground",children:[b("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1",children:[a!=="unknown"?b(Kf,{label:i,children:[a==="completed"?u(bo,{className:"size-icon-1 text-success","aria-hidden":!0}):a==="error"?u(jt,{className:"size-icon-1 text-destructive","aria-hidden":!0}):u(oc,{className:"size-3","aria-hidden":!0}),u("span",{className:"sr-only",children:i})]}):null,t.completedAt?u(Kf,{label:na(t.completedAt,n),children:u("time",{dateTime:t.completedAt,children:hi(t.completedAt,n)})}):null,t.workingElapsedMs!==void 0?b(Kf,{label:r("timeline.workingTime",{duration:ds(t.workingElapsedMs)}),children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),ds(t.workingElapsedMs)]}):null,t.outputTokens!==void 0?b(Kf,{label:`${r("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),VF(t.outputTokens)]}):null]}),o?u(wl,{text:o,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});ge();ge();function SS(e){if(e<1e3)return String(e);if(e<1e6){let n=e/1e3;return`${n<10?n.toFixed(1).replace(/\.0$/,""):Math.round(n)}k`}if(e<1e9){let n=e/1e6;return`${n<10?n.toFixed(1).replace(/\.0$/,""):Math.round(n)}m`}let t=e/1e9;return`${t<10?t.toFixed(1).replace(/\.0$/,""):Math.round(t)}b`}var wS=de(function(t){let{additions:n,deletions:o,className:r,showParentheses:a=!1,layout:i="aligned"}=t,{t:s}=Dt(),l=new Intl.ListFormat(void 0,{type:"unit"}).format([s("changedFiles.additions",{count:n}),s("changedFiles.deletions",{count:o})]);return b(Ce,{children:[a&&u("span",{className:"text-muted-foreground/70",children:"("}),b("span",{role:"group","aria-label":l,className:O(i==="inline"?"inline-flex items-center gap-1 tabular-nums align-middle":"inline-grid grid-cols-[4ch_4ch] gap-2 text-right tabular-nums align-middle",r),children:[b("span",{"aria-hidden":"true",className:"font-mono text-success",children:["+",SS(n)]}),b("span",{"aria-hidden":"true",className:"font-mono text-destructive",children:["-",SS(o)]})]}),a&&u("span",{className:"text-muted-foreground/70",children:")"})]})});function TS(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}function WF(e){let t=e,n,o,r=t.match(/:(\d+)$/);if(!r?.[1])return{path:t,line:void 0,column:void 0};n=r[1],t=t.slice(0,-r[0].length);let a=t.match(/:(\d+)$/);return a?.[1]?(o=a[1],t=t.slice(0,-a[0].length)):(o=n,n=void 0),{path:t,line:o,column:n}}function kS(e){return e.replaceAll("\\","/")}function LS(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function GF(e){return e.replace(/[\\/]+$/,"")}function jF(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function QF(e){return e.replace(/^\.\/+/,"").replace(/^\/+/,"")}function XF(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function qf(e,t){let{path:n,line:o,column:r}=WF(e),a=LS(kS(n)),i=a;if(t){let s=LS(kS(GF(t))),l=jF(s),d=a.toLowerCase(),c=s.toLowerCase(),f=`${c}/`,p=`${l.toLowerCase()}/`;if(d===c)i=l;else if(d.startsWith(f)){let m=a.slice(s.length+1);i=`${l}/${m}`}else if(!XF(a)){let m=QF(a);i=d.startsWith(p)?a:`${l}/${m}`}}return o?`${i}:${o}${r?`:${r}`:""}`:i}function PS(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function AS(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}var Vf="chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left";function uc({children:e}){return u("span",{"aria-hidden":!0,className:"flex size-4 shrink-0 items-center justify-center",children:e})}function fc({status:e}){return u("span",{"aria-hidden":!0,className:"flex size-2 shrink-0 items-center justify-center",children:e===null?null:u("span",{className:O("block size-2 rounded-full",e==="failed"?"bg-destructive":e==="success"?"bg-success":"border border-muted-foreground/60")})})}function Wf({state:e,variant:t="inline",className:n,children:o}){return b("div",{"data-process-state":e,"data-process-kind":t,className:O("chat-process-shell relative min-w-0 overflow-hidden",t==="tool"?"rounded-lg bg-card":"rounded-md",n),children:[e==="running"?u("span",{"aria-hidden":!0,className:"chat-process-shell-pulse animate-status-pulse"}):null,o]})}ge();var Tl=new Map,ES=24,YF=4e3;function kh(e){let t=Tl.get(e);if(t)return t;let n={values:new Map,listeners:new Set};if(Tl.set(e,n),Tl.size>ES){for(let[o,r]of Tl)if(r.listeners.size===0&&o!==e&&(Tl.delete(o),Tl.size<=ES))break}return n}function Lh(e,t,n){return kh(e).values.get(t)??n}function pc(e,t,n,o=!0){let r=kh(e);if(r.values.get(t)!==n){if(r.values.delete(t),r.values.set(t,n),r.values.size>YF){let a=r.values.keys().next().value;a!==void 0&&r.values.delete(a)}o&&r.listeners.forEach(a=>a())}}function kl(e,t,n){let o=B(s=>{let l=kh(e);return l.listeners.add(s),()=>l.listeners.delete(s)},[e]),r=B(()=>Lh(e,t,n),[e,t,n]),a=ka(o,r,r),i=B(s=>pc(e,t,s),[e,t]);return[a,i]}function Gf({name:e,className:t}){switch(e){case"bot":return u(Pa,{className:t,"aria-hidden":!0});case"check":return u(bo,{className:t,"aria-hidden":!0});case"circle-alert":return u(Io,{className:t,"aria-hidden":!0});case"eye":return u(Ud,{className:t,"aria-hidden":!0});case"globe":return u(Wd,{className:t,"aria-hidden":!0});case"hammer":return u(jd,{className:t,"aria-hidden":!0});case"message-circle":return u(Zi,{className:t,"aria-hidden":!0});case"search":return u(as,{className:t,"aria-hidden":!0});case"square-pen":return u(Do,{className:t,"aria-hidden":!0});case"terminal":return u(Ea,{className:t,"aria-hidden":!0});case"wrench":return u(ac,{className:t,"aria-hidden":!0});case"x":return u(jt,{className:t,"aria-hidden":!0});case"zap":return u(ss,{className:t,"aria-hidden":!0})}}function JF(e){switch(e){case"read":return"eye";case"edit":return"square-pen";case"command":return"terminal";case"search":return"globe";case"code-search":return"search";case"other":return"wrench";case"dynamic-tool":return"hammer";case"agent-tool":return"bot";case"tone-tool":return"zap";case"mixed":case null:return"hammer"}}function Ph(e,t){let n=new Map;for(let o of e){let r=t(o);n.set(r,(n.get(r)??0)+1)}return Array.from(n,([o,r])=>({action:o,icon:JF(o),count:r}))}function Ah(e,t){let n;for(let o of Ph(e,t))(!n||o.count>n.count)&&(n=o);return n?.icon??"wrench"}var Ll=20;function Pl(e){return TS(e)}function MS(e,t,n){let o=e.toolLabel,r=n.resolveToolCommand(e);if(r&&o?.descriptive&&!o.path&&o.detail?.trim())return o.detail.replace(/\s+/g," ").trim();for(let p of[e.rawCommand,e.command]){let m=n.parseToolCommandInput(p)?.description;if(m)return m.replace(/\s+/g," ").trim()}if(r)return r.replace(/\s+/g," ").trim();let a=typeof e.toolData=="object"&&e.toolData!==null&&!Array.isArray(e.toolData)?e.toolData:null,i=typeof a?.toolName=="string"?a.toolName:typeof a?.name=="string"?a.name:void 0,s=o?.name??i??e.toolTitle??e.label,l=o?.path??e.changedFiles?.[0],d=l?qf(l,t):void 0,c=[s.trim().toLowerCase()==="tool"?void 0:s,d,o?.detail??e.detail],f=[];for(let p of c){let m=p?.replace(/\s+/g," ").trim();m&&!f.some(h=>h.toLowerCase()===m.toLowerCase())&&f.push(m)}return f.join(" ")||null}function RS({entry:e,failed:t}){let n=e.toolLabel?.diffStat;return!n||t||Eh(e)?null:u(wS,{...n,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function Eh(e){return e.toolLifecycleStatus==="declined"||e.toolLifecycleStatus==="stopped"}function ZF({entry:e,failed:t=!1,derive:n}){return t?u(Io,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive"}):u(Gf,{name:Ah([e],n.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function e2({entries:e,failed:t,derive:n}){let{t:o}=Dt(),r=z(()=>Ph(e,n.toolGroupAction),[e,n]),a=r.length===1;return a&&r[0].count<2?null:u("span",{className:"chat-process-meta flex shrink-0 items-center gap-2 tabular-nums","aria-label":o("toolGroup.calls",{count:e.length}),children:r.map(({action:i,icon:s,count:l})=>b("span",{"aria-hidden":!0,className:"flex items-center gap-1",children:[a?null:u(Gf,{name:s,className:O("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive":"text-icon-muted")}),l]},i))})}function NS({entry:e}){let t=Kt(kn),n=e.detail??e.command??e.rawCommand??e.toolLabel?.detail,o=JSON.stringify([e.id,e.sourceActivityKind,e.toolLifecycleStatus]),r=t.renderToolCallDetail?.({entry:e,threadRef:t.threadRef,threadKey:t.threadKey,workspaceRoot:t.workspaceRoot,revision:o,onOpenFileDiff:t.onOpenFileDiff});return u("div",{className:"min-w-0 space-y-2 p-3",children:r!==void 0?u(Ce,{children:r}):u("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:n??""})})}var t2=de(function(t){let{entry:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}=t,s=Kt(kn).derive,{t:l}=Dt(),[d,c]=kl(o,`call:${Pl(n)}`,!1),f=s.workEntryIndicatesFailure(n),p=Eh(n),m=s.resolveWorkEntryStatus(n),h=m==="failed"||m==="running"?m:null,g=Xr();return b("div",{"data-tool-call-id":n.toolCallId??n.id,"data-tool-identity":Pl(n),className:"border-b border-border/50 last:border-b-0",children:[b("button",{type:"button","aria-expanded":d,"aria-controls":g,onClick:()=>{a?.(),c(!d)},className:O("chat-tool-member-row chat-tool-summary flex w-full min-w-0 items-center gap-1.5 px-3 text-left hover:bg-accent/20",f?"text-destructive":"text-muted-foreground"),children:[u(fc,{status:h}),u(uc,{children:u(ZF,{entry:n,failed:f,derive:s})}),b("span",{className:"flex min-w-0 flex-1 items-center",children:[u("span",{className:"truncate",children:MS(n,r,s)??l("toolGroup.calls",{count:1})}),u(RS,{entry:n,failed:f})]}),f||p?u("span",{className:"chat-process-meta shrink-0",children:f?l("toolGroup.failed",{count:1}):l("toolGroup.cancelled",{count:1})}):null,u(dn,{"aria-hidden":!0,className:O("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),d?u("div",{id:g,children:u(NS,{entry:n})}):null]})});function n2({threadKey:e,stateKey:t,maxHeight:n,children:o}){let r=D(null);return xe(()=>{let a=r.current;if(!a)return;a.scrollTop=Lh(e,`${t}:scroll`,0);let i=()=>{pc(e,`${t}:scroll`,a.scrollTop,!1)};return a.addEventListener("scroll",i,{passive:!0}),()=>a.removeEventListener("scroll",i)},[e,t]),u("div",{ref:r,"data-slot":"scroll-area-viewport",className:"min-w-0 overflow-y-auto overscroll-y-contain",style:{maxHeight:n},children:o})}var _S=de(function({entries:t,groupId:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}){let s=Kt(kn).derive,{t:l}=Dt(),[d,c]=kl(o,`group:${n}`,!1),[f,p]=kl(o,`group-page:${n}`,0),m=Xr(),h=D(null),[g,v]=G(null),x=t.at(-1),y=z(()=>t.filter(F=>s.workEntryIndicatesFailure(F)),[t,s]),C=z(()=>t.filter(Eh),[t]),S=t.filter(F=>F.toolLifecycleStatus==="inProgress").length,L=y[0]??C[0],w=L??x,k=Math.max(0,Math.ceil(t.length/Ll)-1),I=Math.min(f,k),T=I*Ll,E=t.slice(T,T+Ll),A=t.length>1;if(xe(()=>{if(!g)return;let F=h.current,oe=Array.from(F?.querySelectorAll("[data-tool-identity]")??[]).find(W=>W.dataset.toolIdentity===g.id);if(!oe)return;let ee=oe.closest('[data-slot="scroll-area-viewport"]');ee&&(ee.scrollTop+=oe.getBoundingClientRect().top-ee.getBoundingClientRect().top),oe.querySelector("button")?.focus({preventScroll:!0})},[g]),!x||!w)return null;let N=F=>{a?.(),p(F)},R={threadKey:o,workspaceRoot:r,onDisclosureChange:a},$=AS(t.map(F=>PS(s.resolveWorkEntryStatus(F)))),U=Ah(t,s.toolGroupAction),H=$==="failed"?"failed":$==="running"?"running":"success";return u(Wf,{state:$,variant:"tool",children:b("section",{ref:h,"data-tool-group-id":n,className:"min-w-0",children:[b("div",{className:"flex min-w-0 items-center",children:[b("button",{type:"button","aria-expanded":d,"aria-controls":m,onClick:()=>{a?.(),c(!d),!A&&!d&&pc(o,`call:${Pl(x)}`,!0)},className:O(Vf,"flex-1",L?"text-destructive":"text-muted-foreground"),children:[u(fc,{status:H}),u(uc,{children:u(Gf,{name:U,className:O("size-icon-1 shrink-0 stroke-[1.8] opacity-70",y.length>0?"text-destructive":"text-icon-muted")})}),b("span",{className:O("flex min-w-0 flex-1 items-center",d&&A?"chat-process-text":"chat-tool-summary"),children:[u("span",{className:"truncate",children:d&&A?l("toolGroup.calls",{count:t.length}):MS(w,r,s)??l("toolGroup.calls",{count:1})}),d&&A?null:u(RS,{entry:w,failed:s.workEntryIndicatesFailure(w)})]}),S>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.running",{count:S})}):null,y.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.failed",{count:y.length})}):null,C.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.cancelled",{count:C.length})}):null,d&&A?null:u(e2,{entries:t,failed:y.length>0,derive:s}),u(dn,{"aria-hidden":!0,className:O("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),L&&A?u("button",{type:"button",className:"chat-process-meta me-2 min-h-8 shrink-0 rounded-control-4 px-1 text-destructive underline [@media(pointer:coarse)]:min-h-11",onClick:()=>{a?.(),c(!0),p(Math.floor(t.indexOf(L)/Ll)),pc(o,`call:${Pl(L)}`,!0),v({id:Pl(L)})},children:l("toolGroup.showFailure")}):null]}),d?u("div",{id:m,className:"border-t border-border/50",children:A?b(Ce,{children:[t.length>Ll?b("div",{className:"chat-process-meta flex items-center gap-1 border-b border-border/40 px-2 py-1 text-muted-foreground",children:[u("span",{className:"min-w-0 flex-1 tabular-nums",children:l("toolGroup.pageRange",{from:T+1,to:Math.min(T+Ll,t.length),count:t.length})}),[{label:l("toolGroup.firstPage"),target:0,disabled:I===0,Icon:$d},{label:l("toolGroup.previousPage"),target:I-1,disabled:I===0,Icon:Gi},{label:l("toolGroup.nextPage"),target:I+1,disabled:I===k,Icon:Go},{label:l("toolGroup.lastPage"),target:k,disabled:I===k,Icon:Hd}].map(({label:F,target:oe,disabled:ee,Icon:W})=>u("button",{type:"button","aria-label":F,disabled:ee,onClick:()=>N(oe),className:"flex size-7 items-center justify-center rounded-control-3 disabled:opacity-64 [@media(pointer:coarse)]:size-11",children:u(W,{"aria-hidden":!0,className:"size-icon-1"})},F))]}):null,u(n2,{threadKey:o,stateKey:`group-scroll:${n}:${I}`,maxHeight:"min(320px, 50dvh)",children:u("div",{className:"space-y-0.5 py-1",children:E.map(F=>u(t2,{entry:F,...R},Pl(F)))})})]}):u(NS,{entry:x})}):null]})})});function o2(e,t,n){let o=n-t;if(Math.abs(o)<1)return null;let r=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+o));return Math.abs(r-e.scrollTop)<1?null:r}function DS(e){let{viewport:t,anchor:n,row:o,scrollToOffset:r}=e,a=n.getBoundingClientRect().top,i=!0,s=null,l=()=>{if(s=null,!i||!n.isConnected||!t.contains(n))return;let f=o2(t,a,n.getBoundingClientRect().top);f!==null&&r(f),a=n.getBoundingClientRect().top},d=()=>{i&&s===null&&(s=requestAnimationFrame(l))},c=typeof ResizeObserver>"u"?null:new ResizeObserver(d);return c?.observe(o),d(),{schedule:d,stop:()=>{i=!1,c?.disconnect(),s!==null&&cancelAnimationFrame(s),s=null}}}ge();function Mh(e,t){for(let n of e.querySelectorAll("[data-timeline-row-id]"))if(n.dataset.timelineRowId===t)return n;return null}function OS(e,t){let n=0,o=e.length,r=-1;for(;n<o;){let a=Math.floor((n+o)/2),s=e[a].getBoundingClientRect();Math.max(s.bottom,s.top+1)>t?(r=a,o=a):n=a+1}return r}function r2(e){let t=e.getBoundingClientRect().top,n=e.querySelectorAll("[data-timeline-turn-section]"),o=a=>{let i=a.querySelectorAll("[data-timeline-row-id]"),s=OS(i,t),l=s<0?void 0:i[s],d=l?.dataset.timelineRowId;return!l||d===void 0?null:{rowId:d,offsetPx:Math.max(0,Math.round(t-l.getBoundingClientRect().top))}};if(n.length===0)return o(e);let r=OS(n,t);if(r<0)return null;for(let a=r;a<n.length;a+=1){let i=o(n[a]);if(i)return i}return null}function FS(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}var Rh=class extends qi{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function BS({inputKey:e,onBeforeInputChange:t,handleRef:n,onAttach:o,className:r,children:a,onScroll:i}){let s=D(null);Yr(n,()=>({get node(){return s.current},measure:()=>{let d=s.current;return d?{scroll:d.scrollTop,scrollLength:d.clientHeight,contentLength:d.scrollHeight,topOf:c=>{let f=Mh(d,c);return f===null?null:FS(f,d)},heightOf:c=>{let f=Mh(d,c);return f===null?null:f.offsetHeight},rowAtScroll:()=>r2(d)}:null},scrollToEnd:d=>{let c=s.current;if(c){if(d?.animated){c.scrollTo({top:c.scrollHeight,behavior:"smooth"});return}c.scrollTop=c.scrollHeight-c.clientHeight}},scrollToRow:(d,c)=>{let f=s.current;if(!f)return!1;let p=Mh(f,d);return p?(f.scrollTop=Math.max(0,FS(p,f)-(c?.viewOffset??0)),!0):!1},scrollToOffset:d=>{let c=s.current;c&&(c.scrollTop=Math.max(0,d))}}),[]);let l=B(d=>{s.current=d,o(d)},[o]);return u(Rh,{inputKey:e,onBeforeInputChange:t,children:u("div",{ref:l,className:r,style:{position:"relative"},onScroll:i,children:a})})}ge();var zS=de(function({sectionKey:t,rowKeyPrefix:n,rows:o,renderRow:r,sectionRef:a}){return u("div",{className:"session-turn","data-timeline-turn-section":t,ref:a,children:o.map(i=>u("div",{className:"transcript-col min-w-0 overflow-x-clip",children:r(i)},`${n}:${i.id}`))})});function a2(e){for(let t of e)switch(t.kind){case"turn-identity":return t.turnId;case"working":return t.turnId??null;case"message":if(t.message.role==="assistant")return t.message.turnId;break;case"tool-group":if(t.entries[0]?.turnId!==void 0)return t.entries[0].turnId??null;break;case"work":if(t.groupedEntries[0]?.turnId!==void 0)return t.groupedEntries[0].turnId??null;break;case"turn-plan":return t.turnPlan.turnId;case"proposed-plan":return t.proposedPlan.turnId;case"turn-summary":return t.footer.turnId}return null}function $S(e,t){let n=[];for(let o of t){if(o.end<=o.start)continue;let r=e.slice(o.start,o.end);n.push({key:o.key,turnId:a2(r),firstRowIndex:o.start,rows:r})}return n}function HS(e,t){let n=Math.max(0,Math.min(t,e)),o=e-n;return{startIndex:o,hasHiddenOlder:o>0}}function mc(e,t,n){let o=e.findIndex(r=>r.rows.some(a=>a.id===t));return o<0?n:Math.max(n,e.length-o)}ge();ge();var KS=100,i2=new Map,US=new Map,_h=e=>typeof e=="function"?e():e,s2=(e,t)=>typeof t=="function"?t(e):t;function l2(e,t,n){let o=e.get(t);return o===void 0&&(o={values:new Map,limit:Math.max(1,n)},e.set(t,o)),o}function d2(e,t){let n=US.get(e);return n===void 0&&(n={values:new Map,limit:Math.max(1,t)},US.set(e,n)),n}function c2(e,t){if(!(e.values.size<=e.limit)){for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.committed||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}for(let[n,o]of e.values){if(e.values.size<=e.limit)return;o===t||o.leases>0||(e.values.delete(n),o.alive=!1,o.subscribers.clear())}}}function Nh(e,t,n){e.values.get(t)===n&&(e.values.delete(t),e.values.set(t,n))}function qS(e,t,n){let o=e.values.get(t);return o===void 0&&(o={value:_h(n),subscribers:new Set,leases:0,alive:!0,committed:!1},e.values.set(t,o)),o}function gc(e){queueMicrotask(()=>c2(e))}function Ln(e,t,n,o=KS){let r=Math.max(1,o),a=l2(i2,e,r),i=qS(a,t,n),s=B(f=>i.alive?(a.limit=r,i.committed=!0,Nh(a,t,i),i.leases+=1,i.subscribers.add(f),gc(a),()=>{i.subscribers.delete(f),i.leases=Math.max(0,i.leases-1),gc(a)}):()=>{},[r,i,a,t]),l=B(()=>i.value,[i]),d=ka(s,l,l),c=B(f=>{if(!i.alive||a.values.get(t)!==i)return;let p=i.value,m=s2(p,f);if(!Object.is(m,p)){i.value=m,Nh(a,t,i);for(let h of i.subscribers)h();gc(a)}},[i,a,t]);return[d,c]}function Rn(e,t,n,o=KS){let r=Math.max(1,o),a=d2(e,r),i=qS(a,t,()=>({current:_h(n)}));return K(()=>{if(!(!i.alive||a.values.get(t)!==i))return a.limit=r,i.committed=!0,Nh(a,t,i),i.leases+=1,gc(a),()=>{i.leases=Math.max(0,i.leases-1),gc(a)}},[r,i,a,t]),i.value}function hc(e,t){let n=D(null);return(n.current===null||n.current.key!==e)&&(n.current={key:e,ref:{current:_h(t)}}),n.current.ref}var cs=3,u2=cs;function VS(e){let[t,n]=Ln("timeline-reveal-window",e,cs),o=B(()=>{n(s=>s+u2)},[n]),r=B(s=>{n(l=>s>l?s:l)},[n]),a=B(()=>{n(cs)},[n]),i=B(s=>{n(l=>Math.min(l,Math.max(cs,s)))},[n]);return{revealedCount:t,revealOlder:o,revealAtLeast:r,compactTo:i,reset:a}}function WS({root:e,minimumCount:t,canCompact:n,onCompact:o}){let r=e.ownerDocument,a=new Set,i,s=!1,l=()=>e.scrollHeight-e.clientHeight-e.scrollTop<=2,d=()=>{if(i=void 0,r.hidden||a.size>0||!n()||e.clientHeight<=0||!l())return;let x=r.getSelection();if(x&&!x.isCollapsed){for(let k=0;k<x.rangeCount;k+=1)if(x.getRangeAt(k).intersectsNode(e))return}let y=e.querySelectorAll("[data-timeline-turn-section]"),C=e.getBoundingClientRect().top-32,S=0,L=Math.max(0,y.length-t);for(;S<L;){let k=Math.floor((S+L)/2),I=y[k].getBoundingClientRect().bottom;if(!Number.isFinite(I))return;I<=C?S=k+1:L=k}if(S===0)return;let w=r.activeElement;if(w){for(let k=0;k<S;k+=1)if(y[k].contains(w))return}o(y.length-S)},c=()=>{i===void 0&&(i=setTimeout(d,400))},f=()=>{clearTimeout(i),i=setTimeout(d,400)},p=()=>{let x=l();!x||!s?f():c(),s=x},m=x=>{a.add(x.pointerId),f()},h=x=>{a.delete(x.pointerId),f()},g=()=>{a.clear(),f()},v=["wheel","keydown","focusin","focusout"];for(let x of v)e.addEventListener(x,f,{passive:!0});return e.addEventListener("scroll",p,{passive:!0}),e.addEventListener("pointerdown",m,!0),r.addEventListener("pointerup",h,!0),r.addEventListener("pointercancel",h,!0),r.addEventListener("selectionchange",f),r.addEventListener("visibilitychange",c),r.defaultView?.addEventListener("blur",g),c(),{schedule:c,disconnect:()=>{clearTimeout(i);for(let x of v)e.removeEventListener(x,f);e.removeEventListener("scroll",p),e.removeEventListener("pointerdown",m,!0),r.removeEventListener("pointerup",h,!0),r.removeEventListener("pointercancel",h,!0),r.removeEventListener("selectionchange",f),r.removeEventListener("visibilitychange",c),r.defaultView?.removeEventListener("blur",g)}}}ge();ge();function GS(e){let t=D(e);t.current=e;let n=D(!1),o=D(null),r=D(null),a=D(0),i=B(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),s=B(()=>{if(!n.current||!t.current||r.current!==null||o.current===null)return;let c=++a.current;r.current=requestAnimationFrame(f=>{if(c!==a.current||(r.current=null,!n.current||!t.current))return;let p=o.current;o.current=null,p?.(f)})},[]),l=B(c=>{o.current=c,s()},[s]),d=B(()=>{o.current=null,i()},[i]);return xe(()=>(n.current=!0,s(),()=>{n.current=!1,i()}),[e,i,s]),z(()=>({request:l,cancel:d}),[l,d])}function jS({root:e,topInsetPx:t,onActiveSectionChange:n,active:o}){let r=D(o);r.current=o;let a=GS(o),i=D(new Map),s=D(null),l=D(null),d=D(n);d.current=n;let c=B(()=>{if(!r.current||!e)return;let g=e.scrollTop+t,v=null,x=Number.NEGATIVE_INFINITY,y=null,C=Number.POSITIVE_INFINITY;for(let[L,w]of i.current){if(!w.isConnected)continue;let k=w.offsetTop;k<C&&(C=k,y=L),k<=g&&k>=x&&(x=k,v=L)}let S=v??y;S!==l.current&&(l.current=S,d.current(S))},[e,t]),f=B(()=>{r.current&&a.request(c)},[a,c]);K(()=>{if(!o||!e||typeof IntersectionObserver>"u")return;let g=!0,v=new IntersectionObserver(()=>{!g||!r.current||f()},{root:e,rootMargin:`-${t}px 0px 0px 0px`,threshold:0});s.current=v;for(let x of i.current.values())v.observe(x);return f(),()=>{g=!1,v.disconnect(),s.current=null,a.cancel()}},[o,a,f,e,t]);let p=D(new Map),m=B(g=>{let v=p.current.get(g);if(v)return v;let x=y=>{let C=i.current.get(g);C&&C!==y&&(s.current?.unobserve(C),i.current.delete(g)),y?(i.current.set(g,y),s.current?.observe(y)):p.current.delete(g)};return p.current.set(g,x),x},[]),h=B(()=>{r.current&&(l.current=null,f())},[f]);return z(()=>({observeSection:m,refresh:h}),[m,h])}function vc(e,t,n="duration"){let o=`<${n}></${n}>`,r=`<${n}/>`,a=s=>{let l=e.indexOf(s);return l<0?null:[e.slice(0,l),e.slice(l+s.length)]},i=a(o)??a(r);return i===null?b(Ce,{children:[e,t]}):b(Ce,{children:[i[0],t,i[1]]})}ge();function QS(){let e=nr(),t=r=>r instanceof Error?r.message:void 0,n=(r,a)=>a!==void 0&&a.length>0?`${r}: ${a}`:r,o=(r,a,i)=>e.notify(r,a,i);return{error:(r,a,i)=>{let s=i?.description??t(a);o(n(r,s),"error",s)},warning:(r,a,i)=>{let s=i?.description??t(a);o(n(r,s),"warning",s)},success:(r,a,i)=>{let s=a??i?.description;o(n(r,s),"success",s)}}}function jf(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function Dh(e){let t=e.trimEnd().split(/\r?\n/),n=t[0]&&/^\s{0,3}#{1,6}\s+/.test(t[0])?t.slice(1):[...t];for(;n[0]?.trim().length===0;)n.shift();if(n[0]?.match(/^\s{0,3}#{1,6}\s+(.+)$/)?.[1]?.trim().toLowerCase()==="summary")for(n.shift();n[0]?.trim().length===0;)n.shift();return n.join(`
3672
+ `)}function XS(e,t){let n=t?.maxLines??8,o=Dh(e).trimEnd().split(/\r?\n/).map(s=>s.trimEnd()),r=[],a=0,i=!1;for(let s of o){let l=s.trim().length>0;if(l&&a>=n){i=!0;break}r.push(s),l&&(a+=1)}for(;r.length>0&&r.at(-1)?.trim().length===0;)r.pop();return r.length===0?jf(e)??"Plan preview unavailable.":(i&&r.push("","..."),r.join(`
3673
+ `))}function f2(e){let t=e.toLowerCase().replace(/[`'".,!?()[\]{}]+/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"plan"}function YS(e){let t=jf(e);return`${f2(t??"plan")}.md`}function JS(e){return`${e.trimEnd()}
3674
+ `}function ZS(e,t){let n=new Blob([t],{type:"text/markdown;charset=utf-8"}),o=URL.createObjectURL(n),r=document.createElement("a");r.href=o,r.download=e,r.click(),window.setTimeout(()=>{URL.revokeObjectURL(o)},0)}var e0=de(function({planMarkdown:t,environmentId:n,threadRef:o,cwd:r,workspaceRoot:a,onSavePlanToWorkspace:i}){let{t:s}=Dt(),l=QS(),[d,c]=G(!1),[f,p]=G(!1),[m,h]=G(""),[g,v]=G(!1),{copyToClipboard:x,isCopied:y}=Uf({target:"plan",onError:U=>{l.error(s("proposedPlan.couldNotCopy"),U,{description:s("proposedPlan.copyErrorDescription")})}}),C=Xr(),S=jf(t)??s("proposedPlan.defaultTitle"),L=t.split(`
3675
+ `).length,w=t.length>900||L>20,k=Dh(t),I=w?XS(t,{maxLines:10}):null,T=YS(t),E=JS(t),A=()=>{ZS(T,E)},N=()=>{x(E)},R=()=>{if(!a){l.error(s("proposedPlan.workspacePathUnavailable"),s("proposedPlan.workspacePathUnavailableDescription"));return}h(U=>U.length>0?U:T),p(!0)},$=()=>{let U=m.trim();if(!(!a||i===null)){if(!U){l.warning(s("proposedPlan.enterWorkspacePath"));return}v(!0),(async()=>{let H=await i({environmentId:n,workspaceRoot:a,relativePath:U,contents:E});if(v(!1),H.ok){p(!1),l.success(s("proposedPlan.savedToWorkspace"),H.relativePath);return}l.error(s("proposedPlan.couldNotSave"),void 0,{description:s("proposedPlan.saveErrorDescription")})})()}};return b("div",{className:"rounded-[24px] border border-border/80 bg-card/70 p-4 sm:p-5",children:[b("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[b("div",{className:"flex min-w-0 items-center gap-2",children:[u(gl,{variant:"secondary",children:s("proposedPlan.badge")}),u("p",{className:"truncate text-sm font-medium text-foreground",children:S})]}),b(Oo,{children:[u(Bo,{render:u(ne,{"aria-label":s("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:u(or,{"aria-hidden":"true",className:"size-4"})}),b(Fo,{align:"end",children:[u(rr,{onClick:N,children:s(y?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),u(rr,{onClick:A,children:s("proposedPlan.downloadAsMarkdown")}),i!==null?u(rr,{onClick:R,disabled:!a||g,children:s("proposedPlan.saveToWorkspace")}):null]})]})]}),b("div",{className:"mt-4",children:[b("div",{className:O("relative",w&&!d&&"max-h-104 overflow-hidden"),children:[w&&!d?u(ar,{text:I??"",cwd:r,threadRef:o,isStreaming:!1}):u(ar,{text:k,cwd:r,threadRef:o,isStreaming:!1}),w&&!d?u("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-24 bg-linear-to-t from-card/95 via-card/80 to-transparent"}):null]}),w?u("div",{className:"mt-4 flex justify-center",children:u(ne,{size:"sm",variant:"outline","data-scroll-anchor-ignore":!0,onClick:()=>c(U=>!U),children:s(d?"proposedPlan.collapse":"proposedPlan.expand")})}):null]}),u(Af,{open:f,onOpenChange:U=>{g||p(U)},children:b(Nf,{className:"max-w-xl",children:[b(Rf,{children:[u(_f,{children:s("proposedPlan.saveToWorkspace")}),u(Ef,{children:vc(s("proposedPlan.pathHint"),u("code",{children:a??s("proposedPlan.theWorkspace")}),"path")})]}),u(JI,{className:"space-y-3",children:b("label",{htmlFor:C,className:"grid gap-1.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:s("proposedPlan.workspacePath")}),u(kf,{id:C,value:m,onChange:U=>h(U.target.value),placeholder:T,spellCheck:!1,disabled:g})]})}),b(Mf,{children:[u(ne,{variant:"outline",size:"sm",onClick:()=>p(!1),disabled:g,children:s("proposedPlan.cancel")}),u(ne,{size:"sm",onClick:()=>{$()},disabled:g,children:s(g?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});function t0({timeline:e,previousOverlayHeight:t,overlayHeight:n,followingEnd:o}){e&&o&&n>t&&e.scrollToEnd({animated:!1})}function n0({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}ge();var Qf=class extends qi{state={failed:!1,error:null};static getDerivedStateFromError(t){return{failed:!0,error:t instanceof Error?t:new Error(String(t))}}componentDidUpdate(t){this.state.failed&&t.resetKey!==this.props.resetKey&&this.setState({failed:!1,error:null})}render(){if(!this.state.failed)return this.props.children;let{fallback:t}=this.props;return typeof t=="function"?t(this.state.error):t}};function p2({error:e,className:t}){let{t:n}=Dt();return b(Ve,{children:[b(Ge,{render:u("div",{className:O("flex min-h-6 min-w-0 items-center gap-1.5 px-0.5 py-0.5 text-destructive",t)}),children:[u(Io,{"aria-hidden":!0,className:"size-4 shrink-0"}),u("span",{className:"min-w-0 flex-1 truncate",children:n("timeline.entryUnavailable")})]}),u(We,{className:"max-w-xs whitespace-pre-wrap font-mono text-[11px]",children:e.message})]})}function o0(e){return u(p2,{error:e})}ge();function Oh(e,t){let n=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name}]:[]);if(n.length===0)return null;let o=n.findIndex(r=>r.id===t);return o<0?null:{images:n.map(r=>({src:r.src,name:r.name})),index:o}}function vi(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||m2.has(t)?"text":"file"}var m2=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function r0(e){return!Number.isFinite(e)||e<=0?"0 KB":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}var g2="<ycodium-system>";function Fh(e){return e.startsWith(g2)}var h2=/<ycodium-system>[\s\S]*?<\/ycodium-system>/g;function a0(e){let t=e.match(h2);return t&&t.length>0?t:[e]}function i0(e){let t=e.match(/<plugin-instruction>\n([\s\S]*?)\n<\/plugin-instruction>/)?.[1];if(t===void 0)return null;try{let n=JSON.parse(t);if(n===null||typeof n!="object"||Array.isArray(n))return null;let o=n;return typeof o.pluginId!="string"||typeof o.title!="string"||typeof o.body!="string"?null:{pluginId:o.pluginId,title:o.title,body:o.body}}catch{return null}}function s0(e){switch(e){case"image":return Yi;case"pdf":return Xi;case"text":return Qi;case"file":return _o}}var v2=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/;function xc(e){let t=v2.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=x2(t[1]??"");return{promptText:n,contextCount:o.length,contexts:o}}function x2(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3673
3676
  `).trimEnd()}),n=null)};for(let r of e.split(`
3674
- `)){let a=/^- (.+):$/.exec(r);if(a){o(),n={header:a[1],bodyLines:[]};continue}n&&(r.startsWith(" ")?n.bodyLines.push(r.slice(2)):r.length===0&&n.bodyLines.push(""))}return o(),t}var l2=/\n*<preview_annotation>\n((?:(?!<preview_annotation>)[\s\S])*)\n<\/preview_annotation>\s*$/;function Nh(e){let t=l2.exec(e);if(!t)return{promptText:e,annotation:null};let n=t[1]??"",o=n.split(`
3675
- `),r=o.find(p=>p.startsWith("Page: ")),a=o.find(p=>p.startsWith("Id: ")),i=o.find(p=>p.startsWith("Comment: ")),s=o.find(p=>p.startsWith("Targets: ")),l=o.indexOf("Requested visual changes:"),d=o.slice(l+1),c=d.indexOf("<element_context>"),f=l<0?[]:d.slice(0,c<0?void 0:c).filter(p=>p.startsWith("- ")).map(p=>p.slice(2));return{promptText:e.slice(0,t.index).replace(/\n+$/,""),annotation:{id:a?.slice(4).trim()||`${t.index}`,title:r?.slice(6).trim()||"Preview annotation",comment:i?.slice(9).trim()||"",targetSummary:s?.slice(9).trim()||"",styleChanges:f,hasScreenshot:n.includes("The attached screenshot is the annotated preview crop.")}}}var d2=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,c2=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,u2=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function f2(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function p2(e){let t={};for(let n of e.matchAll(c2))t[n[1]]=f2(n[2]??"");return t}function ZS(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function m2(e){let n=Array.from(e.matchAll(u2)).at(-1),o=n?.index;return{text:e.slice(0,o??e.length).trim(),language:n?.[2]?.trim()||"diff",contents:n?.[3]??""}}function g2(e,t,n){let o=p2(e),r=ZS(o.startIndex),a=ZS(o.endIndex),i=o.filePath?.trim(),s=o.sectionId?.trim();if(!i||!s||r===null||a===null)return null;let l=m2(t);return{id:`review-comment:${n}:${s}:${i}:${r}:${a}`,sectionId:s,sectionTitle:o.sectionTitle?.trim()||"Review",filePath:i,startIndex:Math.min(r,a),endIndex:Math.max(r,a),rangeLabel:o.rangeLabel?.trim()||"line",text:l.text,diff:l.contents,fenceLanguage:l.language}}function _h(e){let t=[],n=0,o=0;for(let a of e.matchAll(d2)){let i=a.index??0,s=e.slice(n,i);s.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:s});let l=g2(a[1]??"",a[2]??"",o);l?(t.push({kind:"review-comment",comment:l}),o+=1):t.push({kind:"text",id:`review-comment-invalid:${i}`,text:a[0]}),n=i+a[0].length}let r=e.slice(n);return r.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:r}),t}function e0(e,t){let n=Math.max(0,...Array.from(t.matchAll(/`+/g),r=>r[0].length)),o="`".repeat(Math.max(3,n+1));return[`${o}${e}`,t.trimEnd(),o].join(`
3676
- `)}function t0(e){if((e.fenceLanguage??"diff")!=="diff")return"";let t=e.diff.trim();if(t.length===0)return"";if(t.startsWith("diff --git "))return t;let n=e.filePath.replaceAll("\\","/");return[`diff --git a/${n} b/${n}`,`--- a/${n}`,`+++ b/${n}`,t].join(`
3677
- `)}var h2="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium leading-none align-middle",v2=`${h2} border border-border/70 bg-accent/40 text-foreground`,Kf=`${v2} text-[12px]`,qf="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",Vf="truncate leading-tight",n0='<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>';var x2=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s|$)/g;function y2(e){return e.split(/[\s_-]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function C2(e){let t=e.displayName?.trim();return t||y2(e.name)}function o0(e){let t=[],n=0;for(let o of e.text.matchAll(x2)){let r=o[1]??"",a=o[2]??"",i=(o.index??0)+r.length,s=`$${a}`,l=e.skills.find(d=>d.name===a);l&&(i>n&&t.push(e.text.slice(n,i)),t.push(u(b2,{skill:l,rawText:s},`${i}:${a}`)),n=i+s.length)}return n===0?u(be,{children:e.text}):(n<e.text.length&&t.push(e.text.slice(n)),u(be,{children:t}))}function b2(e){return u("span",{className:"inline-flex align-middle leading-none","data-markdown-copy":e.rawText,children:b("span",{className:F(Kf,"border-fuchsia-500/25 bg-fuchsia-500/12 text-fuchsia-700 dark:text-fuchsia-300"),children:[u("span",{"aria-hidden":"true",className:qf,dangerouslySetInnerHTML:{__html:n0}}),u("span",{className:Vf,children:C2(e.skill)})]})})}function r0(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Qe,{children:[b(Ye,{render:u("span",{className:F(Kf,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0}),children:[u(ba,{className:F(qf,"size-icon-1",o&&"opacity-100")}),u("span",{className:Vf,children:t})]}),u(Xe,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}var I2=/\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/;function S2(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3677
+ `)){let a=/^- (.+):$/.exec(r);if(a){o(),n={header:a[1],bodyLines:[]};continue}n&&(r.startsWith(" ")?n.bodyLines.push(r.slice(2)):r.length===0&&n.bodyLines.push(""))}return o(),t}var y2=/\n*<preview_annotation>\n((?:(?!<preview_annotation>)[\s\S])*)\n<\/preview_annotation>\s*$/;function Bh(e){let t=y2.exec(e);if(!t)return{promptText:e,annotation:null};let n=t[1]??"",o=n.split(`
3678
+ `),r=o.find(p=>p.startsWith("Page: ")),a=o.find(p=>p.startsWith("Id: ")),i=o.find(p=>p.startsWith("Comment: ")),s=o.find(p=>p.startsWith("Targets: ")),l=o.indexOf("Requested visual changes:"),d=o.slice(l+1),c=d.indexOf("<element_context>"),f=l<0?[]:d.slice(0,c<0?void 0:c).filter(p=>p.startsWith("- ")).map(p=>p.slice(2));return{promptText:e.slice(0,t.index).replace(/\n+$/,""),annotation:{id:a?.slice(4).trim()||`${t.index}`,title:r?.slice(6).trim()||"Preview annotation",comment:i?.slice(9).trim()||"",targetSummary:s?.slice(9).trim()||"",styleChanges:f,hasScreenshot:n.includes("The attached screenshot is the annotated preview crop.")}}}var C2=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,b2=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,I2=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function S2(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function w2(e){let t={};for(let n of e.matchAll(b2))t[n[1]]=S2(n[2]??"");return t}function l0(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function T2(e){let n=Array.from(e.matchAll(I2)).at(-1),o=n?.index;return{text:e.slice(0,o??e.length).trim(),language:n?.[2]?.trim()||"diff",contents:n?.[3]??""}}function k2(e,t,n){let o=w2(e),r=l0(o.startIndex),a=l0(o.endIndex),i=o.filePath?.trim(),s=o.sectionId?.trim();if(!i||!s||r===null||a===null)return null;let l=T2(t);return{id:`review-comment:${n}:${s}:${i}:${r}:${a}`,sectionId:s,sectionTitle:o.sectionTitle?.trim()||"Review",filePath:i,startIndex:Math.min(r,a),endIndex:Math.max(r,a),rangeLabel:o.rangeLabel?.trim()||"line",text:l.text,diff:l.contents,fenceLanguage:l.language}}function zh(e){let t=[],n=0,o=0;for(let a of e.matchAll(C2)){let i=a.index??0,s=e.slice(n,i);s.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:s});let l=k2(a[1]??"",a[2]??"",o);l?(t.push({kind:"review-comment",comment:l}),o+=1):t.push({kind:"text",id:`review-comment-invalid:${i}`,text:a[0]}),n=i+a[0].length}let r=e.slice(n);return r.length>0&&t.push({kind:"text",id:`review-comment-text:${n}`,text:r}),t}function d0(e,t){let n=Math.max(0,...Array.from(t.matchAll(/`+/g),r=>r[0].length)),o="`".repeat(Math.max(3,n+1));return[`${o}${e}`,t.trimEnd(),o].join(`
3679
+ `)}function c0(e){if((e.fenceLanguage??"diff")!=="diff")return"";let t=e.diff.trim();if(t.length===0)return"";if(t.startsWith("diff --git "))return t;let n=e.filePath.replaceAll("\\","/");return[`diff --git a/${n} b/${n}`,`--- a/${n}`,`+++ b/${n}`,t].join(`
3680
+ `)}var L2="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium leading-none align-middle",P2=`${L2} border border-border/70 bg-accent/40 text-foreground`,Xf=`${P2} text-[12px]`,Yf="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",Jf="truncate leading-tight",u0='<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>';var A2=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s|$)/g;function E2(e){return e.split(/[\s_-]+/).filter(t=>t.length>0).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function M2(e){let t=e.displayName?.trim();return t||E2(e.name)}function f0(e){let t=[],n=0;for(let o of e.text.matchAll(A2)){let r=o[1]??"",a=o[2]??"",i=(o.index??0)+r.length,s=`$${a}`,l=e.skills.find(d=>d.name===a);l&&(i>n&&t.push(e.text.slice(n,i)),t.push(u(R2,{skill:l,rawText:s},`${i}:${a}`)),n=i+s.length)}return n===0?u(Ce,{children:e.text}):(n<e.text.length&&t.push(e.text.slice(n)),u(Ce,{children:t}))}function R2(e){return u("span",{className:"inline-flex align-middle leading-none","data-markdown-copy":e.rawText,children:b("span",{className:O(Xf,"border-fuchsia-500/25 bg-fuchsia-500/12 text-fuchsia-700 dark:text-fuchsia-300"),children:[u("span",{"aria-hidden":"true",className:Yf,dangerouslySetInnerHTML:{__html:u0}}),u("span",{className:Jf,children:M2(e.skill)})]})})}function p0(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Ve,{children:[b(Ge,{render:u("span",{className:O(Xf,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0}),children:[u(Ea,{className:O(Yf,"size-icon-1",o&&"opacity-100")}),u("span",{className:Jf,children:t})]}),u(We,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}var N2=/\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/;function _2(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3678
3681
  `).trimEnd()}),n=null)};for(let r of e.split(`
3679
- `)){let a=/^- (.+):$/.exec(r);if(a){o(),n={header:a[1],bodyLines:[]};continue}if(n){if(r.startsWith(" ")){n.bodyLines.push(r.slice(2));continue}r.length===0&&n.bodyLines.push("")}}return o(),t}function w2(e){let t=I2.exec(e);if(!t)return{promptText:e,contextCount:0,previewTitle:null,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=S2(t[1]??"");return{promptText:n,contextCount:o.length,previewTitle:o.length>0?o.map(({header:r,body:a})=>a.length>0?`${r}
3682
+ `)){let a=/^- (.+):$/.exec(r);if(a){o(),n={header:a[1],bodyLines:[]};continue}if(n){if(r.startsWith(" ")){n.bodyLines.push(r.slice(2));continue}r.length===0&&n.bodyLines.push("")}}return o(),t}function D2(e){let t=N2.exec(e);if(!t)return{promptText:e,contextCount:0,previewTitle:null,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=_2(t[1]??"");return{promptText:n,contextCount:o.length,previewTitle:o.length>0?o.map(({header:r,body:a})=>a.length>0?`${r}
3680
3683
  ${a}`:r).join(`
3681
3684
 
3682
- `):null,contexts:o}}function a0(e){let t=e.terminalLabel.trim().toLowerCase().replace(/\s+/g,"-"),n=e.lineStart===e.lineEnd?`${e.lineStart}`:`${e.lineStart}-${e.lineEnd}`;return`@${t}:${n}`}function Dh(e){let t=uc(e),n=w2(t.promptText);return{visibleText:n.promptText,copyText:e,contextCount:n.contextCount,previewTitle:n.previewTitle,contexts:n.contexts,elementContexts:t.contexts}}var T2=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function i0(e){let t=[];for(let n of e){let o=n.header.trim();o.length>0&&t.push(Wf(o))}return t.join(" ")}function Wf(e){let t=e.trim(),n=T2.exec(t);if(!n)return`@${t.toLowerCase().replace(/\s+/g,"-")}`;let o=Number.parseInt(n[2]??"",10),r=Number.parseInt(n[3]??n[2]??"",10);return!Number.isFinite(o)||!Number.isFinite(r)?`@${t.toLowerCase().replace(/\s+/g,"-")}`:a0({terminalLabel:n[1]?.trim()||"terminal",lineStart:o,lineEnd:r})}function s0(e,t){let n=0;for(let o of t){let r=Wf(o.header),a=e.indexOf(r,n);if(a===-1)return!1;n=a+r.length}return!0}function Oh({row:e}){let t=Ut(Tn).derive;if(Rh(e.message.text)){let n=t.parsePresetPrefixText(e.message.text);return n?b(be,{children:[u(P2,{parsed:n}),n.body.length>0||(e.message.attachments?.length??0)>0?u(Oh,{row:{...e,message:{...e.message,text:n.body}}}):null]}):u(E2,{row:e})}return u(L2,{row:e,text:e.message.text})}function Fh({images:e}){let t=Ut(Tn),{t:n}=Dt();return e.length===0?null:u("div",{className:"mb-2 grid max-w-[420px] grid-cols-2 gap-2",children:e.map(o=>u("div",{className:"overflow-hidden rounded-lg border border-border/80 bg-background/70",children:o.previewUrl?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":n("attachments.preview",{name:o.name}),onClick:()=>{let r=Mh(e,o.id);r&&t.onImageExpand(r)},children:u("img",{src:o.previewUrl,alt:o.name,className:"block h-auto max-h-[220px] w-full object-cover"})}):u("div",{className:"flex min-h-[72px] items-center justify-center px-2 py-3 text-center text-secondary-label text-chat-dense",children:o.name})},o.id))})}function L2({row:e,text:t}){let{t:n}=Dt(),o=Ut(Tn),r=e.message.attachments??[],a=Dh(t),i=a.contexts,s=[],l=a.visibleText;for(;;){let v=Nh(l);if(!v.annotation)break;s.unshift(v.annotation),l=v.promptText}let d=uc(l),c=[...a.elementContexts,...d.contexts],f=r.filter(v=>v.name.startsWith("preview-annotation-")),p=r.filter(v=>!v.name.startsWith("preview-annotation-")),m=p.filter(v=>di(v)==="image"),h=p.filter(v=>di(v)!=="image"),g=e.message.author??null;return b("div",{className:"group flex min-w-0 items-start gap-2.5",children:[u(k2,{author:g}),b("div",{className:"min-w-0 flex-1 space-y-2",children:[b("div",{className:"flex min-h-7 min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-chat-dense",children:[u("span",{className:"min-w-0 truncate font-medium text-foreground",children:g?.displayName??n("message.user")}),b(Qe,{children:[u(Ye,{render:u("span",{className:"text-muted-foreground tabular-nums"}),children:li(e.message.createdAt,o.timestampFormat)}),u(Xe,{children:Jr(e.message.createdAt,o.timestampFormat)})]}),b("div",{className:"ms-auto flex items-center gap-0.5",children:[o.onForkFromUserMessage!==null&&u(M2,{messageId:e.message.id,onFork:o.onForkFromUserMessage}),a.copyText&&u(hl,{text:a.copyText,variant:"ghost"})]})]}),b("div",{className:"relative min-w-0 rounded-lg border border-border/60 bg-message px-3 py-2.5 text-message-foreground",children:[u(Fh,{images:m}),h.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:h.map(v=>u(zh,{attachment:v},v.id))}),s.map((v,x)=>u(_2,{annotation:v,image:f[x]??null},v.id)),c.length>0?u("div",{className:"mb-2 flex flex-wrap gap-1.5",children:c.map(v=>u(N2,{context:v},`${v.header}:${v.body}`))}):null,u(z2,{text:d.promptText,terminalContexts:i,skills:o.skills,markdownCwd:o.markdownCwd})]})]})]})}function k2({author:e}){let t=e;return t!==null?u(RI,{userId:t.userId,displayName:t.displayName,size:28,className:"mt-0.5"}):u("span",{"aria-hidden":!0,className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-message text-secondary-label",children:u(Yr,{className:"size-4"})})}function Gf({children:e}){return u("div",{className:"flex justify-center py-1",children:u("div",{className:"max-w-[80%] rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-chat-row text-muted-foreground",children:e})})}function P2({parsed:e}){let{t}=Dt();return b(Gf,{children:[u("p",{className:"font-medium text-foreground/80",children:t("preset.systemBlockTitle",{name:e.presetId})}),e.prefix.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:e.prefix}):null]})}var A2={"child.settled":"childThread.notification.settled","child.failed":"childThread.notification.failed","child.approval":"childThread.notification.approval","child.stopped":"childThread.notification.stopped","plugin.notice":"childThread.notification.pluginNotice","selfdev.resolved":"childThread.notification.selfdevResolved"};function E2({row:e}){let{t}=Dt(),n=Ut(Tn).derive,o=e.message.attachments??[],r=o.filter(l=>di(l)==="image"),a=o.filter(l=>di(l)!=="image"),i=l=>{let d=YS(l);if(d)return b(Gf,{children:[u("p",{className:"font-medium text-foreground/80",children:d.title}),d.body.length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:d.body}):null]});let c=n.parseThreadHandoverText(l);if(c)return b(Gf,{children:[u("p",{className:"font-medium text-foreground/80",children:t("continuation.systemBlockTitle")}),u("p",{className:"mt-1",children:t("continuation.systemBlockTurns",{count:c.includedTurns})}),u("p",{className:"mt-1 whitespace-pre-wrap",children:c.body})]});let f=n.parseSystemNotificationText(l);return f?b(Gf,{children:[u("p",{className:"font-medium text-foreground/80",children:t(A2[f.kind],{title:f.title})}),f.summary.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:f.summary}):null]}):null},s=XS(e.message.text).map(i).filter(l=>l!==null);return s.length===0&&o.length===0?null:b(be,{children:[s.map((l,d)=>u(Ja,{children:l},d)),o.length>0?b("div",{className:"min-w-0 px-3 py-2",children:[u(Fh,{images:r}),a.map(l=>u(zh,{attachment:l},l.id))]}):null]})}function c0(e,t){let n=t.parsePresetPrefixText(e??"")?.body??null;if(n===null&&Rh(e??""))return null;let r=Dh(n??e??"").visibleText;for(;;){let s=Nh(r);if(!s.annotation)break;r=s.promptText}let a=uc(r).promptText,i=_h(a).map(s=>s.kind==="text"?s.text:s.comment.text).join(" ").replace(/\s+/g," ").trim();return i.length>0?i:null}var u0=34,f0=8,Bh=u0+f0,p0=ue(function({ref:t,textRef:n,initialText:o,expanded:r,onToggleExpanded:a}){let{t:i}=Dt(),s=i(r?"timeline.pinnedTurnHeaderShowLess":"timeline.pinnedTurnHeaderShowMore");return u("div",{ref:t,className:"group pointer-events-none absolute inset-x-0 top-0 z-10 px-3 sm:px-5",style:{paddingTop:f0},"data-timeline-turn-header":"true","data-truncated":"false",children:b("div",{className:F("transcript-col-wide pointer-events-auto flex gap-2 rounded-sm border border-border/70 bg-background pe-1 ps-3 shadow-md shadow-black/10",r?"items-start py-1.5":"items-center"),...r?{}:{style:{height:u0}},children:[u("span",{ref:n,className:F("min-w-0 flex-1 text-foreground/85 text-chat",r?"max-h-40 overflow-y-auto whitespace-pre-wrap":"truncate"),children:o}),b(Qe,{children:[u(Ye,{render:u(te,{type:"button",size:"xs",variant:"ghost",className:"group-data-[truncated=false]:hidden","aria-label":s,onClick:a}),children:r?u(Ed,{}):u(pn,{})}),u(Xe,{side:"bottom",children:s})]})]})})});function M2({messageId:e,onFork:t}){let{t:n}=Dt(),o=n("fork.action");return b(Qe,{children:[u(Ye,{render:u(te,{type:"button",size:"xs",variant:"ghost",onClick:()=>t(e),"aria-label":o}),children:u(Od,{className:"size-3"})}),u(Xe,{side:"top",children:o})]})}function m0({row:e}){let t=Ut(Tn),{t:n}=Dt(),[o,r]=xl(t.threadKey,`message:${e.message.id}`,!1);if(e.presentation==="compact"&&!o)return u(zf,{state:"idle",children:b("button",{type:"button",className:F(Bf,"chat-process-text cursor-pointer text-secondary-label hover:bg-accent/20"),"aria-expanded":!1,"aria-label":n("timeline.expandMessage"),onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!0)},children:[u(ac,{status:null}),u(rc,{children:u(Xd,{className:"size-icon-1","aria-hidden":!0})}),u("span",{className:"min-w-0 flex-1 truncate",children:t.derive.reasoningPreviewText(e.message.text)}),u(pn,{className:"size-icon-1 shrink-0 -rotate-90","aria-hidden":!0})]})});let i=e.message.attachments??[],s=i.filter(c=>di(c)==="image"),l=i.filter(c=>di(c)!=="image"),d=e.message.text||(e.message.streaming||i.length>0?"":"(empty response)");return u(be,{children:b("div",{className:"relative min-w-0 px-1 py-0.5","data-assistant-text-tone":e.textTone==="process"&&e.presentation!=="compact"?"process":"primary",children:[e.presentation==="compact"?b("div",{className:"mb-1 flex items-center gap-2",children:[u("button",{type:"button",className:"chat-process-meta mb-1 rounded-sm text-secondary-label","aria-expanded":!0,onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!1)},children:n("timeline.collapseMessage")}),e.copyInFooter?null:u(hl,{text:e.message.text,variant:"ghost"})]}):null,e.modelBadge?u($h,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,u(nr,{text:d,className:e.textTone==="process"&&e.presentation!=="compact"?"chat-commentary":"chat-readable-body",cwd:t.markdownCwd,threadRef:t.threadRef??void 0,isStreaming:!!e.message.streaming,lineBreaks:t.derive.shouldPreserveAssistantLineBreaks(d),skills:t.skills}),u(Fh,{images:s}),l.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:l.map(c=>u(zh,{attachment:c},c.id))}),e.showAssistantMeta||e.showAssistantCopyButton&&!e.assistantCopyStreaming&&e.message.text.trim().length>0?b("div",{className:"mt-1.5 flex items-center gap-2 text-chat-row tabular-nums opacity-0 transition-opacity duration-(--control-duration) focus-within:opacity-100 group-hover/assistant:opacity-100",children:[u(R2,{row:e}),e.showAssistantMeta&&!e.message.streaming&&e.modelBadge===null&&b(Qe,{children:[u(Ye,{render:u("p",{className:"text-muted-foreground text-chat-row tabular-nums"}),children:li(e.message.updatedAt,t.timestampFormat)}),u(Xe,{children:Jr(e.message.updatedAt,t.timestampFormat)})]})]}):null]})})}function R2({row:e}){let n=Ut(Tn).derive.resolveAssistantMessageCopyState({text:e.message.text??null,showCopyButton:e.showAssistantCopyButton,streaming:e.assistantCopyStreaming});return n.visible?u(hl,{text:n.text??"",variant:"ghost"}):null}var l0=ue(function(t){let n=t.context.body.length>0?`${t.context.header}
3683
- ${t.context.body}`:t.context.header;return u(r0,{label:t.context.header,tooltipText:n})}),N2=ue(function(t){let n=t.context.body?`${t.context.header}
3684
- ${t.context.body}`:t.context.header;return b(Qe,{children:[b(Ye,{render:u("span",{className:"inline-flex max-w-full items-center gap-1 rounded-md border border-border/70 bg-background/70 px-1.5 py-0.5 text-foreground/85 text-chat-row"}),children:[u(Qr,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:t.context.header})]}),u(Xe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:n})]})});function zh(e){let{t}=Dt(),n=di(e.attachment),o=JS(n),r=t("attachments.open",{name:e.attachment.name}),a=b(be,{children:[u(o,{className:"size-4 shrink-0 text-secondary-label"}),b("span",{className:"min-w-0 flex-1",children:[u("span",{className:"block truncate font-medium text-foreground text-chat-row",children:e.attachment.name}),u("span",{className:"block text-secondary-label text-chat-meta",children:QS(e.attachment.sizeBytes)})]})]});return e.attachment.previewUrl?u("a",{href:e.attachment.previewUrl,target:"_blank",rel:"noreferrer","aria-label":r,className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2 hover:bg-background/90",children:a}):u("div",{className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2",children:a})}function _2(e){let t=Ut(Tn),{t:n}=Dt();return b("div",{className:"mb-2 flex max-w-full items-center overflow-hidden rounded-lg border border-border/70 bg-background/70",children:[e.image?.previewUrl?u("button",{type:"button",className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted","aria-label":n("attachments.preview",{name:e.image.name}),onClick:()=>{if(!e.image)return;let o=Mh([e.image],e.image.id);o&&t.onImageExpand(o)},children:u("img",{src:e.image.previewUrl,alt:"Annotated preview crop",className:"size-full object-cover"})}):null,b("div",{className:"min-w-0 px-2.5 py-2",children:[e.annotation.comment?u("div",{className:"max-w-80 truncate text-foreground text-chat-row font-medium",children:e.annotation.comment}):null,b("div",{className:F("flex items-center gap-2 text-secondary-label text-chat-meta",e.annotation.comment&&"mt-1"),children:[e.annotation.targetSummary?u("span",{className:"truncate",children:e.annotation.targetSummary}):null,e.annotation.styleChanges.length>0?b("span",{className:"inline-flex shrink-0 items-center gap-1",children:[u(es,{className:"size-3"}),e.annotation.styleChanges.length]}):null]})]})]})}var D2=8,O2=600,F2=1.75,d0=`linear-gradient(to bottom, black calc(100% - ${F2}rem), transparent)`;function B2(e){return e.trim().length===0?!1:e.length>O2||e.split(`
3685
- `).length>D2}var z2=ue(function(t){let[n,o]=G(!1),r=t.text.trim().length>0||t.terminalContexts.length>0,a=r&&B2(t.text),i=a&&!n;return b("div",{children:[r?u("div",{className:F("relative",i&&"max-h-44 overflow-hidden"),"data-user-message-body":"true","data-user-message-collapsed":i?"true":"false","data-user-message-collapsible":a?"true":"false","data-user-message-fade":i?"true":"false",style:i?{WebkitMaskImage:d0,maskImage:d0}:void 0,children:u($2,{text:t.text,terminalContexts:t.terminalContexts,skills:t.skills,markdownCwd:t.markdownCwd})}):null,a||t.footer?b("div",{className:F("mt-1.5 flex items-center gap-2",a&&t.footer?"justify-between":"justify-end"),"data-user-message-footer":"true",children:[a?u(te,{type:"button",size:"xs",variant:"ghost","aria-expanded":n,"data-scroll-anchor-ignore":!0,onClick:()=>o(s=>!s),className:"-ml-1 h-6 rounded-control-2 px-1.5 text-secondary-label text-chat-row hover:bg-muted/40 hover:text-message-foreground",children:n?"Show less":"Show full message"}):null,t.footer?u("div",{className:"ml-auto flex items-center gap-2",children:t.footer}):null]}):null]})}),$2=ue(function(t){let n=Ut(Tn),o=(a,i)=>{let s=/^\s+/.exec(a)?.[0]??"",l=a.slice(s.length),d=/\s+$/.exec(l)?.[0]??"",c=l.slice(0,l.length-d.length);return b(Ja,{children:[s?u("span",{"aria-hidden":"true",children:s}):null,c?u(nr,{text:c,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1}):null,d?u("span",{"aria-hidden":"true",children:d}):null]},i)},r=_h(t.text);if(r.some(a=>a.kind==="review-comment"))return u("div",{className:"space-y-3 text-message-foreground text-chat",children:r.map(a=>a.kind==="text"?a.text.trim().length>0?u("div",{className:"wrap-break-word",children:u(nr,{text:a.text.trim(),cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})},a.id):null:u(H2,{comment:a.comment},a.comment.id))});if(t.terminalContexts.length>0){let a=s0(t.text,t.terminalContexts),i=i0(t.terminalContexts),s=[];if(a){let l=0;for(let d of t.terminalContexts){let c=Wf(d.header),f=t.text.indexOf(c,l);if(f===-1){s.length=0;break}f>l&&s.push(o(t.text.slice(l,f),`user-terminal-context-inline-before:${d.header}:${l}`)),s.push(u(l0,{context:d},`user-terminal-context-inline:${d.header}`)),l=f+c.length}if(s.length>0)return l<t.text.length&&s.push(o(t.text.slice(l),`user-message-terminal-context-inline-rest:${l}`)),u("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:s})}for(let l of t.terminalContexts)s.push(u(l0,{context:l},`user-terminal-context-inline:${l.header}`)),s.push(u("span",{"aria-hidden":"true",children:" "},`user-terminal-context-inline-space:${l.header}`));if(t.text.length>0)s.push(u(nr,{text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1},"user-message-terminal-context-inline-text"));else if(i.length===0)return null;return u("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:s})}return t.text.length===0?null:u(nr,{text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})});function H2({comment:e}){let t=Ut(Tn),n=e.fenceLanguage??"diff",o=t0(e);return b("div",{className:"space-y-2 rounded-lg border border-border/70 bg-background/70 p-3",children:[b("div",{className:"space-y-1",children:[u("div",{className:"text-message-foreground text-chat-row font-medium",children:Ff(e.filePath,t.workspaceRoot)}),b("div",{className:"text-secondary-label text-chat-dense",children:[e.sectionTitle," \xB7 ",e.rangeLabel]})]}),e.text.length>0&&u("div",{className:"whitespace-pre-wrap wrap-break-word text-chat",children:u(o0,{text:e.text,skills:t.skills})}),n!=="diff"&&e.diff.trim().length>0&&u(nr,{text:e0(n,e.diff),cwd:t.markdownCwd,threadRef:t.threadRef??void 0,skills:t.skills,className:"text-message-foreground"}),o?u(oS,{patch:o}):null]})}function U2({badge:e}){return b(be,{children:[e.providerId?u("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-card","aria-label":e.providerDisplayName??void 0,children:u(Ia,{providerId:e.providerId,displayName:e.providerDisplayName,accentColor:e.accentColor,className:"size-5",iconClassName:"size-4"})}):null,b("span",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[e.providerId?u("span",{className:"font-medium text-foreground",children:e.providerDisplayName}):null,u("span",{className:"min-w-0 truncate text-muted-foreground",children:e.modelLabel}),e.effortLabel?b("span",{children:[" \xB7 ",e.effortLabel]}):null]})]})}function $h({badge:e,createdAt:t}){let n=Ut(Tn);return b("div",{className:"mb-3 flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 text-chat-dense text-muted-foreground","data-testid":"assistant-model-header",children:[u(U2,{badge:e}),u("span",{"aria-hidden":!0,children:"\xB7"}),b(Qe,{children:[u(Ye,{render:u("span",{className:"shrink-0 tabular-nums"}),children:li(t,n.timestampFormat)}),u(Xe,{children:Jr(t,n.timestampFormat)})]})]})}function g0({row:e}){let{t}=Dt(),n=e.badge.effortLabel?`${e.badge.modelLabel} \xB7 ${e.badge.effortLabel}`:e.badge.modelLabel,o=[e.badge.providerDisplayName,e.badge.sourceLabel,n].filter(a=>typeof a=="string"&&a.length>0).join(" \xB7 "),r=e.pending?t("timeline.modelSwitchPending",{model:o}):t("timeline.modelSwitched",{model:o});return b("div",{role:"separator","aria-label":r,"data-pending":e.pending?"true":void 0,className:"flex items-center gap-2 px-1 py-1 text-chat-dense text-muted-foreground/70",children:[u("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"}),b("span",{className:"flex min-w-0 shrink items-center gap-1.5",children:[e.badge.providerId?u(Ia,{providerId:e.badge.providerId,displayName:e.badge.providerDisplayName,accentColor:e.badge.accentColor,className:"size-icon-1",iconClassName:"size-icon-1"}):null,u("span",{className:"truncate",children:r})]}),u("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"})]})}var Tn=Ht(null),v0=Ht(null),K2=u("div",{className:"h-3 sm:h-4"}),q2=u("div",{className:"h-10 sm:h-12"}),V2=Object.freeze([]);function W2({loading:e,onLoadEarlier:t,fade:n}){return u("div",{className:n?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:t,disabled:e,className:"relative w-full py-1.5 text-chat-row text-muted-foreground/60 hover:text-foreground disabled:cursor-default pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:e?"Loading earlier turns\u2026":"Load earlier turns"})})})}function G2({onReveal:e,fade:t}){return u("div",{className:t?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:e,className:"relative w-full py-1.5 text-chat-row text-muted-foreground/60 hover:text-foreground pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:"Show earlier turns"})})})}var j2=u("div",{className:"h-3 sm:h-4"}),Q2=[],X2=new Set,Y2=200,J2=1e4,Z2=600,eB=()=>{};function or(e,t){let n=_(e);return t&&(n.current=e),n.current}var tB=[],x0=ue(function({derive:t,activities:n=tB,threadKey:o,threadRef:r,environmentId:a,isWorking:i,workingStepLabel:s=null,stall:l=null,retry:d=null,onInterrupt:c=null,onRespondToDecision:f=null,scheduledWakes:p=V2,onCancelScheduledWake:m=null,activeTurnStartedAt:h,totalTurnCount:g=null,agentPanelModel:v,onOpenAgents:x=eB,timelineEntries:y,latestTurn:C,latestAssistantMessageId:w=null,runningTurnId:k,resolveModelBadge:S,pendingModelSelection:L,onOpenFileDiff:I,onForkFromUserMessage:T,onImageExpand:E,markdownCwd:A,resolvedTheme:N,timestampFormat:R,workspaceRoot:$,skills:H=Q2,anchorMessageId:K,onAnchorReady:O,onRowsChange:oe,contentInsetEndAdjustment:ee,liveFollowEnabled:W,awaitingUserDecision:qe=!1,onIsAtEndChange:ve,onManualNavigation:fe,onDisclosureNavigation:Ne=fe,hideEmptyPlaceholder:Ae=!1,topFadeEnabled:ae=!1,scrollerRef:Ee,loadEarlier:xe=null,revealMessageRequest:re=null,onRevealMessageHandled:Ie,usageByTurnId:st,renderWorkGroup:dt,renderToolCallDetail:lt,loadScrollAnchor:ct,saveScrollAnchor:Et,disclosure:ot,useVisibleThreadCompletion:He,export:Se,onSavePlanToWorkspace:ze,paneActive:Je,onTurnNavigatorChange:qt}){let X=ni(),nn=_(X);nn.current=X;let xt=ot.usePersistedExpandedTurnIds(o),[mn,Tt]=Ln("timeline-auto-expanded-turns",o,X2),Yt=z(()=>t.resolveExpandedTurnIds(xt??[],mn),[mn,t,xt]),[Jt,Mt]=Ln("timeline-disclosure-reading",o,!1),zn=_(o);zn.current=o;let kn=_(Yt);kn.current=Yt;let vn=En("timeline-following-end",o,!0);vn.current=W&&K===null;let $n=En("timeline-scroll-restore-pending",o,!1),Vt=dc(o,null),Zt=dc(o,null),Sn=dc(o,null),ho=En("timeline-content-inset",o,ee),zt=_(null),D=B(U=>{if(U!==null&&(zt.current=U),typeof Ee=="function"){Ee(U);return}Ee.current=U},[Ee]);ye(()=>{WS({timeline:zt.current,previousOverlayHeight:ho.current,overlayHeight:ee,followingEnd:X&&W&&!Jt&&K===null}),ho.current=ee},[K,ee,Jt,W,X]),q(()=>()=>{Zt.current?.stop()},[]);let Y=B(()=>{Zt.current?.stop(),Zt.current=null,Vt.current=null,Mt(!1)},[Vt,Zt,Mt]),ce=B(U=>{Ne(),Vt.current=U,Mt(!0),Zt.current?.stop();let se=zt.current?.node??null;if(!se)return;let Re=Array.from(se.querySelectorAll("[data-timeline-row-id]")).find(gn=>gn.dataset.timelineRowId===U);if(!Re)return;let yt=Sn.current;Zt.current=LS({viewport:se,row:Re,anchor:yt&&Re.contains(yt)?yt:Re,scrollToOffset:gn=>{se.scrollTop=gn}})},[Ne]),ie=En("timeline-live-follow-previous",o,W);ye(()=>{W&&!ie.current&&Y(),ie.current=W},[W,Y]);let pe=En("timeline-latest-turn-previous",o,C);q(()=>{let U=pe.current;if(pe.current=C,!(!C||U?.turnId===void 0)){if(C.turnId===U.turnId){U.state==="running"&&C.state==="interrupted"&&Tt(se=>{let Re=new Set(se);return Re.add(C.turnId),Re});return}Tt(se=>{if(!se.has(U.turnId))return se;let Re=new Set(se);return Re.delete(U.turnId),Re})}},[C]);let Ze=En("timeline-rows-cache",o,null,3);Ze.current??=t.createRowsCache();let pt=Ze.current.deriveGroups,xn=or(n,X),ht=or(y,X),en=or(C,X),tn=or(k,X),bt=or(Yt,X),yn=or(i,X),sn=or(h,X),ge=or(S,X),Rt=or(L,X),rt=or(s,X),Lt=or(l,X),et=or(d,X),Nt=z(()=>pt({activities:xn,timelineEntries:ht,latestTurn:en,runningTurnId:tn,expandedTurnIds:bt,isWorking:yn,activeTurnStartedAt:sn,resolveModelBadge:ge,pendingModelSelection:Rt}),[pt,xn,ht,en,tn,bt,yn,sn,ge,Rt]),ut=gB(Nt.rows,t),ft=z(()=>MS(ut,Nt.turnGroups),[Nt.turnGroups,ut]),eo=_(ut);eo.current=ut;let ln=B(U=>{let se=eo.current.find(Re=>Re.id===U||Re.kind==="work"&&Re.groupedEntries.some(yt=>yt.id===U)||Re.kind==="tool-group"&&Re.entries.some(yt=>yt.id===U));ce(se?.id??U)},[ce]),Nn=_(ut);Nn.current=ut;let Hn=En("timeline-scroll-snapshot",o,null),Un=B((U,se=vn.current)=>{U.scrollLength<=0||(Hn.current={threadKey:o,anchor:GS({measurement:U,followingEnd:se})})},[vn,o,Hn]),ne=B(()=>{let U=Hn.current;U&&Et(U.threadKey,U.anchor)},[Et,Hn]),Fe=B(()=>{if(!X||$n.current)return;let U=zt.current?.measure();U&&U.scrollLength>0&&(Un(U,vn.current&&t.resolveIsAtEnd(U,ee)!==!1),ne())},[Un,ee,t,vn,X,ne,$n]),at=OS(o),je=_(at);je.current=at;let{startIndex:wn,hasHiddenOlder:dn}=RS(ft.length,at.revealedCount),Cn=z(()=>ft.slice(wn),[wn,ft]),$t=_(ft);$t.current=ft;let Kn=dc(o,null),Wt=B(()=>{if(!nn.current)return;let U=zt.current?.node;U&&(Kn.current={scrollHeight:U.scrollHeight,scrollTop:U.scrollTop,until:Date.now()+J2})},[Kn]);ye(()=>{if(!X)return;let U=Kn.current;if(!U)return;Kn.current=null;let se=zt.current?.node;if(!se||Date.now()>U.until)return;let Re=U.scrollTop+(se.scrollHeight-U.scrollHeight);se.scrollTop=Re},[X,wn,ut.length]);let vo=B(()=>{Wt(),je.current.revealOlder()},[Wt]),Wa=_(vo);Wa.current=vo;let Ga=_(dn);Ga.current=dn;let Ni=_(null),he=En("timeline-scroll-restore",o,void 0);if(he.current===void 0&&ut.length>0){let U=ct(o);he.current=U!==null&&ut.some(se=>se.id===U.rowId)?U:null}let da=he.current??null,Go=_(()=>{}),[ja,gd]=Ln("timeline-scroll-restore-settled",o,!1),ca=da!==null&&!ja,qn=En("timeline-last-anchor-save",o,0);q(()=>{let U=da;if(!X||ja||U===null)return;let se=null,Re=requestAnimationFrame(()=>{nn.current&&(fe(),je.current.revealAtLeast(sc($t.current,U.rowId,je.current.revealedCount)),se=requestAnimationFrame(()=>{nn.current&&(gd(!0),Go.current(U.rowId,-U.offsetPx))}))});return()=>{cancelAnimationFrame(Re),se!==null&&cancelAnimationFrame(se)}},[fe,X,da,ja]);let _t=En("timeline-restore-after-presentation",o,!1),ro=ca||_t.current;$n.current=ro,ye(()=>{if(X)return()=>{zn.current!==o?ne():Fe(),_t.current=!0}},[X,o]),ye(()=>{if(!X||!_t.current)return;let U=null,se=null,Re=()=>{zt.current?.scrollToEnd(),_t.current=!1,$n.current=!1,vn.current=!0,Qo.current=!0,io.current={...io.current,followEnabled:!0,restoreInProgress:!1},ve(!0)},yt=ct(o),gn=yt!==null&&$t.current.some(xr=>xr.rows.some(Co=>Co.id===yt.rowId));return yt===null?U=requestAnimationFrame(Re):gn?(fe(),je.current.revealAtLeast(sc($t.current,yt.rowId,je.current.revealedCount)),U=requestAnimationFrame(()=>{se=requestAnimationFrame(()=>{nn.current&&(Go.current(yt.rowId,-yt.offsetPx),_t.current=!1,$n.current=!1)})})):ut.length>0&&(U=requestAnimationFrame(Re)),()=>{U!==null&&cancelAnimationFrame(U),se!==null&&cancelAnimationFrame(se)}},[ct,ve,fe,X,o,ut.length,ft.length]);let on=z(()=>X?nB(ft,t):[],[t,X,ft]),_i=z(()=>{if(!X)return[];let U=new Map;for(let se of ft)for(let Re of se.rows){let yt=Re.kind==="message"?Re.message.turnId??null:Re.kind==="turn-summary"?Re.footer.turnId:null;if(yt!==null){U.set(se.key,yt);break}}return on.filter(se=>se.userText!==null).map(se=>({...se,turnId:U.get(se.sectionKey)??null}))},[X,on,ft]),It=B(U=>{Y(),fe(),je.current.revealAtLeast(sc($t.current,U.anchorRowId,je.current.revealedCount));let se=o;requestAnimationFrame(()=>{zn.current===se&&Go.current(U.anchorRowId,24)})},[fe,Y,o]),xo=z(()=>X?{items:_i,totalTurnCount:g,bottomInset:ee,usageByTurnId:st,onSelect:It,exportMarkdown:Se.markdown,onDownload:Se.download}:null,[ee,Se,It,X,g,_i,st]);q(()=>{xo!==null&&qt(xo)},[qt,xo]),q(()=>{if(X)return()=>qt(null)},[qt,X]),q(()=>{if(re===null||!X)return;Y(),fe();let U=t.resolveToolGroupRevealRowId(Nn.current,re.rowId);je.current.revealAtLeast(sc($t.current,U,je.current.revealedCount));let se=requestAnimationFrame(()=>{zn.current===o&&(Go.current(U,24),Ie?.())});return()=>cancelAnimationFrame(se)},[re,X,fe,Y,Ie,t,o]);let bn=z(()=>on.flatMap(U=>U.headerText===null?[]:[{sectionKey:U.sectionKey,text:U.headerText}]),[on]),_e=_(bn);_e.current=bn;let Gt=En("timeline-active-header",o,null),Eo=bn.at(-1)?.text??null,gr=Eo!==null,Di=_(null),yo=_(null),[Hr,jo]=Ln("timeline-pinned-header-expanded",o,!1),hr=_(Hr);hr.current=Hr;let ao=B(()=>{if(!nn.current)return;let U=Di.current,se=yo.current;!U||!se||(U.dataset.truncated=hr.current||se.scrollWidth>se.clientWidth+1?"true":"false")},[]),[Ur,ua]=G(null),Oi=z(()=>t.hasSettledAssistantMessage(y,w),[t,y,w]),[_n,Fi]=G(null),Oo=B(()=>{Wt(),xe?.onLoadEarlier()},[Wt,xe]);Ni.current=xe===null||xe.loading?null:Oo;let Bi=B((U,se)=>{if(!nn.current)return;let Re=zt.current?.node;if(!Re)return;let yt=Array.from(Re.querySelectorAll("[data-timeline-turn-section]")),gn=yt.findIndex(Co=>Co.querySelector(`[data-timeline-row-id="${CSS.escape(U)}"]`)),xr=gn<0?yt:yt.slice(0,gn+1);for(let Co of xr)Co.style.contentVisibility="visible";Re.offsetHeight,zt.current?.scrollToRow(U,{viewOffset:se}),requestAnimationFrame(()=>{for(let Co of xr)Co.style.removeProperty("content-visibility")})},[]);Go.current=Bi;let Fo=z(()=>dS(ut,K,U=>U.kind==="message"&&U.message.role==="user"?U.message.id:null),[K,ut]),vr=X&&W&&!Jt&&Fo===void 0&&!ro,Qo=_(vr);Qo.current=vr;let io=_({followEnabled:vr,restoreInProgress:ro,loadEarlier:xe});io.current={followEnabled:vr,restoreInProgress:ro,loadEarlier:xe};let zi=_(null);q(()=>{if(!_n||!X)return;let U=FS({root:_n,minimumCount:ls,canCompact:()=>{let se=io.current,Re=Kn.current;return se.followEnabled&&!se.restoreInProgress&&!se.loadEarlier?.loading&&!(Re&&Re.until>Date.now())&&je.current.revealedCount>ls},onCompact:se=>{rn.current=!0,Wt(),je.current.compactTo(se)}});return zi.current=U,()=>{U.disconnect(),zi.current=null}},[Wt,X,_n]),q(()=>{zi.current?.schedule()},[vr,xe?.loading,at.revealedCount,ft.length]),q(()=>{if(!_n||!X||typeof ResizeObserver>"u")return;let U=()=>{if(!nn.current||!Qo.current)return;let yt=_n.scrollHeight-_n.clientHeight;Math.abs(_n.scrollTop-yt)>.5&&(_n.scrollTop=yt)},se=new ResizeObserver(U);se.observe(_n);let Re=_n.firstElementChild;return Re&&se.observe(Re),()=>se.disconnect()},[X,_n]),He({viewport:Ur,viewActive:Je&&X,threadKey:o,completedAt:!ro&&C?.state==="completed"&&Oi?C.completedAt:null,messageId:w,bottomInset:ee});let[Bo,$e]=Ln("timeline-anchored-end-height",o,0),vt=En("timeline-anchored-ready",o,null);ye(()=>{if(!X)return;if(Fo===void 0||K===null){$e(0),vt.current=null;return}let U=zt.current?.node,se=ut[Fo.anchorIndex],Re=zt.current?.measure();if(!U||!se||!Re||Re.scrollLength<=0)return;let yt=Re.topOf(se.id);if(yt===null)return;let gn=Re.contentLength-Bo-yt,xr=Math.max(0,Re.scrollLength-ee-Fo.anchorOffset),Co=Math.max(0,Math.round(xr-gn));if(Math.abs(Co-Bo)>1){$e(Co);return}vt.current!==K&&(vt.current=K,O(K,{rowId:se.id,lastRowId:ut.at(-1)?.id??null}))},[K,Fo,Bo,ee,O,X,ut]);let cn=ut.at(-1)?.id??null;q(()=>{oe?.(cn)},[cn,oe,o]);let rn=En("timeline-top-reveal-armed",o,!0),Qa=B(U=>{if(U>Z2){rn.current=!0;return}if(rn.current){if(rn.current=!1,Ga.current){Wa.current();return}Ni.current?.()}},[rn]),fa=B(()=>{if(!nn.current||zn.current!==o)return;let U=zt.current?.measure();if(!U||$n.current)return;Un(U);let se=t.resolveIsAtEnd({contentLength:U.contentLength,scroll:U.scroll,scrollLength:U.scrollLength},ee);se!==void 0&&ve(se),U.contentLength-U.scrollLength-U.scroll>2&&Qa(U.scroll);let Re=Date.now();Re-qn.current>=Y2&&(qn.current=Re,ne())},[Un,ee,t,Qa,ve,ne,o,$n]),zo=_(null),Kr=B(()=>{nn.current&&zo.current===null&&(zo.current=requestAnimationFrame(()=>{zo.current=null,ao()}))},[ao]);q(()=>()=>{zo.current!==null&&(cancelAnimationFrame(zo.current),zo.current=null)},[o]);let Og=B(U=>{if(U===null||U===Gt.current)return;Gt.current=U;let se=_e.current.find(Re=>Re.sectionKey===U);se&&yo.current&&(yo.current.textContent=se.text),hr.current&&jo(!1),Kr()},[Gt,Kr,jo]),un=zS({root:_n,topInsetPx:Bh,onActiveSectionChange:Og,active:X});q(()=>{if(!X){ne();return}let U=requestAnimationFrame(()=>{if(!nn.current)return;let se=zt.current?.node;se&&Qo.current&&(se.scrollTop=se.scrollHeight-se.clientHeight),un.refresh()});return()=>cancelAnimationFrame(U)},[ne,un,X]);let Fg=B(()=>{jo(U=>!U)},[jo]);ye(()=>{if(!X)return;let U=Gt.current,se=U===null?void 0:_e.current.find(Re=>Re.sectionKey===U);se&&yo.current&&(yo.current.textContent=se.text),Kr()},[X,Kr,Hr]);let Ys=z(()=>{let U=dn?u(G2,{onReveal:vo,fade:ae}):xe!==null?u(W2,{loading:xe.loading,onLoadEarlier:Oo,fade:ae}):ae?q2:K2;return gr?b(be,{children:[u("div",{style:{height:Bh}}),U]}):U},[Oo,dn,gr,xe,vo,ae]);q(()=>{if(!X)return;let U=requestAnimationFrame(fa);return()=>cancelAnimationFrame(U)},[fa,X,ro,ut.length]);let $u=z(()=>({timestampFormat:R,threadKey:o,threadRef:r,markdownCwd:A,resolvedTheme:N,workspaceRoot:$,skills:H,activeThreadEnvironmentId:a,onForkFromUserMessage:T,onImageExpand:E,onOpenFileDiff:I,onProcessDisclosureChange:ln,agentPanelModel:v,onOpenAgents:x,onInterrupt:c,onRespondToDecision:f,scheduledWakes:p,onCancelScheduledWake:m,derive:t,renderWorkGroup:dt,renderToolCallDetail:lt,onSavePlanToWorkspace:ze}),[R,o,r,A,N,$,H,a,T,E,I,ln,v,x,c,f,p,m,t,dt,lt,ze]),Bg=z(()=>({isWorking:yn,latestTurnId:en?.turnId??null,workingStepLabel:rt,stall:Lt,retry:et}),[yn,en?.turnId,et,Lt,rt]),pa=B(U=>u(rB,{row:U}),[]);return ut.length===0&&!i?Ae?null:u("div",{className:"flex h-full items-center justify-center",children:u("p",{className:"text-placeholder text-chat",children:"Send a message to start the conversation."})}):u(Tn,{value:$u,children:u(v0,{value:Bg,children:b("div",{ref:ua,onClickCapture:U=>{Sn.current=U.target instanceof Element?U.target.closest("button"):null},onWheelCapture:Y,onTouchMoveCapture:Y,onPointerDownCapture:U=>{U.target===zt.current?.node&&Y()},onKeyDownCapture:U=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(U.key)&&Y()},className:"chat-timeline relative h-full min-h-0","data-awaiting-user-decision":qe?"true":"false","data-disclosure-reading":Jt?"true":void 0,"data-timeline-follow-end":vr?"true":"false","data-timeline-anchor-row":Fo===void 0?void 0:ut[Fo.anchorIndex]?.id??void 0,"data-timeline-end-inset":ee,children:[u(AS,{inputKey:o,onBeforeInputChange:Fe,handleRef:D,onAttach:Fi,onScroll:fa,className:F("scrollbar-gutter-both h-full min-h-0 overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 sm:px-5",ae&&"topbar-scroll-fade"),children:b("div",{style:{paddingBottom:ee},children:[Ys,Cn.map(U=>u(ES,{sectionKey:U.key,rowKeyPrefix:o,rows:U.rows,renderRow:pa,sectionRef:un.observeSection(U.key)},`${o}:${U.key}`)),j2,Fo?u("div",{"aria-hidden":!0,"data-timeline-anchored-end-space":"true",style:{height:Bo}}):null]})}),Eo!==null?u(p0,{ref:Di,textRef:yo,initialText:Eo,expanded:Hr,onToggleExpanded:Fg}):null]})})})});function nB(e,t){return e.map(n=>{let o=n.rows.find(i=>i.kind==="message"&&i.message.role==="user"),r=o?.kind==="message"?o.message:null,a=null;for(let i of n.rows)i.kind==="message"&&i.message.role==="assistant"&&(a=i.message.text??null);return{id:n.key,sectionKey:n.key,anchorRowId:o?.id??n.rows[0]?.id??n.key,userText:r===null?null:h0(t.parseSystemNotificationText(r.text)?.summary??t.parseThreadHandoverText(r.text)?.body??r.text),assistantText:h0(a),headerText:r===null?null:c0(r.text,t)}})}var Hh=240,oB=/\s/u;function h0(e){if(!e)return null;let t=[],n=0,o=!1,r=()=>{for(;n>Hh-1;)n-=t.pop()?.length??0;for(;t.at(-1)===" ";)t.pop(),n-=1;return t.push("\u2026"),t.join("")};for(let a of e){if(oB.test(a)){o=t.length>0;continue}if(o&&(t.push(" "),n+=1,o=!1,n>Hh)||(t.push(a),n+=a.length,n>Hh))return r()}return t.length>0?t.join(""):null}var rB=ue(function({row:t}){let n=Ut(Tn);return u("div",{className:F("relative",t.kind==="message"&&t.message.role==="user"?"pb-6":t.kind==="message"&&t.message.role==="assistant"?t.copyInFooter?"pb-1 group/assistant":"pb-4 group/assistant":"pb-2"),"data-timeline-row-id":t.id,"data-timeline-row-kind":t.kind,"data-message-id":t.kind==="message"?t.message.id:void 0,"data-message-role":t.kind==="message"?t.message.role:void 0,children:b(Uf,{resetKey:t.id,fallback:jS,children:[t.kind==="turn-summary"?u(pS,{footer:t.footer,copyText:t.copyText,timestampFormat:n.timestampFormat}):null,t.kind==="tool-group"?u(TS,{entries:t.entries,groupId:t.groupId,threadKey:n.threadKey,workspaceRoot:n.workspaceRoot,onDisclosureChange:()=>n.onProcessDisclosureChange?.(t.id)}):null,t.kind==="work"?u(aB,{row:t}):null,t.kind==="model-switch"?u(g0,{row:t}):null,t.kind==="turn-identity"?u("div",{"data-turn-identity":t.turnId,className:"px-1 pt-1",children:u($h,{badge:t.badge,createdAt:t.createdAt})}):null,t.kind==="message"&&t.message.role==="user"?u(Oh,{row:t}):null,t.kind==="message"&&t.message.role==="assistant"?u(m0,{row:t}):null,t.kind==="proposed-plan"?u(sB,{row:t}):null,t.kind==="turn-plan"?u(lB,{row:t}):null,t.kind==="working"?u(dB,{row:t}):null]})})});function aB({row:e}){let t=Ut(Tn),n=ni(),o=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:n});return o!==void 0?u(be,{children:o}):u("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>u(iB,{entry:r},r.id))})}function iB({entry:e}){let[t,n]=G(!1),o=e.detail??e.command??e.rawCommand??e.toolLabel?.detail;return b("div",{children:[b("button",{type:"button","aria-expanded":t,className:F("chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left",e.tone==="error"?"text-destructive":"text-muted-foreground"),onClick:()=>n(r=>!r),disabled:o===void 0,children:[u("span",{"aria-hidden":!0,className:F("block size-2 shrink-0 rounded-full",e.tone==="error"?"bg-destructive":e.tone==="thinking"||e.tone==="info"?"bg-muted-foreground/60":"border border-muted-foreground/60")}),u("span",{className:"chat-process-text min-w-0 flex-1 truncate",children:e.label}),o!==void 0?u(pn,{"aria-hidden":!0,className:F("size-icon-1 shrink-0",!t&&"-rotate-90")}):null]}),t&&o!==void 0?u("pre",{className:"chat-tool-body mx-2 overflow-x-auto rounded-md bg-muted/40 p-2",children:o}):null]})}function sB({row:e}){let t=Ut(Tn);return u("div",{className:"min-w-0 px-1 py-0.5",children:u(VS,{planMarkdown:e.proposedPlan.planMarkdown,environmentId:t.activeThreadEnvironmentId,threadRef:t.threadRef??void 0,cwd:t.markdownCwd,workspaceRoot:t.workspaceRoot,onSavePlanToWorkspace:t.onSavePlanToWorkspace})})}var lB=ue(function({row:t}){let[n,o]=G(!1),{steps:r}=t.turnPlan.plan,a=r.filter(d=>d.status==="completed").length,i=a===r.length,s=r.find(d=>d.status==="inProgress")?.step??r.find(d=>d.status==="pending")?.step??r.at(-1)?.step??"Plan";return b("div",{className:"min-w-0 px-1 py-0.5",children:[b("button",{type:"button",className:"relative flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-md px-0.5 py-0.5 text-left text-[12px] leading-5 transition-colors duration-(--control-duration) hover:bg-accent/20 pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11","aria-expanded":n,onClick:()=>o(d=>!d),children:[u(n?pn:Uo,{className:"size-icon-1 shrink-0 text-muted-foreground/65"}),r.length>1?u("span",{"aria-hidden":!0,className:"flex shrink-0 items-center gap-0.5",children:r.map(d=>u("span",{className:F("h-[3px] w-2.5 rounded-full",d.status==="completed"?"bg-success":d.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},d.step))}):null,u("span",{className:F("min-w-0 truncate",i?"text-muted-foreground/65":"font-medium text-foreground/85"),children:s}),r.length>1?b("span",{className:"shrink-0 text-muted-foreground/50 tabular-nums",children:[a,"/",r.length]}):null]}),n?u("div",{className:"mt-0.5 space-y-px pl-6",children:r.map(d=>b("div",{className:"flex items-baseline gap-2 text-[12px] leading-5",children:[u("span",{className:F("w-3 shrink-0 text-center font-mono text-chat-meta",d.status==="completed"?"text-success":d.status==="inProgress"?"text-primary":"text-muted-foreground/40"),"aria-hidden":!0,children:d.status==="completed"?"\u2713":d.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:F("min-w-0",d.status==="completed"?"text-muted-foreground/55":d.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:d.step})]},d.step))}):null]})});function dB({row:e}){let{workingStepLabel:t,stall:n,retry:o}=Ut(v0),{t:r}=Dt();return b("div",{className:"border-b border-border/60 pb-2 pt-1",children:[u("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 px-1 text-chat text-muted-foreground tabular-nums","data-testid":"working-row",children:b("span",{className:"min-w-0",children:[e.compacting?r("activity.compacting"):e.createdAt?cc(r("activity.workingForLive"),u(mB,{createdAt:e.createdAt})):r("activity.workingNoTimer"),t&&!e.compacting?b("span",{className:"ml-2 text-muted-foreground/55",children:["\xB7 ",t]}):null]})}),o?u(cB,{retry:o}):n&&!e.compacting?u(fB,{stall:n}):null]})}function cB({retry:e}){let{t}=Dt(),n=Ut(Tn);return b(tc,{variant:"warning",className:"mt-2 px-2 py-1.5 text-chat-row",children:[u(Af,{children:n.derive.providerRetryMessage(e,(o,r)=>t(o,r))}),n.onInterrupt?u(nc,{children:u(te,{onClick:n.onInterrupt,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:t("stall.interrupt")})}):null]})}var uB={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function fB({stall:e}){let{t}=Dt(),{onInterrupt:n}=Ut(Tn),o=t(uB[e.reason]);return b("div",{className:"mt-1 flex items-center gap-2 px-1 text-chat-row text-muted-foreground/70",children:[u("span",{className:"tabular-nums",children:cc(t("stall.noOutputForLive"),u(pB,{since:e.since}))}),u("span",{"aria-hidden":!0,children:"\xB7"}),u("span",{children:o}),n?u(te,{className:"h-5 px-1.5 text-chat-row",onClick:n,size:"sm",title:t("stall.interruptHint"),variant:"ghost",children:t("stall.interrupt")}):null]})}function y0(e,t){let n=ni();q(()=>{let o=()=>{t.current&&(t.current.textContent=Uh(e))};if(o(),!n)return;let r=setInterval(o,1e3);return document.addEventListener("visibilitychange",o),()=>{clearInterval(r),document.removeEventListener("visibilitychange",o)}},[n,e,t])}function pB({since:e}){let t=_(null);return y0(e,t),u("span",{className:"timeline-timer tabular-nums",ref:t,children:Uh(e)})}function mB({createdAt:e}){let t=_(null);return y0(e,t),u("span",{ref:t,className:"timeline-timer tabular-nums",children:Uh(e)})}function gB(e,t){let n=_({byId:new Map,result:[]}),o=_(t);return o.current=t,z(()=>{let r=new Map,a=e.map(i=>{let s=n.current.byId.get(i.id),l=s&&hB(s,i)?s:i;return r.set(i.id,l),l});return n.current={byId:r,result:a},a},[e])}function hB(e,t){if(e===t)return!0;if(e.kind!==t.kind||e.id!==t.id)return!1;switch(e.kind){case"turn-identity":{let n=t;return e.turnId===n.turnId&&e.createdAt===n.createdAt&&e.badge===n.badge}case"turn-summary":{let n=t;return e.createdAt===n.createdAt&&e.copyText===n.copyText&&e.footer===n.footer}case"tool-group":{let n=t;return e.createdAt===n.createdAt&&e.groupId===n.groupId&&e.entries===n.entries}case"working":{let n=t;return e.createdAt===n.createdAt&&e.turnId===n.turnId&&e.compacting===n.compacting&&e.modelBadge===n.modelBadge}case"model-switch":{let n=t;return e.createdAt===n.createdAt&&e.pending===n.pending&&e.badge===n.badge}case"proposed-plan":return e.proposedPlan===t.proposedPlan;case"turn-plan":{let n=t;return e.createdAt===n.createdAt&&e.turnPlan.plan===n.turnPlan.plan}case"work":{let n=t;return e.isExpandedToolGroupEntry===n.isExpandedToolGroupEntry&&e.isLastExpandedToolGroupEntry===n.isLastExpandedToolGroupEntry&&e.groupedEntries===n.groupedEntries}case"message":{let n=t;return e.message===n.message&&e.presentation===n.presentation&&e.textTone===n.textTone&&e.durationStart===n.durationStart&&e.showAssistantMeta===n.showAssistantMeta&&e.showAssistantCopyButton===n.showAssistantCopyButton&&e.copyInFooter===n.copyInFooter&&e.assistantCopyStreaming===n.assistantCopyStreaming&&e.modelBadge===n.modelBadge}}}function vB(e,t){let n=Date.parse(e),o=Date.parse(t);if(!Number.isFinite(n)||!Number.isFinite(o))return null;let r=Math.max(0,Math.floor((o-n)/1e3));if(r<60)return`${r}s`;let a=Math.floor(r/3600),i=Math.floor(r%3600/60),s=r%60;return a>0?i>0?`${a}h ${i}m`:`${a}h`:s>0?`${i}m ${s}s`:`${i}m`}function Uh(e){return vB(e,new Date().toISOString())??"0s"}me();var C0=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];var b0=50,xB=32;function yB(e){let t=[];for(let n=0;n<e.length;n+=b0)t.push(e.slice(n,n+b0));return t}function CB({useToolCallDetail:e,threadRef:t,toolCallId:n,turnId:o,fallback:r,revision:a}){let i=e===void 0?null:e({threadRef:t,toolCallId:n,turnId:o??null,revision:a??r??"initial"}),s=i===null?[]:[i.input,i.output].filter(d=>d!==void 0&&d.length>0),l=i?.input!==void 0&&i?.output!==void 0?s.join(`
3685
+ `):null,contexts:o}}function m0(e){let t=e.terminalLabel.trim().toLowerCase().replace(/\s+/g,"-"),n=e.lineStart===e.lineEnd?`${e.lineStart}`:`${e.lineStart}-${e.lineEnd}`;return`@${t}:${n}`}function $h(e){let t=xc(e),n=D2(t.promptText);return{visibleText:n.promptText,copyText:e,contextCount:n.contextCount,previewTitle:n.previewTitle,contexts:n.contexts,elementContexts:t.contexts}}var O2=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function g0(e){let t=[];for(let n of e){let o=n.header.trim();o.length>0&&t.push(Zf(o))}return t.join(" ")}function Zf(e){let t=e.trim(),n=O2.exec(t);if(!n)return`@${t.toLowerCase().replace(/\s+/g,"-")}`;let o=Number.parseInt(n[2]??"",10),r=Number.parseInt(n[3]??n[2]??"",10);return!Number.isFinite(o)||!Number.isFinite(r)?`@${t.toLowerCase().replace(/\s+/g,"-")}`:m0({terminalLabel:n[1]?.trim()||"terminal",lineStart:o,lineEnd:r})}function h0(e,t){let n=0;for(let o of t){let r=Zf(o.header),a=e.indexOf(r,n);if(a===-1)return!1;n=a+r.length}return!0}function Hh({row:e}){let t=Kt(kn).derive;if(Fh(e.message.text)){let n=t.parsePresetPrefixText(e.message.text);return n?b(Ce,{children:[u(z2,{parsed:n}),n.body.length>0||(e.message.attachments?.length??0)>0?u(Hh,{row:{...e,message:{...e.message,text:n.body}}}):null]}):u(H2,{row:e})}return u(F2,{row:e,text:e.message.text})}function Uh({images:e}){let t=Kt(kn),{t:n}=Dt();return e.length===0?null:u("div",{className:"mb-2 grid max-w-[420px] grid-cols-2 gap-2",children:e.map(o=>u("div",{className:"overflow-hidden rounded-lg border border-border/80 bg-background/70",children:o.previewUrl?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":n("attachments.preview",{name:o.name}),onClick:()=>{let r=Oh(e,o.id);r&&t.onImageExpand(r)},children:u("img",{src:o.previewUrl,alt:o.name,className:"block h-auto max-h-[220px] w-full object-cover"})}):u("div",{className:"flex min-h-[72px] items-center justify-center px-2 py-3 text-center text-secondary-label text-chat-dense",children:o.name})},o.id))})}function F2({row:e,text:t}){let{t:n}=Dt(),o=Kt(kn),r=e.message.attachments??[],a=$h(t),i=a.contexts,s=[],l=a.visibleText;for(;;){let v=Bh(l);if(!v.annotation)break;s.unshift(v.annotation),l=v.promptText}let d=xc(l),c=[...a.elementContexts,...d.contexts],f=r.filter(v=>v.name.startsWith("preview-annotation-")),p=r.filter(v=>!v.name.startsWith("preview-annotation-")),m=p.filter(v=>vi(v)==="image"),h=p.filter(v=>vi(v)!=="image"),g=e.message.author??null;return b("div",{className:"group flex min-w-0 items-start gap-2.5",children:[u(B2,{author:g}),b("div",{className:"min-w-0 flex-1 space-y-2",children:[b("div",{className:"flex min-h-7 min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-chat-dense",children:[u("span",{className:"min-w-0 truncate font-medium text-foreground",children:g?.displayName??n("message.user")}),b(Ve,{children:[u(Ge,{render:u("span",{className:"text-muted-foreground tabular-nums"}),children:hi(e.message.createdAt,o.timestampFormat)}),u(We,{children:na(e.message.createdAt,o.timestampFormat)})]}),b("div",{className:"ms-auto flex items-center gap-0.5",children:[o.onForkFromUserMessage!==null&&u(U2,{messageId:e.message.id,onFork:o.onForkFromUserMessage}),a.copyText&&u(wl,{text:a.copyText,variant:"ghost"})]})]}),b("div",{className:"relative min-w-0 rounded-lg border border-border/60 bg-message px-3 py-2.5 text-message-foreground",children:[u(Uh,{images:m}),h.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:h.map(v=>u(qh,{attachment:v},v.id))}),s.map((v,x)=>u(V2,{annotation:v,image:f[x]??null},v.id)),c.length>0?u("div",{className:"mb-2 flex flex-wrap gap-1.5",children:c.map(v=>u(q2,{context:v},`${v.header}:${v.body}`))}):null,u(X2,{text:d.promptText,terminalContexts:i,skills:o.skills,markdownCwd:o.markdownCwd})]})]})]})}function B2({author:e}){let t=e;return t!==null?u(HI,{userId:t.userId,displayName:t.displayName,size:28,className:"mt-0.5"}):u("span",{"aria-hidden":!0,className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-message text-secondary-label",children:u(ta,{className:"size-4"})})}function ep({children:e}){return u("div",{className:"flex justify-center py-1",children:u("div",{className:"max-w-[80%] rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-chat-row text-muted-foreground",children:e})})}function z2({parsed:e}){let{t}=Dt();return b(ep,{children:[u("p",{className:"font-medium text-foreground/80",children:t("preset.systemBlockTitle",{name:e.presetId})}),e.prefix.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:e.prefix}):null]})}var $2={"child.settled":"childThread.notification.settled","child.failed":"childThread.notification.failed","child.approval":"childThread.notification.approval","child.stopped":"childThread.notification.stopped","plugin.notice":"childThread.notification.pluginNotice","selfdev.resolved":"childThread.notification.selfdevResolved"};function H2({row:e}){let{t}=Dt(),n=Kt(kn).derive,o=e.message.attachments??[],r=o.filter(l=>vi(l)==="image"),a=o.filter(l=>vi(l)!=="image"),i=l=>{let d=i0(l);if(d)return b(ep,{children:[u("p",{className:"font-medium text-foreground/80",children:d.title}),d.body.length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:d.body}):null]});let c=n.parseThreadHandoverText(l);if(c)return b(ep,{children:[u("p",{className:"font-medium text-foreground/80",children:t("continuation.systemBlockTitle")}),u("p",{className:"mt-1",children:t("continuation.systemBlockTurns",{count:c.includedTurns})}),u("p",{className:"mt-1 whitespace-pre-wrap",children:c.body})]});let f=n.parseSystemNotificationText(l);return f?b(ep,{children:[u("p",{className:"font-medium text-foreground/80",children:t($2[f.kind],{title:f.title})}),f.summary.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:f.summary}):null]}):null},s=a0(e.message.text).map(i).filter(l=>l!==null);return s.length===0&&o.length===0?null:b(Ce,{children:[s.map((l,d)=>u(ii,{children:l},d)),o.length>0?b("div",{className:"min-w-0 px-3 py-2",children:[u(Uh,{images:r}),a.map(l=>u(qh,{attachment:l},l.id))]}):null]})}function y0(e,t){let n=t.parsePresetPrefixText(e??"")?.body??null;if(n===null&&Fh(e??""))return null;let r=$h(n??e??"").visibleText;for(;;){let s=Bh(r);if(!s.annotation)break;r=s.promptText}let a=xc(r).promptText,i=zh(a).map(s=>s.kind==="text"?s.text:s.comment.text).join(" ").replace(/\s+/g," ").trim();return i.length>0?i:null}var C0=34,b0=8,Kh=C0+b0,I0=de(function({ref:t,textRef:n,initialText:o,expanded:r,onToggleExpanded:a}){let{t:i}=Dt(),s=i(r?"timeline.pinnedTurnHeaderShowLess":"timeline.pinnedTurnHeaderShowMore");return u("div",{ref:t,className:"group pointer-events-none absolute inset-x-0 top-0 z-10 px-3 sm:px-5",style:{paddingTop:b0},"data-timeline-turn-header":"true","data-truncated":"false",children:b("div",{className:O("transcript-col-wide pointer-events-auto flex gap-2 rounded-sm border border-border/70 bg-background pe-1 ps-3 shadow-md shadow-black/10",r?"items-start py-1.5":"items-center"),...r?{}:{style:{height:C0}},children:[u("span",{ref:n,className:O("min-w-0 flex-1 text-foreground/85 text-chat",r?"max-h-40 overflow-y-auto whitespace-pre-wrap":"truncate"),children:o}),b(Ve,{children:[u(Ge,{render:u(ne,{type:"button",size:"xs",variant:"ghost",className:"group-data-[truncated=false]:hidden","aria-label":s,onClick:a}),children:r?u(zd,{}):u(dn,{})}),u(We,{side:"bottom",children:s})]})]})})});function U2({messageId:e,onFork:t}){let{t:n}=Dt(),o=n("fork.action");return b(Ve,{children:[u(Ge,{render:u(ne,{type:"button",size:"xs",variant:"ghost",onClick:()=>t(e),"aria-label":o}),children:u(Vd,{className:"size-3"})}),u(We,{side:"top",children:o})]})}function S0({row:e}){let t=Kt(kn),{t:n}=Dt(),[o,r]=kl(t.threadKey,`message:${e.message.id}`,!1);if(e.presentation==="compact"&&!o)return u(Wf,{state:"idle",children:b("button",{type:"button",className:O(Vf,"chat-process-text cursor-pointer text-secondary-label hover:bg-accent/20"),"aria-expanded":!1,"aria-label":n("timeline.expandMessage"),onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!0)},children:[u(fc,{status:null}),u(uc,{children:u(rc,{className:"size-icon-1","aria-hidden":!0})}),u("span",{className:"min-w-0 flex-1 truncate",children:t.derive.reasoningPreviewText(e.message.text)}),u(dn,{className:"size-icon-1 shrink-0 -rotate-90","aria-hidden":!0})]})});let i=e.message.attachments??[],s=i.filter(c=>vi(c)==="image"),l=i.filter(c=>vi(c)!=="image"),d=e.message.text||(e.message.streaming||i.length>0?"":"(empty response)");return u(Ce,{children:b("div",{className:"relative min-w-0 px-1 py-0.5","data-assistant-text-tone":e.textTone==="process"&&e.presentation!=="compact"?"process":"primary",children:[e.presentation==="compact"?b("div",{className:"mb-1 flex items-center gap-2",children:[u("button",{type:"button",className:"chat-process-meta mb-1 rounded-sm text-secondary-label","aria-expanded":!0,onClick:()=>{t.onProcessDisclosureChange?.(e.id),r(!1)},children:n("timeline.collapseMessage")}),e.copyInFooter?null:u(wl,{text:e.message.text,variant:"ghost"})]}):null,e.modelBadge?u(Vh,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,u(ar,{text:d,className:e.textTone==="process"&&e.presentation!=="compact"?"chat-commentary":"chat-readable-body",cwd:t.markdownCwd,threadRef:t.threadRef??void 0,isStreaming:!!e.message.streaming,lineBreaks:t.derive.shouldPreserveAssistantLineBreaks(d),skills:t.skills}),u(Uh,{images:s}),l.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:l.map(c=>u(qh,{attachment:c},c.id))}),e.showAssistantMeta||e.showAssistantCopyButton&&!e.assistantCopyStreaming&&e.message.text.trim().length>0?b("div",{className:"mt-1.5 flex items-center gap-2 text-chat-row tabular-nums opacity-0 transition-opacity duration-(--control-duration) focus-within:opacity-100 group-hover/assistant:opacity-100",children:[u(K2,{row:e}),e.showAssistantMeta&&!e.message.streaming&&e.modelBadge===null&&b(Ve,{children:[u(Ge,{render:u("p",{className:"text-muted-foreground text-chat-row tabular-nums"}),children:hi(e.message.updatedAt,t.timestampFormat)}),u(We,{children:na(e.message.updatedAt,t.timestampFormat)})]})]}):null]})})}function K2({row:e}){let n=Kt(kn).derive.resolveAssistantMessageCopyState({text:e.message.text??null,showCopyButton:e.showAssistantCopyButton,streaming:e.assistantCopyStreaming});return n.visible?u(wl,{text:n.text??"",variant:"ghost"}):null}var v0=de(function(t){let n=t.context.body.length>0?`${t.context.header}
3686
+ ${t.context.body}`:t.context.header;return u(p0,{label:t.context.header,tooltipText:n})}),q2=de(function(t){let n=t.context.body?`${t.context.header}
3687
+ ${t.context.body}`:t.context.header;return b(Ve,{children:[b(Ge,{render:u("span",{className:"inline-flex max-w-full items-center gap-1 rounded-md border border-border/70 bg-background/70 px-1.5 py-0.5 text-foreground/85 text-chat-row"}),children:[u(Zr,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:t.context.header})]}),u(We,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:n})]})});function qh(e){let{t}=Dt(),n=vi(e.attachment),o=s0(n),r=t("attachments.open",{name:e.attachment.name}),a=b(Ce,{children:[u(o,{className:"size-4 shrink-0 text-secondary-label"}),b("span",{className:"min-w-0 flex-1",children:[u("span",{className:"block truncate font-medium text-foreground text-chat-row",children:e.attachment.name}),u("span",{className:"block text-secondary-label text-chat-meta",children:r0(e.attachment.sizeBytes)})]})]});return e.attachment.previewUrl?u("a",{href:e.attachment.previewUrl,target:"_blank",rel:"noreferrer","aria-label":r,className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2 hover:bg-background/90",children:a}):u("div",{className:"flex items-center gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2",children:a})}function V2(e){let t=Kt(kn),{t:n}=Dt();return b("div",{className:"mb-2 flex max-w-full items-center overflow-hidden rounded-lg border border-border/70 bg-background/70",children:[e.image?.previewUrl?u("button",{type:"button",className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted","aria-label":n("attachments.preview",{name:e.image.name}),onClick:()=>{if(!e.image)return;let o=Oh([e.image],e.image.id);o&&t.onImageExpand(o)},children:u("img",{src:e.image.previewUrl,alt:"Annotated preview crop",className:"size-full object-cover"})}):null,b("div",{className:"min-w-0 px-2.5 py-2",children:[e.annotation.comment?u("div",{className:"max-w-80 truncate text-foreground text-chat-row font-medium",children:e.annotation.comment}):null,b("div",{className:O("flex items-center gap-2 text-secondary-label text-chat-meta",e.annotation.comment&&"mt-1"),children:[e.annotation.targetSummary?u("span",{className:"truncate",children:e.annotation.targetSummary}):null,e.annotation.styleChanges.length>0?b("span",{className:"inline-flex shrink-0 items-center gap-1",children:[u(ts,{className:"size-3"}),e.annotation.styleChanges.length]}):null]})]})]})}var W2=8,G2=600,j2=1.75,x0=`linear-gradient(to bottom, black calc(100% - ${j2}rem), transparent)`;function Q2(e){return e.trim().length===0?!1:e.length>G2||e.split(`
3688
+ `).length>W2}var X2=de(function(t){let[n,o]=G(!1),r=t.text.trim().length>0||t.terminalContexts.length>0,a=r&&Q2(t.text),i=a&&!n;return b("div",{children:[r?u("div",{className:O("relative",i&&"max-h-44 overflow-hidden"),"data-user-message-body":"true","data-user-message-collapsed":i?"true":"false","data-user-message-collapsible":a?"true":"false","data-user-message-fade":i?"true":"false",style:i?{WebkitMaskImage:x0,maskImage:x0}:void 0,children:u(Y2,{text:t.text,terminalContexts:t.terminalContexts,skills:t.skills,markdownCwd:t.markdownCwd})}):null,a||t.footer?b("div",{className:O("mt-1.5 flex items-center gap-2",a&&t.footer?"justify-between":"justify-end"),"data-user-message-footer":"true",children:[a?u(ne,{type:"button",size:"xs",variant:"ghost","aria-expanded":n,"data-scroll-anchor-ignore":!0,onClick:()=>o(s=>!s),className:"-ml-1 h-6 rounded-control-2 px-1.5 text-secondary-label text-chat-row hover:bg-muted/40 hover:text-message-foreground",children:n?"Show less":"Show full message"}):null,t.footer?u("div",{className:"ml-auto flex items-center gap-2",children:t.footer}):null]}):null]})}),Y2=de(function(t){let n=Kt(kn),o=(a,i)=>{let s=/^\s+/.exec(a)?.[0]??"",l=a.slice(s.length),d=/\s+$/.exec(l)?.[0]??"",c=l.slice(0,l.length-d.length);return b(ii,{children:[s?u("span",{"aria-hidden":"true",children:s}):null,c?u(ar,{text:c,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1}):null,d?u("span",{"aria-hidden":"true",children:d}):null]},i)},r=zh(t.text);if(r.some(a=>a.kind==="review-comment"))return u("div",{className:"space-y-3 text-message-foreground text-chat",children:r.map(a=>a.kind==="text"?a.text.trim().length>0?u("div",{className:"wrap-break-word",children:u(ar,{text:a.text.trim(),cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})},a.id):null:u(J2,{comment:a.comment},a.comment.id))});if(t.terminalContexts.length>0){let a=h0(t.text,t.terminalContexts),i=g0(t.terminalContexts),s=[];if(a){let l=0;for(let d of t.terminalContexts){let c=Zf(d.header),f=t.text.indexOf(c,l);if(f===-1){s.length=0;break}f>l&&s.push(o(t.text.slice(l,f),`user-terminal-context-inline-before:${d.header}:${l}`)),s.push(u(v0,{context:d},`user-terminal-context-inline:${d.header}`)),l=f+c.length}if(s.length>0)return l<t.text.length&&s.push(o(t.text.slice(l),`user-message-terminal-context-inline-rest:${l}`)),u("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:s})}for(let l of t.terminalContexts)s.push(u(v0,{context:l},`user-terminal-context-inline:${l.header}`)),s.push(u("span",{"aria-hidden":"true",children:" "},`user-terminal-context-inline-space:${l.header}`));if(t.text.length>0)s.push(u(ar,{text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1},"user-message-terminal-context-inline-text"));else if(i.length===0)return null;return u("div",{className:"whitespace-pre-wrap wrap-break-word text-message-foreground text-chat",children:s})}return t.text.length===0?null:u(ar,{text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})});function J2({comment:e}){let t=Kt(kn),n=e.fenceLanguage??"diff",o=c0(e);return b("div",{className:"space-y-2 rounded-lg border border-border/70 bg-background/70 p-3",children:[b("div",{className:"space-y-1",children:[u("div",{className:"text-message-foreground text-chat-row font-medium",children:qf(e.filePath,t.workspaceRoot)}),b("div",{className:"text-secondary-label text-chat-dense",children:[e.sectionTitle," \xB7 ",e.rangeLabel]})]}),e.text.length>0&&u("div",{className:"whitespace-pre-wrap wrap-break-word text-chat",children:u(f0,{text:e.text,skills:t.skills})}),n!=="diff"&&e.diff.trim().length>0&&u(ar,{text:d0(n,e.diff),cwd:t.markdownCwd,threadRef:t.threadRef??void 0,skills:t.skills,className:"text-message-foreground"}),o?u(fS,{patch:o}):null]})}function Z2({badge:e}){return b(Ce,{children:[e.providerId?u("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-card","aria-label":e.providerDisplayName??void 0,children:u(Ir,{providerId:e.providerId,displayName:e.providerDisplayName,accentColor:e.accentColor,className:"size-5",iconClassName:"size-4"})}):null,b("span",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[e.providerId?u("span",{className:"font-medium text-foreground",children:e.providerDisplayName}):null,u("span",{className:"min-w-0 truncate text-muted-foreground",children:e.modelLabel}),e.effortLabel?b("span",{children:[" \xB7 ",e.effortLabel]}):null]})]})}function Vh({badge:e,createdAt:t}){let n=Kt(kn);return b("div",{className:"mb-3 flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 text-chat-dense text-muted-foreground","data-testid":"assistant-model-header",children:[u(Z2,{badge:e}),u("span",{"aria-hidden":!0,children:"\xB7"}),b(Ve,{children:[u(Ge,{render:u("span",{className:"shrink-0 tabular-nums"}),children:hi(t,n.timestampFormat)}),u(We,{children:na(t,n.timestampFormat)})]})]})}function w0({row:e}){let{t}=Dt(),n=e.badge.effortLabel?`${e.badge.modelLabel} \xB7 ${e.badge.effortLabel}`:e.badge.modelLabel,o=[e.badge.providerDisplayName,e.badge.sourceLabel,n].filter(a=>typeof a=="string"&&a.length>0).join(" \xB7 "),r=e.pending?t("timeline.modelSwitchPending",{model:o}):t("timeline.modelSwitched",{model:o});return b("div",{role:"separator","aria-label":r,"data-pending":e.pending?"true":void 0,className:"flex items-center gap-2 px-1 py-1 text-chat-dense text-muted-foreground/70",children:[u("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"}),b("span",{className:"flex min-w-0 shrink items-center gap-1.5",children:[e.badge.providerId?u(Ir,{providerId:e.badge.providerId,displayName:e.badge.providerDisplayName,accentColor:e.badge.accentColor,className:"size-icon-1",iconClassName:"size-icon-1"}):null,u("span",{className:"truncate",children:r})]}),u("span",{"aria-hidden":!0,className:"h-px min-w-4 flex-1 bg-border/60"})]})}var kn=Ut(null),k0=Ut(null),eB=u("div",{className:"h-3 sm:h-4"}),tB=u("div",{className:"h-10 sm:h-12"}),nB=Object.freeze([]);function oB({loading:e,onLoadEarlier:t,fade:n}){return u("div",{className:n?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:t,disabled:e,className:"relative w-full py-1.5 text-chat-row text-muted-foreground/60 hover:text-foreground disabled:cursor-default pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:e?"Loading earlier turns\u2026":"Load earlier turns"})})})}function rB({onReveal:e,fade:t}){return u("div",{className:t?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:e,className:"relative w-full py-1.5 text-chat-row text-muted-foreground/60 hover:text-foreground pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",children:"Show earlier turns"})})})}var aB=u("div",{className:"h-3 sm:h-4"}),iB=[],sB=new Set,lB=200,dB=1e4,cB=600,uB=()=>{};function ir(e,t){let n=D(e);return t&&(n.current=e),n.current}var fB=[],L0=de(function({derive:t,activities:n=fB,threadKey:o,threadRef:r,environmentId:a,isWorking:i,workingStepLabel:s=null,stall:l=null,retry:d=null,onInterrupt:c=null,onRespondToDecision:f=null,scheduledWakes:p=nB,onCancelScheduledWake:m=null,activeTurnStartedAt:h,totalTurnCount:g=null,agentPanelModel:v,onOpenAgents:x=uB,timelineEntries:y,latestTurn:C,latestAssistantMessageId:S=null,runningTurnId:L,resolveModelBadge:w,pendingModelSelection:k,onOpenFileDiff:I,onForkFromUserMessage:T,onImageExpand:E,markdownCwd:A,resolvedTheme:N,timestampFormat:R,workspaceRoot:$,skills:U=iB,anchorMessageId:H,onAnchorReady:F,onRowsChange:oe,contentInsetEndAdjustment:ee,liveFollowEnabled:W,awaitingUserDecision:Ze=!1,onIsAtEndChange:ue,onManualNavigation:pe,onDisclosureNavigation:Fe=pe,hideEmptyPlaceholder:Le=!1,topFadeEnabled:ie=!1,scrollerRef:Ie,loadEarlier:ve=null,revealMessageRequest:re=null,onRevealMessageHandled:be,usageByTurnId:rt,renderWorkGroup:dt,renderToolCallDetail:st,loadScrollAnchor:ct,saveScrollAnchor:Zt,disclosure:at,useVisibleThreadCompletion:_e,export:He,onSavePlanToWorkspace:qe,paneActive:Be,onTurnNavigatorChange:Vt}){let he=ci(),sn=D(he);sn.current=he;let Re=at.usePersistedExpandedTurnIds(o),[Jn,lt]=Ln("timeline-auto-expanded-turns",o,sB),kt=z(()=>t.resolveExpandedTurnIds(Re??[],Jn),[Jn,t,Re]),[Nt,en]=Ln("timeline-disclosure-reading",o,!1),gn=D(o);gn.current=o;let Pn=D(kt);Pn.current=kt;let An=Rn("timeline-following-end",o,!0);An.current=W&&H===null;let hn=Rn("timeline-scroll-restore-pending",o,!1),cn=hc(o,null),Yt=hc(o,null),Hn=hc(o,null),io=Rn("timeline-content-inset",o,ee),It=D(null),Eo=B(q=>{if(q!==null&&(It.current=q),typeof Ie=="function"){Ie(q);return}Ie.current=q},[Ie]);xe(()=>{t0({timeline:It.current,previousOverlayHeight:io.current,overlayHeight:ee,followingEnd:he&&W&&!Nt&&H===null}),io.current=ee},[H,ee,Nt,W,he]),K(()=>()=>{Yt.current?.stop()},[]);let _=B(()=>{Yt.current?.stop(),Yt.current=null,cn.current=null,en(!1)},[cn,Yt,en]),Z=B(q=>{Fe(),cn.current=q,en(!0),Yt.current?.stop();let ce=It.current?.node??null;if(!ce)return;let Ee=Array.from(ce.querySelectorAll("[data-timeline-row-id]")).find(Sn=>Sn.dataset.timelineRowId===q);if(!Ee)return;let tt=Hn.current;Yt.current=DS({viewport:ce,row:Ee,anchor:tt&&Ee.contains(tt)?tt:Ee,scrollToOffset:Sn=>{ce.scrollTop=Sn}})},[Fe]),X=Rn("timeline-live-follow-previous",o,W);xe(()=>{W&&!X.current&&_(),X.current=W},[W,_]);let ae=Rn("timeline-latest-turn-previous",o,C);K(()=>{let q=ae.current;if(ae.current=C,!(!C||q?.turnId===void 0)){if(C.turnId===q.turnId){q.state==="running"&&C.state==="interrupted"&&lt(ce=>{let Ee=new Set(ce);return Ee.add(C.turnId),Ee});return}lt(ce=>{if(!ce.has(q.turnId))return ce;let Ee=new Set(ce);return Ee.delete(q.turnId),Ee})}},[C]);let fe=Rn("timeline-rows-cache",o,null,3);fe.current??=t.createRowsCache();let ft=fe.current.deriveGroups,ut=ir(n,he),vt=ir(y,he),_t=ir(C,he),Jt=ir(L,he),xt=ir(kt,he),vn=ir(i,he),tn=ir(h,he),un=ir(w,he),Zn=ir(k,he),me=ir(s,he),St=ir(l,he),yt=ir(d,he),zt=z(()=>ft({activities:ut,timelineEntries:vt,latestTurn:_t,runningTurnId:Jt,expandedTurnIds:xt,isWorking:vn,activeTurnStartedAt:tn,resolveModelBadge:un,pendingModelSelection:Zn}),[ft,ut,vt,_t,Jt,xt,vn,tn,un,Zn]),Oe=kB(zt.rows,t),gt=z(()=>$S(Oe,zt.turnGroups),[zt.turnGroups,Oe]),Zo=D(Oe);Zo.current=Oe;let Lt=B(q=>{let ce=Zo.current.find(Ee=>Ee.id===q||Ee.kind==="work"&&Ee.groupedEntries.some(tt=>tt.id===q)||Ee.kind==="tool-group"&&Ee.entries.some(tt=>tt.id===q));Z(ce?.id??q)},[Z]),Dn=D(Oe);Dn.current=Oe;let nn=Rn("timeline-scroll-snapshot",o,null),xn=B((q,ce=An.current)=>{q.scrollLength<=0||(nn.current={threadKey:o,anchor:n0({measurement:q,followingEnd:ce})})},[An,o,nn]),te=B(()=>{let q=nn.current;q&&Zt(q.threadKey,q.anchor)},[Zt,nn]),et=B(()=>{if(!he||hn.current)return;let q=It.current?.measure();q&&q.scrollLength>0&&(xn(q,An.current&&t.resolveIsAtEnd(q,ee)!==!1),te())},[xn,ee,t,An,he,te,hn]),Ct=VS(o),ze=D(Ct);ze.current=Ct;let{startIndex:on,hasHiddenOlder:yn}=HS(gt.length,Ct.revealedCount),Cn=z(()=>gt.slice(on),[on,gt]),Pt=D(gt);Pt.current=gt;let Un=hc(o,null),Wt=B(()=>{if(!sn.current)return;let q=It.current?.node;q&&(Un.current={scrollHeight:q.scrollHeight,scrollTop:q.scrollTop,until:Date.now()+dB})},[Un]);xe(()=>{if(!he)return;let q=Un.current;if(!q)return;Un.current=null;let ce=It.current?.node;if(!ce||Date.now()>q.until)return;let Ee=q.scrollTop+(ce.scrollHeight-q.scrollHeight);ce.scrollTop=Ee},[he,on,Oe.length]);let so=B(()=>{Wt(),ze.current.revealOlder()},[Wt]),ma=D(so);ma.current=so;let ei=D(yn);ei.current=yn;let Zs=D(null),Ne=Rn("timeline-scroll-restore",o,void 0);if(Ne.current===void 0&&Oe.length>0){let q=ct(o);Ne.current=q!==null&&Oe.some(ce=>ce.id===q.rowId)?q:null}let Kr=Ne.current??null,rn=D(()=>{}),[ga,Td]=Ln("timeline-scroll-restore-settled",o,!1),el=Kr!==null&&!ga,Ho=Rn("timeline-last-anchor-save",o,0);K(()=>{let q=Kr;if(!he||ga||q===null)return;let ce=null,Ee=requestAnimationFrame(()=>{sn.current&&(pe(),ze.current.revealAtLeast(mc(Pt.current,q.rowId,ze.current.revealedCount)),ce=requestAnimationFrame(()=>{sn.current&&(Td(!0),rn.current(q.rowId,-q.offsetPx))}))});return()=>{cancelAnimationFrame(Ee),ce!==null&&cancelAnimationFrame(ce)}},[pe,he,Kr,ga]);let Mo=Rn("timeline-restore-after-presentation",o,!1),lo=el||Mo.current;hn.current=lo,xe(()=>{if(he)return()=>{gn.current!==o?te():et(),Mo.current=!0}},[he,o]),xe(()=>{if(!he||!Mo.current)return;let q=null,ce=null,Ee=()=>{It.current?.scrollToEnd(),Mo.current=!1,hn.current=!1,An.current=!0,xa.current=!0,Ko.current={...Ko.current,followEnabled:!0,restoreInProgress:!1},ue(!0)},tt=ct(o),Sn=tt!==null&&Pt.current.some(qo=>qo.rows.some(pn=>pn.id===tt.rowId));return tt===null?q=requestAnimationFrame(Ee):Sn?(pe(),ze.current.revealAtLeast(mc(Pt.current,tt.rowId,ze.current.revealedCount)),q=requestAnimationFrame(()=>{ce=requestAnimationFrame(()=>{sn.current&&(rn.current(tt.rowId,-tt.offsetPx),Mo.current=!1,hn.current=!1)})})):Oe.length>0&&(q=requestAnimationFrame(Ee)),()=>{q!==null&&cancelAnimationFrame(q),ce!==null&&cancelAnimationFrame(ce)}},[ct,ue,pe,he,o,Oe.length,gt.length]);let $t=z(()=>he?pB(gt,t):[],[t,he,gt]),er=z(()=>{if(!he)return[];let q=new Map;for(let ce of gt)for(let Ee of ce.rows){let tt=Ee.kind==="message"?Ee.message.turnId??null:Ee.kind==="turn-summary"?Ee.footer.turnId:null;if(tt!==null){q.set(ce.key,tt);break}}return $t.filter(ce=>ce.userText!==null).map(ce=>({...ce,turnId:q.get(ce.sectionKey)??null}))},[he,$t,gt]),At=B(q=>{_(),pe(),ze.current.revealAtLeast(mc(Pt.current,q.anchorRowId,ze.current.revealedCount));let ce=o;requestAnimationFrame(()=>{gn.current===ce&&rn.current(q.anchorRowId,24)})},[pe,_,o]),vr=z(()=>he?{items:er,totalTurnCount:g,bottomInset:ee,usageByTurnId:rt,onSelect:At,exportMarkdown:He.markdown,onDownload:He.download}:null,[ee,He,At,he,g,er,rt]);K(()=>{vr!==null&&Vt(vr)},[Vt,vr]),K(()=>{if(he)return()=>Vt(null)},[Vt,he]),K(()=>{if(re===null||!he)return;_(),pe();let q=t.resolveToolGroupRevealRowId(Dn.current,re.rowId);ze.current.revealAtLeast(mc(Pt.current,q,ze.current.revealedCount));let ce=requestAnimationFrame(()=>{gn.current===o&&(rn.current(q,24),be?.())});return()=>cancelAnimationFrame(ce)},[re,he,pe,_,be,t,o]);let Gt=z(()=>$t.flatMap(q=>q.headerText===null?[]:[{sectionKey:q.sectionKey,text:q.headerText}]),[$t]),Pe=D(Gt);Pe.current=Gt;let Ht=Rn("timeline-active-header",o,null),$i=Gt.at(-1)?.text??null,On=$i!==null,Uo=D(null),yo=D(null),[ha,Ro]=Ln("timeline-pinned-header-expanded",o,!1),va=D(ha);va.current=ha;let co=B(()=>{if(!sn.current)return;let q=Uo.current,ce=yo.current;!q||!ce||(q.dataset.truncated=va.current||ce.scrollWidth>ce.clientWidth+1?"true":"false")},[]),[tr,xr]=G(null),ti=z(()=>t.hasSettledAssistantMessage(y,S),[t,y,S]),[Tn,qr]=G(null),Vr=B(()=>{Wt(),ve?.onLoadEarlier()},[Wt,ve]);Zs.current=ve===null||ve.loading?null:Vr;let ni=B((q,ce)=>{if(!sn.current)return;let Ee=It.current?.node;if(!Ee)return;let tt=Array.from(Ee.querySelectorAll("[data-timeline-turn-section]")),Sn=tt.findIndex(pn=>pn.querySelector(`[data-timeline-row-id="${CSS.escape(q)}"]`)),qo=Sn<0?tt:tt.slice(0,Sn+1);for(let pn of qo)pn.style.contentVisibility="visible";Ee.offsetHeight,It.current?.scrollToRow(q,{viewOffset:ce}),requestAnimationFrame(()=>{for(let pn of qo)pn.style.removeProperty("content-visibility")})},[]);rn.current=ni;let eo=z(()=>xS(Oe,H,q=>q.kind==="message"&&q.message.role==="user"?q.message.id:null),[H,Oe]),yr=he&&W&&!Nt&&eo===void 0&&!lo,xa=D(yr);xa.current=yr;let Ko=D({followEnabled:yr,restoreInProgress:lo,loadEarlier:ve});Ko.current={followEnabled:yr,restoreInProgress:lo,loadEarlier:ve};let Cr=D(null);K(()=>{if(!Tn||!he)return;let q=WS({root:Tn,minimumCount:cs,canCompact:()=>{let ce=Ko.current,Ee=Un.current;return ce.followEnabled&&!ce.restoreInProgress&&!ce.loadEarlier?.loading&&!(Ee&&Ee.until>Date.now())&&ze.current.revealedCount>cs},onCompact:ce=>{fn.current=!0,Wt(),ze.current.compactTo(ce)}});return Cr.current=q,()=>{q.disconnect(),Cr.current=null}},[Wt,he,Tn]),K(()=>{Cr.current?.schedule()},[yr,ve?.loading,Ct.revealedCount,gt.length]),K(()=>{if(!Tn||!he||typeof ResizeObserver>"u")return;let q=()=>{if(!sn.current||!xa.current)return;let tt=Tn.scrollHeight-Tn.clientHeight;Math.abs(Tn.scrollTop-tt)>.5&&(Tn.scrollTop=tt)},ce=new ResizeObserver(q);ce.observe(Tn);let Ee=Tn.firstElementChild;return Ee&&ce.observe(Ee),()=>ce.disconnect()},[he,Tn]),_e({viewport:tr,viewActive:Be&&he,threadKey:o,completedAt:!lo&&C?.state==="completed"&&ti?C.completedAt:null,messageId:S,bottomInset:ee});let[to,Ke]=Ln("timeline-anchored-end-height",o,0),ht=Rn("timeline-anchored-ready",o,null);xe(()=>{if(!he)return;if(eo===void 0||H===null){Ke(0),ht.current=null;return}let q=It.current?.node,ce=Oe[eo.anchorIndex],Ee=It.current?.measure();if(!q||!ce||!Ee||Ee.scrollLength<=0)return;let tt=Ee.topOf(ce.id);if(tt===null)return;let Sn=Ee.contentLength-to-tt,qo=Math.max(0,Ee.scrollLength-ee-eo.anchorOffset),pn=Math.max(0,Math.round(qo-Sn));if(Math.abs(pn-to)>1){Ke(pn);return}ht.current!==H&&(ht.current=H,F(H,{rowId:ce.id,lastRowId:Oe.at(-1)?.id??null}))},[H,eo,to,ee,F,he,Oe]);let bn=Oe.at(-1)?.id??null;K(()=>{oe?.(bn)},[bn,oe,o]);let fn=Rn("timeline-top-reveal-armed",o,!0),Wr=B(q=>{if(q>cB){fn.current=!0;return}if(fn.current){if(fn.current=!1,ei.current){ma.current();return}Zs.current?.()}},[fn]),ya=B(()=>{if(!sn.current||gn.current!==o)return;let q=It.current?.measure();if(!q||hn.current)return;xn(q);let ce=t.resolveIsAtEnd({contentLength:q.contentLength,scroll:q.scroll,scrollLength:q.scrollLength},ee);ce!==void 0&&ue(ce),q.contentLength-q.scrollLength-q.scroll>2&&Wr(q.scroll);let Ee=Date.now();Ee-Ho.current>=lB&&(Ho.current=Ee,te())},[xn,ee,t,Wr,ue,te,o,hn]),Ca=D(null),Gr=B(()=>{sn.current&&Ca.current===null&&(Ca.current=requestAnimationFrame(()=>{Ca.current=null,co()}))},[co]);K(()=>()=>{Ca.current!==null&&(cancelAnimationFrame(Ca.current),Ca.current=null)},[o]);let oi=B(q=>{if(q===null||q===Ht.current)return;Ht.current=q;let ce=Pe.current.find(Ee=>Ee.sectionKey===q);ce&&yo.current&&(yo.current.textContent=ce.text),va.current&&Ro(!1),Gr()},[Ht,Gr,Ro]),ba=jS({root:Tn,topInsetPx:Kh,onActiveSectionChange:oi,active:he});K(()=>{if(!he){te();return}let q=requestAnimationFrame(()=>{if(!sn.current)return;let ce=It.current?.node;ce&&xa.current&&(ce.scrollTop=ce.scrollHeight-ce.clientHeight),ba.refresh()});return()=>cancelAnimationFrame(q)},[te,ba,he]);let Ug=B(()=>{Ro(q=>!q)},[Ro]);xe(()=>{if(!he)return;let q=Ht.current,ce=q===null?void 0:Pe.current.find(Ee=>Ee.sectionKey===q);ce&&yo.current&&(yo.current.textContent=ce.text),Gr()},[he,Gr,ha]);let In=z(()=>{let q=yn?u(rB,{onReveal:so,fade:ie}):ve!==null?u(oB,{loading:ve.loading,onLoadEarlier:Vr,fade:ie}):ie?tB:eB;return On?b(Ce,{children:[u("div",{style:{height:Kh}}),q]}):q},[Vr,yn,On,ve,so,ie]);K(()=>{if(!he)return;let q=requestAnimationFrame(ya);return()=>cancelAnimationFrame(q)},[ya,he,lo,Oe.length]);let Kg=z(()=>({timestampFormat:R,threadKey:o,threadRef:r,markdownCwd:A,resolvedTheme:N,workspaceRoot:$,skills:U,activeThreadEnvironmentId:a,onForkFromUserMessage:T,onImageExpand:E,onOpenFileDiff:I,onProcessDisclosureChange:Lt,agentPanelModel:v,onOpenAgents:x,onInterrupt:c,onRespondToDecision:f,scheduledWakes:p,onCancelScheduledWake:m,derive:t,renderWorkGroup:dt,renderToolCallDetail:st,onSavePlanToWorkspace:qe}),[R,o,r,A,N,$,U,a,T,E,I,Lt,v,x,c,f,p,m,t,dt,st,qe]),tl=z(()=>({isWorking:vn,latestTurnId:_t?.turnId??null,workingStepLabel:me,stall:St,retry:yt}),[vn,_t?.turnId,yt,St,me]),ju=B(q=>u(gB,{row:q}),[]);return Oe.length===0&&!i?Le?null:u("div",{className:"flex h-full items-center justify-center",children:u("p",{className:"text-placeholder text-chat",children:"Send a message to start the conversation."})}):u(kn,{value:Kg,children:u(k0,{value:tl,children:b("div",{ref:xr,onClickCapture:q=>{Hn.current=q.target instanceof Element?q.target.closest("button"):null},onWheelCapture:_,onTouchMoveCapture:_,onPointerDownCapture:q=>{q.target===It.current?.node&&_()},onKeyDownCapture:q=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(q.key)&&_()},className:"chat-timeline relative h-full min-h-0","data-awaiting-user-decision":Ze?"true":"false","data-disclosure-reading":Nt?"true":void 0,"data-timeline-follow-end":yr?"true":"false","data-timeline-anchor-row":eo===void 0?void 0:Oe[eo.anchorIndex]?.id??void 0,"data-timeline-end-inset":ee,children:[u(BS,{inputKey:o,onBeforeInputChange:et,handleRef:Eo,onAttach:qr,onScroll:ya,className:O("scrollbar-gutter-both h-full min-h-0 overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 sm:px-5",ie&&"topbar-scroll-fade"),children:b("div",{style:{paddingBottom:ee},children:[In,Cn.map(q=>u(zS,{sectionKey:q.key,rowKeyPrefix:o,rows:q.rows,renderRow:ju,sectionRef:ba.observeSection(q.key)},`${o}:${q.key}`)),aB,eo?u("div",{"aria-hidden":!0,"data-timeline-anchored-end-space":"true",style:{height:to}}):null]})}),$i!==null?u(I0,{ref:Uo,textRef:yo,initialText:$i,expanded:ha,onToggleExpanded:Ug}):null]})})})});function pB(e,t){return e.map(n=>{let o=n.rows.find(i=>i.kind==="message"&&i.message.role==="user"),r=o?.kind==="message"?o.message:null,a=null;for(let i of n.rows)i.kind==="message"&&i.message.role==="assistant"&&(a=i.message.text??null);return{id:n.key,sectionKey:n.key,anchorRowId:o?.id??n.rows[0]?.id??n.key,userText:r===null?null:T0(t.parseSystemNotificationText(r.text)?.summary??t.parseThreadHandoverText(r.text)?.body??r.text),assistantText:T0(a),headerText:r===null?null:y0(r.text,t)}})}var Wh=240,mB=/\s/u;function T0(e){if(!e)return null;let t=[],n=0,o=!1,r=()=>{for(;n>Wh-1;)n-=t.pop()?.length??0;for(;t.at(-1)===" ";)t.pop(),n-=1;return t.push("\u2026"),t.join("")};for(let a of e){if(mB.test(a)){o=t.length>0;continue}if(o&&(t.push(" "),n+=1,o=!1,n>Wh)||(t.push(a),n+=a.length,n>Wh))return r()}return t.length>0?t.join(""):null}var gB=de(function({row:t}){let n=Kt(kn);return u("div",{className:O("relative",t.kind==="message"&&t.message.role==="user"?"pb-6":t.kind==="message"&&t.message.role==="assistant"?t.copyInFooter?"pb-1 group/assistant":"pb-4 group/assistant":"pb-2"),"data-timeline-row-id":t.id,"data-timeline-row-kind":t.kind,"data-message-id":t.kind==="message"?t.message.id:void 0,"data-message-role":t.kind==="message"?t.message.role:void 0,children:b(Qf,{resetKey:t.id,fallback:o0,children:[t.kind==="turn-summary"?u(IS,{footer:t.footer,copyText:t.copyText,timestampFormat:n.timestampFormat}):null,t.kind==="tool-group"?u(_S,{entries:t.entries,groupId:t.groupId,threadKey:n.threadKey,workspaceRoot:n.workspaceRoot,onDisclosureChange:()=>n.onProcessDisclosureChange?.(t.id)}):null,t.kind==="work"?u(hB,{row:t}):null,t.kind==="model-switch"?u(w0,{row:t}):null,t.kind==="turn-identity"?u("div",{"data-turn-identity":t.turnId,className:"px-1 pt-1",children:u(Vh,{badge:t.badge,createdAt:t.createdAt})}):null,t.kind==="message"&&t.message.role==="user"?u(Hh,{row:t}):null,t.kind==="message"&&t.message.role==="assistant"?u(S0,{row:t}):null,t.kind==="proposed-plan"?u(xB,{row:t}):null,t.kind==="turn-plan"?u(yB,{row:t}):null,t.kind==="working"?u(CB,{row:t}):null]})})});function hB({row:e}){let t=Kt(kn),n=ci(),o=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:n});return o!==void 0?u(Ce,{children:o}):u("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>u(vB,{entry:r},r.id))})}function vB({entry:e}){let[t,n]=G(!1),o=e.detail??e.command??e.rawCommand??e.toolLabel?.detail;return b("div",{children:[b("button",{type:"button","aria-expanded":t,className:O("chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left",e.tone==="error"?"text-destructive":"text-muted-foreground"),onClick:()=>n(r=>!r),disabled:o===void 0,children:[u("span",{"aria-hidden":!0,className:O("block size-2 shrink-0 rounded-full",e.tone==="error"?"bg-destructive":e.tone==="thinking"||e.tone==="info"?"bg-muted-foreground/60":"border border-muted-foreground/60")}),u("span",{className:"chat-process-text min-w-0 flex-1 truncate",children:e.label}),o!==void 0?u(dn,{"aria-hidden":!0,className:O("size-icon-1 shrink-0",!t&&"-rotate-90")}):null]}),t&&o!==void 0?u("pre",{className:"chat-tool-body mx-2 overflow-x-auto rounded-md bg-muted/40 p-2",children:o}):null]})}function xB({row:e}){let t=Kt(kn);return u("div",{className:"min-w-0 px-1 py-0.5",children:u(e0,{planMarkdown:e.proposedPlan.planMarkdown,environmentId:t.activeThreadEnvironmentId,threadRef:t.threadRef??void 0,cwd:t.markdownCwd,workspaceRoot:t.workspaceRoot,onSavePlanToWorkspace:t.onSavePlanToWorkspace})})}var yB=de(function({row:t}){let[n,o]=G(!1),{steps:r}=t.turnPlan.plan,a=r.filter(d=>d.status==="completed").length,i=a===r.length,s=r.find(d=>d.status==="inProgress")?.step??r.find(d=>d.status==="pending")?.step??r.at(-1)?.step??"Plan";return b("div",{className:"min-w-0 px-1 py-0.5",children:[b("button",{type:"button",className:"relative flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-md px-0.5 py-0.5 text-left text-[12px] leading-5 transition-colors duration-(--control-duration) hover:bg-accent/20 pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11","aria-expanded":n,onClick:()=>o(d=>!d),children:[u(n?dn:Go,{className:"size-icon-1 shrink-0 text-muted-foreground/65"}),r.length>1?u("span",{"aria-hidden":!0,className:"flex shrink-0 items-center gap-0.5",children:r.map(d=>u("span",{className:O("h-[3px] w-2.5 rounded-full",d.status==="completed"?"bg-success":d.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},d.step))}):null,u("span",{className:O("min-w-0 truncate",i?"text-muted-foreground/65":"font-medium text-foreground/85"),children:s}),r.length>1?b("span",{className:"shrink-0 text-muted-foreground/50 tabular-nums",children:[a,"/",r.length]}):null]}),n?u("div",{className:"mt-0.5 space-y-px pl-6",children:r.map(d=>b("div",{className:"flex items-baseline gap-2 text-[12px] leading-5",children:[u("span",{className:O("w-3 shrink-0 text-center font-mono text-chat-meta",d.status==="completed"?"text-success":d.status==="inProgress"?"text-primary":"text-muted-foreground/40"),"aria-hidden":!0,children:d.status==="completed"?"\u2713":d.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:O("min-w-0",d.status==="completed"?"text-muted-foreground/55":d.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:d.step})]},d.step))}):null]})});function CB({row:e}){let{workingStepLabel:t,stall:n,retry:o}=Kt(k0),{t:r}=Dt();return b("div",{className:"border-b border-border/60 pb-2 pt-1",children:[u("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 px-1 text-chat text-muted-foreground tabular-nums","data-testid":"working-row",children:b("span",{className:"min-w-0",children:[e.compacting?r("activity.compacting"):e.createdAt?vc(r("activity.workingForLive"),u(TB,{createdAt:e.createdAt})):r("activity.workingNoTimer"),t&&!e.compacting?b("span",{className:"ml-2 text-muted-foreground/55",children:["\xB7 ",t]}):null]})}),o?u(bB,{retry:o}):n&&!e.compacting?u(SB,{stall:n}):null]})}function bB({retry:e}){let{t}=Dt(),n=Kt(kn);return b(lc,{variant:"warning",className:"mt-2 px-2 py-1.5 text-chat-row",children:[u(Of,{children:n.derive.providerRetryMessage(e,(o,r)=>t(o,r))}),n.onInterrupt?u(dc,{children:u(ne,{onClick:n.onInterrupt,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:t("stall.interrupt")})}):null]})}var IB={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function SB({stall:e}){let{t}=Dt(),{onInterrupt:n}=Kt(kn),o=t(IB[e.reason]);return b("div",{className:"mt-1 flex items-center gap-2 px-1 text-chat-row text-muted-foreground/70",children:[u("span",{className:"tabular-nums",children:vc(t("stall.noOutputForLive"),u(wB,{since:e.since}))}),u("span",{"aria-hidden":!0,children:"\xB7"}),u("span",{children:o}),n?u(ne,{className:"h-5 px-1.5 text-chat-row",onClick:n,size:"sm",title:t("stall.interruptHint"),variant:"ghost",children:t("stall.interrupt")}):null]})}function P0(e,t){let n=ci();K(()=>{let o=()=>{t.current&&(t.current.textContent=Gh(e))};if(o(),!n)return;let r=setInterval(o,1e3);return document.addEventListener("visibilitychange",o),()=>{clearInterval(r),document.removeEventListener("visibilitychange",o)}},[n,e,t])}function wB({since:e}){let t=D(null);return P0(e,t),u("span",{className:"timeline-timer tabular-nums",ref:t,children:Gh(e)})}function TB({createdAt:e}){let t=D(null);return P0(e,t),u("span",{ref:t,className:"timeline-timer tabular-nums",children:Gh(e)})}function kB(e,t){let n=D({byId:new Map,result:[]}),o=D(t);return o.current=t,z(()=>{let r=new Map,a=e.map(i=>{let s=n.current.byId.get(i.id),l=s&&LB(s,i)?s:i;return r.set(i.id,l),l});return n.current={byId:r,result:a},a},[e])}function LB(e,t){if(e===t)return!0;if(e.kind!==t.kind||e.id!==t.id)return!1;switch(e.kind){case"turn-identity":{let n=t;return e.turnId===n.turnId&&e.createdAt===n.createdAt&&e.badge===n.badge}case"turn-summary":{let n=t;return e.createdAt===n.createdAt&&e.copyText===n.copyText&&e.footer===n.footer}case"tool-group":{let n=t;return e.createdAt===n.createdAt&&e.groupId===n.groupId&&e.entries===n.entries}case"working":{let n=t;return e.createdAt===n.createdAt&&e.turnId===n.turnId&&e.compacting===n.compacting&&e.modelBadge===n.modelBadge}case"model-switch":{let n=t;return e.createdAt===n.createdAt&&e.pending===n.pending&&e.badge===n.badge}case"proposed-plan":return e.proposedPlan===t.proposedPlan;case"turn-plan":{let n=t;return e.createdAt===n.createdAt&&e.turnPlan.plan===n.turnPlan.plan}case"work":{let n=t;return e.isExpandedToolGroupEntry===n.isExpandedToolGroupEntry&&e.isLastExpandedToolGroupEntry===n.isLastExpandedToolGroupEntry&&e.groupedEntries===n.groupedEntries}case"message":{let n=t;return e.message===n.message&&e.presentation===n.presentation&&e.textTone===n.textTone&&e.durationStart===n.durationStart&&e.showAssistantMeta===n.showAssistantMeta&&e.showAssistantCopyButton===n.showAssistantCopyButton&&e.copyInFooter===n.copyInFooter&&e.assistantCopyStreaming===n.assistantCopyStreaming&&e.modelBadge===n.modelBadge}}}function PB(e,t){let n=Date.parse(e),o=Date.parse(t);if(!Number.isFinite(n)||!Number.isFinite(o))return null;let r=Math.max(0,Math.floor((o-n)/1e3));if(r<60)return`${r}s`;let a=Math.floor(r/3600),i=Math.floor(r%3600/60),s=r%60;return a>0?i>0?`${a}h ${i}m`:`${a}h`:s>0?`${i}m ${s}s`:`${i}m`}function Gh(e){return PB(e,new Date().toISOString())??"0s"}ge();var A0=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];var E0=50,AB=32;function EB(e){let t=[];for(let n=0;n<e.length;n+=E0)t.push(e.slice(n,n+E0));return t}function MB({useToolCallDetail:e,threadRef:t,toolCallId:n,turnId:o,fallback:r,revision:a}){let i=e===void 0?null:e({threadRef:t,toolCallId:n,turnId:o??null,revision:a??r??"initial"}),s=i===null?[]:[i.input,i.output].filter(d=>d!==void 0&&d.length>0),l=i?.input!==void 0&&i?.output!==void 0?s.join(`
3686
3689
 
3687
3690
  `):[r,...s].filter(Boolean).join(`
3688
3691
 
3689
- `);return l.length===0?null:u("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:l})}var I0=ue(function({inputKey:t,rows:n,loadEarlier:o,timestampFormat:r,paneVisible:a,useToolCallDetail:i,threadRef:s,resolveChatAnchorMessageId:l,onOpenInChat:d}){let{t:c}=co(),[f,p]=Ln("trajectory-kind-filter",t,"all"),[m,h]=Ln("trajectory-expanded-rows",t,()=>new Set),[g,v]=Ln("trajectory-follow-latest",t,!0),x=z(()=>{let E=new Set(n.map(A=>A.kind));return C0.filter(A=>E.has(A))},[n]),y=z(()=>f==="all"?n:n.filter(E=>E.kind===f),[n,f]),C=z(()=>yB(y),[y]),w=E=>h(A=>{let N=new Set(A);return N.has(E)?N.delete(E):N.add(E),N}),k=_(null),S=En("trajectory-at-end",t,!0),L=En("trajectory-scroll-top",t,0),I=()=>{if(!a)return;let E=k.current;E&&(L.current=E.scrollTop,S.current=E.scrollHeight-E.scrollTop-E.clientHeight<=xB)},T=E=>{E&&(S.current=!0),v(E)};return ye(()=>{if(!a)return;let E=k.current;if(E)return(!g||!S.current)&&(E.scrollTop=L.current),()=>{L.current=E.scrollTop}},[S,g,t,a,L]),ye(()=>{if(!a||!g||!S.current)return;let E=k.current;E&&(E.scrollTop=E.scrollHeight)},[y,g,t,a,n]),b("div",{className:"flex min-h-0 flex-1 flex-col","data-trajectory-view":!0,children:[b("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-border px-3 py-1.5",children:[b("div",{role:"group","aria-label":c("trajectory.filterLabel"),className:"flex flex-wrap items-center gap-1",children:[u(te,{size:"xs",variant:f==="all"?"secondary":"ghost","aria-pressed":f==="all",onClick:()=>p("all"),children:c("trajectory.filterAll")}),x.map(E=>u(te,{size:"xs",variant:f===E?"secondary":"ghost","aria-pressed":f===E,onClick:()=>p(E),children:c(`trajectory.kinds.${E}`)},E))]}),u(Zd,{className:"ml-auto",size:"xs",variant:"outline",pressed:g,onPressedChange:T,"aria-label":c("trajectory.followLatest"),children:c("trajectory.followLatest")})]}),b("div",{ref:k,className:"min-h-0 flex-1 overflow-auto",onScroll:I,"data-trajectory-scroll":!0,children:[o!==null?b("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2 text-xs text-muted-foreground",children:[u("span",{children:c("trajectory.loadEarlier")}),u(te,{size:"xs",variant:"outline",disabled:o.loading,onClick:o.onLoadEarlier,children:o.loading?c("trajectory.loadingEarlier"):c("trajectory.loadEarlierAction")})]}):null,y.length===0?u("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:c("trajectory.empty")}):b(qI,{children:[u(WI,{className:"sticky top-0 z-10 bg-background",children:b(Pf,{className:"hover:bg-transparent",children:[u(is,{className:"w-px whitespace-nowrap",children:c("trajectory.columnTime")}),u(is,{className:"w-px whitespace-nowrap",children:c("trajectory.columnType")}),u(is,{children:c("trajectory.columnSummary")}),u(is,{className:"w-px whitespace-nowrap",children:c("trajectory.columnStatus")}),u(is,{className:"w-px whitespace-nowrap",children:c("trajectory.columnDuration")}),u(is,{className:"w-px",children:u("span",{className:"sr-only",children:c("trajectory.openInChat")})})]})}),C.map((E,A)=>u(VI,{className:"trajectory-chunk [&_tr:last-child]:border-b",children:E.map(N=>{let R=m.has(N.id),$=N.detail!==void 0||N.toolCallId!==void 0,H=l(N);return[b(Pf,{"data-trajectory-row-id":N.id,className:F($&&"cursor-pointer"),onClick:$?()=>w(N.id):void 0,children:[u(si,{className:"whitespace-nowrap text-muted-foreground",title:Jr(N.createdAt,r),children:li(N.createdAt,r)}),u(si,{className:"whitespace-nowrap",children:c(`trajectory.kinds.${N.kind}`)}),u(si,{className:"max-w-0 whitespace-normal",children:b("span",{className:"inline-flex items-start gap-1",children:[$?u(te,{size:"xs",variant:"ghost",className:"mt-0.5 size-4 min-w-4 shrink-0 px-0","aria-label":c(R?"trajectory.collapseRow":"trajectory.expandRow"),"aria-expanded":R,onClick:K=>{K.stopPropagation(),w(N.id)},children:R?u(pn,{"aria-hidden":!0}):u(Uo,{"aria-hidden":!0})}):null,u("span",{className:"break-words",children:N.summary})]})}),u(si,{className:"whitespace-nowrap",children:c(`trajectory.status.${N.status}`)}),u(si,{className:"whitespace-nowrap text-muted-foreground",children:N.durationMs!==void 0?ss(N.durationMs):c("trajectory.valueUnknown")}),u(si,{className:"whitespace-nowrap",children:H!==null?b(Qe,{children:[u(Ye,{render:u(te,{size:"xs",variant:"ghost","aria-label":c("trajectory.openInChat"),onClick:K=>{K.stopPropagation(),d(H)}}),children:u(Zi,{"aria-hidden":!0})}),u(Xe,{side:"top",children:c("trajectory.openInChat")})]}):null})]},`${t}:${N.id}`),R&&$?u(Pf,{className:"hover:bg-transparent","data-trajectory-detail-row":N.id,children:b(si,{colSpan:6,className:"whitespace-normal",children:[u("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:c("trajectory.detailTitle")}),N.kind==="tool-call"&&N.toolCallId!==void 0?u(CB,{threadRef:s,useToolCallDetail:i,toolCallId:N.toolCallId,turnId:N.turnId,fallback:N.detail,revision:`${N.status}:${N.updatedActivityId??N.activityId??N.id}`}):N.detail!==void 0?u("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:N.detail}):null]})},`${t}:${N.id}:detail`):null]})},`${t}:${E[0]?.id??A}`))]})]})]})});me();var ms=Sd(pc());me();function P0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return z(()=>o=>{t.forEach(r=>r(o))},t)}var mc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ds(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Qf(e){return"nodeType"in e}function Lo(e){var t,n;return e?ds(e)?e:Qf(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Xf(e){let{Document:t}=Lo(e);return e instanceof t}function bl(e){return ds(e)?!1:e instanceof Lo(e).HTMLElement}function qh(e){return e instanceof Lo(e).SVGElement}function cs(e){return e?ds(e)?e.document:Qf(e)?Xf(e)?e:bl(e)||qh(e)?e.ownerDocument:document:document:document}var rr=mc?ye:q;function Yf(e){let t=_(e);return rr(()=>{t.current=e}),B(function(){for(var n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return t.current==null?void 0:t.current(...o)},[])}function A0(){let e=_(null),t=B((o,r)=>{e.current=setInterval(o,r)},[]),n=B(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Il(e,t){t===void 0&&(t=[e]);let n=_(e);return rr(()=>{n.current!==e&&(n.current=e)},t),n}function Sl(e,t){let n=_();return z(()=>{let o=e(n.current);return n.current=o,o},[...t])}function gc(e){let t=Yf(e),n=_(null),o=B(r=>{r!==n.current&&t?.(r,n.current),n.current=r},[]);return[n,o]}function Jf(e){let t=_();return q(()=>{t.current=e},[e]),t.current}var Kh={};function us(e,t){return z(()=>{if(t)return t;let n=Kh[e]==null?0:Kh[e]+1;return Kh[e]=n,e+"-"+n},[e,t])}function E0(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.reduce((a,i)=>{let s=Object.entries(i);for(let[l,d]of s){let c=a[l];c!=null&&(a[l]=c+e*d)}return a},{...t})}}var fs=E0(1),ps=E0(-1);function wB(e){return"clientX"in e&&"clientY"in e}function hc(e){if(!e)return!1;let{KeyboardEvent:t}=Lo(e.target);return t&&e instanceof t}function TB(e){if(!e)return!1;let{TouchEvent:t}=Lo(e.target);return t&&e instanceof t}function vc(e){if(TB(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return wB(e)?{x:e.clientX,y:e.clientY}:null}var ui=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[ui.Translate.toString(e),ui.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:o}=e;return t+" "+n+"ms "+o}}}),k0="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function M0(e){return e.matches(k0)?e:e.querySelector(k0)}me();var LB={display:"none"};function R0(e){let{id:t,value:n}=e;return hn.createElement("div",{id:t,style:LB},n)}function N0(e){let{id:t,announcement:n,ariaLiveType:o="assertive"}=e,r={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return hn.createElement("div",{id:t,style:r,role:"status","aria-live":o,"aria-atomic":!0},n)}function _0(){let[e,t]=G("");return{announce:B(o=>{o!=null&&t(o)},[]),announcement:e}}var G0=Ht(null);function kB(e){let t=fn(G0);q(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function PB(){let[e]=G(()=>new Set),t=B(o=>(e.add(o),()=>e.delete(o)),[e]);return[B(o=>{let{type:r,event:a}=o;e.forEach(i=>{var s;return(s=i[r])==null?void 0:s.call(i,a)})},[e]),t]}var AB={draggable:`
3692
+ `);return l.length===0?null:u("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:l})}var M0=de(function({inputKey:t,rows:n,loadEarlier:o,timestampFormat:r,paneVisible:a,useToolCallDetail:i,threadRef:s,resolveChatAnchorMessageId:l,onOpenInChat:d}){let{t:c}=po(),[f,p]=Ln("trajectory-kind-filter",t,"all"),[m,h]=Ln("trajectory-expanded-rows",t,()=>new Set),[g,v]=Ln("trajectory-follow-latest",t,!0),x=z(()=>{let E=new Set(n.map(A=>A.kind));return A0.filter(A=>E.has(A))},[n]),y=z(()=>f==="all"?n:n.filter(E=>E.kind===f),[n,f]),C=z(()=>EB(y),[y]),S=E=>h(A=>{let N=new Set(A);return N.has(E)?N.delete(E):N.add(E),N}),L=D(null),w=Rn("trajectory-at-end",t,!0),k=Rn("trajectory-scroll-top",t,0),I=()=>{if(!a)return;let E=L.current;E&&(k.current=E.scrollTop,w.current=E.scrollHeight-E.scrollTop-E.clientHeight<=AB)},T=E=>{E&&(w.current=!0),v(E)};return xe(()=>{if(!a)return;let E=L.current;if(E)return(!g||!w.current)&&(E.scrollTop=k.current),()=>{k.current=E.scrollTop}},[w,g,t,a,k]),xe(()=>{if(!a||!g||!w.current)return;let E=L.current;E&&(E.scrollTop=E.scrollHeight)},[y,g,t,a,n]),b("div",{className:"flex min-h-0 flex-1 flex-col","data-trajectory-view":!0,children:[b("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-border px-3 py-1.5",children:[b("div",{role:"group","aria-label":c("trajectory.filterLabel"),className:"flex flex-wrap items-center gap-1",children:[u(ne,{size:"xs",variant:f==="all"?"secondary":"ghost","aria-pressed":f==="all",onClick:()=>p("all"),children:c("trajectory.filterAll")}),x.map(E=>u(ne,{size:"xs",variant:f===E?"secondary":"ghost","aria-pressed":f===E,onClick:()=>p(E),children:c(`trajectory.kinds.${E}`)},E))]}),u(ic,{className:"ml-auto",size:"xs",variant:"outline",pressed:g,onPressedChange:T,"aria-label":c("trajectory.followLatest"),children:c("trajectory.followLatest")})]}),b("div",{ref:L,className:"min-h-0 flex-1 overflow-auto",onScroll:I,"data-trajectory-scroll":!0,children:[o!==null?b("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2 text-xs text-muted-foreground",children:[u("span",{children:c("trajectory.loadEarlier")}),u(ne,{size:"xs",variant:"outline",disabled:o.loading,onClick:o.onLoadEarlier,children:o.loading?c("trajectory.loadingEarlier"):c("trajectory.loadEarlierAction")})]}):null,y.length===0?u("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:c("trajectory.empty")}):b(ZI,{children:[u(tS,{className:"sticky top-0 z-10 bg-background",children:b(Df,{className:"hover:bg-transparent",children:[u(ls,{className:"w-px whitespace-nowrap",children:c("trajectory.columnTime")}),u(ls,{className:"w-px whitespace-nowrap",children:c("trajectory.columnType")}),u(ls,{children:c("trajectory.columnSummary")}),u(ls,{className:"w-px whitespace-nowrap",children:c("trajectory.columnStatus")}),u(ls,{className:"w-px whitespace-nowrap",children:c("trajectory.columnDuration")}),u(ls,{className:"w-px",children:u("span",{className:"sr-only",children:c("trajectory.openInChat")})})]})}),C.map((E,A)=>u(eS,{className:"trajectory-chunk [&_tr:last-child]:border-b",children:E.map(N=>{let R=m.has(N.id),$=N.detail!==void 0||N.toolCallId!==void 0,U=l(N);return[b(Df,{"data-trajectory-row-id":N.id,className:O($&&"cursor-pointer"),onClick:$?()=>S(N.id):void 0,children:[u(gi,{className:"whitespace-nowrap text-muted-foreground",title:na(N.createdAt,r),children:hi(N.createdAt,r)}),u(gi,{className:"whitespace-nowrap",children:c(`trajectory.kinds.${N.kind}`)}),u(gi,{className:"max-w-0 whitespace-normal",children:b("span",{className:"inline-flex items-start gap-1",children:[$?u(ne,{size:"xs",variant:"ghost",className:"mt-0.5 size-4 min-w-4 shrink-0 px-0","aria-label":c(R?"trajectory.collapseRow":"trajectory.expandRow"),"aria-expanded":R,onClick:H=>{H.stopPropagation(),S(N.id)},children:R?u(dn,{"aria-hidden":!0}):u(Go,{"aria-hidden":!0})}):null,u("span",{className:"break-words",children:N.summary})]})}),u(gi,{className:"whitespace-nowrap",children:c(`trajectory.status.${N.status}`)}),u(gi,{className:"whitespace-nowrap text-muted-foreground",children:N.durationMs!==void 0?ds(N.durationMs):c("trajectory.valueUnknown")}),u(gi,{className:"whitespace-nowrap",children:U!==null?b(Ve,{children:[u(Ge,{render:u(ne,{size:"xs",variant:"ghost","aria-label":c("trajectory.openInChat"),onClick:H=>{H.stopPropagation(),d(U)}}),children:u(es,{"aria-hidden":!0})}),u(We,{side:"top",children:c("trajectory.openInChat")})]}):null})]},`${t}:${N.id}`),R&&$?u(Df,{className:"hover:bg-transparent","data-trajectory-detail-row":N.id,children:b(gi,{colSpan:6,className:"whitespace-normal",children:[u("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:c("trajectory.detailTitle")}),N.kind==="tool-call"&&N.toolCallId!==void 0?u(MB,{threadRef:s,useToolCallDetail:i,toolCallId:N.toolCallId,turnId:N.turnId,fallback:N.detail,revision:`${N.status}:${N.updatedActivityId??N.activityId??N.id}`}):N.detail!==void 0?u("pre",{className:"max-h-80 overflow-auto rounded-md bg-muted/40 p-3 font-mono text-xs break-words whitespace-pre-wrap",children:N.detail}):null]})},`${t}:${N.id}:detail`):null]})},`${t}:${E[0]?.id??A}`))]})]})]})});ge();var hs=Rd(Cc());ge();function F0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return z(()=>o=>{t.forEach(r=>r(o))},t)}var bc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function us(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function np(e){return"nodeType"in e}function To(e){var t,n;return e?us(e)?e:np(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function op(e){let{Document:t}=To(e);return e instanceof t}function Al(e){return us(e)?!1:e instanceof To(e).HTMLElement}function Qh(e){return e instanceof To(e).SVGElement}function fs(e){return e?us(e)?e.document:np(e)?op(e)?e:Al(e)||Qh(e)?e.ownerDocument:document:document:document}var sr=bc?xe:K;function rp(e){let t=D(e);return sr(()=>{t.current=e}),B(function(){for(var n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return t.current==null?void 0:t.current(...o)},[])}function B0(){let e=D(null),t=B((o,r)=>{e.current=setInterval(o,r)},[]),n=B(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function El(e,t){t===void 0&&(t=[e]);let n=D(e);return sr(()=>{n.current!==e&&(n.current=e)},t),n}function Ml(e,t){let n=D();return z(()=>{let o=e(n.current);return n.current=o,o},[...t])}function Ic(e){let t=rp(e),n=D(null),o=B(r=>{r!==n.current&&t?.(r,n.current),n.current=r},[]);return[n,o]}function ap(e){let t=D();return K(()=>{t.current=e},[e]),t.current}var jh={};function ps(e,t){return z(()=>{if(t)return t;let n=jh[e]==null?0:jh[e]+1;return jh[e]=n,e+"-"+n},[e,t])}function z0(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.reduce((a,i)=>{let s=Object.entries(i);for(let[l,d]of s){let c=a[l];c!=null&&(a[l]=c+e*d)}return a},{...t})}}var ms=z0(1),gs=z0(-1);function DB(e){return"clientX"in e&&"clientY"in e}function Sc(e){if(!e)return!1;let{KeyboardEvent:t}=To(e.target);return t&&e instanceof t}function OB(e){if(!e)return!1;let{TouchEvent:t}=To(e.target);return t&&e instanceof t}function wc(e){if(OB(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return DB(e)?{x:e.clientX,y:e.clientY}:null}var yi=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[yi.Translate.toString(e),yi.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:o}=e;return t+" "+n+"ms "+o}}}),O0="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function $0(e){return e.matches(O0)?e:e.querySelector(O0)}ge();var FB={display:"none"};function H0(e){let{id:t,value:n}=e;return mn.createElement("div",{id:t,style:FB},n)}function U0(e){let{id:t,announcement:n,ariaLiveType:o="assertive"}=e,r={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return mn.createElement("div",{id:t,style:r,role:"status","aria-live":o,"aria-atomic":!0},n)}function K0(){let[e,t]=G("");return{announce:B(o=>{o!=null&&t(o)},[]),announcement:e}}var nw=Ut(null);function BB(e){let t=ln(nw);K(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function zB(){let[e]=G(()=>new Set),t=B(o=>(e.add(o),()=>e.delete(o)),[e]);return[B(o=>{let{type:r,event:a}=o;e.forEach(i=>{var s;return(s=i[r])==null?void 0:s.call(i,a)})},[e]),t]}var $B={draggable:`
3690
3693
  To pick up a draggable item, press the space bar.
3691
3694
  While dragging, use the arrow keys to move the item.
3692
3695
  Press space again to drop the item in its new position, or press escape to cancel.
3693
- `},EB={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function MB(e){let{announcements:t=EB,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=AB}=e,{announce:a,announcement:i}=_0(),s=us("DndLiveRegion"),[l,d]=G(!1);if(q(()=>{d(!0)},[]),kB(z(()=>({onDragStart(f){let{active:p}=f;a(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:m}=f;t.onDragMove&&a(t.onDragMove({active:p,over:m}))},onDragOver(f){let{active:p,over:m}=f;a(t.onDragOver({active:p,over:m}))},onDragEnd(f){let{active:p,over:m}=f;a(t.onDragEnd({active:p,over:m}))},onDragCancel(f){let{active:p,over:m}=f;a(t.onDragCancel({active:p,over:m}))}}),[a,t])),!l)return null;let c=hn.createElement(hn.Fragment,null,hn.createElement(R0,{id:o,value:r.draggable}),hn.createElement(N0,{id:s,announcement:i}));return n?(0,ms.createPortal)(c,n):c}var On;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(On||(On={}));function ep(){}function Zh(e,t){return z(()=>({sensor:e,options:t??{}}),[e,t])}function j0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return z(()=>[...t].filter(o=>o!=null),[...t])}var br=Object.freeze({x:0,y:0});function Q0(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function X0(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function RB(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function D0(e){let{left:t,top:n,height:o,width:r}=e;return[{x:t,y:n},{x:t+r,y:n},{x:t,y:n+o},{x:t+r,y:n+o}]}function ev(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function O0(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Y0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=O0(t,t.left,t.top),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=Q0(O0(l),r);a.push({id:s,data:{droppableContainer:i,value:d}})}}return a.sort(X0)},J0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=D0(t),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=D0(l),c=r.reduce((p,m,h)=>p+Q0(d[h],m),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:i,value:f}})}}return a.sort(X0)};function NB(e,t){let n=Math.max(t.top,e.top),o=Math.max(t.left,e.left),r=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=r-o,s=a-n;if(o<r&&n<a){let l=t.width*t.height,d=e.width*e.height,c=i*s,f=c/(l+d-c);return Number(f.toFixed(4))}return 0}var _B=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=[];for(let a of o){let{id:i}=a,s=n.get(i);if(s){let l=NB(s,t);l>0&&r.push({id:i,data:{droppableContainer:a,value:l}})}}return r.sort(RB)};function DB(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Z0(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:br}function OB(e){return function(n){for(var o=arguments.length,r=new Array(o>1?o-1:0),a=1;a<o;a++)r[a-1]=arguments[a];return r.reduce((i,s)=>({...i,top:i.top+e*s.y,bottom:i.bottom+e*s.y,left:i.left+e*s.x,right:i.right+e*s.x}),{...n})}}var FB=OB(1);function BB(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function zB(e,t,n){let o=BB(t);if(!o)return e;let{scaleX:r,scaleY:a,x:i,y:s}=o,l=e.left-i-(1-r)*parseFloat(n),d=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),c=r?e.width/r:e.width,f=a?e.height/a:e.height;return{width:c,height:f,top:d,right:l+c,bottom:d+f,left:l}}var $B={ignoreTransform:!1};function vs(e,t){t===void 0&&(t=$B);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:d,transformOrigin:c}=Lo(e).getComputedStyle(e);d&&(n=zB(n,d,c))}let{top:o,left:r,width:a,height:i,bottom:s,right:l}=n;return{top:o,left:r,width:a,height:i,bottom:s,right:l}}function F0(e){return vs(e,{ignoreTransform:!0})}function HB(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function UB(e,t){return t===void 0&&(t=Lo(e).getComputedStyle(e)),t.position==="fixed"}function KB(e,t){t===void 0&&(t=Lo(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{let a=t[r];return typeof a=="string"?n.test(a):!1})}function Ic(e,t){let n=[];function o(r){if(t!=null&&n.length>=t||!r)return n;if(Xf(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!bl(r)||qh(r)||n.includes(r))return n;let a=Lo(e).getComputedStyle(r);return r!==e&&KB(r,a)&&n.push(r),UB(r,a)?n:o(r.parentNode)}return e?o(e):n}function ew(e){let[t]=Ic(e,1);return t??null}function Vh(e){return!mc||!e?null:ds(e)?e:Qf(e)?Xf(e)||e===cs(e).scrollingElement?window:bl(e)?e:null:null}function tw(e){return ds(e)?e.scrollX:e.scrollLeft}function nw(e){return ds(e)?e.scrollY:e.scrollTop}function jh(e){return{x:tw(e),y:nw(e)}}var Gn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Gn||(Gn={}));function ow(e){return!mc||!e?!1:e===document.scrollingElement}function rw(e){let t={x:0,y:0},n=ow(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},r=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=o.y,s=e.scrollLeft>=o.x;return{isTop:r,isLeft:a,isBottom:i,isRight:s,maxScroll:o,minScroll:t}}var qB={x:.2,y:.2};function VB(e,t,n,o,r){let{top:a,left:i,right:s,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=qB);let{isTop:d,isBottom:c,isLeft:f,isRight:p}=rw(e),m={x:0,y:0},h={x:0,y:0},g={height:t.height*r.y,width:t.width*r.x};return!d&&a<=t.top+g.height?(m.y=Gn.Backward,h.y=o*Math.abs((t.top+g.height-a)/g.height)):!c&&l>=t.bottom-g.height&&(m.y=Gn.Forward,h.y=o*Math.abs((t.bottom-g.height-l)/g.height)),!p&&s>=t.right-g.width?(m.x=Gn.Forward,h.x=o*Math.abs((t.right-g.width-s)/g.width)):!f&&i<=t.left+g.width&&(m.x=Gn.Backward,h.x=o*Math.abs((t.left+g.width-i)/g.width)),{direction:m,speed:h}}function WB(e){if(e===document.scrollingElement){let{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}let{top:t,left:n,right:o,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:o,bottom:r,width:e.clientWidth,height:e.clientHeight}}function aw(e){return e.reduce((t,n)=>fs(t,jh(n)),br)}function GB(e){return e.reduce((t,n)=>t+tw(n),0)}function jB(e){return e.reduce((t,n)=>t+nw(n),0)}function QB(e,t){if(t===void 0&&(t=vs),!e)return;let{top:n,left:o,bottom:r,right:a}=t(e);ew(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var XB=[["x",["left","right"],GB],["y",["top","bottom"],jB]],yc=class{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let o=Ic(n),r=aw(o);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,i,s]of XB)for(let l of i)Object.defineProperty(this,l,{get:()=>{let d=s(o),c=r[a]-d;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},gs=class{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...n)})},this.target=t}add(t,n,o){var r;(r=this.target)==null||r.addEventListener(t,n,o),this.listeners.push([t,n,o])}};function YB(e){let{EventTarget:t}=Lo(e);return e instanceof t?e:cs(e)}function Wh(e,t){let n=Math.abs(e.x),o=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+o**2)>t:"x"in t&&"y"in t?n>t.x&&o>t.y:"x"in t?n>t.x:"y"in t?o>t.y:!1}var ar;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ar||(ar={}));function B0(e){e.preventDefault()}function JB(e){e.stopPropagation()}var mt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(mt||(mt={}));var iw={start:[mt.Space,mt.Enter],cancel:[mt.Esc],end:[mt.Space,mt.Enter,mt.Tab]},ZB=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case mt.Right:return{...n,x:n.x+25};case mt.Left:return{...n,x:n.x-25};case mt.Down:return{...n,y:n.y+25};case mt.Up:return{...n,y:n.y-25}}},wl=class{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;let{event:{target:n}}=t;this.props=t,this.listeners=new gs(cs(n)),this.windowListeners=new gs(Lo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ar.Resize,this.handleCancel),this.windowListeners.add(ar.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ar.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:n}=this.props,o=t.node.current;o&&QB(o),n(br)}handleKeyDown(t){if(hc(t)){let{active:n,context:o,options:r}=this.props,{keyboardCodes:a=iw,coordinateGetter:i=ZB,scrollBehavior:s="smooth"}=r,{code:l}=t;if(a.end.includes(l)){this.handleEnd(t);return}if(a.cancel.includes(l)){this.handleCancel(t);return}let{collisionRect:d}=o.current,c=d?{x:d.left,y:d.top}:br;this.referenceCoordinates||(this.referenceCoordinates=c);let f=i(t,{active:n,context:o.current,currentCoordinates:c});if(f){let p=ps(f,c),m={x:0,y:0},{scrollableAncestors:h}=o.current;for(let g of h){let v=t.code,{isTop:x,isRight:y,isLeft:C,isBottom:w,maxScroll:k,minScroll:S}=rw(g),L=WB(g),I={x:Math.min(v===mt.Right?L.right-L.width/2:L.right,Math.max(v===mt.Right?L.left:L.left+L.width/2,f.x)),y:Math.min(v===mt.Down?L.bottom-L.height/2:L.bottom,Math.max(v===mt.Down?L.top:L.top+L.height/2,f.y))},T=v===mt.Right&&!y||v===mt.Left&&!C,E=v===mt.Down&&!w||v===mt.Up&&!x;if(T&&I.x!==f.x){let A=g.scrollLeft+p.x,N=v===mt.Right&&A<=k.x||v===mt.Left&&A>=S.x;if(N&&!p.y){g.scrollTo({left:A,behavior:s});return}N?m.x=g.scrollLeft-A:m.x=v===mt.Right?g.scrollLeft-k.x:g.scrollLeft-S.x,m.x&&g.scrollBy({left:-m.x,behavior:s});break}else if(E&&I.y!==f.y){let A=g.scrollTop+p.y,N=v===mt.Down&&A<=k.y||v===mt.Up&&A>=S.y;if(N&&!p.x){g.scrollTo({top:A,behavior:s});return}N?m.y=g.scrollTop-A:m.y=v===mt.Down?g.scrollTop-k.y:g.scrollTop-S.y,m.y&&g.scrollBy({top:-m.y,behavior:s});break}}this.handleMove(t,fs(ps(f,this.referenceCoordinates),m))}}}handleMove(t,n){let{onMove:o}=this.props;t.preventDefault(),o(n)}handleEnd(t){let{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){let{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};wl.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=iw,onActivation:r}=t,{active:a}=n,{code:i}=e.nativeEvent;if(o.start.includes(i)){let s=a.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),r?.({event:e.nativeEvent}),!0)}return!1}}];function z0(e){return!!(e&&"distance"in e)}function $0(e){return!!(e&&"delay"in e)}var Cc=class{constructor(t,n,o){var r;o===void 0&&(o=YB(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;let{event:a}=t,{target:i}=a;this.props=t,this.events=n,this.document=cs(i),this.documentListeners=new gs(this.document),this.listeners=new gs(o),this.windowListeners=new gs(Lo(i)),this.initialCoordinates=(r=vc(a))!=null?r:br,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:o}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ar.Resize,this.handleCancel),this.windowListeners.add(ar.DragStart,B0),this.windowListeners.add(ar.VisibilityChange,this.handleCancel),this.windowListeners.add(ar.ContextMenu,B0),this.documentListeners.add(ar.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if($0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(z0(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){let{active:o,onPending:r}=this.props;r(o,t,this.initialCoordinates,n)}handleStart(){let{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ar.Click,JB,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ar.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;let{activated:o,initialCoordinates:r,props:a}=this,{onMove:i,options:{activationConstraint:s}}=a;if(!r)return;let l=(n=vc(t))!=null?n:br,d=ps(r,l);if(!o&&s){if(z0(s)){if(s.tolerance!=null&&Wh(d,s.tolerance))return this.handleCancel();if(Wh(d,s.distance))return this.handleStart()}if($0(s)&&Wh(d,s.tolerance))return this.handleCancel();this.handlePending(s,d);return}t.cancelable&&t.preventDefault(),i(l)}handleEnd(){let{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){let{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===mt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},ez={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},Tl=class extends Cc{constructor(t){let{event:n}=t,o=cs(n.target);super(t,ez,o)}};Tl.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return!n.isPrimary||n.button!==0?!1:(o?.({event:n}),!0)}}];var tz={move:{name:"mousemove"},end:{name:"mouseup"}},Qh;(function(e){e[e.RightClick=2]="RightClick"})(Qh||(Qh={}));var Xh=class extends Cc{constructor(t){super(t,tz,cs(t.event.target))}};Xh.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button===Qh.RightClick?!1:(o?.({event:n}),!0)}}];var Gh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},Yh=class extends Cc{constructor(t){super(t,Gh)}static setup(){return window.addEventListener(Gh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Gh.move.name,t)};function t(){}}};Yh.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t,{touches:r}=n;return r.length>1?!1:(o?.({event:n}),!0)}}];var xc;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(xc||(xc={}));var tp;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(tp||(tp={}));function nz(e){let{acceleration:t,activator:n=xc.Pointer,canScroll:o,draggingRect:r,enabled:a,interval:i=5,order:s=tp.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:c,delta:f,threshold:p}=e,m=rz({delta:f,disabled:!a}),[h,g]=A0(),v=_({x:0,y:0}),x=_({x:0,y:0}),y=z(()=>{switch(n){case xc.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case xc.DraggableRect:return r}},[n,r,l]),C=_(null),w=B(()=>{let S=C.current;if(!S)return;let L=v.current.x*x.current.x,I=v.current.y*x.current.y;S.scrollBy(L,I)},[]),k=z(()=>s===tp.TreeOrder?[...d].reverse():d,[s,d]);q(()=>{if(!a||!d.length||!y){g();return}for(let S of k){if(o?.(S)===!1)continue;let L=d.indexOf(S),I=c[L];if(!I)continue;let{direction:T,speed:E}=VB(S,I,y,t,p);for(let A of["x","y"])m[A][T[A]]||(E[A]=0,T[A]=0);if(E.x>0||E.y>0){g(),C.current=S,h(w,i),v.current=E,x.current=T;return}}v.current={x:0,y:0},x.current={x:0,y:0},g()},[t,w,o,g,a,i,JSON.stringify(y),JSON.stringify(m),h,d,k,c,JSON.stringify(p)])}var oz={x:{[Gn.Backward]:!1,[Gn.Forward]:!1},y:{[Gn.Backward]:!1,[Gn.Forward]:!1}};function rz(e){let{delta:t,disabled:n}=e,o=Jf(t);return Sl(r=>{if(n||!o||!r)return oz;let a={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[Gn.Backward]:r.x[Gn.Backward]||a.x===-1,[Gn.Forward]:r.x[Gn.Forward]||a.x===1},y:{[Gn.Backward]:r.y[Gn.Backward]||a.y===-1,[Gn.Forward]:r.y[Gn.Forward]||a.y===1}}},[n,t,o])}function az(e,t){let n=t!=null?e.get(t):void 0,o=n?n.node.current:null;return Sl(r=>{var a;return t==null?null:(a=o??r)!=null?a:null},[o,t])}function iz(e,t){return z(()=>e.reduce((n,o)=>{let{sensor:r}=o,a=r.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,o)}));return[...n,...a]},[]),[e,t])}var bc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(bc||(bc={}));var Jh;(function(e){e.Optimized="optimized"})(Jh||(Jh={}));var H0=new Map;function sz(e,t){let{dragging:n,dependencies:o,config:r}=t,[a,i]=G(null),{frequency:s,measure:l,strategy:d}=r,c=_(e),f=v(),p=Il(f),m=B(function(x){x===void 0&&(x=[]),!p.current&&i(y=>y===null?x:y.concat(x.filter(C=>!y.includes(C))))},[p]),h=_(null),g=Sl(x=>{if(f&&!n)return H0;if(!x||x===H0||c.current!==e||a!=null){let y=new Map;for(let C of e){if(!C)continue;if(a&&a.length>0&&!a.includes(C.id)&&C.rect.current){y.set(C.id,C.rect.current);continue}let w=C.node.current,k=w?new yc(l(w),w):null;C.rect.current=k,k&&y.set(C.id,k)}return y}return x},[e,a,n,f,l]);return q(()=>{c.current=e},[e]),q(()=>{f||m()},[n,f]),q(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),q(()=>{f||typeof s!="number"||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},s))},[s,f,m,...o]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:a!=null};function v(){switch(d){case bc.Always:return!1;case bc.BeforeDragging:return n;default:return!n}}}function sw(e,t){return Sl(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function lz(e,t){return sw(e,t)}function dz(e){let{callback:t,disabled:n}=e,o=Yf(t),r=z(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(o)},[o,n]);return q(()=>()=>r?.disconnect(),[r]),r}function np(e){let{callback:t,disabled:n}=e,o=Yf(t),r=z(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(o)},[n]);return q(()=>()=>r?.disconnect(),[r]),r}function cz(e){return new yc(vs(e),e)}function U0(e,t,n){t===void 0&&(t=cz);let[o,r]=G(null);function a(){r(l=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=l??n)!=null?d:null}let c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c})}let i=dz({callback(l){if(e)for(let d of l){let{type:c,target:f}=d;if(c==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),s=np({callback:a});return rr(()=>{a(),e?(s?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[e]),o}function uz(e){let t=sw(e);return Z0(e,t)}var K0=[];function fz(e){let t=_(e),n=Sl(o=>e?o&&o!==K0&&e&&t.current&&e.parentNode===t.current.parentNode?o:Ic(e):K0,[e]);return q(()=>{t.current=e},[e]),n}function pz(e){let[t,n]=G(null),o=_(e),r=B(a=>{let i=Vh(a.target);i&&n(s=>s?(s.set(i,jh(i)),new Map(s)):null)},[]);return q(()=>{let a=o.current;if(e!==a){i(a);let s=e.map(l=>{let d=Vh(l);return d?(d.addEventListener("scroll",r,{passive:!0}),[d,jh(d)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),o.current=e}return()=>{i(e),i(a)};function i(s){s.forEach(l=>{let d=Vh(l);d?.removeEventListener("scroll",r)})}},[r,e]),z(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>fs(a,i),br):aw(e):br,[e,t])}function q0(e,t){t===void 0&&(t=[]);let n=_(null);return q(()=>{n.current=null},t),q(()=>{let o=e!==br;o&&!n.current&&(n.current=e),!o&&n.current&&(n.current=null)},[e]),n.current?ps(e,n.current):br}function mz(e){q(()=>{if(!mc)return;let t=e.map(n=>{let{sensor:o}=n;return o.setup==null?void 0:o.setup()});return()=>{for(let n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function gz(e,t){return z(()=>e.reduce((n,o)=>{let{eventName:r,handler:a}=o;return n[r]=i=>{a(i,t)},n},{}),[e,t])}function lw(e){return z(()=>e?HB(e):null,[e])}var V0=[];function hz(e,t){t===void 0&&(t=vs);let[n]=e,o=lw(n?Lo(n):null),[r,a]=G(V0);function i(){a(()=>e.length?e.map(l=>ow(l)?o:new yc(t(l),l)):V0)}let s=np({callback:i});return rr(()=>{s?.disconnect(),i(),e.forEach(l=>s?.observe(l))},[e]),r}function vz(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return bl(t)?t:e}function xz(e){let{measure:t}=e,[n,o]=G(null),r=B(d=>{for(let{target:c}of d)if(bl(c)){o(f=>{let p=t(c);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=np({callback:r}),i=B(d=>{let c=vz(d);a?.disconnect(),c&&a?.observe(c),o(c?t(c):null)},[t,a]),[s,l]=gc(i);return z(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}var yz=[{sensor:Tl,options:{}},{sensor:wl,options:{}}],Cz={current:{}},Zf={draggable:{measure:F0},droppable:{measure:F0,strategy:bc.WhileDragging,frequency:Jh.Optimized},dragOverlay:{measure:vs}},hs=class extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,o;return(n=(o=this.get(t))==null?void 0:o.node.current)!=null?n:void 0}},bz={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new hs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ep},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Zf,measureDroppableContainers:ep,windowRect:null,measuringScheduled:!1},Iz={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ep,draggableNodes:new Map,over:null,measureDroppableContainers:ep},op=Ht(Iz),dw=Ht(bz);function Sz(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new hs}}}function wz(e,t){switch(t.type){case On.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case On.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case On.DragEnd:case On.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case On.RegisterDroppable:{let{element:n}=t,{id:o}=n,r=new hs(e.droppable.containers);return r.set(o,n),{...e,droppable:{...e.droppable,containers:r}}}case On.SetDroppableDisabled:{let{id:n,key:o,disabled:r}=t,a=e.droppable.containers.get(n);if(!a||o!==a.key)return e;let i=new hs(e.droppable.containers);return i.set(n,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:i}}}case On.UnregisterDroppable:{let{id:n,key:o}=t,r=e.droppable.containers.get(n);if(!r||o!==r.key)return e;let a=new hs(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Tz(e){let{disabled:t}=e,{active:n,activatorEvent:o,draggableNodes:r}=fn(op),a=Jf(o),i=Jf(n?.id);return q(()=>{if(!t&&!o&&a&&i!=null){if(!hc(a)||document.activeElement===a.target)return;let s=r.get(i);if(!s)return;let{activatorNode:l,node:d}=s;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(let c of[l.current,d.current]){if(!c)continue;let f=M0(c);if(f){f.focus();break}}})}},[o,t,r,i,a]),null}function Lz(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...o}),n):n}function kz(e){return z(()=>({draggable:{...Zf.draggable,...e?.draggable},droppable:{...Zf.droppable,...e?.droppable},dragOverlay:{...Zf.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Pz(e){let{activeNode:t,measure:n,initialRect:o,config:r=!0}=e,a=_(!1),{x:i,y:s}=typeof r=="boolean"?{x:r,y:r}:r;rr(()=>{if(!i&&!s||!t){a.current=!1;return}if(a.current||!o)return;let d=t?.node.current;if(!d||d.isConnected===!1)return;let c=n(d),f=Z0(c,o);if(i||(f.x=0),s||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){let p=ew(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,s,o,n])}var cw=Ht({...br,scaleX:1,scaleY:1}),fi;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(fi||(fi={}));var uw=ue(function(t){var n,o,r,a;let{id:i,accessibility:s,autoScroll:l=!0,children:d,sensors:c=yz,collisionDetection:f=_B,measuring:p,modifiers:m,...h}=t,g=Za(wz,void 0,Sz),[v,x]=g,[y,C]=PB(),[w,k]=G(fi.Uninitialized),S=w===fi.Initialized,{draggable:{active:L,nodes:I,translate:T},droppable:{containers:E}}=v,A=L!=null?I.get(L):null,N=_({initial:null,translated:null}),R=z(()=>{var ie;return L!=null?{id:L,data:(ie=A?.data)!=null?ie:Cz,rect:N}:null},[L,A]),$=_(null),[H,K]=G(null),[O,oe]=G(null),ee=Il(h,Object.values(h)),W=us("DndDescribedBy",i),qe=z(()=>E.getEnabled(),[E]),ve=kz(p),{droppableRects:fe,measureDroppableContainers:Ne,measuringScheduled:Ae}=sz(qe,{dragging:S,dependencies:[T.x,T.y],config:ve.droppable}),ae=az(I,L),Ee=z(()=>O?vc(O):null,[O]),xe=ce(),re=lz(ae,ve.draggable.measure);Pz({activeNode:L!=null?I.get(L):null,config:xe.layoutShiftCompensation,initialRect:re,measure:ve.draggable.measure});let Ie=U0(ae,ve.draggable.measure,re),st=U0(ae?ae.parentElement:null),dt=_({activatorEvent:null,active:null,activeNode:ae,collisionRect:null,collisions:null,droppableRects:fe,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),lt=E.getNodeFor((n=dt.current.over)==null?void 0:n.id),ct=xz({measure:ve.dragOverlay.measure}),Et=(o=ct.nodeRef.current)!=null?o:ae,ot=S?(r=ct.rect)!=null?r:Ie:null,He=!!(ct.nodeRef.current&&ct.rect),Se=uz(He?null:Ie),ze=lw(Et?Lo(Et):null),Je=fz(S?lt??ae:null),qt=hz(Je),X=Lz(m,{transform:{x:T.x-Se.x,y:T.y-Se.y,scaleX:1,scaleY:1},activatorEvent:O,active:R,activeNodeRect:Ie,containerNodeRect:st,draggingNodeRect:ot,over:dt.current.over,overlayNodeRect:ct.rect,scrollableAncestors:Je,scrollableAncestorRects:qt,windowRect:ze}),nn=Ee?fs(Ee,T):null,xt=pz(Je),mn=q0(xt),Tt=q0(xt,[Ie]),Yt=fs(X,mn),Jt=ot?FB(ot,X):null,Mt=R&&Jt?f({active:R,collisionRect:Jt,droppableRects:fe,droppableContainers:qe,pointerCoordinates:nn}):null,zn=ev(Mt,"id"),[kn,vn]=G(null),$n=He?X:fs(X,Tt),Vt=DB($n,(a=kn?.rect)!=null?a:null,Ie),Zt=_(null),Sn=B((ie,pe)=>{let{sensor:Ze,options:pt}=pe;if($.current==null)return;let xn=I.get($.current);if(!xn)return;let ht=ie.nativeEvent,en=new Ze({active:$.current,activeNode:xn,event:ht,options:pt,context:dt,onAbort(bt){if(!I.get(bt))return;let{onDragAbort:sn}=ee.current,ge={id:bt};sn?.(ge),y({type:"onDragAbort",event:ge})},onPending(bt,yn,sn,ge){if(!I.get(bt))return;let{onDragPending:rt}=ee.current,Lt={id:bt,constraint:yn,initialCoordinates:sn,offset:ge};rt?.(Lt),y({type:"onDragPending",event:Lt})},onStart(bt){let yn=$.current;if(yn==null)return;let sn=I.get(yn);if(!sn)return;let{onDragStart:ge}=ee.current,Rt={activatorEvent:ht,active:{id:yn,data:sn.data,rect:N}};(0,ms.unstable_batchedUpdates)(()=>{ge?.(Rt),k(fi.Initializing),x({type:On.DragStart,initialCoordinates:bt,active:yn}),y({type:"onDragStart",event:Rt}),K(Zt.current),oe(ht)})},onMove(bt){x({type:On.DragMove,coordinates:bt})},onEnd:tn(On.DragEnd),onCancel:tn(On.DragCancel)});Zt.current=en;function tn(bt){return async function(){let{active:sn,collisions:ge,over:Rt,scrollAdjustedTranslate:rt}=dt.current,Lt=null;if(sn&&rt){let{cancelDrop:et}=ee.current;Lt={activatorEvent:ht,active:sn,collisions:ge,delta:rt,over:Rt},bt===On.DragEnd&&typeof et=="function"&&await Promise.resolve(et(Lt))&&(bt=On.DragCancel)}$.current=null,(0,ms.unstable_batchedUpdates)(()=>{x({type:bt}),k(fi.Uninitialized),vn(null),K(null),oe(null),Zt.current=null;let et=bt===On.DragEnd?"onDragEnd":"onDragCancel";if(Lt){let Nt=ee.current[et];Nt?.(Lt),y({type:et,event:Lt})}})}}},[I]),ho=B((ie,pe)=>(Ze,pt)=>{let xn=Ze.nativeEvent,ht=I.get(pt);if($.current!==null||!ht||xn.dndKit||xn.defaultPrevented)return;let en={active:ht};ie(Ze,pe.options,en)===!0&&(xn.dndKit={capturedBy:pe.sensor},$.current=pt,Sn(Ze,pe))},[I,Sn]),zt=iz(c,ho);mz(c),rr(()=>{Ie&&w===fi.Initializing&&k(fi.Initialized)},[Ie,w]),q(()=>{let{onDragMove:ie}=ee.current,{active:pe,activatorEvent:Ze,collisions:pt,over:xn}=dt.current;if(!pe||!Ze)return;let ht={active:pe,activatorEvent:Ze,collisions:pt,delta:{x:Yt.x,y:Yt.y},over:xn};(0,ms.unstable_batchedUpdates)(()=>{ie?.(ht),y({type:"onDragMove",event:ht})})},[Yt.x,Yt.y]),q(()=>{let{active:ie,activatorEvent:pe,collisions:Ze,droppableContainers:pt,scrollAdjustedTranslate:xn}=dt.current;if(!ie||$.current==null||!pe||!xn)return;let{onDragOver:ht}=ee.current,en=pt.get(zn),tn=en&&en.rect.current?{id:en.id,rect:en.rect.current,data:en.data,disabled:en.disabled}:null,bt={active:ie,activatorEvent:pe,collisions:Ze,delta:{x:xn.x,y:xn.y},over:tn};(0,ms.unstable_batchedUpdates)(()=>{vn(tn),ht?.(bt),y({type:"onDragOver",event:bt})})},[zn]),rr(()=>{dt.current={activatorEvent:O,active:R,activeNode:ae,collisionRect:Jt,collisions:Mt,droppableRects:fe,draggableNodes:I,draggingNode:Et,draggingNodeRect:ot,droppableContainers:E,over:kn,scrollableAncestors:Je,scrollAdjustedTranslate:Yt},N.current={initial:ot,translated:Jt}},[R,ae,Mt,Jt,I,Et,ot,fe,E,kn,Je,Yt]),nz({...xe,delta:T,draggingRect:Jt,pointerCoordinates:nn,scrollableAncestors:Je,scrollableAncestorRects:qt});let D=z(()=>({active:R,activeNode:ae,activeNodeRect:Ie,activatorEvent:O,collisions:Mt,containerNodeRect:st,dragOverlay:ct,draggableNodes:I,droppableContainers:E,droppableRects:fe,over:kn,measureDroppableContainers:Ne,scrollableAncestors:Je,scrollableAncestorRects:qt,measuringConfiguration:ve,measuringScheduled:Ae,windowRect:ze}),[R,ae,Ie,O,Mt,st,ct,I,E,fe,kn,Ne,Je,qt,ve,Ae,ze]),Y=z(()=>({activatorEvent:O,activators:zt,active:R,activeNodeRect:Ie,ariaDescribedById:{draggable:W},dispatch:x,draggableNodes:I,over:kn,measureDroppableContainers:Ne}),[O,zt,R,Ie,x,W,I,kn,Ne]);return hn.createElement(G0.Provider,{value:C},hn.createElement(op.Provider,{value:Y},hn.createElement(dw.Provider,{value:D},hn.createElement(cw.Provider,{value:Vt},d)),hn.createElement(Tz,{disabled:s?.restoreFocus===!1})),hn.createElement(MB,{...s,hiddenTextDescribedById:W}));function ce(){let ie=H?.autoScrollEnabled===!1,pe=typeof l=="object"?l.enabled===!1:l===!1,Ze=S&&!ie&&!pe;return typeof l=="object"?{...l,enabled:Ze}:{enabled:Ze}}}),Az=Ht(null),W0="button",Ez="Draggable";function fw(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e,a=us(Ez),{activators:i,activatorEvent:s,active:l,activeNodeRect:d,ariaDescribedById:c,draggableNodes:f,over:p}=fn(op),{role:m=W0,roleDescription:h="draggable",tabIndex:g=0}=r??{},v=l?.id===t,x=fn(v?cw:Az),[y,C]=gc(),[w,k]=gc(),S=gz(i,t),L=Il(n);rr(()=>(f.set(t,{id:t,key:a,node:y,activatorNode:w,data:L}),()=>{let T=f.get(t);T&&T.key===a&&f.delete(t)}),[f,t]);let I=z(()=>({role:m,tabIndex:g,"aria-disabled":o,"aria-pressed":v&&m===W0?!0:void 0,"aria-roledescription":h,"aria-describedby":c.draggable}),[o,m,g,v,h,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:d,attributes:I,isDragging:v,listeners:o?void 0:S,node:y,over:p,setNodeRef:C,setActivatorNodeRef:k,transform:x}}function pw(){return fn(dw)}var Mz="Droppable",Rz={timeout:25};function mw(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e,a=us(Mz),{active:i,dispatch:s,over:l,measureDroppableContainers:d}=fn(op),c=_({disabled:n}),f=_(!1),p=_(null),m=_(null),{disabled:h,updateMeasurementsFor:g,timeout:v}={...Rz,...r},x=Il(g??o),y=B(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(x.current)?x.current:[x.current]),m.current=null},v)},[v]),C=np({callback:y,disabled:h||!i}),w=B((I,T)=>{C&&(T&&(C.unobserve(T),f.current=!1),I&&C.observe(I))},[C]),[k,S]=gc(w),L=Il(t);return q(()=>{!C||!k.current||(C.disconnect(),f.current=!1,C.observe(k.current))},[k,C]),q(()=>(s({type:On.RegisterDroppable,element:{id:o,key:a,disabled:n,node:k,rect:p,data:L}}),()=>s({type:On.UnregisterDroppable,key:a,id:o})),[o]),q(()=>{n!==c.current.disabled&&(s({type:On.SetDroppableDisabled,id:o,key:a,disabled:n}),c.current.disabled=n)},[o,a,n,s]),{active:i,rect:p,isOver:l?.id===o,node:k,over:l,setNodeRef:S}}me();function gw(e,t,n){let o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function Nz(e,t){return e.reduce((n,o,r)=>{let a=t.get(o);return a&&(n[r]=a),n},Array(e.length))}function rp(e){return e!==null&&e>=0}function _z(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Dz(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var hw=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e,a=gw(t,o,n),i=t[r],s=a[r];return!s||!i?null:{x:s.left-i.left,y:s.top-i.top,scaleX:s.width/i.width,scaleY:s.height/i.height}};var ap={scaleX:1,scaleY:1},vw=e=>{var t;let{activeIndex:n,activeNodeRect:o,index:r,rects:a,overIndex:i}=e,s=(t=a[n])!=null?t:o;if(!s)return null;if(r===n){let d=a[i];return d?{x:0,y:n<i?d.top+d.height-(s.top+s.height):d.top-s.top,...ap}:null}let l=Oz(a,r,n);return r>n&&r<=i?{x:0,y:-s.height-l,...ap}:r<n&&r>=i?{x:0,y:s.height+l,...ap}:{x:0,y:0,...ap}};function Oz(e,t,n){let o=e[t],r=e[t-1],a=e[t+1];return o?n<t?r?o.top-(r.top+r.height):a?a.top-(o.top+o.height):0:a?a.top-(o.top+o.height):r?o.top-(r.top+r.height):0:0}var xw="Sortable",yw=hn.createContext({activeIndex:-1,containerId:xw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:hw,disabled:{draggable:!1,droppable:!1}});function Cw(e){let{children:t,id:n,items:o,strategy:r=hw,disabled:a=!1}=e,{active:i,dragOverlay:s,droppableRects:l,over:d,measureDroppableContainers:c}=pw(),f=us(xw,n),p=s.rect!==null,m=z(()=>o.map(S=>typeof S=="object"&&"id"in S?S.id:S),[o]),h=i!=null,g=i?m.indexOf(i.id):-1,v=d?m.indexOf(d.id):-1,x=_(m),y=!_z(m,x.current),C=v!==-1&&g===-1||y,w=Dz(a);rr(()=>{y&&h&&c(m)},[y,m,h,c]),q(()=>{x.current=m},[m]);let k=z(()=>({activeIndex:g,containerId:f,disabled:w,disableTransforms:C,items:m,overIndex:v,useDragOverlay:p,sortedRects:Nz(m,l),strategy:r}),[g,f,w.draggable,w.droppable,C,m,v,l,p,r]);return hn.createElement(yw.Provider,{value:k},t)}var Fz=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return gw(n,o,r).indexOf(t)},Bz=e=>{let{containerId:t,isSorting:n,wasDragging:o,index:r,items:a,newIndex:i,previousItems:s,previousContainerId:l,transition:d}=e;return!d||!o||s!==a&&r===i?!1:n?!0:i!==r&&t===l},zz={duration:200,easing:"ease"},bw="transform",$z=ui.Transition.toString({property:bw,duration:0,easing:"linear"}),Hz={roleDescription:"sortable"};function Uz(e){let{disabled:t,index:n,node:o,rect:r}=e,[a,i]=G(null),s=_(n);return rr(()=>{if(!t&&n!==s.current&&o.current){let l=r.current;if(l){let d=vs(o.current,{ignoreTransform:!0}),c={x:l.left-d.left,y:l.top-d.top,scaleX:l.width/d.width,scaleY:l.height/d.height};(c.x||c.y)&&i(c)}}n!==s.current&&(s.current=n)},[t,n,o,r]),q(()=>{a&&i(null)},[a]),a}function Iw(e){let{animateLayoutChanges:t=Bz,attributes:n,disabled:o,data:r,getNewIndex:a=Fz,id:i,strategy:s,resizeObserverConfig:l,transition:d=zz}=e,{items:c,containerId:f,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:v,useDragOverlay:x,strategy:y}=fn(yw),C=Kz(o,m),w=c.indexOf(i),k=z(()=>({sortable:{containerId:f,index:w,items:c},...r}),[f,r,w,c]),S=z(()=>c.slice(c.indexOf(i)),[c,i]),{rect:L,node:I,isOver:T,setNodeRef:E}=mw({id:i,data:k,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...l}}),{active:A,activatorEvent:N,activeNodeRect:R,attributes:$,setNodeRef:H,listeners:K,isDragging:O,over:oe,setActivatorNodeRef:ee,transform:W}=fw({id:i,data:k,attributes:{...Hz,...n},disabled:C.draggable}),qe=P0(E,H),ve=!!A,fe=ve&&!h&&rp(p)&&rp(v),Ne=!x&&O,Ae=Ne&&fe?W:null,Ee=fe?Ae??(s??y)({rects:g,activeNodeRect:R,activeIndex:p,overIndex:v,index:w}):null,xe=rp(p)&&rp(v)?a({id:i,items:c,activeIndex:p,overIndex:v}):w,re=A?.id,Ie=_({activeId:re,items:c,newIndex:xe,containerId:f}),st=c!==Ie.current.items,dt=t({active:A,containerId:f,isDragging:O,isSorting:ve,id:i,index:w,items:c,newIndex:Ie.current.newIndex,previousItems:Ie.current.items,previousContainerId:Ie.current.containerId,transition:d,wasDragging:Ie.current.activeId!=null}),lt=Uz({disabled:!dt,index:w,node:I,rect:L});return q(()=>{ve&&Ie.current.newIndex!==xe&&(Ie.current.newIndex=xe),f!==Ie.current.containerId&&(Ie.current.containerId=f),c!==Ie.current.items&&(Ie.current.items=c)},[ve,xe,f,c]),q(()=>{if(re===Ie.current.activeId)return;if(re!=null&&Ie.current.activeId==null){Ie.current.activeId=re;return}let Et=setTimeout(()=>{Ie.current.activeId=re},50);return()=>clearTimeout(Et)},[re]),{active:A,activeIndex:p,attributes:$,data:k,rect:L,index:w,newIndex:xe,items:c,isOver:T,isSorting:ve,isDragging:O,listeners:K,node:I,overIndex:v,over:oe,setNodeRef:qe,setActivatorNodeRef:ee,setDroppableNodeRef:E,setDraggableNodeRef:H,transform:lt??Ee,transition:ct()};function ct(){if(lt||st&&Ie.current.newIndex===w)return $z;if(!(Ne&&!hc(N)||!d)&&(ve||dt))return ui.Transition.toString({...d,property:bw})}}function Kz(e,t){var n,o;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(o=e?.droppable)!=null?o:t.droppable}}function ip(e){if(!e)return!1;let t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}var qz=[mt.Down,mt.Right,mt.Up,mt.Left],Sw=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:i,scrollableAncestors:s}}=t;if(qz.includes(e.code)){if(e.preventDefault(),!n||!o)return;let l=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;let p=r.get(f.id);if(p)switch(e.code){case mt.Down:o.top<p.top&&l.push(f);break;case mt.Up:o.top>p.top&&l.push(f);break;case mt.Left:o.left>p.left&&l.push(f);break;case mt.Right:o.left<p.left&&l.push(f);break}});let d=J0({active:n,collisionRect:o,droppableRects:r,droppableContainers:l,pointerCoordinates:null}),c=ev(d,"id");if(c===i?.id&&d.length>1&&(c=d[1].id),c!=null){let f=a.get(n.id),p=a.get(c),m=p?r.get(p.id):null,h=p?.node.current;if(h&&m&&f&&p){let v=Ic(h).some((S,L)=>s[L]!==S),x=ww(f,p),y=Vz(f,p),C=v||!x?{x:0,y:0}:{x:y?o.width-m.width:0,y:y?o.height-m.height:0},w={x:m.left,y:m.top};return C.x&&C.y?w:ps(w,C)}}}};function ww(e,t){return!ip(e)||!ip(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Vz(e,t){return!ip(e)||!ip(t)||!ww(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Wz(e,t,n){let o={...e};return t.top+e.y<=n.top?o.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(o.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?o.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(o.x=n.left+n.width-t.right),o}var Tw=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:o}=e,r=o[0];return!t||!r?n:Wz(n,t,r)},Lw=e=>{let{transform:t}=e;return{...t,x:0}};me();me();var sp={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function kw(e){return`(min-width: ${typeof e=="number"?e:sp[e]}px)`}function Pw(e){return`(max-width: ${(typeof e=="number"?e:sp[e])-1}px)`}function Gz(e){if(typeof e!="string"){let n=[];return e.min!=null&&n.push(kw(e.min)),e.max!=null&&n.push(Pw(e.max)),e.pointer==="coarse"&&n.push("(pointer: coarse)"),e.pointer==="fine"&&n.push("(pointer: fine)"),n.length===0?"(min-width: 0px)":n.join(" and ")}if(e.startsWith("("))return e;let t=[];for(let n of e.split(":"))if(n.startsWith("max-")){let o=n.slice(4);o in sp&&t.push(Pw(o))}else n in sp&&t.push(kw(n));return t.length>0?t.join(" and "):e}function jz(){return!1}function lp(e){let t=Gz(e),n=B(r=>{if(typeof window>"u")return()=>{};let a=window.matchMedia(t);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[t]),o=B(()=>typeof window>"u"?!1:window.matchMedia(t).matches,[t]);return xa(n,o,jz)}me();var uo=new Map;function Qz(e,t,n){return`${e}\0${t}\0${n??"none"}`}function tv(e,t){uo.delete(e),uo.set(e,t)}function Ll(e,t){if(uo.get(e)===t){if(t.operationLeases>0){t.disposeRequested=!0;return}t.releaseAuthorityWatch?.(),t.releaseAuthorityWatch=void 0,uo.delete(e);for(let n of t.state.added)t.releaseUpload(n.id),URL.revokeObjectURL(n.previewUrl);for(let n of t.listeners)n()}}function Xz(e){if(uo.size<=100)return;let t=Array.from(uo);for(let[n,o]of t){if(uo.size<=100)return;n===e||o.committed||o.listeners.size>0||o.operationLeases>0||Ll(n,o)}for(let[n,o]of t){if(uo.size<=100)return;n===e||o.listeners.size>0||o.operationLeases>0||Ll(n,o)}}function dp(){queueMicrotask(()=>Xz())}function Aw(e,t,n,o,r=void 0){let a=n.management?.revision??null,i=Qz(e,n.intentId,a),s=uo.get(i);if(s)return s.releaseUpload=o.releaseUpload,s.watchAuthority=r,s.state;let l={key:i,inputKey:e,environmentId:t,intentId:n.intentId,revision:a,text:n.text??"",retained:n.management?.attachments??[],added:[],saving:!1,error:null},d={state:l,listeners:new Set,releaseUpload:o.releaseUpload,operationLeases:0,committed:!1,disposeRequested:!1,watchAuthority:r,releaseAuthorityWatch:void 0};return uo.set(i,d),l}function Ew(e,t){let n=uo.get(e);return n?(n.releaseAuthorityWatch===void 0&&n.watchAuthority!==void 0&&(n.releaseAuthorityWatch=n.watchAuthority({threadKey:n.state.inputKey,intentId:n.state.intentId,revision:n.state.revision,onInvalid:()=>Ll(e,n)})),n.committed=!0,tv(e,n),n.listeners.add(t),dp(),()=>{n.listeners.delete(t),dp()}):()=>{}}function xs(e,t){let n=uo.get(e);if(!n)return;n.committed=!0;let o=t(n.state);if(o!==n.state){n.state=o,tv(e,n);for(let r of n.listeners)r()}}function cp(e){return uo.get(e)?.state}function Mw(e){let t=uo.get(e);if(!t)return null;t.committed=!0,t.operationLeases+=1,tv(e,t);let n=!1;return()=>{if(!n){if(n=!0,t.operationLeases=Math.max(0,t.operationLeases-1),t.operationLeases===0&&t.disposeRequested){Ll(e,t);return}dp()}}}function up(e){let t=uo.get(e);t&&Ll(e,t)}function Rw(e,t){let n=new Map(t.flatMap(o=>o.waiting&&o.management!==void 0?[[o.intentId,o.management.revision]]:[]));for(let[o,r]of uo)r.state.inputKey===e&&n.get(r.state.intentId)!==r.state.revision&&Ll(o,r);dp()}function Nw({entry:e,current:t,inputKey:n,environmentId:o,unavailable:r,attachments:a,watchEditorAuthority:i,onEdit:s,onClose:l}){let{t:d}=co(),c=Aw(n,o,e,a,i),f=xa(A=>Ew(c.key,A),()=>cp(c.key)??c,()=>cp(c.key)??c),{key:p,text:m,retained:h,added:g,saving:v,error:x}=f,y=_(null),C=a.useUploadStatuses(),w=z(()=>h.map(A=>A.id),[h]),k=a.useAssetUrls(o,w),S=!t?.management||t.management.revision!==e.management?.revision;q(()=>{t===void 0&&(up(p),l())},[t,p,l]);let L=()=>{v||(up(p),l())},I=A=>{if(v||r||S)return;let N=null,R=[...g];for(let $ of A){let H=$.type||"application/octet-stream";if(h.length+R.length>=a.limits.maxAttachments||$.size===0||$.size>a.maxAttachmentBytes(H)){N=d("turnQueue.attachmentLimit",{name:$.name,count:a.limits.maxAttachments,size:a.formatAttachmentSize(a.maxAttachmentBytes(H))});continue}let K=a.makeImageAttachment({id:a.randomUUID(),name:$.name,mimeType:H,sizeBytes:$.size,file:$});R.push(K),a.startUpload({environmentId:o,image:K})}xs(p,$=>({...$,added:R,error:N}))},T=async()=>{let A=cp(p);if(!A||A.saving||r||S||!A.text.trim()&&A.retained.length+A.added.length===0)return;let N=Mw(p);if(N!==null){xs(p,R=>({...R,saving:!0,error:null}));try{await a.awaitUploads(A.added.map($=>$.id));let R=a.getUploadedAttachments({environmentId:o,images:A.added});if(!R)throw new Error(d("turnQueue.uploadFailed"));await s(e,{text:A.text,attachments:[...A.retained,...R]}),up(p),l()}catch(R){xs(p,$=>({...$,saving:!1,error:R instanceof Error?R.message:d("turnQueue.actionFailed")}))}finally{N()}}},E=[...h.map((A,N)=>({...A,previewUrl:k[N],added:!1})),...g.map(A=>({...A,added:!0}))];return u(If,{open:!0,onOpenChange:A=>{A||L()},children:b(Lf,{className:"max-w-2xl","data-queued-message-editor":!0,children:[b(Tf,{children:[u(kf,{children:d("turnQueue.editTitle")}),u(Sf,{children:d("turnQueue.editDescription")})]}),b("div",{className:"max-h-[60dvh] space-y-3 overflow-y-auto px-6 pb-4",onDragOver:A=>{A.dataTransfer.types.includes("Files")&&A.preventDefault()},onDrop:A=>{A.dataTransfer.files.length&&(A.preventDefault(),A.stopPropagation(),I(Array.from(A.dataTransfer.files)))},children:[u(NI,{"aria-label":d("turnQueue.editText"),autoFocus:!0,value:m,maxLength:a.limits.maxInputChars,disabled:v,onChange:A=>xs(p,N=>({...N,text:A.target.value})),onPaste:A=>{A.clipboardData.files.length&&(A.preventDefault(),I(Array.from(A.clipboardData.files)))},onKeyDown:A=>{(A.metaKey||A.ctrlKey)&&A.key==="Enter"&&!A.nativeEvent.isComposing&&(A.preventDefault(),T())}}),u("ul",{className:"flex flex-wrap gap-2",children:E.map(A=>b("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2 py-1.5",children:[A.type==="image"&&A.previewUrl?u("img",{src:A.previewUrl,alt:A.name,className:"size-12 rounded object-cover"}):u(Ro,{className:"size-4 shrink-0"}),b("div",{className:"min-w-0 text-xs",children:[u("p",{className:"max-w-48 break-words",children:A.name}),u("p",{className:"text-muted-foreground",children:a.formatAttachmentSize(A.sizeBytes)}),A.added&&C.get(A.id)!=="ready"?u("p",{children:d(C.get(A.id)==="failed"?"turnQueue.uploadFailed":"turnQueue.uploading")}):null,A.added&&C.get(A.id)==="failed"?u(te,{size:"xs",variant:"ghost",disabled:v||r||S,onClick:()=>{let N=g.find(R=>R.id===A.id);N&&a.retryUpload({environmentId:o,image:N})},children:d("turnQueue.retryUpload")}):null]}),u(te,{size:"icon-xs",variant:"ghost","aria-label":d("turnQueue.removeAttachment",{name:A.name}),disabled:v||S,onClick:()=>{A.added?(a.releaseUpload(A.id),A.previewUrl&&URL.revokeObjectURL(A.previewUrl),xs(p,N=>({...N,added:N.added.filter(R=>R.id!==A.id)}))):xs(p,N=>({...N,retained:N.retained.filter(R=>R.id!==A.id)}))},children:u(jt,{className:"size-3.5"})})]},A.id))}),u("input",{ref:y,type:"file",multiple:!0,className:"hidden","aria-label":d("turnQueue.addAttachments"),onChange:A=>{I(Array.from(A.target.files??[])),A.target.value=""}}),b(te,{size:"sm",variant:"outline",disabled:v||r||S,onClick:()=>y.current?.click(),children:[u(Ro,{className:"size-4"}),d("turnQueue.addAttachments")]}),S?u("p",{role:"alert",className:"text-sm text-muted-foreground",children:d("turnQueue.editStale")}):null,x?u("p",{role:"alert",className:"text-sm text-destructive-foreground",children:x}):null]}),b(wf,{children:[u(te,{variant:"ghost",disabled:v,onClick:L,children:d("turnQueue.discardEdit")}),u(te,{disabled:v||r||S||!m.trim()&&E.length===0,onClick:()=>{T()},children:d(v?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}function _w(e,t){let n=e.find(a=>a.intentId===t.intentId);if(!n)return e;let o=e.filter(a=>a.intentId!==t.intentId),r=t.beforeIntentId===null?o.length:o.findIndex(a=>a.intentId===t.beforeIntentId);return r<0?e:(o.splice(r,0,n),o)}function Dw(e,t,n){if(t===n)return null;let o={intentId:t,beforeIntentId:n,previousOrder:e.map(a=>a.intentId)};return _w(e,o).every((a,i)=>a.intentId===e[i]?.intentId)?null:o}function Ow(e,t){if(!e.find(l=>l.intentId===t.intentId)?.management?.canReorder||t.beforeIntentId!==null&&!e.some(l=>l.intentId===t.beforeIntentId))return{entries:e,settled:!0};let o=new Set(e.map(l=>l.intentId)),r=new Set(t.previousOrder),a=t.previousOrder.filter(l=>o.has(l));return e.filter(l=>r.has(l.intentId)).some((l,d)=>l.intentId!==a[d])?{entries:e,settled:!0}:{entries:_w(e,t),settled:!1}}me();me();function Yz({entry:e,unavailable:t,onCancel:n}){let{t:o}=co(),r=_(!1),[a,i]=G(!1),[s,l]=G(!1),[d,c]=G(!1);q(()=>{c(!1),l(!1)},[e.status,e.deliveryCertainty]);let f=async()=>{if(!(r.current||t||e.action===null)){r.current=!0,i(!0),l(!1);try{await n(e),c(!1)}catch{l(!0)}finally{r.current=!1,i(!1)}}};return b("li",{className:"space-y-2 border-t border-border py-2","data-turn-queue-message":!0,children:[u("p",{className:"text-muted-foreground",children:o(e.deliveryCertainty==="unknown"?"turnQueue.itemUnknown":e.status==="queued"?"turnQueue.itemQueued":e.status==="blocked"||e.status==="reconciling"?"turnQueue.itemBlocked":"turnQueue.itemRunning")}),u("p",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e.text??o("turnQueue.messageUnavailable")}),e.attachmentNames.length>0?u("p",{className:"break-words text-muted-foreground",children:e.attachmentNames.join(", ")}):null,e.action!==null?d&&e.action==="abandon"?b("div",{className:"space-y-2",children:[u("p",{children:o("turnQueue.abandonDescription")}),b("div",{className:"flex flex-wrap gap-2",children:[u(te,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>{f()},children:o("turnQueue.confirmAbandon")}),u(te,{size:"xs",variant:"ghost",disabled:a,onClick:()=>c(!1),children:o("turnQueue.keepWaiting")})]})]}):u(te,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>e.action==="abandon"?c(!0):void f(),children:o(a?"turnQueue.cancelling":e.action==="abandon"?"turnQueue.stopWaiting":"turnQueue.cancelMessage")}):null,s?u("p",{role:"alert",className:"text-destructive-foreground",children:o("turnQueue.actionFailed")}):null]})}function Fw({entries:e,unavailable:t,onCancel:n}){let{t:o}=co(),[r,a]=G(!1),i=Wr();return e.length===0?null:b("div",{className:"min-w-0 basis-full space-y-2",children:[u(te,{size:"xs",variant:"ghost","aria-expanded":r,"aria-controls":i,onClick:()=>a(s=>!s),children:o(r?"turnQueue.hideMessages":"turnQueue.showMessages")}),r?u("ol",{id:i,className:"max-h-64 overflow-y-auto overscroll-contain",children:e.map(s=>u(Yz,{entry:s,unavailable:t,onCancel:n},s.intentId))}):null]})}function nv({queue:e,unavailable:t=!1,onResume:n,entries:o,onCancel:r}){let{t:a}=co(),i=_(!1),[s,l]=G(!1),[d,c]=G(!1),f=_(!1),[p,m]=G(!1),[h,g]=G(!1),[v,x]=G(null);q(()=>{e.paused||c(!1)},[e.paused]);let y=o?.[0];q(()=>{m(!1),x(null)},[y?.intentId,y?.status,y?.deliveryCertainty]);let C=e.deliveryUncertain||e.blocked||e.reconciling;if(!e.paused&&!C)return null;let w=r!==void 0&&y?.action==="abandon"&&(e.reconciling||e.deliveryUncertain),k=async()=>{if(f.current||t||r===void 0||y===void 0)return;let T=y;f.current=!0,g(!0),x(null);try{await r(T),m(!1)}catch{x(T.intentId)}finally{f.current=!1,g(!1)}},S=e.paused?a("turnQueue.pausedTitle"):e.deliveryUncertain?a("turnQueue.uncertainTitle"):e.blocked?a("turnQueue.blockedTitle"):e.reconciling?a("turnQueue.reconcilingTitle"):a("turnQueue.queuedTitle"),L=e.deliveryUncertain?a("turnQueue.uncertainDescription"):e.blocked?a("turnQueue.blockedDescription"):e.reconciling?a("turnQueue.reconcilingDescription"):e.paused?a("turnQueue.pausedDescription"):a("turnQueue.queuedDescription"),I=async()=>{if(!(i.current||t||!e.paused)){i.current=!0,l(!0),c(!1);try{await n()}catch{c(!0)}finally{i.current=!1,l(!1)}}};return b("div",{className:"mx-auto mb-2 flex w-full max-w-3xl flex-wrap items-start gap-2 rounded-md border border-warning/40 bg-background px-3 py-2 text-xs text-foreground","data-turn-queue-banner":!0,role:"status",children:[b("div",{className:"min-w-0 flex-1 basis-48 space-y-1",children:[b("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[u("span",{className:"font-medium",children:S}),u("span",{className:"text-muted-foreground",children:a("turnQueue.queued",{count:e.queuedCount})})]}),u("p",{className:"text-muted-foreground",children:L}),e.paused&&C?u("p",{className:"text-muted-foreground",children:a("turnQueue.pausedUncertainDescription")}):null,t?u("p",{className:"text-muted-foreground",children:a("turnQueue.disconnected")}):null,d&&e.paused?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.resumeFailed")}):null,v!==null&&v===y?.intentId?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.actionFailed")}):null]}),e.paused?u(te,{size:"xs",variant:"outline",disabled:s,softDisabled:t,onClick:()=>{I()},children:a(s?"turnQueue.resuming":"turnQueue.resume")}):null,w?b(be,{children:[u(te,{size:"xs",variant:"outline",disabled:h,softDisabled:t,onClick:()=>m(!0),children:a("turnQueue.stopWaiting")}),u(OI,{open:p,onOpenChange:T=>{T||m(!1)},children:b(HI,{className:"max-w-lg",children:[b($I,{children:[u(UI,{children:a("turnQueue.stopWaiting")}),u(BI,{children:a("turnQueue.abandonDescription")})]}),b(zI,{children:[u(FI,{render:u(te,{variant:"ghost"}),children:a("turnQueue.keepWaiting")}),u(te,{variant:"outline",disabled:h||t,onClick:()=>{k()},children:a(h?"turnQueue.cancelling":"turnQueue.confirmAbandon")})]})]})})]}):null,r&&o?u(Fw,{entries:o.filter(T=>T.status!=="queued"),unavailable:t,onCancel:r}):null]})}var Jz=[Lw,Tw];function Zz({entry:e,disabled:t,dropPosition:n,dragPosition:o,feedback:r,reducedMotion:a,children:i}){let{t:s}=co(),{attributes:l,listeners:d,setNodeRef:c,setActivatorNodeRef:f,transform:p,transition:m,isDragging:h}=Iw({id:e.intentId,disabled:t,transition:a?null:{duration:160,easing:"ease-out"}});return b("li",{ref:c,"data-queue-intent":e.intentId,"data-queue-dragging":h||void 0,"data-queue-feedback":r,style:{transform:ui.Transform.toString(p),transition:m},className:F("relative flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",h&&"z-10 bg-accent shadow-md ring-1 ring-primary/50 ring-inset",r==="saved"&&"bg-primary/10 ring-1 ring-primary/30 ring-inset",r==="failed"&&"bg-destructive/10"),children:[n?u("span",{"aria-hidden":"true","data-queue-drop-position":n,className:F("pointer-events-none absolute inset-x-1 z-20 h-0.5 rounded-full bg-primary before:absolute before:-top-0.5 before:start-0 before:size-1.5 before:rounded-full before:bg-primary",n==="before"?"top-0":"bottom-0")}):null,u(te,{ref:f,size:"icon-xs",variant:"ghost",className:F("shrink-0 touch-none cursor-grab text-muted-foreground active:cursor-grabbing",(h||r==="saved")&&"bg-primary/10 text-primary"),...l,...d,"aria-label":s("turnQueue.reorderMessage"),title:s("turnQueue.reorderMessage"),softDisabled:t,children:r==="saved"?u(Io,{className:"size-3.5"}):u(Bd,{className:"size-3.5"})}),i,h&&o?u("span",{"aria-hidden":"true","data-queue-drag-position":!0,className:"pointer-events-none absolute end-3 rounded bg-primary/10 px-2 py-1 font-medium text-primary tabular-nums",children:o}):null]})}function Bw({inputKey:e,entries:t,environmentId:n,unavailable:o,attachments:r,actions:a,onCancel:i}){let{t:s}=co(),l=lp("(prefers-reduced-motion: reduce)"),[d,c]=Ln("turn-queue:editing",e,null),[f,p]=Ln("turn-queue:pending",e,!1),m=En("turn-queue:pending-ref",e,!1),[h,g]=Ln("turn-queue:error",e,null),[v,x]=Ln("turn-queue:drag",e,null),[y,C]=Ln("turn-queue:move",e,null),w=En("turn-queue:reorder-ref",e,!1),[k,S]=Ln("turn-queue:feedback",e,null),L=j0(Zh(Tl,{activationConstraint:{distance:5}}),Zh(wl,{coordinateGetter:Sw,scrollBehavior:l?"auto":"smooth"})),I=z(()=>t.filter(O=>O.waiting),[t]),T=y?Ow(I,y.preview):null,E=T?.entries??I,A=o||f||y!==null,N=E.findIndex(O=>O.intentId===v?.activeId),R=E.findIndex(O=>O.intentId===v?.overId);q(()=>{Rw(e,t)},[t,e]),q(()=>{y!==null&&(o||y.acknowledged&&T?.settled)&&(w.current=!1,C(null),!o&&I.some(O=>O.intentId===y.preview.intentId)&&S({intentId:y.preview.intentId,kind:"saved"}))},[I,y,T?.settled,o]),q(()=>{if(k===null||k.kind==="failed")return;let O=window.setTimeout(()=>S(oe=>oe===k?null:oe),1600);return()=>window.clearTimeout(O)},[k]);let $=async O=>{if(!(m.current||w.current||o)){m.current=!0,p(!0),g(null),S(null);try{await O()}catch(oe){g(oe instanceof Error?oe.message:s("turnQueue.actionFailed"))}finally{m.current=!1,p(!1)}}},H=(O,oe)=>$(async()=>{let ee=Dw(I,O.intentId,oe);if(!(ee===null||!O.management?.canReorder)){w.current=!0,C({preview:ee,acknowledged:!1});try{await a.onReorder(O,oe),C(W=>W?.preview===ee?{...W,acknowledged:!0}:W)}catch(W){throw w.current=!1,C(null),S({intentId:O.intentId,kind:"failed"}),W}}}),K=o?s("turnQueue.disconnected"):y!==null?s("turnQueue.saving"):v!==null?`${s("turnQueue.dragStarted")} ${R+1}/${E.length}`:k?.kind==="saved"?s("common.action.done"):k?.kind==="cancelled"?s("turnQueue.dragCancelled"):"";return b(be,{children:[E.length>0?b("section",{"aria-label":s("turnQueue.pendingMessages"),"data-turn-queue-dock":!0,className:"mx-auto mb-2 w-full max-w-3xl overflow-hidden rounded-xl border border-border/60 bg-background/95 text-xs shadow-xs",children:[b("div",{className:"flex h-7 items-center justify-between gap-3 px-3 py-1.5 text-muted-foreground",children:[u("span",{className:"shrink-0",children:s("turnQueue.queued",{count:E.length})}),u("span",{role:"status","aria-live":v===null?"polite":"off","data-queue-reorder-status":y?"saving":k?.kind,className:F("min-w-0 truncate",k?.kind==="saved"&&"text-primary"),children:K})]}),u(uw,{sensors:L,collisionDetection:Y0,modifiers:Jz,accessibility:{screenReaderInstructions:{draggable:s("turnQueue.dragInstructions")},announcements:{onDragStart:()=>s("turnQueue.dragStarted"),onDragOver:({over:O})=>{let oe=E.findIndex(ee=>ee.intentId===O?.id);return oe<0?void 0:`${s("turnQueue.dragStarted")} ${oe+1}/${E.length}`},onDragEnd:()=>s("turnQueue.dragFinished"),onDragCancel:()=>s("turnQueue.dragCancelled")}},onDragStart:({active:O})=>{let oe=E.find(ee=>ee.intentId===O.id);!oe?.management?.canReorder||A||(g(null),S(null),x({activeId:oe.intentId,overId:oe.intentId}))},onDragOver:({over:O})=>{let oe=E.find(ee=>ee.intentId===O?.id);oe&&x(ee=>ee&&{...ee,overId:oe.intentId})},onDragCancel:()=>{v&&S({intentId:v.activeId,kind:"cancelled"}),x(null)},onDragEnd:({active:O,over:oe})=>{if(x(null),!oe||O.id===oe.id)return;let ee=E.findIndex(fe=>fe.intentId===O.id),W=E.findIndex(fe=>fe.intentId===oe.id),qe=E[ee];if(!qe?.management?.canReorder||W<0)return;let ve=E[W+(ee<W?1:0)]?.intentId??null;H(qe,ve)},children:u(Cw,{items:E.map(O=>O.intentId),strategy:vw,children:u("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:E.map((O,oe)=>b(Zz,{entry:O,disabled:!O.management?.canReorder||A,reducedMotion:l,feedback:k?.intentId===O.intentId?k.kind:void 0,dropPosition:O.intentId===v?.overId&&N!==R?N<R?"after":"before":void 0,dragPosition:O.intentId===v?.activeId?`${R+1}/${E.length}`:void 0,children:[b("div",{className:"min-w-0 flex-1",children:[u("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:O.text||s("turnQueue.attachmentsOnly")}),O.attachmentNames.length?b("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(Ro,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:O.attachmentNames.join(", ")})]}):null,O.pendingAction?u("p",{className:"text-muted-foreground",children:s(O.pendingAction==="steer"?"turnQueue.steering":"turnQueue.interrupting")}):null,O.failure?u("p",{role:"alert",className:"text-destructive-foreground",children:O.failure}):null]}),b("div",{className:F("flex shrink-0 items-center gap-0.5",O.intentId===v?.activeId&&"invisible"),children:[u(te,{size:"icon-xs",variant:"ghost",disabled:!O.management||A||v!==null,"aria-label":s("turnQueue.editMessage"),title:s("turnQueue.editMessage"),onClick:()=>c(O),children:u(Wd,{className:"size-3.5"})}),O.management?.canSteer?u(te,{size:"icon-xs",variant:"ghost",disabled:A||v!==null,"aria-label":s("turnQueue.steer"),title:s("turnQueue.steerDescription"),onClick:()=>{$(()=>a.onRun(O,"steer"))},children:u(Gd,{className:"size-3.5"})}):null,b(Jo,{children:[u(tr,{render:u(te,{size:"icon-xs",variant:"ghost",disabled:A||!O.management||v!==null,"aria-label":s("turnQueue.messageActions")}),children:u(Yo,{className:"size-4"})}),b(er,{align:"end",children:[b(Zo,{disabled:!O.management?.canReorder||oe===0,onClick:()=>{H(O,E[oe-1].intentId)},children:[u(Pd,{className:"size-4"}),s("turnQueue.moveUp")]}),b(Zo,{disabled:!O.management?.canReorder||oe===E.length-1,onClick:()=>{H(O,E[oe+2]?.intentId??null)},children:[u(Ld,{className:"size-4"}),s("turnQueue.moveDown")]}),O.management?.canSteer?u(Zo,{onClick:()=>{$(()=>a.onRun(O,"steer"))},children:s("turnQueue.steer")}):null,u(Zo,{disabled:!O.management?.canRun,onClick:()=>{$(()=>a.onRun(O,"interrupt"))},children:s(O.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),u(ii,{}),u(Zo,{disabled:O.action!=="cancel",onClick:()=>{$(()=>i(O))},children:s("turnQueue.cancelMessage")})]})]})]})]},O.intentId))})})},e),h?u("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:h}):null]}):null,d?u(Nw,{entry:d,current:t.find(O=>O.intentId===d.intentId),inputKey:e,environmentId:n,unavailable:A,attachments:r,watchEditorAuthority:a.watchEditorAuthority,onEdit:a.onEdit,onClose:()=>c(null)},`${e}\0${d.intentId}\0${d.management?.revision??"none"}`):null]})}me();var ov=220,e5={opacity:0,transform:"translate3d(0, 4rem, 0)"},t5={opacity:0,transform:"translate3d(0, 7rem, 0)"},zw={opacity:1,transform:"none"},$w={transition:`transform ${ov}ms ease-in, opacity ${ov}ms ease-in`},n5={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function Uw({className:e,items:t}){let[n,o]=G(null),r=_(null),a=n!==null&&t.some(p=>p.id===n)?n:null;if(q(()=>()=>{r.current&&clearTimeout(r.current)},[]),t.length===0)return null;let i=t[0];if(!i)return null;let s=t.slice(1),l=s.length>0,d=l&&a!==i.id,c=s[0],f=p=>{!p.onDismiss||a||(o(p.id),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,p.onDismiss?.()},ov))};return u("div",{className:F("group/banner-stack chat-composer-drawer-slot",e),"data-composer-banner-drawer":"true",children:b("div",{className:F("relative flex flex-col-reverse",l?"group-hover/banner-stack:z-50 group-focus-within/banner-stack:z-50":null),children:[d&&c?u("div",{className:F("pointer-events-none absolute inset-x-0 -top-3 z-0 mx-auto h-3 rounded-t-2xl","chat-composer-banner-stack-cap border border-b-0 shadow-[0_6px_18px_rgba(0,0,0,0.06)]",n5[c.variant],"transition-opacity duration-150 ease-out","group-hover/banner-stack:opacity-0 group-focus-within/banner-stack:opacity-0"),style:{width:"96%"},"aria-hidden":"true"}):null,u("div",{className:F("relative z-10",a===i.id?"pointer-events-none":null),style:{...$w,...a===i.id?e5:zw},children:u(Hw,{item:i,attached:!0,exiting:a===i.id,onDismissRequest:()=>f(i)})}),l?u("div",{"data-composer-banner-stack-expanded-items":"true",className:F("relative z-20 grid grid-rows-[0fr] transition-[grid-template-rows] duration-150 ease-out","group-hover/banner-stack:grid-rows-[1fr] group-focus-within/banner-stack:grid-rows-[1fr]"),children:u("div",{className:"min-h-0 overflow-hidden",children:u("div",{className:F("invisible pointer-events-none space-y-2 pb-2 opacity-0","translate-y-1 transform-gpu transition-[opacity,transform] duration-150 ease-out will-change-[opacity,transform]","group-hover/banner-stack:visible group-hover/banner-stack:pointer-events-auto group-hover/banner-stack:translate-y-0 group-hover/banner-stack:opacity-100","group-focus-within/banner-stack:visible group-focus-within/banner-stack:pointer-events-auto group-focus-within/banner-stack:translate-y-0 group-focus-within/banner-stack:opacity-100"),children:s.map(p=>u("div",{className:F(a===p.id?"pointer-events-none":null),style:{...$w,...a===p.id?t5:zw},children:u(Hw,{item:p,attached:!1,exiting:a===p.id,onDismissRequest:()=>f(p)})},p.id))})})}):null]})})}function Hw({item:e,attached:t,exiting:n,onDismissRequest:o}){let r=e.onDismiss&&!e.actions;return e.presentation==="compact"?b(tc,{variant:e.variant,role:"status",className:F("min-h-0 px-3 text-xs sm:px-4",t?"chat-composer-drawer-surface chat-composer-drawer-attached pt-1.5 pb-[calc(var(--chat-composer-attachment-overlap)_+_0.25rem)]":"alert-glass rounded-[22px] py-1.5",e.className),"data-composer-banner-presentation":"compact","data-variant":e.variant,children:[e.icon,b(xh,{className:"flex min-w-0 items-baseline gap-1.5 font-normal leading-5",children:[u("span",{className:"shrink-0 font-medium text-foreground",children:e.title}),e.description?u("span",{className:"min-w-0 truncate text-muted-foreground",children:e.description}):null]}),e.actions||e.onDismiss?b(nc,{className:F("shrink-0",e.actionClassName),children:[e.actions,e.onDismiss?u(te,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??"Dismiss notice",disabled:n,onClick:o,children:u(jt,{})}):null]}):null]}):b(tc,{variant:e.variant,className:F(t?"chat-composer-drawer-surface chat-composer-drawer-attached px-3 pt-2 pb-[calc(var(--chat-composer-attachment-overlap)_+_0.375rem)] text-xs sm:px-4":"alert-glass rounded-[22px]",e.className),"data-variant":e.variant,children:[e.icon,u(xh,{children:e.title}),e.description?u(Af,{children:e.description}):null,e.actions||e.onDismiss?b(nc,{className:F(e.actionClassName,r?"max-sm:col-start-3 max-sm:row-start-1 max-sm:mt-0 max-sm:self-start":void 0),children:[e.actions,e.onDismiss?u(te,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??"Dismiss warning",disabled:n,onClick:o,children:u(jt,{})}):null]}):null]})}function Kw({bannerItems:e,belowSlot:t,composer:n,draftHero:o,onOverlayElementChange:r,queue:a}){let i=u(Uw,{className:"relative z-0",items:e});return u("div",{ref:r,"data-chat-composer-overlay":"true",className:o.active?"pointer-events-none absolute inset-0 z-20 flex items-center":"pointer-events-none absolute inset-x-0 bottom-0 z-20 pt-1.5 sm:pt-2",children:b("div",{ref:o.transitionGroupRef,className:"w-full ps-[calc(env(safe-area-inset-left)+0.75rem)] pe-[calc(env(safe-area-inset-right)+0.75rem)] sm:ps-[calc(env(safe-area-inset-left)+1.25rem)] sm:pe-[calc(env(safe-area-inset-right)+1.25rem)]",children:[b("div",{className:"pointer-events-auto relative z-10",children:[a,o.active?b("div",{className:"absolute inset-x-0 bottom-full z-0",children:[u("div",{className:"pb-8",style:{viewTransitionName:o.headlineTransitionName},children:o.headline}),i]}):i,b("div",{className:"chat-composer-glass-shell relative mx-auto w-full max-w-3xl",style:{viewTransitionName:o.composerTransitionName},children:[u("div",{className:"chat-composer-glass-host relative z-10 w-full rounded-[22px]",children:u("div",{ref:o.composerAnchorRef,className:"relative z-10",children:n})}),u("div",{className:"min-h-0",children:t})]})]}),u("div",{"aria-hidden":!0,className:"h-[calc(env(safe-area-inset-bottom)+1rem)] sm:h-[calc(env(safe-area-inset-bottom)+1.25rem)]"})]})})}function qw(e,t){let n=e!==null&&e!=="plan-follow-up";return{showTopDrawer:e!==null&&(n||!t),showCollapsedPromptRow:t&&!n,hasBlocking:n}}var o5=["image/gif","image/jpeg","image/png","image/webp"],r5=new Set(o5);function rv(e){return r5.has(e.toLowerCase())}function a5(e){return rv(e)?"image":"file"}var i5=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function av(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||i5.has(t)?"text":"file"}function iv(e){return!Number.isFinite(e)||e<=0?"0 KB":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function sv(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return a5(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t}}var s5=new Set(["claudeAgent","cursor","grok","dsh","acp"]),Vw=e=>s5.has(e)?"in-session":"next-turn";function l5(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function d5(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function c5(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function Sc(e){return`[${d5(l5(e))}](${c5(e)})`}me();var u5=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s)/g,f5=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g;var p5=new RegExp("(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,512})\\]\\(([^)\\s]+)\\)(?=\\s)","g"),m5=/^[A-Za-z][A-Za-z0-9+.-]*:/,g5=/^[A-Za-z]:[\\/]/,h5=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function v5(e){let t=[];for(let n of e.matchAll(p5)){let o=n[0],r=n[1]??"",a=(n[2]??"").replace(/\\(.)/g,"$1"),i=n[3]??"",s=i;try{s=decodeURIComponent(i)}catch{}let l=Math.max(s.lastIndexOf("/"),s.lastIndexOf("\\")),d=l>=0?s.slice(l+1):s,c=m5.test(s)&&!g5.test(s);if(!s||c||a!==d)continue;let f=(n.index??0)+r.length,p=f+o.length-r.length;t.push({type:"mention",value:s,source:e.slice(f,p),start:f,end:p})}for(let n of e.matchAll(f5)){let o=n[0],r=n[1]??"",a=n[2],i=a!==void 0?a.replace(/\\(.)/g,"$1"):n[3]??"";if(!i||a===void 0&&h5.test(i))continue;let s=(n.index??0)+r.length,l=s+o.length-r.length;t.push({type:"mention",value:i,source:e.slice(s,l),start:s,end:l})}return t}function wc(e,t={}){let n=v5(e);for(let o of e.matchAll(u5)){let r=o[0],a=o[1]??"",i=o[2]??"";if(!i)continue;let s=(o.index??0)+a.length,l=s+r.length-a.length;n.push({type:"skill",value:i,source:e.slice(s,l),start:s,end:l})}for(let o of t.preserveTrailingFrom??[])o.end===e.length&&e.slice(o.start,o.end)===o.source&&!n.some(r=>r.type===o.type&&r.start===o.start&&r.end===o.end)&&n.push(o);return[...n].sort((o,r)=>o.start-r.start)}function x5(e){return e.replace(/\r\n/g,`
3694
- `).replace(/^\n+|\n+$/g,"")}function y5(e){return x5(e.text).length>0}function Ww(e){return!y5(e)}function C5(e){return e.lineStart===e.lineEnd?`line ${e.lineStart}`:`lines ${e.lineStart}-${e.lineEnd}`}function Gw(e){return`${e.terminalLabel} (${C5(e)})`}function jw(e,t,n){return e<=n&&n<t}function Qw(e,t){if(!t)return;let n=e[e.length-1];if(n&&n.type==="text"){n.text+=t;return}e.push({type:"text",text:t})}function Xw(e,t){let n=0;for(let o=0;o<e.length;o+=1)if(e[o]==="\uFFFC"){if(o>n&&t({type:"text",text:e.slice(n,o),promptOffset:n})===!0||t({type:"terminal-context",promptOffset:o})===!0)return!0;n=o+1}return n<e.length&&t({type:"text",text:e.slice(n),promptOffset:n})===!0}function b5(e,t){return Xw(e,n=>n.type!=="text"?!1:t(n.text,n.promptOffset))}function I5(e,t){return b5(e,(n,o)=>{for(let r of wc(n))if(r.type==="mention"&&t(r,o)===!0)return!0;return!1})}function S5(e){let t=[];if(!e)return t;let n=wc(e),o=0;for(let r of n)r.start<o||(r.start>o&&Qw(t,e.slice(o,r.start)),r.type==="mention"?t.push({type:"mention",path:r.value,source:r.source}):t.push({type:"skill",name:r.value}),o=r.end);return o<e.length&&Qw(t,e.slice(o)),t}function lv(e,t,n){return!e||t>=n?!1:I5(e,(o,r)=>{let a=r+o.start,i=r+o.end,s=a-1,l=i;return!!(s>=0&&/\s/.test(e[s]??"")&&jw(t,n,s)||l<e.length&&/\s/.test(e[l]??"")&&jw(t,n,l))})}function ys(e,t=[]){if(!e)return[];let n=[],o=0;return Xw(e,r=>r.type==="text"?(n.push(...S5(r.text)),!1):(n.push({type:"terminal-context",context:t[o]??null}),o+=1,!1)),n}function Jw(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:"foreground"}var Yw=e=>e.type!=="text";function dv(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function w5(e){return e===" "||e===`
3695
- `||e===" "||e==="\r"||e==="\uFFFC"}function T5(e,t){let n=t-1;for(;n>=0&&!w5(e[n]??"");)n-=1;return n+1}function Ir(e,t){let n=dv(e,t),o=ys(e);if(o.length===0)return n;let r=n,a=0;for(let i of o){if(i.type==="mention"){let l=i.source.length;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;continue}if(i.type==="skill"){let l=i.name.length+1;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;continue}if(i.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let s=i.text.length;if(r<=s)return a+r;r-=s,a+=s}return a}function Zw(e){return e.type==="text"?e.text.length:1}function eT(e,t){let n=e.reduce((o,r)=>o+Zw(r),0);return Number.isFinite(t)?Math.max(0,Math.min(n,Math.floor(t))):n}function ir(e,t){return eT(ys(e),t)}function sr(e,t){let n=dv(e,t),o=ys(e);if(o.length===0)return n;let r=n,a=0;for(let i of o){if(i.type==="mention"){let l=i.source.length;if(r===0)return a;if(r<=l)return a+1;r-=l,a+=1;continue}if(i.type==="skill"){let l=i.name.length+1;if(r===0)return a;if(r<=l)return a+1;r-=l,a+=1;continue}if(i.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let s=i.text.length;if(r<=s)return a+r;r-=s,a+=s}return a}function Tc(e,t,n){let o=ys(e);if(!o.some(Yw))return!1;let r=eT(o,t),a=0;for(let i of o){if(Yw(i)&&(n==="left"&&r===a+1||n==="right"&&r===a))return!0;a+=Zw(i)}return!1}function lr(e,t){let n=dv(e,t),o=e.lastIndexOf(`
3696
- `,Math.max(0,n-1))+1,r=e.slice(o,n);if(r.startsWith("/")){let s=/^\/(\S*)$/.exec(r);if(s)return{kind:"slash-command",query:s[1]??"",rangeStart:o,rangeEnd:n}}let a=T5(e,n),i=e.slice(a,n);return i.startsWith("$")?{kind:"skill",query:i.slice(1),rangeStart:a,rangeEnd:n}:i.startsWith("@")?{kind:"path",query:i.slice(1),rangeStart:a,rangeEnd:n}:null}function tT(e,t,n,o){let r=Math.max(0,Math.min(e.length,t)),a=Math.max(r,Math.min(e.length,n));return{text:`${e.slice(0,r)}${o}${e.slice(a)}`,cursor:r+o.length}}var nT="Ask for changes, send follow-ups, or attach images";var oT="application/x-ycodium-composer-mention";function cv(e){return e.includes(oT)}function rT(e){let t=n=>cv(n.dataTransfer.types)?(n.preventDefault(),n.stopPropagation(),n.nativeEvent.stopPropagation(),!0):!1;return{onDragEnter(n){t(n)&&e.setDragActive(!0)},onDragOver(n){t(n)&&(n.dataTransfer.dropEffect="move",e.setDragActive(!0))},onDrop(n){if(!t(n))return;e.setDragActive(!1);let o=n.dataTransfer.getData(oT);o.length!==0&&(e.insertMentionAtEnd(`${o} `)||e.onInsertRejected())}}}me();var uv=ue(function(t){let{t:n}=De();if(t.count===0)return null;let o=t.placement==="inline",r=u("span",{className:F("text-[10px] font-medium leading-none tabular-nums",t.pulsing?"animate-[prompt-stash-count-enter_180ms_ease-out_both] text-primary motion-reduce:animate-none":"text-muted-foreground"),children:t.count},t.pulseKey);return o?b(te,{size:"micro",variant:"ghost-muted","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:F("shrink-0 gap-1 px-1.5",(t.menuOpen||t.pulsing)&&"[--control-icon-color:currentColor] text-foreground"),onPointerDown:a=>a.preventDefault(),onClick:t.onToggleMenu,children:[u(dl,{className:"size-3 shrink-0","aria-hidden":"true"}),r]}):b("button",{type:"button","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:F("chat-composer-shoulder-tab chat-composer-stash-tab absolute -top-7 right-4 z-0 inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-t-xl border border-b-0 px-3 pb-1 text-xs leading-none","transition-colors duration-(--control-duration)",t.menuOpen&&"pointer-events-none",t.menuOpen||t.pulsing?"text-foreground":"text-muted-foreground hover:text-foreground"),onPointerDown:a=>{a.preventDefault()},onClick:t.onToggleMenu,children:[u(dl,{className:"size-3 shrink-0","aria-hidden":"true"}),n("stash.label"),r]})});me();function L5(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function k5(e){let t=L5(e);if(!t)return null;let n=Date.now()-t.getTime();if(n<0)return{value:"just now",suffix:null};let o=Math.floor(n/1e3);if(o<60)return{value:"just now",suffix:null};let r=Math.floor(o/60);if(r<60)return{value:`${r}m`,suffix:"ago"};let a=Math.floor(r/60);return a<24?{value:`${a}h`,suffix:"ago"}:{value:`${Math.floor(a/24)}d`,suffix:"ago"}}function aT(e){let t=k5(e);return t?t.suffix?`${t.value} ${t.suffix}`:t.value:""}me();var iT=Ht(null),sT=iT.Provider;function Ot(){let e=fn(iT);if(e===null)throw new Error("Composer API has not been provided.");return e}var lT=90;function dT(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function P5(e,t){let n=e.prompt.trim().replace(/\s+/g," ");if(n.length>0)return n.length>lT?`${n.slice(0,lT)}\u2026`:n;let o=e.attachments.length+e.droppedImageNames.length;return o>0?t("stash.imageCountLabel",{count:o}):t("stash.emptyEntry")}var cT=ue(function(t){let{entries:n,onRestore:o,onDelete:r,onClose:a}=t,{t:i}=De(),s=Ot(),l=_(null),[d,c]=G(n[0]?.id??null),f=n.find(p=>p.id===d)??n[0];return q(()=>{let p=m=>{let h=l.current;h&&m.composedPath().includes(h)||m.target instanceof Element&&m.target.closest('[data-prompt-stash-badge="true"]')||a()};return document.addEventListener("pointerdown",p,!0),()=>document.removeEventListener("pointerdown",p,!0)},[a]),q(()=>{n.length!==0&&(n.some(p=>p.id===d)||c(n[0]?.id??null))},[n,d]),s.pane.useKeydown(p=>{if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),a();return}if(p.key==="ArrowDown"||p.key==="ArrowUp"){if(n.length===0)return;p.preventDefault(),p.stopPropagation();let m=n.findIndex(x=>x.id===d),h=p.key==="ArrowDown"?1:-1,v=((m>=0?m:h===1?-1:0)+h+n.length)%n.length;c(n[v]?.id??null);return}if(p.key==="Enter"){if(p.target instanceof HTMLElement&&p.target.closest("button[aria-label]")||!f)return;p.preventDefault(),p.stopPropagation(),o(f);return}if(p.key==="Backspace"&&(p.metaKey||p.ctrlKey)){if(!f)return;p.preventDefault(),p.stopPropagation(),r(f)}},{capture:!0}),u(Mf,{autoHighlight:!1,mode:"none",children:b("div",{ref:l,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden","data-composer-stash-drawer":"true",children:[u("div",{className:"flex h-7 items-center justify-end px-2 pt-1",children:u(te,{variant:"ghost-muted",size:"icon-micro","aria-label":i("stash.closeLabel"),onPointerDown:p=>p.preventDefault(),onClick:a,children:u(jt,{className:"size-3"})})}),u(_f,{className:"max-h-64 scroll-pb-6",children:u(Rf,{children:n.length===0?u("p",{className:"px-3 py-1.5 text-secondary-label text-xs",children:i("stash.empty")}):n.map(p=>b(Nf,{value:p.id,className:F("group/stash relative cursor-pointer select-none gap-3 rounded-lg px-3 py-1.5! hover:bg-transparent hover:text-inherit data-highlighted:bg-transparent data-highlighted:text-inherit",d===p.id&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{d!==p.id&&c(p.id)},onMouseDown:m=>{m.preventDefault()},onClick:()=>{o(p)},children:[u("span",{className:"min-w-0 flex-1 truncate text-xs",children:P5(p,i)}),p.pendingImageCount?u("span",{className:"shrink-0 text-[10px] text-secondary-label",children:i("stash.savingImage",{count:p.pendingImageCount})}):dT(p)>0?u("span",{className:"shrink-0 text-[10px] text-warning-foreground",children:i("stash.imagesDropped",{count:dT(p)})}):null,p.attachments.length>0?u("span",{className:"flex shrink-0 items-center -space-x-1.5",children:p.attachments.slice(0,3).map(m=>u("img",{src:m.dataUrl,alt:"","aria-hidden":"true",className:"size-5 rounded border border-border/70 object-cover"},m.id))}):null,u("span",{className:"shrink-0 text-secondary-label text-xs max-sm:hidden",children:aT(p.createdAt)}),u(te,{variant:"ghost",size:"icon-xs",className:"pointer-events-none shrink-0 [--control-icon-color:currentColor] opacity-0 shadow-none! transition-opacity pointer-coarse:pointer-events-auto pointer-coarse:opacity-100 group-hover/stash:pointer-events-auto group-hover/stash:opacity-100 group-focus-within/stash:pointer-events-auto group-focus-within/stash:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100","aria-label":i("stash.deleteLabel"),onClick:m=>{m.stopPropagation(),r(p)},children:u(jt,{className:"stroke-2"})})]},p.id))})})]})})});me();function fT(e){let t=new Map;return e.map(n=>{let o=t.get(n.step)??0;return t.set(n.step,o+1),{key:`${n.step}:${o}`,step:n}})}function uT({className:e,steps:t}){return t.length<=1?null:u("span",{"aria-hidden":!0,className:F("flex w-10 shrink-0 items-center gap-0.5",e),children:fT(t).map(({key:n,step:o})=>u("span",{className:F("h-[3px] min-w-0 flex-1 rounded-full",o.status==="completed"?"bg-success":o.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},n))})}var fv=ue(function({expanded:t,hasTrailingShoulder:n=!1,onDismiss:o,onToggle:r,placement:a="tab",progress:i,steps:s}){let{t:l}=De();if(i.totalSteps<=0)return null;let d=i.completedSteps>=i.totalSteps,c=l("tasksBadge.ariaLabel",{completed:i.completedSteps,total:i.totalSteps,step:i.step});return a==="inline"?b("span",{className:"inline-flex shrink-0 items-center gap-0.5","data-composer-tasks-badge":"true",children:[b(te,{size:"micro",variant:"ghost-muted","aria-expanded":t,"aria-label":c,className:"shrink-0 gap-1 px-1.5",onClick:r,onPointerDown:f=>f.preventDefault(),children:[u(Yi,{"aria-hidden":!0,className:"size-3 shrink-0"}),u("span",{children:l("tasksBadge.label")}),u(uT,{steps:s}),b("span",{className:F("font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]})]}),u(te,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(jt,{"aria-hidden":!0,className:"size-2.5"})})]}):b("div",{className:F("chat-composer-shoulder-tab chat-composer-tasks-tab absolute -top-7 left-4 z-0 flex h-8 items-center gap-1 rounded-t-xl border border-b-0 px-2 pb-1 text-xs leading-none text-muted-foreground",n?"right-28":"right-4",d&&"text-foreground"),"data-composer-tasks-badge":"true",children:[b("button",{type:"button","aria-expanded":t,"aria-label":c,className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 self-stretch text-muted-foreground hover:text-foreground",onClick:r,onPointerDown:f=>f.preventDefault(),children:[u(Yi,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"shrink-0",children:"Tasks"}),u("span",{className:"min-w-0 flex-1 truncate text-left font-medium text-foreground/80","data-composer-task-current":"true",children:i.step}),b("span",{className:F("shrink-0 font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]}),u(uT,{className:"w-20",steps:s})]}),u(te,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(jt,{"aria-hidden":!0,className:"size-3"})})]})}),pT=ue(function({onDismiss:t,onCollapse:n,progress:o,steps:r}){let{t:a}=De();return b("div",{className:"chat-composer-top-drawer","data-chat-composer-tasks-drawer":"true",children:[b("div",{className:"flex items-center gap-1 px-3 py-1.5 sm:px-4",children:[b("button",{type:"button","aria-expanded":"true",className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 self-stretch text-left text-xs text-muted-foreground hover:text-foreground",onClick:n,onPointerDown:i=>i.preventDefault(),children:[u(Yi,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"font-medium text-foreground",children:a("tasksBadge.label")}),b("span",{className:"tabular-nums",children:[o.completedSteps,"/",o.totalSteps]})]}),u(te,{size:"icon-micro",variant:"ghost-muted","aria-label":a("tasksBadge.dismissLabel"),className:"shrink-0",onClick:t,onPointerDown:i=>i.preventDefault(),children:u(jt,{"aria-hidden":!0,className:"size-3"})})]}),u("div",{className:"space-y-px px-3 pb-4 sm:px-4",role:"list",children:fT(r).map(({key:i,step:s})=>b("div",{className:"flex items-baseline gap-2 text-xs leading-5",role:"listitem",children:[u("span",{"aria-hidden":!0,className:F("w-3 shrink-0 text-center font-mono text-[10px]",s.status==="completed"?"text-success":s.status==="inProgress"?"text-primary":"text-muted-foreground/40"),children:s.status==="completed"?"\u2713":s.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:F("min-w-0 flex-1",s.status==="completed"?"text-muted-foreground/55":s.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:s.step}),u("span",{className:"ml-auto w-10 shrink-0 text-right text-[10px] text-muted-foreground/45 tabular-nums","data-composer-task-duration":"true",children:s.durationMs!==void 0?ss(s.durationMs):s.status==="inProgress"?a("tasksBadge.now"):null})]},i))})]})});function mT(e){let t=0,n=0;for(let o of e.imageIds){let r=e.uploadsByImageId[o];r?.status==="failed"&&r.environmentId===e.environmentId?n+=1:(r?.status!=="ready"||r.environmentId!==e.environmentId)&&(t+=1)}return n>0?n===1?"Retry or remove the failed image":"Retry or remove the failed images":t>0?t===1?"Image still uploading":"Images still uploading":null}function fp(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0));return`${Math.floor(t*100)}%`}function gT(e){switch(e){case"image":return Xi;case"pdf":return Qi;case"text":return ji;case"file":return Ro}}var hT="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium leading-none align-middle",vT=`${hT} border border-border/70 bg-accent/40 text-foreground`,A5=`${vT} text-[12px]`,mi=`${vT} text-[0.86em] select-none`,pp="relative inline-flex align-[-0.125em] leading-none data-[composer-chip-selected]:after:pointer-events-none data-[composer-chip-selected]:after:absolute data-[composer-chip-selected]:after:inset-0 data-[composer-chip-selected]:after:rounded-[6px] data-[composer-chip-selected]:after:bg-[Highlight] data-[composer-chip-selected]:after:opacity-30 data-[composer-chip-selected]:after:content-['']",Zr="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",xT="truncate leading-tight",ea="block self-center truncate leading-tight select-none",yT=`${hT} select-none border border-fuchsia-500/25 bg-fuchsia-500/12 text-[0.86em] text-fuchsia-700 dark:text-fuchsia-300`,CT='<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>',mp="ml-[0.17em] inline-flex size-[1.17em] shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/72 transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring";function E5(e,t,n){let o=[];o.push(t(e));let r=n(e);return r&&o.push(r),e.pageUrl&&o.push(e.pageUrl),e.selector&&o.push(e.selector),e.htmlPreview.trim().length>0&&(o.push(""),o.push(e.htmlPreview.trim().slice(0,600))),o.join(`
3697
- `)}function M5({context:e,onRemove:t}){let{t:n}=De(),o=Ot().elementContext,r=o.formatLabel(e),a=o.formatSourceLabel(e);return b(Qe,{children:[u(Ye,{render:b("span",{className:F(mi,"pr-1"),children:[u(Qr,{className:F(Zr,"size-icon-1")}),u("span",{className:ea,children:r}),a?u("span",{className:"select-none text-[10px] font-normal leading-tight text-muted-foreground/85",children:a}):null,u("button",{type:"button","aria-label":n("pendingContext.removeElement",{label:r}),className:mp,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(e.id)},children:u(jt,{className:"size-3","aria-hidden":!0})})]})}),u(Xe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:E5(e,o.formatLabel,o.formatSourceLabel)})]})}function bT({contexts:e,onRemove:t,className:n}){return e.length===0?null:u("div",{className:F("flex flex-wrap gap-1.5",n),children:e.map(o=>u(M5,{context:o,onRemove:t},o.id))})}function IT({comments:e,onRemove:t,className:n}){let{t:o}=De();return e.length===0?null:u("div",{className:F("flex flex-wrap gap-1.5",n),children:e.map(r=>{let a=`${r.filePath} ${r.rangeLabel}`,i=b("span",{className:F(mi,"pr-1"),children:[u(Ji,{className:F(Zr,"size-icon-1")}),u("span",{className:ea,children:a}),u("button",{type:"button","aria-label":o("pendingContext.removeReviewComment",{label:a}),className:mp,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(r.id)},children:u(jt,{className:"size-3","aria-hidden":!0})})]},r.id);return r.text.length===0?i:b(Qe,{children:[u(Ye,{render:i}),u(Xe,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:r.text})]},r.id)})})}function gp(e){let t=`${e.count} ${e.label}${e.count===1?"":"s"}`;return b(Qe,{children:[u(Ye,{render:b("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground",children:[e.icon,e.count]})}),u(Xe,{side:"top",children:t})]})}function ST({annotations:e,images:t,onRemove:n,onExpandImage:o,uploadsByImageId:r,onRetryUpload:a,className:i}){let{t:s}=De(),l=Ot().elementContext;if(e.length===0)return null;let d=new Map(t.map(c=>[c.id,c]));return u("div",{className:F("flex flex-wrap gap-1.5",i),children:e.map(c=>{let f=d.get(c.id),p=f?r?.[f.id]:void 0,m=c.elements.flatMap(h=>{let g=l.normalizeSelection(h.element);return g?[{id:h.id,label:l.formatLabel(g)}]:[]});return b("section",{className:"group/preview-annotation relative flex min-w-0 max-w-full items-center overflow-hidden rounded-lg border border-border/80 bg-background/72",children:[f?.previewUrl?u("button",{type:"button","aria-label":s("previewAnnotation.previewImage",{name:f.name}),className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted",onClick:()=>o(f.id),children:u("img",{src:f.previewUrl,alt:s("previewAnnotation.cropAlt"),className:"size-full object-cover transition-transform duration-(--control-duration) group-hover/preview-annotation:scale-[1.03]"})}):u("span",{className:"grid size-10 shrink-0 place-items-center border-r border-border/70 text-message-action",children:u(Qr,{className:"size-icon-2"})}),b("div",{className:"min-w-0 px-2.5 py-2 pr-8",children:[c.comment.trim()?u("p",{className:"max-w-80 truncate text-foreground text-xs font-medium",children:c.comment.trim()}):null,b("div",{className:F("flex min-w-0 items-center gap-2",c.comment.trim()&&"mt-1"),children:[m.length>0?b("div",{className:"flex min-w-0 items-center gap-1",children:[m.slice(0,2).map(({id:h,label:g})=>u("span",{className:"max-w-40 truncate font-mono text-secondary-label text-[10px]",children:g},h)),m.length>2?b("span",{className:"text-secondary-label text-[10px]",children:["+",m.length-2]}):null]}):null,b("div",{className:"flex shrink-0 items-center gap-2",children:[c.elements.length>0?u(gp,{icon:u(Qr,{className:"size-3"}),count:c.elements.length,label:"element"}):null,c.regions.length>0?u(gp,{icon:u(Dd,{className:"size-3"}),count:c.regions.length,label:"region"}):null,c.strokes.length>0?u(gp,{icon:u(Xr,{className:"size-3"}),count:c.strokes.length,label:"drawing"}):null,c.styleChanges.length>0?u(gp,{icon:u(es,{className:"size-3"}),count:c.styleChanges.length,label:"style change"}):null,p?.status==="uploading"?u("span",{className:"text-[10px] text-secondary-label",children:fp(p.progress)}):null,p?.status==="failed"&&f&&a?b(Qe,{children:[u(Ye,{render:u(te,{size:"icon-micro",variant:"ghost-muted","aria-label":`Retry upload for ${f.name}`,onClick:()=>a(f)}),children:u(ns,{className:"size-3"})}),u(Xe,{side:"top",children:p.reason})]}):null]})]})]}),u(te,{size:"icon-micro",variant:"ghost-muted","aria-label":s("previewAnnotation.remove"),className:"absolute right-1.5 top-1.5 [--control-icon-color:currentColor] rounded text-icon-muted hover:bg-muted",onClick:()=>n(c.id),children:u(jt,{className:"size-3"})})]},c.id)})})}me();function wT(e,t){let n=t?.hasWideActions?780:620;return e!==null&&e<n}function TT(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function LT(e,t){let n=Ot().pane.useVisible(),[o,r]=G(null);ye(()=>{if(!n)return;let i=e.current;if(!i)return;let s=!0;if(typeof ResizeObserver<"u"){let c=new ResizeObserver(f=>{if(!s)return;let p=f.find(v=>v.target===i);if(!p)return;let m=window.getComputedStyle(i),h=Number.parseFloat(m.paddingLeft)||0,g=Number.parseFloat(m.paddingRight)||0;r(Math.round(p.contentRect.width+h+g))});return c.observe(i),()=>{s=!1,c.disconnect()}}let l=null,d=()=>{l===null&&(l=window.requestAnimationFrame(()=>{l=null,s&&r(i.clientWidth)}))};return d(),window.addEventListener("resize",d),()=>{s=!1,window.removeEventListener("resize",d),l!==null&&window.cancelAnimationFrame(l)}},[e,n]);let a=wT(o,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&TT(o,{hasWideActions:t})}}var pv={};An(pv,{LexicalComposerContext:()=>kT,createLexicalComposerContext:()=>R5,useLexicalComposerContext:()=>N5});me();var kT=Ht(null);function R5(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}}function N5(){let e=fn(kT);return e==null&&(function(t,...n){let o=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(let a of n)r.append("v",a);throw o.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),e}var mv=pv,PT=mv.LexicalComposerContext,AT=mv.createLexicalComposerContext,In=mv.useLexicalComposerContext;var Kx={};An(Kx,{$addUpdateTag:()=>em,$applyNodeReplacement:()=>Xc,$caretFromPoint:()=>wi,$caretRangeFromSelection:()=>tx,$cloneWithProperties:()=>Ox,$cloneWithPropertiesEphemeral:()=>hH,$comparePointCaretNext:()=>$x,$copyNode:()=>_x,$create:()=>xH,$createLineBreakNode:()=>Dl,$createNodeSelection:()=>yx,$createParagraphNode:()=>Ea,$createPoint:()=>Pr,$createRangeSelection:()=>yk,$createRangeSelectionFromDom:()=>V$,$createTabNode:()=>jp,$createTextNode:()=>jn,$extendCaretToRange:()=>Bx,$findMatchingParent:()=>Mc,$getAdjacentChildCaret:()=>Kl,$getAdjacentNode:()=>zk,$getAdjacentSiblingOrParentSiblingCaret:()=>LH,$getCaretInDirection:()=>Ti,$getCaretRange:()=>Si,$getCaretRangeInDirection:()=>Ux,$getCharacterOffsets:()=>Gv,$getChildCaret:()=>Ra,$getChildCaretAtIndex:()=>eP,$getChildCaretOrSelf:()=>Qk,$getCollapsedCaretRange:()=>Xk,$getCommonAncestor:()=>Rc,$getCommonAncestorResultBranchOrder:()=>Hx,$getEditor:()=>Dx,$getNearestNodeFromDOMNode:()=>Zp,$getNearestRootOrShadowRoot:()=>Uk,$getNodeByKey:()=>Bn,$getNodeByKeyOrThrow:()=>Kk,$getNodeFromDOMNode:()=>kx,$getPreviousSelection:()=>Es,$getRoot:()=>Ko,$getSelection:()=>St,$getSiblingCaret:()=>Zn,$getState:()=>kp,$getStateChange:()=>u$,$getTextContent:()=>j$,$getTextNodeOffset:()=>kr,$getTextPointCaret:()=>Ii,$getTextPointCaretSlice:()=>Zv,$getWritableNodeState:()=>ax,$hasAncestor:()=>Up,$hasUpdateTag:()=>uH,$insertNodes:()=>G$,$isBlockElementNode:()=>q$,$isChildCaret:()=>Lr,$isDecoratorNode:()=>Qt,$isEditorState:()=>J$,$isElementNode:()=>Q,$isExtendableTextPointCaret:()=>Zk,$isInlineElementOrDecoratorNode:()=>fH,$isLeafNode:()=>lH,$isLineBreakNode:()=>Ss,$isNodeCaret:()=>bH,$isNodeSelection:()=>Wc,$isParagraphNode:()=>Lk,$isRangeSelection:()=>Ue,$isRootNode:()=>to,$isRootOrShadowRoot:()=>cr,$isSiblingCaret:()=>As,$isTabNode:()=>xx,$isTextNode:()=>Me,$isTextPointCaret:()=>Ma,$isTextPointCaretSlice:()=>TH,$isTokenOrSegmented:()=>ka,$isTokenOrTab:()=>vi,$nodesOfType:()=>cH,$normalizeCaret:()=>wr,$normalizeSelection__EXPERIMENTAL:()=>Pp,$onUpdate:()=>Hk,$parseSerializedNode:()=>Y$,$removeTextFromCaretRange:()=>Jk,$rewindSiblingCaret:()=>Gl,$selectAll:()=>dH,$setCompositionKey:()=>Xn,$setPointFromCaret:()=>ql,$setSelection:()=>Do,$setSelectionFromCaretRange:()=>Yk,$setState:()=>f$,$splitAtPointCaretNext:()=>AH,$splitNode:()=>pH,$updateRangeSelectionFromCaretRange:()=>Nc,ArtificialNode__DO_NOT_USE:()=>$p,BEFORE_INPUT_COMMAND:()=>sx,BLUR_COMMAND:()=>JL,CAN_REDO_COMMAND:()=>w$,CAN_UNDO_COMMAND:()=>T$,CLEAR_EDITOR_COMMAND:()=>I$,CLEAR_HISTORY_COMMAND:()=>S$,CLICK_COMMAND:()=>DL,COLLABORATION_TAG:()=>dk,COMMAND_PRIORITY_CRITICAL:()=>oH,COMMAND_PRIORITY_EDITOR:()=>Al,COMMAND_PRIORITY_HIGH:()=>nH,COMMAND_PRIORITY_LOW:()=>eH,COMMAND_PRIORITY_NORMAL:()=>tH,COMPOSITION_END_COMMAND:()=>cx,COMPOSITION_END_TAG:()=>pk,COMPOSITION_START_COMMAND:()=>dx,COMPOSITION_START_TAG:()=>fk,CONTROLLED_TEXT_INSERTION_COMMAND:()=>Ml,COPY_COMMAND:()=>gx,CUT_COMMAND:()=>hx,DELETE_CHARACTER_COMMAND:()=>Fc,DELETE_LINE_COMMAND:()=>zc,DELETE_WORD_COMMAND:()=>Bc,DRAGEND_COMMAND:()=>XL,DRAGOVER_COMMAND:()=>QL,DRAGSTART_COMMAND:()=>jL,DROP_COMMAND:()=>GL,DecoratorNode:()=>Hc,ElementNode:()=>Ci,FOCUS_COMMAND:()=>YL,FORMAT_ELEMENT_COMMAND:()=>b$,FORMAT_TEXT_COMMAND:()=>gi,HISTORIC_TAG:()=>N$,HISTORY_MERGE_TAG:()=>wp,HISTORY_PUSH_TAG:()=>_$,INDENT_CONTENT_COMMAND:()=>y$,INPUT_COMMAND:()=>lx,INSERT_LINE_BREAK_COMMAND:()=>Pc,INSERT_PARAGRAPH_COMMAND:()=>Fv,INSERT_TAB_COMMAND:()=>x$,INTERNAL_$isBlock:()=>Aa,IS_ALL_FORMATTING:()=>W5,IS_BOLD:()=>z5,IS_CODE:()=>K5,IS_HIGHLIGHT:()=>nx,IS_ITALIC:()=>$5,IS_STRIKETHROUGH:()=>H5,IS_SUBSCRIPT:()=>q5,IS_SUPERSCRIPT:()=>V5,IS_UNDERLINE:()=>U5,KEY_ARROW_DOWN_COMMAND:()=>HL,KEY_ARROW_LEFT_COMMAND:()=>BL,KEY_ARROW_RIGHT_COMMAND:()=>OL,KEY_ARROW_UP_COMMAND:()=>$L,KEY_BACKSPACE_COMMAND:()=>KL,KEY_DELETE_COMMAND:()=>VL,KEY_DOWN_COMMAND:()=>mx,KEY_ENTER_COMMAND:()=>Np,KEY_ESCAPE_COMMAND:()=>qL,KEY_MODIFIER_COMMAND:()=>ZL,KEY_SPACE_COMMAND:()=>UL,KEY_TAB_COMMAND:()=>WL,LineBreakNode:()=>_l,MOVE_TO_END:()=>FL,MOVE_TO_START:()=>zL,NODE_STATE_KEY:()=>a$,OUTDENT_CONTENT_COMMAND:()=>C$,PASTE_COMMAND:()=>ux,PASTE_TAG:()=>D$,ParagraphNode:()=>Bl,REDO_COMMAND:()=>px,REMOVE_TEXT_COMMAND:()=>Bv,RootNode:()=>Fl,SELECTION_CHANGE_COMMAND:()=>ix,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>v$,SELECT_ALL_COMMAND:()=>zv,SKIP_COLLAB_TAG:()=>O$,SKIP_DOM_SELECTION_TAG:()=>uk,SKIP_SCROLL_INTO_VIEW_TAG:()=>ck,SKIP_SELECTION_FOCUS_TAG:()=>Vv,TEXT_TYPE_TO_FORMAT:()=>fo,TabNode:()=>Ol,TextNode:()=>Ls,UNDO_COMMAND:()=>fx,addClassNamesToElement:()=>DH,buildImportMap:()=>R$,configExtension:()=>MH,createCommand:()=>Ge,createEditor:()=>rH,createSharedNodeState:()=>AL,createState:()=>c$,declarePeerDependency:()=>RH,defineExtension:()=>EH,flipDirection:()=>Li,getDOMOwnerDocument:()=>Rx,getDOMSelection:()=>Er,getDOMSelectionFromTarget:()=>qk,getDOMTextNode:()=>Ps,getEditorPropertyFromDOMNode:()=>jc,getNearestEditorFromDOMNode:()=>Lx,getRegisteredNode:()=>wx,getRegisteredNodeOrThrow:()=>Sx,getStaticNodeConfig:()=>Yc,getTextDirection:()=>sH,getTransformSetFromKlass:()=>Pk,isBlockDomNode:()=>Yv,isCurrentlyReadOnlyMode:()=>Vl,isDOMDocumentNode:()=>Mk,isDOMNode:()=>Wl,isDOMTextNode:()=>oa,isDOMUnmanaged:()=>jk,isDocumentFragment:()=>Vk,isExactShortcutMatch:()=>Pt,isHTMLAnchorElement:()=>mH,isHTMLElement:()=>ko,isInlineDomNode:()=>Wk,isLexicalEditor:()=>Yp,isModifierMatch:()=>Bk,isSelectionCapturedInDecoratorInput:()=>Tx,isSelectionWithinEditor:()=>Gc,makeStepwiseIterator:()=>zx,mergeRegister:()=>FH,normalizeClassNames:()=>Jc,removeClassNamesFromElement:()=>OH,removeFromParent:()=>xi,resetRandomKey:()=>aH,safeCast:()=>NH,setDOMUnmanaged:()=>vH,setNodeIndentFromDOM:()=>Gk,shallowMergeConfig:()=>_H,toggleTextFormatType:()=>Kc});function Z(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function bL(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);n.search=o.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Ar=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,_5=Ar&&"documentMode"in document?document.documentMode:null,Sr=Ar&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),yi=Ar&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Lp=!(!Ar||!("InputEvent"in window)||_5)&&"getTargetRanges"in new window.InputEvent("input"),qp=Ar&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Vc=Ar&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,D5=Ar&&/Android/.test(navigator.userAgent),IL=Ar&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Tv=Ar&&D5&&IL,Vp=Ar&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Sr&&!IL,O5=0,F5=1,B5=2,z5=1,$5=2,H5=4,U5=8,K5=16,q5=32,V5=64,nx=128,W5=2047,G5=1,j5=2,Q5=3,X5=4,Y5=5,J5=6,_c=qp||Vc||Vp?"\xA0":"\u200B",Wp=`
3696
+ `},HB={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function UB(e){let{announcements:t=HB,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=$B}=e,{announce:a,announcement:i}=K0(),s=ps("DndLiveRegion"),[l,d]=G(!1);if(K(()=>{d(!0)},[]),BB(z(()=>({onDragStart(f){let{active:p}=f;a(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:m}=f;t.onDragMove&&a(t.onDragMove({active:p,over:m}))},onDragOver(f){let{active:p,over:m}=f;a(t.onDragOver({active:p,over:m}))},onDragEnd(f){let{active:p,over:m}=f;a(t.onDragEnd({active:p,over:m}))},onDragCancel(f){let{active:p,over:m}=f;a(t.onDragCancel({active:p,over:m}))}}),[a,t])),!l)return null;let c=mn.createElement(mn.Fragment,null,mn.createElement(H0,{id:o,value:r.draggable}),mn.createElement(U0,{id:s,announcement:i}));return n?(0,hs.createPortal)(c,n):c}var Bn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Bn||(Bn={}));function sp(){}function rv(e,t){return z(()=>({sensor:e,options:t??{}}),[e,t])}function ow(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return z(()=>[...t].filter(o=>o!=null),[...t])}var wr=Object.freeze({x:0,y:0});function rw(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function aw(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function KB(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function q0(e){let{left:t,top:n,height:o,width:r}=e;return[{x:t,y:n},{x:t+r,y:n},{x:t,y:n+o},{x:t+r,y:n+o}]}function av(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function V0(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var iw=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=V0(t,t.left,t.top),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=rw(V0(l),r);a.push({id:s,data:{droppableContainer:i,value:d}})}}return a.sort(aw)},sw=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=q0(t),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=q0(l),c=r.reduce((p,m,h)=>p+rw(d[h],m),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:i,value:f}})}}return a.sort(aw)};function qB(e,t){let n=Math.max(t.top,e.top),o=Math.max(t.left,e.left),r=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=r-o,s=a-n;if(o<r&&n<a){let l=t.width*t.height,d=e.width*e.height,c=i*s,f=c/(l+d-c);return Number(f.toFixed(4))}return 0}var VB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=[];for(let a of o){let{id:i}=a,s=n.get(i);if(s){let l=qB(s,t);l>0&&r.push({id:i,data:{droppableContainer:a,value:l}})}}return r.sort(KB)};function WB(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function lw(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:wr}function GB(e){return function(n){for(var o=arguments.length,r=new Array(o>1?o-1:0),a=1;a<o;a++)r[a-1]=arguments[a];return r.reduce((i,s)=>({...i,top:i.top+e*s.y,bottom:i.bottom+e*s.y,left:i.left+e*s.x,right:i.right+e*s.x}),{...n})}}var jB=GB(1);function QB(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function XB(e,t,n){let o=QB(t);if(!o)return e;let{scaleX:r,scaleY:a,x:i,y:s}=o,l=e.left-i-(1-r)*parseFloat(n),d=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),c=r?e.width/r:e.width,f=a?e.height/a:e.height;return{width:c,height:f,top:d,right:l+c,bottom:d+f,left:l}}var YB={ignoreTransform:!1};function ys(e,t){t===void 0&&(t=YB);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:d,transformOrigin:c}=To(e).getComputedStyle(e);d&&(n=XB(n,d,c))}let{top:o,left:r,width:a,height:i,bottom:s,right:l}=n;return{top:o,left:r,width:a,height:i,bottom:s,right:l}}function W0(e){return ys(e,{ignoreTransform:!0})}function JB(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function ZB(e,t){return t===void 0&&(t=To(e).getComputedStyle(e)),t.position==="fixed"}function ez(e,t){t===void 0&&(t=To(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{let a=t[r];return typeof a=="string"?n.test(a):!1})}function Ac(e,t){let n=[];function o(r){if(t!=null&&n.length>=t||!r)return n;if(op(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!Al(r)||Qh(r)||n.includes(r))return n;let a=To(e).getComputedStyle(r);return r!==e&&ez(r,a)&&n.push(r),ZB(r,a)?n:o(r.parentNode)}return e?o(e):n}function dw(e){let[t]=Ac(e,1);return t??null}function Xh(e){return!bc||!e?null:us(e)?e:np(e)?op(e)||e===fs(e).scrollingElement?window:Al(e)?e:null:null}function cw(e){return us(e)?e.scrollX:e.scrollLeft}function uw(e){return us(e)?e.scrollY:e.scrollTop}function Zh(e){return{x:cw(e),y:uw(e)}}var Vn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Vn||(Vn={}));function fw(e){return!bc||!e?!1:e===document.scrollingElement}function pw(e){let t={x:0,y:0},n=fw(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},r=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=o.y,s=e.scrollLeft>=o.x;return{isTop:r,isLeft:a,isBottom:i,isRight:s,maxScroll:o,minScroll:t}}var tz={x:.2,y:.2};function nz(e,t,n,o,r){let{top:a,left:i,right:s,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=tz);let{isTop:d,isBottom:c,isLeft:f,isRight:p}=pw(e),m={x:0,y:0},h={x:0,y:0},g={height:t.height*r.y,width:t.width*r.x};return!d&&a<=t.top+g.height?(m.y=Vn.Backward,h.y=o*Math.abs((t.top+g.height-a)/g.height)):!c&&l>=t.bottom-g.height&&(m.y=Vn.Forward,h.y=o*Math.abs((t.bottom-g.height-l)/g.height)),!p&&s>=t.right-g.width?(m.x=Vn.Forward,h.x=o*Math.abs((t.right-g.width-s)/g.width)):!f&&i<=t.left+g.width&&(m.x=Vn.Backward,h.x=o*Math.abs((t.left+g.width-i)/g.width)),{direction:m,speed:h}}function oz(e){if(e===document.scrollingElement){let{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}let{top:t,left:n,right:o,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:o,bottom:r,width:e.clientWidth,height:e.clientHeight}}function mw(e){return e.reduce((t,n)=>ms(t,Zh(n)),wr)}function rz(e){return e.reduce((t,n)=>t+cw(n),0)}function az(e){return e.reduce((t,n)=>t+uw(n),0)}function iz(e,t){if(t===void 0&&(t=ys),!e)return;let{top:n,left:o,bottom:r,right:a}=t(e);dw(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var sz=[["x",["left","right"],rz],["y",["top","bottom"],az]],kc=class{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let o=Ac(n),r=mw(o);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,i,s]of sz)for(let l of i)Object.defineProperty(this,l,{get:()=>{let d=s(o),c=r[a]-d;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},vs=class{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...n)})},this.target=t}add(t,n,o){var r;(r=this.target)==null||r.addEventListener(t,n,o),this.listeners.push([t,n,o])}};function lz(e){let{EventTarget:t}=To(e);return e instanceof t?e:fs(e)}function Yh(e,t){let n=Math.abs(e.x),o=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+o**2)>t:"x"in t&&"y"in t?n>t.x&&o>t.y:"x"in t?n>t.x:"y"in t?o>t.y:!1}var lr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(lr||(lr={}));function G0(e){e.preventDefault()}function dz(e){e.stopPropagation()}var pt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(pt||(pt={}));var gw={start:[pt.Space,pt.Enter],cancel:[pt.Esc],end:[pt.Space,pt.Enter,pt.Tab]},cz=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case pt.Right:return{...n,x:n.x+25};case pt.Left:return{...n,x:n.x-25};case pt.Down:return{...n,y:n.y+25};case pt.Up:return{...n,y:n.y-25}}},Rl=class{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;let{event:{target:n}}=t;this.props=t,this.listeners=new vs(fs(n)),this.windowListeners=new vs(To(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(lr.Resize,this.handleCancel),this.windowListeners.add(lr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(lr.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:n}=this.props,o=t.node.current;o&&iz(o),n(wr)}handleKeyDown(t){if(Sc(t)){let{active:n,context:o,options:r}=this.props,{keyboardCodes:a=gw,coordinateGetter:i=cz,scrollBehavior:s="smooth"}=r,{code:l}=t;if(a.end.includes(l)){this.handleEnd(t);return}if(a.cancel.includes(l)){this.handleCancel(t);return}let{collisionRect:d}=o.current,c=d?{x:d.left,y:d.top}:wr;this.referenceCoordinates||(this.referenceCoordinates=c);let f=i(t,{active:n,context:o.current,currentCoordinates:c});if(f){let p=gs(f,c),m={x:0,y:0},{scrollableAncestors:h}=o.current;for(let g of h){let v=t.code,{isTop:x,isRight:y,isLeft:C,isBottom:S,maxScroll:L,minScroll:w}=pw(g),k=oz(g),I={x:Math.min(v===pt.Right?k.right-k.width/2:k.right,Math.max(v===pt.Right?k.left:k.left+k.width/2,f.x)),y:Math.min(v===pt.Down?k.bottom-k.height/2:k.bottom,Math.max(v===pt.Down?k.top:k.top+k.height/2,f.y))},T=v===pt.Right&&!y||v===pt.Left&&!C,E=v===pt.Down&&!S||v===pt.Up&&!x;if(T&&I.x!==f.x){let A=g.scrollLeft+p.x,N=v===pt.Right&&A<=L.x||v===pt.Left&&A>=w.x;if(N&&!p.y){g.scrollTo({left:A,behavior:s});return}N?m.x=g.scrollLeft-A:m.x=v===pt.Right?g.scrollLeft-L.x:g.scrollLeft-w.x,m.x&&g.scrollBy({left:-m.x,behavior:s});break}else if(E&&I.y!==f.y){let A=g.scrollTop+p.y,N=v===pt.Down&&A<=L.y||v===pt.Up&&A>=w.y;if(N&&!p.x){g.scrollTo({top:A,behavior:s});return}N?m.y=g.scrollTop-A:m.y=v===pt.Down?g.scrollTop-L.y:g.scrollTop-w.y,m.y&&g.scrollBy({top:-m.y,behavior:s});break}}this.handleMove(t,ms(gs(f,this.referenceCoordinates),m))}}}handleMove(t,n){let{onMove:o}=this.props;t.preventDefault(),o(n)}handleEnd(t){let{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){let{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Rl.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=gw,onActivation:r}=t,{active:a}=n,{code:i}=e.nativeEvent;if(o.start.includes(i)){let s=a.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),r?.({event:e.nativeEvent}),!0)}return!1}}];function j0(e){return!!(e&&"distance"in e)}function Q0(e){return!!(e&&"delay"in e)}var Lc=class{constructor(t,n,o){var r;o===void 0&&(o=lz(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;let{event:a}=t,{target:i}=a;this.props=t,this.events=n,this.document=fs(i),this.documentListeners=new vs(this.document),this.listeners=new vs(o),this.windowListeners=new vs(To(i)),this.initialCoordinates=(r=wc(a))!=null?r:wr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:o}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(lr.Resize,this.handleCancel),this.windowListeners.add(lr.DragStart,G0),this.windowListeners.add(lr.VisibilityChange,this.handleCancel),this.windowListeners.add(lr.ContextMenu,G0),this.documentListeners.add(lr.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Q0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(j0(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){let{active:o,onPending:r}=this.props;r(o,t,this.initialCoordinates,n)}handleStart(){let{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(lr.Click,dz,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(lr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;let{activated:o,initialCoordinates:r,props:a}=this,{onMove:i,options:{activationConstraint:s}}=a;if(!r)return;let l=(n=wc(t))!=null?n:wr,d=gs(r,l);if(!o&&s){if(j0(s)){if(s.tolerance!=null&&Yh(d,s.tolerance))return this.handleCancel();if(Yh(d,s.distance))return this.handleStart()}if(Q0(s)&&Yh(d,s.tolerance))return this.handleCancel();this.handlePending(s,d);return}t.cancelable&&t.preventDefault(),i(l)}handleEnd(){let{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){let{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===pt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},uz={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},Nl=class extends Lc{constructor(t){let{event:n}=t,o=fs(n.target);super(t,uz,o)}};Nl.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return!n.isPrimary||n.button!==0?!1:(o?.({event:n}),!0)}}];var fz={move:{name:"mousemove"},end:{name:"mouseup"}},ev;(function(e){e[e.RightClick=2]="RightClick"})(ev||(ev={}));var tv=class extends Lc{constructor(t){super(t,fz,fs(t.event.target))}};tv.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button===ev.RightClick?!1:(o?.({event:n}),!0)}}];var Jh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},nv=class extends Lc{constructor(t){super(t,Jh)}static setup(){return window.addEventListener(Jh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Jh.move.name,t)};function t(){}}};nv.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t,{touches:r}=n;return r.length>1?!1:(o?.({event:n}),!0)}}];var Tc;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Tc||(Tc={}));var lp;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(lp||(lp={}));function pz(e){let{acceleration:t,activator:n=Tc.Pointer,canScroll:o,draggingRect:r,enabled:a,interval:i=5,order:s=lp.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:c,delta:f,threshold:p}=e,m=gz({delta:f,disabled:!a}),[h,g]=B0(),v=D({x:0,y:0}),x=D({x:0,y:0}),y=z(()=>{switch(n){case Tc.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Tc.DraggableRect:return r}},[n,r,l]),C=D(null),S=B(()=>{let w=C.current;if(!w)return;let k=v.current.x*x.current.x,I=v.current.y*x.current.y;w.scrollBy(k,I)},[]),L=z(()=>s===lp.TreeOrder?[...d].reverse():d,[s,d]);K(()=>{if(!a||!d.length||!y){g();return}for(let w of L){if(o?.(w)===!1)continue;let k=d.indexOf(w),I=c[k];if(!I)continue;let{direction:T,speed:E}=nz(w,I,y,t,p);for(let A of["x","y"])m[A][T[A]]||(E[A]=0,T[A]=0);if(E.x>0||E.y>0){g(),C.current=w,h(S,i),v.current=E,x.current=T;return}}v.current={x:0,y:0},x.current={x:0,y:0},g()},[t,S,o,g,a,i,JSON.stringify(y),JSON.stringify(m),h,d,L,c,JSON.stringify(p)])}var mz={x:{[Vn.Backward]:!1,[Vn.Forward]:!1},y:{[Vn.Backward]:!1,[Vn.Forward]:!1}};function gz(e){let{delta:t,disabled:n}=e,o=ap(t);return Ml(r=>{if(n||!o||!r)return mz;let a={x:Math.sign(t.x-o.x),y:Math.sign(t.y-o.y)};return{x:{[Vn.Backward]:r.x[Vn.Backward]||a.x===-1,[Vn.Forward]:r.x[Vn.Forward]||a.x===1},y:{[Vn.Backward]:r.y[Vn.Backward]||a.y===-1,[Vn.Forward]:r.y[Vn.Forward]||a.y===1}}},[n,t,o])}function hz(e,t){let n=t!=null?e.get(t):void 0,o=n?n.node.current:null;return Ml(r=>{var a;return t==null?null:(a=o??r)!=null?a:null},[o,t])}function vz(e,t){return z(()=>e.reduce((n,o)=>{let{sensor:r}=o,a=r.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,o)}));return[...n,...a]},[]),[e,t])}var Pc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Pc||(Pc={}));var ov;(function(e){e.Optimized="optimized"})(ov||(ov={}));var X0=new Map;function xz(e,t){let{dragging:n,dependencies:o,config:r}=t,[a,i]=G(null),{frequency:s,measure:l,strategy:d}=r,c=D(e),f=v(),p=El(f),m=B(function(x){x===void 0&&(x=[]),!p.current&&i(y=>y===null?x:y.concat(x.filter(C=>!y.includes(C))))},[p]),h=D(null),g=Ml(x=>{if(f&&!n)return X0;if(!x||x===X0||c.current!==e||a!=null){let y=new Map;for(let C of e){if(!C)continue;if(a&&a.length>0&&!a.includes(C.id)&&C.rect.current){y.set(C.id,C.rect.current);continue}let S=C.node.current,L=S?new kc(l(S),S):null;C.rect.current=L,L&&y.set(C.id,L)}return y}return x},[e,a,n,f,l]);return K(()=>{c.current=e},[e]),K(()=>{f||m()},[n,f]),K(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),K(()=>{f||typeof s!="number"||h.current!==null||(h.current=setTimeout(()=>{m(),h.current=null},s))},[s,f,m,...o]),{droppableRects:g,measureDroppableContainers:m,measuringScheduled:a!=null};function v(){switch(d){case Pc.Always:return!1;case Pc.BeforeDragging:return n;default:return!n}}}function hw(e,t){return Ml(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function yz(e,t){return hw(e,t)}function Cz(e){let{callback:t,disabled:n}=e,o=rp(t),r=z(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(o)},[o,n]);return K(()=>()=>r?.disconnect(),[r]),r}function dp(e){let{callback:t,disabled:n}=e,o=rp(t),r=z(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(o)},[n]);return K(()=>()=>r?.disconnect(),[r]),r}function bz(e){return new kc(ys(e),e)}function Y0(e,t,n){t===void 0&&(t=bz);let[o,r]=G(null);function a(){r(l=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=l??n)!=null?d:null}let c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c})}let i=Cz({callback(l){if(e)for(let d of l){let{type:c,target:f}=d;if(c==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),s=dp({callback:a});return sr(()=>{a(),e?(s?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[e]),o}function Iz(e){let t=hw(e);return lw(e,t)}var J0=[];function Sz(e){let t=D(e),n=Ml(o=>e?o&&o!==J0&&e&&t.current&&e.parentNode===t.current.parentNode?o:Ac(e):J0,[e]);return K(()=>{t.current=e},[e]),n}function wz(e){let[t,n]=G(null),o=D(e),r=B(a=>{let i=Xh(a.target);i&&n(s=>s?(s.set(i,Zh(i)),new Map(s)):null)},[]);return K(()=>{let a=o.current;if(e!==a){i(a);let s=e.map(l=>{let d=Xh(l);return d?(d.addEventListener("scroll",r,{passive:!0}),[d,Zh(d)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),o.current=e}return()=>{i(e),i(a)};function i(s){s.forEach(l=>{let d=Xh(l);d?.removeEventListener("scroll",r)})}},[r,e]),z(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>ms(a,i),wr):mw(e):wr,[e,t])}function Z0(e,t){t===void 0&&(t=[]);let n=D(null);return K(()=>{n.current=null},t),K(()=>{let o=e!==wr;o&&!n.current&&(n.current=e),!o&&n.current&&(n.current=null)},[e]),n.current?gs(e,n.current):wr}function Tz(e){K(()=>{if(!bc)return;let t=e.map(n=>{let{sensor:o}=n;return o.setup==null?void 0:o.setup()});return()=>{for(let n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function kz(e,t){return z(()=>e.reduce((n,o)=>{let{eventName:r,handler:a}=o;return n[r]=i=>{a(i,t)},n},{}),[e,t])}function vw(e){return z(()=>e?JB(e):null,[e])}var ew=[];function Lz(e,t){t===void 0&&(t=ys);let[n]=e,o=vw(n?To(n):null),[r,a]=G(ew);function i(){a(()=>e.length?e.map(l=>fw(l)?o:new kc(t(l),l)):ew)}let s=dp({callback:i});return sr(()=>{s?.disconnect(),i(),e.forEach(l=>s?.observe(l))},[e]),r}function Pz(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Al(t)?t:e}function Az(e){let{measure:t}=e,[n,o]=G(null),r=B(d=>{for(let{target:c}of d)if(Al(c)){o(f=>{let p=t(c);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=dp({callback:r}),i=B(d=>{let c=Pz(d);a?.disconnect(),c&&a?.observe(c),o(c?t(c):null)},[t,a]),[s,l]=Ic(i);return z(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}var Ez=[{sensor:Nl,options:{}},{sensor:Rl,options:{}}],Mz={current:{}},ip={draggable:{measure:W0},droppable:{measure:W0,strategy:Pc.WhileDragging,frequency:ov.Optimized},dragOverlay:{measure:ys}},xs=class extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,o;return(n=(o=this.get(t))==null?void 0:o.node.current)!=null?n:void 0}},Rz={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new xs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:sp},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ip,measureDroppableContainers:sp,windowRect:null,measuringScheduled:!1},Nz={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:sp,draggableNodes:new Map,over:null,measureDroppableContainers:sp},cp=Ut(Nz),xw=Ut(Rz);function _z(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new xs}}}function Dz(e,t){switch(t.type){case Bn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Bn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Bn.DragEnd:case Bn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Bn.RegisterDroppable:{let{element:n}=t,{id:o}=n,r=new xs(e.droppable.containers);return r.set(o,n),{...e,droppable:{...e.droppable,containers:r}}}case Bn.SetDroppableDisabled:{let{id:n,key:o,disabled:r}=t,a=e.droppable.containers.get(n);if(!a||o!==a.key)return e;let i=new xs(e.droppable.containers);return i.set(n,{...a,disabled:r}),{...e,droppable:{...e.droppable,containers:i}}}case Bn.UnregisterDroppable:{let{id:n,key:o}=t,r=e.droppable.containers.get(n);if(!r||o!==r.key)return e;let a=new xs(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Oz(e){let{disabled:t}=e,{active:n,activatorEvent:o,draggableNodes:r}=ln(cp),a=ap(o),i=ap(n?.id);return K(()=>{if(!t&&!o&&a&&i!=null){if(!Sc(a)||document.activeElement===a.target)return;let s=r.get(i);if(!s)return;let{activatorNode:l,node:d}=s;if(!l.current&&!d.current)return;requestAnimationFrame(()=>{for(let c of[l.current,d.current]){if(!c)continue;let f=$0(c);if(f){f.focus();break}}})}},[o,t,r,i,a]),null}function Fz(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...o}),n):n}function Bz(e){return z(()=>({draggable:{...ip.draggable,...e?.draggable},droppable:{...ip.droppable,...e?.droppable},dragOverlay:{...ip.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function zz(e){let{activeNode:t,measure:n,initialRect:o,config:r=!0}=e,a=D(!1),{x:i,y:s}=typeof r=="boolean"?{x:r,y:r}:r;sr(()=>{if(!i&&!s||!t){a.current=!1;return}if(a.current||!o)return;let d=t?.node.current;if(!d||d.isConnected===!1)return;let c=n(d),f=lw(c,o);if(i||(f.x=0),s||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){let p=dw(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,s,o,n])}var yw=Ut({...wr,scaleX:1,scaleY:1}),Ci;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ci||(Ci={}));var Cw=de(function(t){var n,o,r,a;let{id:i,accessibility:s,autoScroll:l=!0,children:d,sensors:c=Ez,collisionDetection:f=VB,measuring:p,modifiers:m,...h}=t,g=si(Dz,void 0,_z),[v,x]=g,[y,C]=zB(),[S,L]=G(Ci.Uninitialized),w=S===Ci.Initialized,{draggable:{active:k,nodes:I,translate:T},droppable:{containers:E}}=v,A=k!=null?I.get(k):null,N=D({initial:null,translated:null}),R=z(()=>{var X;return k!=null?{id:k,data:(X=A?.data)!=null?X:Mz,rect:N}:null},[k,A]),$=D(null),[U,H]=G(null),[F,oe]=G(null),ee=El(h,Object.values(h)),W=ps("DndDescribedBy",i),Ze=z(()=>E.getEnabled(),[E]),ue=Bz(p),{droppableRects:pe,measureDroppableContainers:Fe,measuringScheduled:Le}=xz(Ze,{dragging:w,dependencies:[T.x,T.y],config:ue.droppable}),ie=hz(I,k),Ie=z(()=>F?wc(F):null,[F]),ve=Z(),re=yz(ie,ue.draggable.measure);zz({activeNode:k!=null?I.get(k):null,config:ve.layoutShiftCompensation,initialRect:re,measure:ue.draggable.measure});let be=Y0(ie,ue.draggable.measure,re),rt=Y0(ie?ie.parentElement:null),dt=D({activatorEvent:null,active:null,activeNode:ie,collisionRect:null,collisions:null,droppableRects:pe,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),st=E.getNodeFor((n=dt.current.over)==null?void 0:n.id),ct=Az({measure:ue.dragOverlay.measure}),Zt=(o=ct.nodeRef.current)!=null?o:ie,at=w?(r=ct.rect)!=null?r:be:null,_e=!!(ct.nodeRef.current&&ct.rect),He=Iz(_e?null:be),qe=vw(Zt?To(Zt):null),Be=Sz(w?st??ie:null),Vt=Lz(Be),he=Fz(m,{transform:{x:T.x-He.x,y:T.y-He.y,scaleX:1,scaleY:1},activatorEvent:F,active:R,activeNodeRect:be,containerNodeRect:rt,draggingNodeRect:at,over:dt.current.over,overlayNodeRect:ct.rect,scrollableAncestors:Be,scrollableAncestorRects:Vt,windowRect:qe}),sn=Ie?ms(Ie,T):null,Re=wz(Be),Jn=Z0(Re),lt=Z0(Re,[be]),kt=ms(he,Jn),Nt=at?jB(at,he):null,en=R&&Nt?f({active:R,collisionRect:Nt,droppableRects:pe,droppableContainers:Ze,pointerCoordinates:sn}):null,gn=av(en,"id"),[Pn,An]=G(null),hn=_e?he:ms(he,lt),cn=WB(hn,(a=Pn?.rect)!=null?a:null,be),Yt=D(null),Hn=B((X,ae)=>{let{sensor:fe,options:ft}=ae;if($.current==null)return;let ut=I.get($.current);if(!ut)return;let vt=X.nativeEvent,_t=new fe({active:$.current,activeNode:ut,event:vt,options:ft,context:dt,onAbort(xt){if(!I.get(xt))return;let{onDragAbort:tn}=ee.current,un={id:xt};tn?.(un),y({type:"onDragAbort",event:un})},onPending(xt,vn,tn,un){if(!I.get(xt))return;let{onDragPending:me}=ee.current,St={id:xt,constraint:vn,initialCoordinates:tn,offset:un};me?.(St),y({type:"onDragPending",event:St})},onStart(xt){let vn=$.current;if(vn==null)return;let tn=I.get(vn);if(!tn)return;let{onDragStart:un}=ee.current,Zn={activatorEvent:vt,active:{id:vn,data:tn.data,rect:N}};(0,hs.unstable_batchedUpdates)(()=>{un?.(Zn),L(Ci.Initializing),x({type:Bn.DragStart,initialCoordinates:xt,active:vn}),y({type:"onDragStart",event:Zn}),H(Yt.current),oe(vt)})},onMove(xt){x({type:Bn.DragMove,coordinates:xt})},onEnd:Jt(Bn.DragEnd),onCancel:Jt(Bn.DragCancel)});Yt.current=_t;function Jt(xt){return async function(){let{active:tn,collisions:un,over:Zn,scrollAdjustedTranslate:me}=dt.current,St=null;if(tn&&me){let{cancelDrop:yt}=ee.current;St={activatorEvent:vt,active:tn,collisions:un,delta:me,over:Zn},xt===Bn.DragEnd&&typeof yt=="function"&&await Promise.resolve(yt(St))&&(xt=Bn.DragCancel)}$.current=null,(0,hs.unstable_batchedUpdates)(()=>{x({type:xt}),L(Ci.Uninitialized),An(null),H(null),oe(null),Yt.current=null;let yt=xt===Bn.DragEnd?"onDragEnd":"onDragCancel";if(St){let zt=ee.current[yt];zt?.(St),y({type:yt,event:St})}})}}},[I]),io=B((X,ae)=>(fe,ft)=>{let ut=fe.nativeEvent,vt=I.get(ft);if($.current!==null||!vt||ut.dndKit||ut.defaultPrevented)return;let _t={active:vt};X(fe,ae.options,_t)===!0&&(ut.dndKit={capturedBy:ae.sensor},$.current=ft,Hn(fe,ae))},[I,Hn]),It=vz(c,io);Tz(c),sr(()=>{be&&S===Ci.Initializing&&L(Ci.Initialized)},[be,S]),K(()=>{let{onDragMove:X}=ee.current,{active:ae,activatorEvent:fe,collisions:ft,over:ut}=dt.current;if(!ae||!fe)return;let vt={active:ae,activatorEvent:fe,collisions:ft,delta:{x:kt.x,y:kt.y},over:ut};(0,hs.unstable_batchedUpdates)(()=>{X?.(vt),y({type:"onDragMove",event:vt})})},[kt.x,kt.y]),K(()=>{let{active:X,activatorEvent:ae,collisions:fe,droppableContainers:ft,scrollAdjustedTranslate:ut}=dt.current;if(!X||$.current==null||!ae||!ut)return;let{onDragOver:vt}=ee.current,_t=ft.get(gn),Jt=_t&&_t.rect.current?{id:_t.id,rect:_t.rect.current,data:_t.data,disabled:_t.disabled}:null,xt={active:X,activatorEvent:ae,collisions:fe,delta:{x:ut.x,y:ut.y},over:Jt};(0,hs.unstable_batchedUpdates)(()=>{An(Jt),vt?.(xt),y({type:"onDragOver",event:xt})})},[gn]),sr(()=>{dt.current={activatorEvent:F,active:R,activeNode:ie,collisionRect:Nt,collisions:en,droppableRects:pe,draggableNodes:I,draggingNode:Zt,draggingNodeRect:at,droppableContainers:E,over:Pn,scrollableAncestors:Be,scrollAdjustedTranslate:kt},N.current={initial:at,translated:Nt}},[R,ie,en,Nt,I,Zt,at,pe,E,Pn,Be,kt]),pz({...ve,delta:T,draggingRect:Nt,pointerCoordinates:sn,scrollableAncestors:Be,scrollableAncestorRects:Vt});let Eo=z(()=>({active:R,activeNode:ie,activeNodeRect:be,activatorEvent:F,collisions:en,containerNodeRect:rt,dragOverlay:ct,draggableNodes:I,droppableContainers:E,droppableRects:pe,over:Pn,measureDroppableContainers:Fe,scrollableAncestors:Be,scrollableAncestorRects:Vt,measuringConfiguration:ue,measuringScheduled:Le,windowRect:qe}),[R,ie,be,F,en,rt,ct,I,E,pe,Pn,Fe,Be,Vt,ue,Le,qe]),_=z(()=>({activatorEvent:F,activators:It,active:R,activeNodeRect:be,ariaDescribedById:{draggable:W},dispatch:x,draggableNodes:I,over:Pn,measureDroppableContainers:Fe}),[F,It,R,be,x,W,I,Pn,Fe]);return mn.createElement(nw.Provider,{value:C},mn.createElement(cp.Provider,{value:_},mn.createElement(xw.Provider,{value:Eo},mn.createElement(yw.Provider,{value:cn},d)),mn.createElement(Oz,{disabled:s?.restoreFocus===!1})),mn.createElement(UB,{...s,hiddenTextDescribedById:W}));function Z(){let X=U?.autoScrollEnabled===!1,ae=typeof l=="object"?l.enabled===!1:l===!1,fe=w&&!X&&!ae;return typeof l=="object"?{...l,enabled:fe}:{enabled:fe}}}),$z=Ut(null),tw="button",Hz="Draggable";function bw(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e,a=ps(Hz),{activators:i,activatorEvent:s,active:l,activeNodeRect:d,ariaDescribedById:c,draggableNodes:f,over:p}=ln(cp),{role:m=tw,roleDescription:h="draggable",tabIndex:g=0}=r??{},v=l?.id===t,x=ln(v?yw:$z),[y,C]=Ic(),[S,L]=Ic(),w=kz(i,t),k=El(n);sr(()=>(f.set(t,{id:t,key:a,node:y,activatorNode:S,data:k}),()=>{let T=f.get(t);T&&T.key===a&&f.delete(t)}),[f,t]);let I=z(()=>({role:m,tabIndex:g,"aria-disabled":o,"aria-pressed":v&&m===tw?!0:void 0,"aria-roledescription":h,"aria-describedby":c.draggable}),[o,m,g,v,h,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:d,attributes:I,isDragging:v,listeners:o?void 0:w,node:y,over:p,setNodeRef:C,setActivatorNodeRef:L,transform:x}}function Iw(){return ln(xw)}var Uz="Droppable",Kz={timeout:25};function Sw(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e,a=ps(Uz),{active:i,dispatch:s,over:l,measureDroppableContainers:d}=ln(cp),c=D({disabled:n}),f=D(!1),p=D(null),m=D(null),{disabled:h,updateMeasurementsFor:g,timeout:v}={...Kz,...r},x=El(g??o),y=B(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(x.current)?x.current:[x.current]),m.current=null},v)},[v]),C=dp({callback:y,disabled:h||!i}),S=B((I,T)=>{C&&(T&&(C.unobserve(T),f.current=!1),I&&C.observe(I))},[C]),[L,w]=Ic(S),k=El(t);return K(()=>{!C||!L.current||(C.disconnect(),f.current=!1,C.observe(L.current))},[L,C]),K(()=>(s({type:Bn.RegisterDroppable,element:{id:o,key:a,disabled:n,node:L,rect:p,data:k}}),()=>s({type:Bn.UnregisterDroppable,key:a,id:o})),[o]),K(()=>{n!==c.current.disabled&&(s({type:Bn.SetDroppableDisabled,id:o,key:a,disabled:n}),c.current.disabled=n)},[o,a,n,s]),{active:i,rect:p,isOver:l?.id===o,node:L,over:l,setNodeRef:w}}ge();function ww(e,t,n){let o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function qz(e,t){return e.reduce((n,o,r)=>{let a=t.get(o);return a&&(n[r]=a),n},Array(e.length))}function up(e){return e!==null&&e>=0}function Vz(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Wz(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var Tw=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e,a=ww(t,o,n),i=t[r],s=a[r];return!s||!i?null:{x:s.left-i.left,y:s.top-i.top,scaleX:s.width/i.width,scaleY:s.height/i.height}};var fp={scaleX:1,scaleY:1},kw=e=>{var t;let{activeIndex:n,activeNodeRect:o,index:r,rects:a,overIndex:i}=e,s=(t=a[n])!=null?t:o;if(!s)return null;if(r===n){let d=a[i];return d?{x:0,y:n<i?d.top+d.height-(s.top+s.height):d.top-s.top,...fp}:null}let l=Gz(a,r,n);return r>n&&r<=i?{x:0,y:-s.height-l,...fp}:r<n&&r>=i?{x:0,y:s.height+l,...fp}:{x:0,y:0,...fp}};function Gz(e,t,n){let o=e[t],r=e[t-1],a=e[t+1];return o?n<t?r?o.top-(r.top+r.height):a?a.top-(o.top+o.height):0:a?a.top-(o.top+o.height):r?o.top-(r.top+r.height):0:0}var Lw="Sortable",Pw=mn.createContext({activeIndex:-1,containerId:Lw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Tw,disabled:{draggable:!1,droppable:!1}});function Aw(e){let{children:t,id:n,items:o,strategy:r=Tw,disabled:a=!1}=e,{active:i,dragOverlay:s,droppableRects:l,over:d,measureDroppableContainers:c}=Iw(),f=ps(Lw,n),p=s.rect!==null,m=z(()=>o.map(w=>typeof w=="object"&&"id"in w?w.id:w),[o]),h=i!=null,g=i?m.indexOf(i.id):-1,v=d?m.indexOf(d.id):-1,x=D(m),y=!Vz(m,x.current),C=v!==-1&&g===-1||y,S=Wz(a);sr(()=>{y&&h&&c(m)},[y,m,h,c]),K(()=>{x.current=m},[m]);let L=z(()=>({activeIndex:g,containerId:f,disabled:S,disableTransforms:C,items:m,overIndex:v,useDragOverlay:p,sortedRects:qz(m,l),strategy:r}),[g,f,S.draggable,S.droppable,C,m,v,l,p,r]);return mn.createElement(Pw.Provider,{value:L},t)}var jz=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return ww(n,o,r).indexOf(t)},Qz=e=>{let{containerId:t,isSorting:n,wasDragging:o,index:r,items:a,newIndex:i,previousItems:s,previousContainerId:l,transition:d}=e;return!d||!o||s!==a&&r===i?!1:n?!0:i!==r&&t===l},Xz={duration:200,easing:"ease"},Ew="transform",Yz=yi.Transition.toString({property:Ew,duration:0,easing:"linear"}),Jz={roleDescription:"sortable"};function Zz(e){let{disabled:t,index:n,node:o,rect:r}=e,[a,i]=G(null),s=D(n);return sr(()=>{if(!t&&n!==s.current&&o.current){let l=r.current;if(l){let d=ys(o.current,{ignoreTransform:!0}),c={x:l.left-d.left,y:l.top-d.top,scaleX:l.width/d.width,scaleY:l.height/d.height};(c.x||c.y)&&i(c)}}n!==s.current&&(s.current=n)},[t,n,o,r]),K(()=>{a&&i(null)},[a]),a}function Mw(e){let{animateLayoutChanges:t=Qz,attributes:n,disabled:o,data:r,getNewIndex:a=jz,id:i,strategy:s,resizeObserverConfig:l,transition:d=Xz}=e,{items:c,containerId:f,activeIndex:p,disabled:m,disableTransforms:h,sortedRects:g,overIndex:v,useDragOverlay:x,strategy:y}=ln(Pw),C=e5(o,m),S=c.indexOf(i),L=z(()=>({sortable:{containerId:f,index:S,items:c},...r}),[f,r,S,c]),w=z(()=>c.slice(c.indexOf(i)),[c,i]),{rect:k,node:I,isOver:T,setNodeRef:E}=Sw({id:i,data:L,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:w,...l}}),{active:A,activatorEvent:N,activeNodeRect:R,attributes:$,setNodeRef:U,listeners:H,isDragging:F,over:oe,setActivatorNodeRef:ee,transform:W}=bw({id:i,data:L,attributes:{...Jz,...n},disabled:C.draggable}),Ze=F0(E,U),ue=!!A,pe=ue&&!h&&up(p)&&up(v),Fe=!x&&F,Le=Fe&&pe?W:null,Ie=pe?Le??(s??y)({rects:g,activeNodeRect:R,activeIndex:p,overIndex:v,index:S}):null,ve=up(p)&&up(v)?a({id:i,items:c,activeIndex:p,overIndex:v}):S,re=A?.id,be=D({activeId:re,items:c,newIndex:ve,containerId:f}),rt=c!==be.current.items,dt=t({active:A,containerId:f,isDragging:F,isSorting:ue,id:i,index:S,items:c,newIndex:be.current.newIndex,previousItems:be.current.items,previousContainerId:be.current.containerId,transition:d,wasDragging:be.current.activeId!=null}),st=Zz({disabled:!dt,index:S,node:I,rect:k});return K(()=>{ue&&be.current.newIndex!==ve&&(be.current.newIndex=ve),f!==be.current.containerId&&(be.current.containerId=f),c!==be.current.items&&(be.current.items=c)},[ue,ve,f,c]),K(()=>{if(re===be.current.activeId)return;if(re!=null&&be.current.activeId==null){be.current.activeId=re;return}let Zt=setTimeout(()=>{be.current.activeId=re},50);return()=>clearTimeout(Zt)},[re]),{active:A,activeIndex:p,attributes:$,data:L,rect:k,index:S,newIndex:ve,items:c,isOver:T,isSorting:ue,isDragging:F,listeners:H,node:I,overIndex:v,over:oe,setNodeRef:Ze,setActivatorNodeRef:ee,setDroppableNodeRef:E,setDraggableNodeRef:U,transform:st??Ie,transition:ct()};function ct(){if(st||rt&&be.current.newIndex===S)return Yz;if(!(Fe&&!Sc(N)||!d)&&(ue||dt))return yi.Transition.toString({...d,property:Ew})}}function e5(e,t){var n,o;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(o=e?.droppable)!=null?o:t.droppable}}function pp(e){if(!e)return!1;let t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}var t5=[pt.Down,pt.Right,pt.Up,pt.Left],Rw=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:i,scrollableAncestors:s}}=t;if(t5.includes(e.code)){if(e.preventDefault(),!n||!o)return;let l=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;let p=r.get(f.id);if(p)switch(e.code){case pt.Down:o.top<p.top&&l.push(f);break;case pt.Up:o.top>p.top&&l.push(f);break;case pt.Left:o.left>p.left&&l.push(f);break;case pt.Right:o.left<p.left&&l.push(f);break}});let d=sw({active:n,collisionRect:o,droppableRects:r,droppableContainers:l,pointerCoordinates:null}),c=av(d,"id");if(c===i?.id&&d.length>1&&(c=d[1].id),c!=null){let f=a.get(n.id),p=a.get(c),m=p?r.get(p.id):null,h=p?.node.current;if(h&&m&&f&&p){let v=Ac(h).some((w,k)=>s[k]!==w),x=Nw(f,p),y=n5(f,p),C=v||!x?{x:0,y:0}:{x:y?o.width-m.width:0,y:y?o.height-m.height:0},S={x:m.left,y:m.top};return C.x&&C.y?S:gs(S,C)}}}};function Nw(e,t){return!pp(e)||!pp(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function n5(e,t){return!pp(e)||!pp(t)||!Nw(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function o5(e,t,n){let o={...e};return t.top+e.y<=n.top?o.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(o.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?o.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(o.x=n.left+n.width-t.right),o}var _w=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:o}=e,r=o[0];return!t||!r?n:o5(n,t,r)},Dw=e=>{let{transform:t}=e;return{...t,x:0}};ge();ge();var mp={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function Ow(e){return`(min-width: ${typeof e=="number"?e:mp[e]}px)`}function Fw(e){return`(max-width: ${(typeof e=="number"?e:mp[e])-1}px)`}function r5(e){if(typeof e!="string"){let n=[];return e.min!=null&&n.push(Ow(e.min)),e.max!=null&&n.push(Fw(e.max)),e.pointer==="coarse"&&n.push("(pointer: coarse)"),e.pointer==="fine"&&n.push("(pointer: fine)"),n.length===0?"(min-width: 0px)":n.join(" and ")}if(e.startsWith("("))return e;let t=[];for(let n of e.split(":"))if(n.startsWith("max-")){let o=n.slice(4);o in mp&&t.push(Fw(o))}else n in mp&&t.push(Ow(n));return t.length>0?t.join(" and "):e}function a5(){return!1}function gp(e){let t=r5(e),n=B(r=>{if(typeof window>"u")return()=>{};let a=window.matchMedia(t);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[t]),o=B(()=>typeof window>"u"?!1:window.matchMedia(t).matches,[t]);return ka(n,o,a5)}ge();var mo=new Map;function i5(e,t,n){return`${e}\0${t}\0${n??"none"}`}function iv(e,t){mo.delete(e),mo.set(e,t)}function _l(e,t){if(mo.get(e)===t){if(t.operationLeases>0){t.disposeRequested=!0;return}t.releaseAuthorityWatch?.(),t.releaseAuthorityWatch=void 0,mo.delete(e);for(let n of t.state.added)t.releaseUpload(n.id),URL.revokeObjectURL(n.previewUrl);for(let n of t.listeners)n()}}function s5(e){if(mo.size<=100)return;let t=Array.from(mo);for(let[n,o]of t){if(mo.size<=100)return;n===e||o.committed||o.listeners.size>0||o.operationLeases>0||_l(n,o)}for(let[n,o]of t){if(mo.size<=100)return;n===e||o.listeners.size>0||o.operationLeases>0||_l(n,o)}}function hp(){queueMicrotask(()=>s5())}function Bw(e,t,n,o,r=void 0){let a=n.management?.revision??null,i=i5(e,n.intentId,a),s=mo.get(i);if(s)return s.releaseUpload=o.releaseUpload,s.watchAuthority=r,s.state;let l={key:i,inputKey:e,environmentId:t,intentId:n.intentId,revision:a,text:n.text??"",retained:n.management?.attachments??[],added:[],saving:!1,error:null},d={state:l,listeners:new Set,releaseUpload:o.releaseUpload,operationLeases:0,committed:!1,disposeRequested:!1,watchAuthority:r,releaseAuthorityWatch:void 0};return mo.set(i,d),l}function zw(e,t){let n=mo.get(e);return n?(n.releaseAuthorityWatch===void 0&&n.watchAuthority!==void 0&&(n.releaseAuthorityWatch=n.watchAuthority({threadKey:n.state.inputKey,intentId:n.state.intentId,revision:n.state.revision,onInvalid:()=>_l(e,n)})),n.committed=!0,iv(e,n),n.listeners.add(t),hp(),()=>{n.listeners.delete(t),hp()}):()=>{}}function Cs(e,t){let n=mo.get(e);if(!n)return;n.committed=!0;let o=t(n.state);if(o!==n.state){n.state=o,iv(e,n);for(let r of n.listeners)r()}}function vp(e){return mo.get(e)?.state}function $w(e){let t=mo.get(e);if(!t)return null;t.committed=!0,t.operationLeases+=1,iv(e,t);let n=!1;return()=>{if(!n){if(n=!0,t.operationLeases=Math.max(0,t.operationLeases-1),t.operationLeases===0&&t.disposeRequested){_l(e,t);return}hp()}}}function xp(e){let t=mo.get(e);t&&_l(e,t)}function Hw(e,t){let n=new Map(t.flatMap(o=>o.waiting&&o.management!==void 0?[[o.intentId,o.management.revision]]:[]));for(let[o,r]of mo)r.state.inputKey===e&&n.get(r.state.intentId)!==r.state.revision&&_l(o,r);hp()}function Uw({entry:e,current:t,inputKey:n,environmentId:o,unavailable:r,attachments:a,watchEditorAuthority:i,onEdit:s,onClose:l}){let{t:d}=po(),c=Bw(n,o,e,a,i),f=ka(A=>zw(c.key,A),()=>vp(c.key)??c,()=>vp(c.key)??c),{key:p,text:m,retained:h,added:g,saving:v,error:x}=f,y=D(null),C=a.useUploadStatuses(),S=z(()=>h.map(A=>A.id),[h]),L=a.useAssetUrls(o,S),w=!t?.management||t.management.revision!==e.management?.revision;K(()=>{t===void 0&&(xp(p),l())},[t,p,l]);let k=()=>{v||(xp(p),l())},I=A=>{if(v||r||w)return;let N=null,R=[...g];for(let $ of A){let U=$.type||"application/octet-stream";if(h.length+R.length>=a.limits.maxAttachments||$.size===0||$.size>a.maxAttachmentBytes(U)){N=d("turnQueue.attachmentLimit",{name:$.name,count:a.limits.maxAttachments,size:a.formatAttachmentSize(a.maxAttachmentBytes(U))});continue}let H=a.makeImageAttachment({id:a.randomUUID(),name:$.name,mimeType:U,sizeBytes:$.size,file:$});R.push(H),a.startUpload({environmentId:o,image:H})}Cs(p,$=>({...$,added:R,error:N}))},T=async()=>{let A=vp(p);if(!A||A.saving||r||w||!A.text.trim()&&A.retained.length+A.added.length===0)return;let N=$w(p);if(N!==null){Cs(p,R=>({...R,saving:!0,error:null}));try{await a.awaitUploads(A.added.map($=>$.id));let R=a.getUploadedAttachments({environmentId:o,images:A.added});if(!R)throw new Error(d("turnQueue.uploadFailed"));await s(e,{text:A.text,attachments:[...A.retained,...R]}),xp(p),l()}catch(R){Cs(p,$=>({...$,saving:!1,error:R instanceof Error?R.message:d("turnQueue.actionFailed")}))}finally{N()}}},E=[...h.map((A,N)=>({...A,previewUrl:L[N],added:!1})),...g.map(A=>({...A,added:!0}))];return u(Af,{open:!0,onOpenChange:A=>{A||k()},children:b(Nf,{className:"max-w-2xl","data-queued-message-editor":!0,children:[b(Rf,{children:[u(_f,{children:d("turnQueue.editTitle")}),u(Ef,{children:d("turnQueue.editDescription")})]}),b("div",{className:"max-h-[60dvh] space-y-3 overflow-y-auto px-6 pb-4",onDragOver:A=>{A.dataTransfer.types.includes("Files")&&A.preventDefault()},onDrop:A=>{A.dataTransfer.files.length&&(A.preventDefault(),A.stopPropagation(),I(Array.from(A.dataTransfer.files)))},children:[u(UI,{"aria-label":d("turnQueue.editText"),autoFocus:!0,value:m,maxLength:a.limits.maxInputChars,disabled:v,onChange:A=>Cs(p,N=>({...N,text:A.target.value})),onPaste:A=>{A.clipboardData.files.length&&(A.preventDefault(),I(Array.from(A.clipboardData.files)))},onKeyDown:A=>{(A.metaKey||A.ctrlKey)&&A.key==="Enter"&&!A.nativeEvent.isComposing&&(A.preventDefault(),T())}}),u("ul",{className:"flex flex-wrap gap-2",children:E.map(A=>b("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2 py-1.5",children:[A.type==="image"&&A.previewUrl?u("img",{src:A.previewUrl,alt:A.name,className:"size-12 rounded object-cover"}):u(_o,{className:"size-4 shrink-0"}),b("div",{className:"min-w-0 text-xs",children:[u("p",{className:"max-w-48 break-words",children:A.name}),u("p",{className:"text-muted-foreground",children:a.formatAttachmentSize(A.sizeBytes)}),A.added&&C.get(A.id)!=="ready"?u("p",{children:d(C.get(A.id)==="failed"?"turnQueue.uploadFailed":"turnQueue.uploading")}):null,A.added&&C.get(A.id)==="failed"?u(ne,{size:"xs",variant:"ghost",disabled:v||r||w,onClick:()=>{let N=g.find(R=>R.id===A.id);N&&a.retryUpload({environmentId:o,image:N})},children:d("turnQueue.retryUpload")}):null]}),u(ne,{size:"icon-xs",variant:"ghost","aria-label":d("turnQueue.removeAttachment",{name:A.name}),disabled:v||w,onClick:()=>{A.added?(a.releaseUpload(A.id),A.previewUrl&&URL.revokeObjectURL(A.previewUrl),Cs(p,N=>({...N,added:N.added.filter(R=>R.id!==A.id)}))):Cs(p,N=>({...N,retained:N.retained.filter(R=>R.id!==A.id)}))},children:u(jt,{className:"size-3.5"})})]},A.id))}),u("input",{ref:y,type:"file",multiple:!0,className:"hidden","aria-label":d("turnQueue.addAttachments"),onChange:A=>{I(Array.from(A.target.files??[])),A.target.value=""}}),b(ne,{size:"sm",variant:"outline",disabled:v||r||w,onClick:()=>y.current?.click(),children:[u(_o,{className:"size-4"}),d("turnQueue.addAttachments")]}),w?u("p",{role:"alert",className:"text-sm text-muted-foreground",children:d("turnQueue.editStale")}):null,x?u("p",{role:"alert",className:"text-sm text-destructive-foreground",children:x}):null]}),b(Mf,{children:[u(ne,{variant:"ghost",disabled:v,onClick:k,children:d("turnQueue.discardEdit")}),u(ne,{disabled:v||r||w||!m.trim()&&E.length===0,onClick:()=>{T()},children:d(v?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}function Kw(e,t){let n=e.find(a=>a.intentId===t.intentId);if(!n)return e;let o=e.filter(a=>a.intentId!==t.intentId),r=t.beforeIntentId===null?o.length:o.findIndex(a=>a.intentId===t.beforeIntentId);return r<0?e:(o.splice(r,0,n),o)}function qw(e,t,n){if(t===n)return null;let o={intentId:t,beforeIntentId:n,previousOrder:e.map(a=>a.intentId)};return Kw(e,o).every((a,i)=>a.intentId===e[i]?.intentId)?null:o}function Vw(e,t){if(!e.find(l=>l.intentId===t.intentId)?.management?.canReorder||t.beforeIntentId!==null&&!e.some(l=>l.intentId===t.beforeIntentId))return{entries:e,settled:!0};let o=new Set(e.map(l=>l.intentId)),r=new Set(t.previousOrder),a=t.previousOrder.filter(l=>o.has(l));return e.filter(l=>r.has(l.intentId)).some((l,d)=>l.intentId!==a[d])?{entries:e,settled:!0}:{entries:Kw(e,t),settled:!1}}ge();ge();function l5({entry:e,unavailable:t,onCancel:n}){let{t:o}=po(),r=D(!1),[a,i]=G(!1),[s,l]=G(!1),[d,c]=G(!1);K(()=>{c(!1),l(!1)},[e.status,e.deliveryCertainty]);let f=async()=>{if(!(r.current||t||e.action===null)){r.current=!0,i(!0),l(!1);try{await n(e),c(!1)}catch{l(!0)}finally{r.current=!1,i(!1)}}};return b("li",{className:"space-y-2 border-t border-border py-2","data-turn-queue-message":!0,children:[u("p",{className:"text-muted-foreground",children:o(e.deliveryCertainty==="unknown"?"turnQueue.itemUnknown":e.status==="queued"?"turnQueue.itemQueued":e.status==="blocked"||e.status==="reconciling"?"turnQueue.itemBlocked":"turnQueue.itemRunning")}),u("p",{className:"whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:e.text??o("turnQueue.messageUnavailable")}),e.attachmentNames.length>0?u("p",{className:"break-words text-muted-foreground",children:e.attachmentNames.join(", ")}):null,e.action!==null?d&&e.action==="abandon"?b("div",{className:"space-y-2",children:[u("p",{children:o("turnQueue.abandonDescription")}),b("div",{className:"flex flex-wrap gap-2",children:[u(ne,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>{f()},children:o("turnQueue.confirmAbandon")}),u(ne,{size:"xs",variant:"ghost",disabled:a,onClick:()=>c(!1),children:o("turnQueue.keepWaiting")})]})]}):u(ne,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>e.action==="abandon"?c(!0):void f(),children:o(a?"turnQueue.cancelling":e.action==="abandon"?"turnQueue.stopWaiting":"turnQueue.cancelMessage")}):null,s?u("p",{role:"alert",className:"text-destructive-foreground",children:o("turnQueue.actionFailed")}):null]})}function Ww({entries:e,unavailable:t,onCancel:n}){let{t:o}=po(),[r,a]=G(!1),i=Xr();return e.length===0?null:b("div",{className:"min-w-0 basis-full space-y-2",children:[u(ne,{size:"xs",variant:"ghost","aria-expanded":r,"aria-controls":i,onClick:()=>a(s=>!s),children:o(r?"turnQueue.hideMessages":"turnQueue.showMessages")}),r?u("ol",{id:i,className:"max-h-64 overflow-y-auto overscroll-contain",children:e.map(s=>u(l5,{entry:s,unavailable:t,onCancel:n},s.intentId))}):null]})}function sv({queue:e,unavailable:t=!1,onResume:n,entries:o,onCancel:r}){let{t:a}=po(),i=D(!1),[s,l]=G(!1),[d,c]=G(!1),f=D(!1),[p,m]=G(!1),[h,g]=G(!1),[v,x]=G(null);K(()=>{e.paused||c(!1)},[e.paused]);let y=o?.[0];K(()=>{m(!1),x(null)},[y?.intentId,y?.status,y?.deliveryCertainty]);let C=e.deliveryUncertain||e.blocked||e.reconciling;if(!e.paused&&!C)return null;let S=r!==void 0&&y?.action==="abandon"&&(e.reconciling||e.deliveryUncertain),L=async()=>{if(f.current||t||r===void 0||y===void 0)return;let T=y;f.current=!0,g(!0),x(null);try{await r(T),m(!1)}catch{x(T.intentId)}finally{f.current=!1,g(!1)}},w=e.paused?a("turnQueue.pausedTitle"):e.deliveryUncertain?a("turnQueue.uncertainTitle"):e.blocked?a("turnQueue.blockedTitle"):e.reconciling?a("turnQueue.reconcilingTitle"):a("turnQueue.queuedTitle"),k=e.deliveryUncertain?a("turnQueue.uncertainDescription"):e.blocked?a("turnQueue.blockedDescription"):e.reconciling?a("turnQueue.reconcilingDescription"):e.paused?a("turnQueue.pausedDescription"):a("turnQueue.queuedDescription"),I=async()=>{if(!(i.current||t||!e.paused)){i.current=!0,l(!0),c(!1);try{await n()}catch{c(!0)}finally{i.current=!1,l(!1)}}};return b("div",{className:"mx-auto mb-2 flex w-full max-w-3xl flex-wrap items-start gap-2 rounded-md border border-warning/40 bg-background px-3 py-2 text-xs text-foreground","data-turn-queue-banner":!0,role:"status",children:[b("div",{className:"min-w-0 flex-1 basis-48 space-y-1",children:[b("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[u("span",{className:"font-medium",children:w}),u("span",{className:"text-muted-foreground",children:a("turnQueue.queued",{count:e.queuedCount})})]}),u("p",{className:"text-muted-foreground",children:k}),e.paused&&C?u("p",{className:"text-muted-foreground",children:a("turnQueue.pausedUncertainDescription")}):null,t?u("p",{className:"text-muted-foreground",children:a("turnQueue.disconnected")}):null,d&&e.paused?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.resumeFailed")}):null,v!==null&&v===y?.intentId?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.actionFailed")}):null]}),e.paused?u(ne,{size:"xs",variant:"outline",disabled:s,softDisabled:t,onClick:()=>{I()},children:a(s?"turnQueue.resuming":"turnQueue.resume")}):null,S?b(Ce,{children:[u(ne,{size:"xs",variant:"outline",disabled:h,softDisabled:t,onClick:()=>m(!0),children:a("turnQueue.stopWaiting")}),u(VI,{open:p,onOpenChange:T=>{T||m(!1)},children:b(XI,{className:"max-w-lg",children:[b(QI,{children:[u(YI,{children:a("turnQueue.stopWaiting")}),u(GI,{children:a("turnQueue.abandonDescription")})]}),b(jI,{children:[u(WI,{render:u(ne,{variant:"ghost"}),children:a("turnQueue.keepWaiting")}),u(ne,{variant:"outline",disabled:h||t,onClick:()=>{L()},children:a(h?"turnQueue.cancelling":"turnQueue.confirmAbandon")})]})]})})]}):null,r&&o?u(Ww,{entries:o.filter(T=>T.status!=="queued"),unavailable:t,onCancel:r}):null]})}var d5=[Dw,_w];function c5({entry:e,disabled:t,dropPosition:n,dragPosition:o,feedback:r,reducedMotion:a,children:i}){let{t:s}=po(),{attributes:l,listeners:d,setNodeRef:c,setActivatorNodeRef:f,transform:p,transition:m,isDragging:h}=Mw({id:e.intentId,disabled:t,transition:a?null:{duration:160,easing:"ease-out"}});return b("li",{ref:c,"data-queue-intent":e.intentId,"data-queue-dragging":h||void 0,"data-queue-feedback":r,style:{transform:yi.Transform.toString(p),transition:m},className:O("relative flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",h&&"z-10 bg-accent shadow-md ring-1 ring-primary/50 ring-inset",r==="saved"&&"bg-primary/10 ring-1 ring-primary/30 ring-inset",r==="failed"&&"bg-destructive/10"),children:[n?u("span",{"aria-hidden":"true","data-queue-drop-position":n,className:O("pointer-events-none absolute inset-x-1 z-20 h-0.5 rounded-full bg-primary before:absolute before:-top-0.5 before:start-0 before:size-1.5 before:rounded-full before:bg-primary",n==="before"?"top-0":"bottom-0")}):null,u(ne,{ref:f,size:"icon-xs",variant:"ghost",className:O("shrink-0 touch-none cursor-grab text-muted-foreground active:cursor-grabbing",(h||r==="saved")&&"bg-primary/10 text-primary"),...l,...d,"aria-label":s("turnQueue.reorderMessage"),title:s("turnQueue.reorderMessage"),softDisabled:t,children:r==="saved"?u(bo,{className:"size-3.5"}):u(Gd,{className:"size-3.5"})}),i,h&&o?u("span",{"aria-hidden":"true","data-queue-drag-position":!0,className:"pointer-events-none absolute end-3 rounded bg-primary/10 px-2 py-1 font-medium text-primary tabular-nums",children:o}):null]})}function Gw({inputKey:e,entries:t,environmentId:n,unavailable:o,attachments:r,actions:a,onCancel:i}){let{t:s}=po(),l=gp("(prefers-reduced-motion: reduce)"),[d,c]=Ln("turn-queue:editing",e,null),[f,p]=Ln("turn-queue:pending",e,!1),m=Rn("turn-queue:pending-ref",e,!1),[h,g]=Ln("turn-queue:error",e,null),[v,x]=Ln("turn-queue:drag",e,null),[y,C]=Ln("turn-queue:move",e,null),S=Rn("turn-queue:reorder-ref",e,!1),[L,w]=Ln("turn-queue:feedback",e,null),k=ow(rv(Nl,{activationConstraint:{distance:5}}),rv(Rl,{coordinateGetter:Rw,scrollBehavior:l?"auto":"smooth"})),I=z(()=>t.filter(F=>F.waiting),[t]),T=y?Vw(I,y.preview):null,E=T?.entries??I,A=o||f||y!==null,N=E.findIndex(F=>F.intentId===v?.activeId),R=E.findIndex(F=>F.intentId===v?.overId);K(()=>{Hw(e,t)},[t,e]),K(()=>{y!==null&&(o||y.acknowledged&&T?.settled)&&(S.current=!1,C(null),!o&&I.some(F=>F.intentId===y.preview.intentId)&&w({intentId:y.preview.intentId,kind:"saved"}))},[I,y,T?.settled,o]),K(()=>{if(L===null||L.kind==="failed")return;let F=window.setTimeout(()=>w(oe=>oe===L?null:oe),1600);return()=>window.clearTimeout(F)},[L]);let $=async F=>{if(!(m.current||S.current||o)){m.current=!0,p(!0),g(null),w(null);try{await F()}catch(oe){g(oe instanceof Error?oe.message:s("turnQueue.actionFailed"))}finally{m.current=!1,p(!1)}}},U=(F,oe)=>$(async()=>{let ee=qw(I,F.intentId,oe);if(!(ee===null||!F.management?.canReorder)){S.current=!0,C({preview:ee,acknowledged:!1});try{await a.onReorder(F,oe),C(W=>W?.preview===ee?{...W,acknowledged:!0}:W)}catch(W){throw S.current=!1,C(null),w({intentId:F.intentId,kind:"failed"}),W}}}),H=o?s("turnQueue.disconnected"):y!==null?s("turnQueue.saving"):v!==null?`${s("turnQueue.dragStarted")} ${R+1}/${E.length}`:L?.kind==="saved"?s("common.action.done"):L?.kind==="cancelled"?s("turnQueue.dragCancelled"):"";return b(Ce,{children:[E.length>0?b("section",{"aria-label":s("turnQueue.pendingMessages"),"data-turn-queue-dock":!0,className:"mx-auto mb-2 w-full max-w-3xl overflow-hidden rounded-xl border border-border/60 bg-background/95 text-xs shadow-xs",children:[b("div",{className:"flex h-7 items-center justify-between gap-3 px-3 py-1.5 text-muted-foreground",children:[u("span",{className:"shrink-0",children:s("turnQueue.queued",{count:E.length})}),u("span",{role:"status","aria-live":v===null?"polite":"off","data-queue-reorder-status":y?"saving":L?.kind,className:O("min-w-0 truncate",L?.kind==="saved"&&"text-primary"),children:H})]}),u(Cw,{sensors:k,collisionDetection:iw,modifiers:d5,accessibility:{screenReaderInstructions:{draggable:s("turnQueue.dragInstructions")},announcements:{onDragStart:()=>s("turnQueue.dragStarted"),onDragOver:({over:F})=>{let oe=E.findIndex(ee=>ee.intentId===F?.id);return oe<0?void 0:`${s("turnQueue.dragStarted")} ${oe+1}/${E.length}`},onDragEnd:()=>s("turnQueue.dragFinished"),onDragCancel:()=>s("turnQueue.dragCancelled")}},onDragStart:({active:F})=>{let oe=E.find(ee=>ee.intentId===F.id);!oe?.management?.canReorder||A||(g(null),w(null),x({activeId:oe.intentId,overId:oe.intentId}))},onDragOver:({over:F})=>{let oe=E.find(ee=>ee.intentId===F?.id);oe&&x(ee=>ee&&{...ee,overId:oe.intentId})},onDragCancel:()=>{v&&w({intentId:v.activeId,kind:"cancelled"}),x(null)},onDragEnd:({active:F,over:oe})=>{if(x(null),!oe||F.id===oe.id)return;let ee=E.findIndex(pe=>pe.intentId===F.id),W=E.findIndex(pe=>pe.intentId===oe.id),Ze=E[ee];if(!Ze?.management?.canReorder||W<0)return;let ue=E[W+(ee<W?1:0)]?.intentId??null;U(Ze,ue)},children:u(Aw,{items:E.map(F=>F.intentId),strategy:kw,children:u("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:E.map((F,oe)=>b(c5,{entry:F,disabled:!F.management?.canReorder||A,reducedMotion:l,feedback:L?.intentId===F.intentId?L.kind:void 0,dropPosition:F.intentId===v?.overId&&N!==R?N<R?"after":"before":void 0,dragPosition:F.intentId===v?.activeId?`${R+1}/${E.length}`:void 0,children:[b("div",{className:"min-w-0 flex-1",children:[u("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:F.text||s("turnQueue.attachmentsOnly")}),F.attachmentNames.length?b("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(_o,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:F.attachmentNames.join(", ")})]}):null,F.pendingAction?u("p",{className:"text-muted-foreground",children:s(F.pendingAction==="steer"?"turnQueue.steering":"turnQueue.interrupting")}):null,F.failure?u("p",{role:"alert",className:"text-destructive-foreground",children:F.failure}):null]}),b("div",{className:O("flex shrink-0 items-center gap-0.5",F.intentId===v?.activeId&&"invisible"),children:[u(ne,{size:"icon-xs",variant:"ghost",disabled:!F.management||A||v!==null,"aria-label":s("turnQueue.editMessage"),title:s("turnQueue.editMessage"),onClick:()=>c(F),children:u(ec,{className:"size-3.5"})}),F.management?.canSteer?u(ne,{size:"icon-xs",variant:"ghost",disabled:A||v!==null,"aria-label":s("turnQueue.steer"),title:s("turnQueue.steerDescription"),onClick:()=>{$(()=>a.onRun(F,"steer"))},children:u(tc,{className:"size-3.5"})}):null,b(Oo,{children:[u(Bo,{render:u(ne,{size:"icon-xs",variant:"ghost",disabled:A||!F.management||v!==null,"aria-label":s("turnQueue.messageActions")}),children:u(or,{className:"size-4"})}),b(Fo,{align:"end",children:[b(rr,{disabled:!F.management?.canReorder||oe===0,onClick:()=>{U(F,E[oe-1].intentId)},children:[u(Fd,{className:"size-4"}),s("turnQueue.moveUp")]}),b(rr,{disabled:!F.management?.canReorder||oe===E.length-1,onClick:()=>{U(F,E[oe+2]?.intentId??null)},children:[u(Dd,{className:"size-4"}),s("turnQueue.moveDown")]}),F.management?.canSteer?u(rr,{onClick:()=>{$(()=>a.onRun(F,"steer"))},children:s("turnQueue.steer")}):null,u(rr,{disabled:!F.management?.canRun,onClick:()=>{$(()=>a.onRun(F,"interrupt"))},children:s(F.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),u(mi,{}),u(rr,{disabled:F.action!=="cancel",onClick:()=>{$(()=>i(F))},children:s("turnQueue.cancelMessage")})]})]})]})]},F.intentId))})})},e),h?u("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:h}):null]}):null,d?u(Uw,{entry:d,current:t.find(F=>F.intentId===d.intentId),inputKey:e,environmentId:n,unavailable:A,attachments:r,watchEditorAuthority:a.watchEditorAuthority,onEdit:a.onEdit,onClose:()=>c(null)},`${e}\0${d.intentId}\0${d.management?.revision??"none"}`):null]})}ge();var lv=220,u5={opacity:0,transform:"translate3d(0, 4rem, 0)"},f5={opacity:0,transform:"translate3d(0, 7rem, 0)"},jw={opacity:1,transform:"none"},Qw={transition:`transform ${lv}ms ease-in, opacity ${lv}ms ease-in`},p5={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function Yw({className:e,items:t}){let[n,o]=G(null),r=D(null),a=n!==null&&t.some(p=>p.id===n)?n:null;if(K(()=>()=>{r.current&&clearTimeout(r.current)},[]),t.length===0)return null;let i=t[0];if(!i)return null;let s=t.slice(1),l=s.length>0,d=l&&a!==i.id,c=s[0],f=p=>{!p.onDismiss||a||(o(p.id),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,p.onDismiss?.()},lv))};return u("div",{className:O("group/banner-stack chat-composer-drawer-slot",e),"data-composer-banner-drawer":"true",children:b("div",{className:O("relative flex flex-col-reverse",l?"group-hover/banner-stack:z-50 group-focus-within/banner-stack:z-50":null),children:[d&&c?u("div",{className:O("pointer-events-none absolute inset-x-0 -top-3 z-0 mx-auto h-3 rounded-t-2xl","chat-composer-banner-stack-cap border border-b-0 shadow-[0_6px_18px_rgba(0,0,0,0.06)]",p5[c.variant],"transition-opacity duration-150 ease-out","group-hover/banner-stack:opacity-0 group-focus-within/banner-stack:opacity-0"),style:{width:"96%"},"aria-hidden":"true"}):null,u("div",{className:O("relative z-10",a===i.id?"pointer-events-none":null),style:{...Qw,...a===i.id?u5:jw},children:u(Xw,{item:i,attached:!0,exiting:a===i.id,onDismissRequest:()=>f(i)})}),l?u("div",{"data-composer-banner-stack-expanded-items":"true",className:O("relative z-20 grid grid-rows-[0fr] transition-[grid-template-rows] duration-150 ease-out","group-hover/banner-stack:grid-rows-[1fr] group-focus-within/banner-stack:grid-rows-[1fr]"),children:u("div",{className:"min-h-0 overflow-hidden",children:u("div",{className:O("invisible pointer-events-none space-y-2 pb-2 opacity-0","translate-y-1 transform-gpu transition-[opacity,transform] duration-150 ease-out will-change-[opacity,transform]","group-hover/banner-stack:visible group-hover/banner-stack:pointer-events-auto group-hover/banner-stack:translate-y-0 group-hover/banner-stack:opacity-100","group-focus-within/banner-stack:visible group-focus-within/banner-stack:pointer-events-auto group-focus-within/banner-stack:translate-y-0 group-focus-within/banner-stack:opacity-100"),children:s.map(p=>u("div",{className:O(a===p.id?"pointer-events-none":null),style:{...Qw,...a===p.id?f5:jw},children:u(Xw,{item:p,attached:!1,exiting:a===p.id,onDismissRequest:()=>f(p)})},p.id))})})}):null]})})}function Xw({item:e,attached:t,exiting:n,onDismissRequest:o}){let r=e.onDismiss&&!e.actions;return e.presentation==="compact"?b(lc,{variant:e.variant,role:"status",className:O("min-h-0 px-3 text-xs sm:px-4",t?"chat-composer-drawer-surface chat-composer-drawer-attached pt-1.5 pb-[calc(var(--chat-composer-attachment-overlap)_+_0.25rem)]":"alert-glass rounded-[22px] py-1.5",e.className),"data-composer-banner-presentation":"compact","data-variant":e.variant,children:[e.icon,b(Sh,{className:"flex min-w-0 items-baseline gap-1.5 font-normal leading-5",children:[u("span",{className:"shrink-0 font-medium text-foreground",children:e.title}),e.description?u("span",{className:"min-w-0 truncate text-muted-foreground",children:e.description}):null]}),e.actions||e.onDismiss?b(dc,{className:O("shrink-0",e.actionClassName),children:[e.actions,e.onDismiss?u(ne,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??"Dismiss notice",disabled:n,onClick:o,children:u(jt,{})}):null]}):null]}):b(lc,{variant:e.variant,className:O(t?"chat-composer-drawer-surface chat-composer-drawer-attached px-3 pt-2 pb-[calc(var(--chat-composer-attachment-overlap)_+_0.375rem)] text-xs sm:px-4":"alert-glass rounded-[22px]",e.className),"data-variant":e.variant,children:[e.icon,u(Sh,{children:e.title}),e.description?u(Of,{children:e.description}):null,e.actions||e.onDismiss?b(dc,{className:O(e.actionClassName,r?"max-sm:col-start-3 max-sm:row-start-1 max-sm:mt-0 max-sm:self-start":void 0),children:[e.actions,e.onDismiss?u(ne,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??"Dismiss warning",disabled:n,onClick:o,children:u(jt,{})}):null]}):null]})}function Jw({bannerItems:e,belowSlot:t,composer:n,draftHero:o,onOverlayElementChange:r,queue:a}){let i=u(Yw,{className:"relative z-0",items:e});return u("div",{ref:r,"data-chat-composer-overlay":"true",className:o.active?"pointer-events-none absolute inset-0 z-20 flex items-center":"pointer-events-none absolute inset-x-0 bottom-0 z-20 pt-1.5 sm:pt-2",children:b("div",{ref:o.transitionGroupRef,className:"w-full ps-[calc(env(safe-area-inset-left)+0.75rem)] pe-[calc(env(safe-area-inset-right)+0.75rem)] sm:ps-[calc(env(safe-area-inset-left)+1.25rem)] sm:pe-[calc(env(safe-area-inset-right)+1.25rem)]",children:[b("div",{className:"pointer-events-auto relative z-10",children:[a,o.active?b("div",{className:"absolute inset-x-0 bottom-full z-0",children:[u("div",{className:"pb-8",style:{viewTransitionName:o.headlineTransitionName},children:o.headline}),i]}):i,b("div",{className:"chat-composer-glass-shell relative mx-auto w-full max-w-3xl",style:{viewTransitionName:o.composerTransitionName},children:[u("div",{className:"chat-composer-glass-host relative z-10 w-full rounded-[22px]",children:u("div",{ref:o.composerAnchorRef,className:"relative z-10",children:n})}),u("div",{className:"min-h-0",children:t})]})]}),u("div",{"aria-hidden":!0,className:"h-[calc(env(safe-area-inset-bottom)+1rem)] sm:h-[calc(env(safe-area-inset-bottom)+1.25rem)]"})]})})}function Zw(e,t){let n=e!==null&&e!=="plan-follow-up";return{showTopDrawer:e!==null&&(n||!t),showCollapsedPromptRow:t&&!n,hasBlocking:n}}var m5=["image/gif","image/jpeg","image/png","image/webp"],g5=new Set(m5);function dv(e){return g5.has(e.toLowerCase())}function h5(e){return dv(e)?"image":"file"}var v5=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function cv(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||v5.has(t)?"text":"file"}function uv(e){return!Number.isFinite(e)||e<=0?"0 KB":e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function fv(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return h5(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t}}var x5=new Set(["claudeAgent","cursor","grok","dsh","acp"]),eT=e=>x5.has(e)?"in-session":"next-turn";function y5(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function C5(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function b5(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function Ec(e){return`[${C5(y5(e))}](${b5(e)})`}ge();var I5=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s)/g,S5=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g;var w5=new RegExp("(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,512})\\]\\(([^)\\s]+)\\)(?=\\s)","g"),T5=/^[A-Za-z][A-Za-z0-9+.-]*:/,k5=/^[A-Za-z]:[\\/]/,L5=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function P5(e){let t=[];for(let n of e.matchAll(w5)){let o=n[0],r=n[1]??"",a=(n[2]??"").replace(/\\(.)/g,"$1"),i=n[3]??"",s=i;try{s=decodeURIComponent(i)}catch{}let l=Math.max(s.lastIndexOf("/"),s.lastIndexOf("\\")),d=l>=0?s.slice(l+1):s,c=T5.test(s)&&!k5.test(s);if(!s||c||a!==d)continue;let f=(n.index??0)+r.length,p=f+o.length-r.length;t.push({type:"mention",value:s,source:e.slice(f,p),start:f,end:p})}for(let n of e.matchAll(S5)){let o=n[0],r=n[1]??"",a=n[2],i=a!==void 0?a.replace(/\\(.)/g,"$1"):n[3]??"";if(!i||a===void 0&&L5.test(i))continue;let s=(n.index??0)+r.length,l=s+o.length-r.length;t.push({type:"mention",value:i,source:e.slice(s,l),start:s,end:l})}return t}function Mc(e,t={}){let n=P5(e);for(let o of e.matchAll(I5)){let r=o[0],a=o[1]??"",i=o[2]??"";if(!i)continue;let s=(o.index??0)+a.length,l=s+r.length-a.length;n.push({type:"skill",value:i,source:e.slice(s,l),start:s,end:l})}for(let o of t.preserveTrailingFrom??[])o.end===e.length&&e.slice(o.start,o.end)===o.source&&!n.some(r=>r.type===o.type&&r.start===o.start&&r.end===o.end)&&n.push(o);return[...n].sort((o,r)=>o.start-r.start)}function A5(e){return e.replace(/\r\n/g,`
3697
+ `).replace(/^\n+|\n+$/g,"")}function E5(e){return A5(e.text).length>0}function tT(e){return!E5(e)}function M5(e){return e.lineStart===e.lineEnd?`line ${e.lineStart}`:`lines ${e.lineStart}-${e.lineEnd}`}function nT(e){return`${e.terminalLabel} (${M5(e)})`}function oT(e,t,n){return e<=n&&n<t}function rT(e,t){if(!t)return;let n=e[e.length-1];if(n&&n.type==="text"){n.text+=t;return}e.push({type:"text",text:t})}function aT(e,t){let n=0;for(let o=0;o<e.length;o+=1)if(e[o]==="\uFFFC"){if(o>n&&t({type:"text",text:e.slice(n,o),promptOffset:n})===!0||t({type:"terminal-context",promptOffset:o})===!0)return!0;n=o+1}return n<e.length&&t({type:"text",text:e.slice(n),promptOffset:n})===!0}function R5(e,t){return aT(e,n=>n.type!=="text"?!1:t(n.text,n.promptOffset))}function N5(e,t){return R5(e,(n,o)=>{for(let r of Mc(n))if(r.type==="mention"&&t(r,o)===!0)return!0;return!1})}function _5(e){let t=[];if(!e)return t;let n=Mc(e),o=0;for(let r of n)r.start<o||(r.start>o&&rT(t,e.slice(o,r.start)),r.type==="mention"?t.push({type:"mention",path:r.value,source:r.source}):t.push({type:"skill",name:r.value}),o=r.end);return o<e.length&&rT(t,e.slice(o)),t}function pv(e,t,n){return!e||t>=n?!1:N5(e,(o,r)=>{let a=r+o.start,i=r+o.end,s=a-1,l=i;return!!(s>=0&&/\s/.test(e[s]??"")&&oT(t,n,s)||l<e.length&&/\s/.test(e[l]??"")&&oT(t,n,l))})}function bs(e,t=[]){if(!e)return[];let n=[],o=0;return aT(e,r=>r.type==="text"?(n.push(..._5(r.text)),!1):(n.push({type:"terminal-context",context:t[o]??null}),o+=1,!1)),n}function sT(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:"foreground"}var iT=e=>e.type!=="text";function mv(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function D5(e){return e===" "||e===`
3698
+ `||e===" "||e==="\r"||e==="\uFFFC"}function O5(e,t){let n=t-1;for(;n>=0&&!D5(e[n]??"");)n-=1;return n+1}function Tr(e,t){let n=mv(e,t),o=bs(e);if(o.length===0)return n;let r=n,a=0;for(let i of o){if(i.type==="mention"){let l=i.source.length;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;continue}if(i.type==="skill"){let l=i.name.length+1;if(r<=1)return a+(r===0?0:l);r-=1,a+=l;continue}if(i.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let s=i.text.length;if(r<=s)return a+r;r-=s,a+=s}return a}function lT(e){return e.type==="text"?e.text.length:1}function dT(e,t){let n=e.reduce((o,r)=>o+lT(r),0);return Number.isFinite(t)?Math.max(0,Math.min(n,Math.floor(t))):n}function dr(e,t){return dT(bs(e),t)}function cr(e,t){let n=mv(e,t),o=bs(e);if(o.length===0)return n;let r=n,a=0;for(let i of o){if(i.type==="mention"){let l=i.source.length;if(r===0)return a;if(r<=l)return a+1;r-=l,a+=1;continue}if(i.type==="skill"){let l=i.name.length+1;if(r===0)return a;if(r<=l)return a+1;r-=l,a+=1;continue}if(i.type==="terminal-context"){if(r<=1)return a+r;r-=1,a+=1;continue}let s=i.text.length;if(r<=s)return a+r;r-=s,a+=s}return a}function Rc(e,t,n){let o=bs(e);if(!o.some(iT))return!1;let r=dT(o,t),a=0;for(let i of o){if(iT(i)&&(n==="left"&&r===a+1||n==="right"&&r===a))return!0;a+=lT(i)}return!1}function ur(e,t){let n=mv(e,t),o=e.lastIndexOf(`
3699
+ `,Math.max(0,n-1))+1,r=e.slice(o,n);if(r.startsWith("/")){let s=/^\/(\S*)$/.exec(r);if(s)return{kind:"slash-command",query:s[1]??"",rangeStart:o,rangeEnd:n}}let a=O5(e,n),i=e.slice(a,n);return i.startsWith("$")?{kind:"skill",query:i.slice(1),rangeStart:a,rangeEnd:n}:i.startsWith("@")?{kind:"path",query:i.slice(1),rangeStart:a,rangeEnd:n}:null}function cT(e,t,n,o){let r=Math.max(0,Math.min(e.length,t)),a=Math.max(r,Math.min(e.length,n));return{text:`${e.slice(0,r)}${o}${e.slice(a)}`,cursor:r+o.length}}var uT="Ask for changes, send follow-ups, or attach images";var fT="application/x-ycodium-composer-mention";function gv(e){return e.includes(fT)}function pT(e){let t=n=>gv(n.dataTransfer.types)?(n.preventDefault(),n.stopPropagation(),n.nativeEvent.stopPropagation(),!0):!1;return{onDragEnter(n){t(n)&&e.setDragActive(!0)},onDragOver(n){t(n)&&(n.dataTransfer.dropEffect="move",e.setDragActive(!0))},onDrop(n){if(!t(n))return;e.setDragActive(!1);let o=n.dataTransfer.getData(fT);o.length!==0&&(e.insertMentionAtEnd(`${o} `)||e.onInsertRejected())}}}ge();var hv=de(function(t){let{t:n}=De();if(t.count===0)return null;let o=t.placement==="inline",r=u("span",{className:O("text-[10px] font-medium leading-none tabular-nums",t.pulsing?"animate-[prompt-stash-count-enter_180ms_ease-out_both] text-primary motion-reduce:animate-none":"text-muted-foreground"),children:t.count},t.pulseKey);return o?b(ne,{size:"micro",variant:"ghost-muted","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:O("shrink-0 gap-1 px-1.5",(t.menuOpen||t.pulsing)&&"[--control-icon-color:currentColor] text-foreground"),onPointerDown:a=>a.preventDefault(),onClick:t.onToggleMenu,children:[u(pl,{className:"size-3 shrink-0","aria-hidden":"true"}),r]}):b("button",{type:"button","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:O("chat-composer-shoulder-tab chat-composer-stash-tab absolute -top-7 right-4 z-0 inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-t-xl border border-b-0 px-3 pb-1 text-xs leading-none","transition-colors duration-(--control-duration)",t.menuOpen&&"pointer-events-none",t.menuOpen||t.pulsing?"text-foreground":"text-muted-foreground hover:text-foreground"),onPointerDown:a=>{a.preventDefault()},onClick:t.onToggleMenu,children:[u(pl,{className:"size-3 shrink-0","aria-hidden":"true"}),n("stash.label"),r]})});ge();function F5(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function B5(e){let t=F5(e);if(!t)return null;let n=Date.now()-t.getTime();if(n<0)return{value:"just now",suffix:null};let o=Math.floor(n/1e3);if(o<60)return{value:"just now",suffix:null};let r=Math.floor(o/60);if(r<60)return{value:`${r}m`,suffix:"ago"};let a=Math.floor(r/60);return a<24?{value:`${a}h`,suffix:"ago"}:{value:`${Math.floor(a/24)}d`,suffix:"ago"}}function mT(e){let t=B5(e);return t?t.suffix?`${t.value} ${t.suffix}`:t.value:""}ge();var gT=Ut(null),hT=gT.Provider;function Ot(){let e=ln(gT);if(e===null)throw new Error("Composer API has not been provided.");return e}var vT=90;function xT(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function z5(e,t){let n=e.prompt.trim().replace(/\s+/g," ");if(n.length>0)return n.length>vT?`${n.slice(0,vT)}\u2026`:n;let o=e.attachments.length+e.droppedImageNames.length;return o>0?t("stash.imageCountLabel",{count:o}):t("stash.emptyEntry")}var yT=de(function(t){let{entries:n,onRestore:o,onDelete:r,onClose:a}=t,{t:i}=De(),s=Ot(),l=D(null),[d,c]=G(n[0]?.id??null),f=n.find(p=>p.id===d)??n[0];return K(()=>{let p=m=>{let h=l.current;h&&m.composedPath().includes(h)||m.target instanceof Element&&m.target.closest('[data-prompt-stash-badge="true"]')||a()};return document.addEventListener("pointerdown",p,!0),()=>document.removeEventListener("pointerdown",p,!0)},[a]),K(()=>{n.length!==0&&(n.some(p=>p.id===d)||c(n[0]?.id??null))},[n,d]),s.pane.useKeydown(p=>{if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),a();return}if(p.key==="ArrowDown"||p.key==="ArrowUp"){if(n.length===0)return;p.preventDefault(),p.stopPropagation();let m=n.findIndex(x=>x.id===d),h=p.key==="ArrowDown"?1:-1,v=((m>=0?m:h===1?-1:0)+h+n.length)%n.length;c(n[v]?.id??null);return}if(p.key==="Enter"){if(p.target instanceof HTMLElement&&p.target.closest("button[aria-label]")||!f)return;p.preventDefault(),p.stopPropagation(),o(f);return}if(p.key==="Backspace"&&(p.metaKey||p.ctrlKey)){if(!f)return;p.preventDefault(),p.stopPropagation(),r(f)}},{capture:!0}),u(Bf,{autoHighlight:!1,mode:"none",children:b("div",{ref:l,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden","data-composer-stash-drawer":"true",children:[u("div",{className:"flex h-7 items-center justify-end px-2 pt-1",children:u(ne,{variant:"ghost-muted",size:"icon-micro","aria-label":i("stash.closeLabel"),onPointerDown:p=>p.preventDefault(),onClick:a,children:u(jt,{className:"size-3"})})}),u(Hf,{className:"max-h-64 scroll-pb-6",children:u(zf,{children:n.length===0?u("p",{className:"px-3 py-1.5 text-secondary-label text-xs",children:i("stash.empty")}):n.map(p=>b($f,{value:p.id,className:O("group/stash relative cursor-pointer select-none gap-3 rounded-lg px-3 py-1.5! hover:bg-transparent hover:text-inherit data-highlighted:bg-transparent data-highlighted:text-inherit",d===p.id&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{d!==p.id&&c(p.id)},onMouseDown:m=>{m.preventDefault()},onClick:()=>{o(p)},children:[u("span",{className:"min-w-0 flex-1 truncate text-xs",children:z5(p,i)}),p.pendingImageCount?u("span",{className:"shrink-0 text-[10px] text-secondary-label",children:i("stash.savingImage",{count:p.pendingImageCount})}):xT(p)>0?u("span",{className:"shrink-0 text-[10px] text-warning-foreground",children:i("stash.imagesDropped",{count:xT(p)})}):null,p.attachments.length>0?u("span",{className:"flex shrink-0 items-center -space-x-1.5",children:p.attachments.slice(0,3).map(m=>u("img",{src:m.dataUrl,alt:"","aria-hidden":"true",className:"size-5 rounded border border-border/70 object-cover"},m.id))}):null,u("span",{className:"shrink-0 text-secondary-label text-xs max-sm:hidden",children:mT(p.createdAt)}),u(ne,{variant:"ghost",size:"icon-xs",className:"pointer-events-none shrink-0 [--control-icon-color:currentColor] opacity-0 shadow-none! transition-opacity pointer-coarse:pointer-events-auto pointer-coarse:opacity-100 group-hover/stash:pointer-events-auto group-hover/stash:opacity-100 group-focus-within/stash:pointer-events-auto group-focus-within/stash:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100","aria-label":i("stash.deleteLabel"),onClick:m=>{m.stopPropagation(),r(p)},children:u(jt,{className:"stroke-2"})})]},p.id))})})]})})});ge();function bT(e){let t=new Map;return e.map(n=>{let o=t.get(n.step)??0;return t.set(n.step,o+1),{key:`${n.step}:${o}`,step:n}})}function CT({className:e,steps:t}){return t.length<=1?null:u("span",{"aria-hidden":!0,className:O("flex w-10 shrink-0 items-center gap-0.5",e),children:bT(t).map(({key:n,step:o})=>u("span",{className:O("h-[3px] min-w-0 flex-1 rounded-full",o.status==="completed"?"bg-success":o.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},n))})}var vv=de(function({expanded:t,hasTrailingShoulder:n=!1,onDismiss:o,onToggle:r,placement:a="tab",progress:i,steps:s}){let{t:l}=De();if(i.totalSteps<=0)return null;let d=i.completedSteps>=i.totalSteps,c=l("tasksBadge.ariaLabel",{completed:i.completedSteps,total:i.totalSteps,step:i.step});return a==="inline"?b("span",{className:"inline-flex shrink-0 items-center gap-0.5","data-composer-tasks-badge":"true",children:[b(ne,{size:"micro",variant:"ghost-muted","aria-expanded":t,"aria-label":c,className:"shrink-0 gap-1 px-1.5",onClick:r,onPointerDown:f=>f.preventDefault(),children:[u(Ji,{"aria-hidden":!0,className:"size-3 shrink-0"}),u("span",{children:l("tasksBadge.label")}),u(CT,{steps:s}),b("span",{className:O("font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]})]}),u(ne,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(jt,{"aria-hidden":!0,className:"size-2.5"})})]}):b("div",{className:O("chat-composer-shoulder-tab chat-composer-tasks-tab absolute -top-7 left-4 z-0 flex h-8 items-center gap-1 rounded-t-xl border border-b-0 px-2 pb-1 text-xs leading-none text-muted-foreground",n?"right-28":"right-4",d&&"text-foreground"),"data-composer-tasks-badge":"true",children:[b("button",{type:"button","aria-expanded":t,"aria-label":c,className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 self-stretch text-muted-foreground hover:text-foreground",onClick:r,onPointerDown:f=>f.preventDefault(),children:[u(Ji,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"shrink-0",children:"Tasks"}),u("span",{className:"min-w-0 flex-1 truncate text-left font-medium text-foreground/80","data-composer-task-current":"true",children:i.step}),b("span",{className:O("shrink-0 font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]}),u(CT,{className:"w-20",steps:s})]}),u(ne,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(jt,{"aria-hidden":!0,className:"size-3"})})]})}),IT=de(function({onDismiss:t,onCollapse:n,progress:o,steps:r}){let{t:a}=De();return b("div",{className:"chat-composer-top-drawer","data-chat-composer-tasks-drawer":"true",children:[b("div",{className:"flex items-center gap-1 px-3 py-1.5 sm:px-4",children:[b("button",{type:"button","aria-expanded":"true",className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 self-stretch text-left text-xs text-muted-foreground hover:text-foreground",onClick:n,onPointerDown:i=>i.preventDefault(),children:[u(Ji,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"font-medium text-foreground",children:a("tasksBadge.label")}),b("span",{className:"tabular-nums",children:[o.completedSteps,"/",o.totalSteps]})]}),u(ne,{size:"icon-micro",variant:"ghost-muted","aria-label":a("tasksBadge.dismissLabel"),className:"shrink-0",onClick:t,onPointerDown:i=>i.preventDefault(),children:u(jt,{"aria-hidden":!0,className:"size-3"})})]}),u("div",{className:"space-y-px px-3 pb-4 sm:px-4",role:"list",children:bT(r).map(({key:i,step:s})=>b("div",{className:"flex items-baseline gap-2 text-xs leading-5",role:"listitem",children:[u("span",{"aria-hidden":!0,className:O("w-3 shrink-0 text-center font-mono text-[10px]",s.status==="completed"?"text-success":s.status==="inProgress"?"text-primary":"text-muted-foreground/40"),children:s.status==="completed"?"\u2713":s.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:O("min-w-0 flex-1",s.status==="completed"?"text-muted-foreground/55":s.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:s.step}),u("span",{className:"ml-auto w-10 shrink-0 text-right text-[10px] text-muted-foreground/45 tabular-nums","data-composer-task-duration":"true",children:s.durationMs!==void 0?ds(s.durationMs):s.status==="inProgress"?a("tasksBadge.now"):null})]},i))})]})});function ST(e){let t=0,n=0;for(let o of e.imageIds){let r=e.uploadsByImageId[o];r?.status==="failed"&&r.environmentId===e.environmentId?n+=1:(r?.status!=="ready"||r.environmentId!==e.environmentId)&&(t+=1)}return n>0?n===1?"Retry or remove the failed image":"Retry or remove the failed images":t>0?t===1?"Image still uploading":"Images still uploading":null}function yp(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0));return`${Math.floor(t*100)}%`}function wT(e){switch(e){case"image":return Yi;case"pdf":return Xi;case"text":return Qi;case"file":return _o}}var TT="inline-flex h-[1.41em] max-w-full items-center gap-[0.33em] rounded-[0.5em] px-[0.5em] font-medium leading-none align-middle",kT=`${TT} border border-border/70 bg-accent/40 text-foreground`,$5=`${kT} text-[12px]`,Ii=`${kT} text-[0.86em] select-none`,Cp="relative inline-flex align-[-0.125em] leading-none data-[composer-chip-selected]:after:pointer-events-none data-[composer-chip-selected]:after:absolute data-[composer-chip-selected]:after:inset-0 data-[composer-chip-selected]:after:rounded-[6px] data-[composer-chip-selected]:after:bg-[Highlight] data-[composer-chip-selected]:after:opacity-30 data-[composer-chip-selected]:after:content-['']",oa="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",LT="truncate leading-tight",ra="block self-center truncate leading-tight select-none",PT=`${TT} select-none border border-fuchsia-500/25 bg-fuchsia-500/12 text-[0.86em] text-fuchsia-700 dark:text-fuchsia-300`,AT='<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>',bp="ml-[0.17em] inline-flex size-[1.17em] shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/72 transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring";function H5(e,t,n){let o=[];o.push(t(e));let r=n(e);return r&&o.push(r),e.pageUrl&&o.push(e.pageUrl),e.selector&&o.push(e.selector),e.htmlPreview.trim().length>0&&(o.push(""),o.push(e.htmlPreview.trim().slice(0,600))),o.join(`
3700
+ `)}function U5({context:e,onRemove:t}){let{t:n}=De(),o=Ot().elementContext,r=o.formatLabel(e),a=o.formatSourceLabel(e);return b(Ve,{children:[u(Ge,{render:b("span",{className:O(Ii,"pr-1"),children:[u(Zr,{className:O(oa,"size-icon-1")}),u("span",{className:ra,children:r}),a?u("span",{className:"select-none text-[10px] font-normal leading-tight text-muted-foreground/85",children:a}):null,u("button",{type:"button","aria-label":n("pendingContext.removeElement",{label:r}),className:bp,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(e.id)},children:u(jt,{className:"size-3","aria-hidden":!0})})]})}),u(We,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:H5(e,o.formatLabel,o.formatSourceLabel)})]})}function ET({contexts:e,onRemove:t,className:n}){return e.length===0?null:u("div",{className:O("flex flex-wrap gap-1.5",n),children:e.map(o=>u(U5,{context:o,onRemove:t},o.id))})}function MT({comments:e,onRemove:t,className:n}){let{t:o}=De();return e.length===0?null:u("div",{className:O("flex flex-wrap gap-1.5",n),children:e.map(r=>{let a=`${r.filePath} ${r.rangeLabel}`,i=b("span",{className:O(Ii,"pr-1"),children:[u(Zi,{className:O(oa,"size-icon-1")}),u("span",{className:ra,children:a}),u("button",{type:"button","aria-label":o("pendingContext.removeReviewComment",{label:a}),className:bp,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(r.id)},children:u(jt,{className:"size-3","aria-hidden":!0})})]},r.id);return r.text.length===0?i:b(Ve,{children:[u(Ge,{render:i}),u(We,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:r.text})]},r.id)})})}function Ip(e){let t=`${e.count} ${e.label}${e.count===1?"":"s"}`;return b(Ve,{children:[u(Ge,{render:b("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground",children:[e.icon,e.count]})}),u(We,{side:"top",children:t})]})}function RT({annotations:e,images:t,onRemove:n,onExpandImage:o,uploadsByImageId:r,onRetryUpload:a,className:i}){let{t:s}=De(),l=Ot().elementContext;if(e.length===0)return null;let d=new Map(t.map(c=>[c.id,c]));return u("div",{className:O("flex flex-wrap gap-1.5",i),children:e.map(c=>{let f=d.get(c.id),p=f?r?.[f.id]:void 0,m=c.elements.flatMap(h=>{let g=l.normalizeSelection(h.element);return g?[{id:h.id,label:l.formatLabel(g)}]:[]});return b("section",{className:"group/preview-annotation relative flex min-w-0 max-w-full items-center overflow-hidden rounded-lg border border-border/80 bg-background/72",children:[f?.previewUrl?u("button",{type:"button","aria-label":s("previewAnnotation.previewImage",{name:f.name}),className:"size-14 shrink-0 cursor-zoom-in overflow-hidden border-r border-border/70 bg-muted",onClick:()=>o(f.id),children:u("img",{src:f.previewUrl,alt:s("previewAnnotation.cropAlt"),className:"size-full object-cover transition-transform duration-(--control-duration) group-hover/preview-annotation:scale-[1.03]"})}):u("span",{className:"grid size-10 shrink-0 place-items-center border-r border-border/70 text-message-action",children:u(Zr,{className:"size-icon-2"})}),b("div",{className:"min-w-0 px-2.5 py-2 pr-8",children:[c.comment.trim()?u("p",{className:"max-w-80 truncate text-foreground text-xs font-medium",children:c.comment.trim()}):null,b("div",{className:O("flex min-w-0 items-center gap-2",c.comment.trim()&&"mt-1"),children:[m.length>0?b("div",{className:"flex min-w-0 items-center gap-1",children:[m.slice(0,2).map(({id:h,label:g})=>u("span",{className:"max-w-40 truncate font-mono text-secondary-label text-[10px]",children:g},h)),m.length>2?b("span",{className:"text-secondary-label text-[10px]",children:["+",m.length-2]}):null]}):null,b("div",{className:"flex shrink-0 items-center gap-2",children:[c.elements.length>0?u(Ip,{icon:u(Zr,{className:"size-3"}),count:c.elements.length,label:"element"}):null,c.regions.length>0?u(Ip,{icon:u(qd,{className:"size-3"}),count:c.regions.length,label:"region"}):null,c.strokes.length>0?u(Ip,{icon:u(ea,{className:"size-3"}),count:c.strokes.length,label:"drawing"}):null,c.styleChanges.length>0?u(Ip,{icon:u(ts,{className:"size-3"}),count:c.styleChanges.length,label:"style change"}):null,p?.status==="uploading"?u("span",{className:"text-[10px] text-secondary-label",children:yp(p.progress)}):null,p?.status==="failed"&&f&&a?b(Ve,{children:[u(Ge,{render:u(ne,{size:"icon-micro",variant:"ghost-muted","aria-label":`Retry upload for ${f.name}`,onClick:()=>a(f)}),children:u(rs,{className:"size-3"})}),u(We,{side:"top",children:p.reason})]}):null]})]})]}),u(ne,{size:"icon-micro",variant:"ghost-muted","aria-label":s("previewAnnotation.remove"),className:"absolute right-1.5 top-1.5 [--control-icon-color:currentColor] rounded text-icon-muted hover:bg-muted",onClick:()=>n(c.id),children:u(jt,{className:"size-3"})})]},c.id)})})}ge();function NT(e,t){let n=t?.hasWideActions?780:620;return e!==null&&e<n}function _T(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function DT(e,t){let n=Ot().pane.useVisible(),[o,r]=G(null);xe(()=>{if(!n)return;let i=e.current;if(!i)return;let s=!0;if(typeof ResizeObserver<"u"){let c=new ResizeObserver(f=>{if(!s)return;let p=f.find(v=>v.target===i);if(!p)return;let m=window.getComputedStyle(i),h=Number.parseFloat(m.paddingLeft)||0,g=Number.parseFloat(m.paddingRight)||0;r(Math.round(p.contentRect.width+h+g))});return c.observe(i),()=>{s=!1,c.disconnect()}}let l=null,d=()=>{l===null&&(l=window.requestAnimationFrame(()=>{l=null,s&&r(i.clientWidth)}))};return d(),window.addEventListener("resize",d),()=>{s=!1,window.removeEventListener("resize",d),l!==null&&window.cancelAnimationFrame(l)}},[e,n]);let a=NT(o,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&_T(o,{hasWideActions:t})}}var xv={};Mn(xv,{LexicalComposerContext:()=>OT,createLexicalComposerContext:()=>K5,useLexicalComposerContext:()=>q5});ge();var OT=Ut(null);function K5(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}}function q5(){let e=ln(OT);return e==null&&(function(t,...n){let o=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(let a of n)r.append("v",a);throw o.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),e}var yv=xv,FT=yv.LexicalComposerContext,BT=yv.createLexicalComposerContext,wn=yv.useLexicalComposerContext;var jx={};Mn(jx,{$addUpdateTag:()=>sm,$applyNodeReplacement:()=>ou,$caretFromPoint:()=>Ri,$caretRangeFromSelection:()=>ix,$cloneWithProperties:()=>Hx,$cloneWithPropertiesEphemeral:()=>LH,$comparePointCaretNext:()=>Vx,$copyNode:()=>zx,$create:()=>AH,$createLineBreakNode:()=>Kl,$createNodeSelection:()=>wx,$createParagraphNode:()=>Fa,$createPoint:()=>Mr,$createRangeSelection:()=>PL,$createRangeSelectionFromDom:()=>nH,$createTabNode:()=>tm,$createTextNode:()=>Wn,$extendCaretToRange:()=>Kx,$findMatchingParent:()=>Bc,$getAdjacentChildCaret:()=>Yl,$getAdjacentNode:()=>jL,$getAdjacentSiblingOrParentSiblingCaret:()=>FH,$getCaretInDirection:()=>Ni,$getCaretRange:()=>Mi,$getCaretRangeInDirection:()=>Gx,$getCharacterOffsets:()=>Jv,$getChildCaret:()=>za,$getChildCaretAtIndex:()=>dP,$getChildCaretOrSelf:()=>rP,$getCollapsedCaretRange:()=>aP,$getCommonAncestor:()=>zc,$getCommonAncestorResultBranchOrder:()=>Wx,$getEditor:()=>$x,$getNearestNodeFromDOMNode:()=>im,$getNearestRootOrShadowRoot:()=>YL,$getNodeByKey:()=>$n,$getNodeByKeyOrThrow:()=>JL,$getNodeFromDOMNode:()=>Rx,$getPreviousSelection:()=>Rs,$getRoot:()=>Qo,$getSelection:()=>wt,$getSiblingCaret:()=>Yn,$getState:()=>_p,$getStateChange:()=>I$,$getTextContent:()=>aH,$getTextNodeOffset:()=>Er,$getTextPointCaret:()=>Ei,$getTextPointCaretSlice:()=>rx,$getWritableNodeState:()=>cx,$hasAncestor:()=>Qp,$hasUpdateTag:()=>IH,$insertNodes:()=>rH,$isBlockElementNode:()=>tH,$isChildCaret:()=>Ar,$isDecoratorNode:()=>Qt,$isEditorState:()=>dH,$isElementNode:()=>Q,$isExtendableTextPointCaret:()=>lP,$isInlineElementOrDecoratorNode:()=>SH,$isLeafNode:()=>yH,$isLineBreakNode:()=>Ts,$isNodeCaret:()=>RH,$isNodeSelection:()=>Zc,$isParagraphNode:()=>DL,$isRangeSelection:()=>je,$isRootNode:()=>no,$isRootOrShadowRoot:()=>pr,$isSiblingCaret:()=>Ms,$isTabNode:()=>Sx,$isTextNode:()=>Me,$isTextPointCaret:()=>Ba,$isTextPointCaretSlice:()=>OH,$isTokenOrSegmented:()=>_a,$isTokenOrTab:()=>Ti,$nodesOfType:()=>bH,$normalizeCaret:()=>Lr,$normalizeSelection__EXPERIMENTAL:()=>Dp,$onUpdate:()=>XL,$parseSerializedNode:()=>lH,$removeTextFromCaretRange:()=>sP,$rewindSiblingCaret:()=>td,$selectAll:()=>CH,$setCompositionKey:()=>jn,$setPointFromCaret:()=>Jl,$setSelection:()=>$o,$setSelectionFromCaretRange:()=>iP,$setState:()=>S$,$splitAtPointCaretNext:()=>$H,$splitNode:()=>wH,$updateRangeSelectionFromCaretRange:()=>$c,ArtificialNode__DO_NOT_USE:()=>Gp,BEFORE_INPUT_COMMAND:()=>fx,BLUR_COMMAND:()=>sL,CAN_REDO_COMMAND:()=>D$,CAN_UNDO_COMMAND:()=>O$,CLEAR_EDITOR_COMMAND:()=>N$,CLEAR_HISTORY_COMMAND:()=>_$,CLICK_COMMAND:()=>qk,COLLABORATION_TAG:()=>xL,COMMAND_PRIORITY_CRITICAL:()=>mH,COMMAND_PRIORITY_EDITOR:()=>Fl,COMMAND_PRIORITY_HIGH:()=>pH,COMMAND_PRIORITY_LOW:()=>uH,COMMAND_PRIORITY_NORMAL:()=>fH,COMPOSITION_END_COMMAND:()=>gx,COMPOSITION_END_TAG:()=>IL,COMPOSITION_START_COMMAND:()=>mx,COMPOSITION_START_TAG:()=>bL,CONTROLLED_TEXT_INSERTION_COMMAND:()=>zl,COPY_COMMAND:()=>Cx,CUT_COMMAND:()=>bx,DELETE_CHARACTER_COMMAND:()=>qc,DELETE_LINE_COMMAND:()=>Wc,DELETE_WORD_COMMAND:()=>Vc,DRAGEND_COMMAND:()=>aL,DRAGOVER_COMMAND:()=>rL,DRAGSTART_COMMAND:()=>oL,DROP_COMMAND:()=>nL,DecoratorNode:()=>jc,ElementNode:()=>Pi,FOCUS_COMMAND:()=>iL,FORMAT_ELEMENT_COMMAND:()=>R$,FORMAT_TEXT_COMMAND:()=>Si,HISTORIC_TAG:()=>q$,HISTORY_MERGE_TAG:()=>Mp,HISTORY_PUSH_TAG:()=>V$,INDENT_CONTENT_COMMAND:()=>E$,INPUT_COMMAND:()=>px,INSERT_LINE_BREAK_COMMAND:()=>Dc,INSERT_PARAGRAPH_COMMAND:()=>Uv,INSERT_TAB_COMMAND:()=>A$,INTERNAL_$isBlock:()=>Oa,IS_ALL_FORMATTING:()=>o$,IS_BOLD:()=>X5,IS_CODE:()=>e$,IS_HIGHLIGHT:()=>sx,IS_ITALIC:()=>Y5,IS_STRIKETHROUGH:()=>J5,IS_SUBSCRIPT:()=>t$,IS_SUPERSCRIPT:()=>n$,IS_UNDERLINE:()=>Z5,KEY_ARROW_DOWN_COMMAND:()=>Xk,KEY_ARROW_LEFT_COMMAND:()=>Gk,KEY_ARROW_RIGHT_COMMAND:()=>Vk,KEY_ARROW_UP_COMMAND:()=>Qk,KEY_BACKSPACE_COMMAND:()=>Jk,KEY_DELETE_COMMAND:()=>eL,KEY_DOWN_COMMAND:()=>yx,KEY_ENTER_COMMAND:()=>$p,KEY_ESCAPE_COMMAND:()=>Zk,KEY_MODIFIER_COMMAND:()=>lL,KEY_SPACE_COMMAND:()=>Yk,KEY_TAB_COMMAND:()=>tL,LineBreakNode:()=>Ul,MOVE_TO_END:()=>Wk,MOVE_TO_START:()=>jk,NODE_STATE_KEY:()=>h$,OUTDENT_CONTENT_COMMAND:()=>M$,PASTE_COMMAND:()=>hx,PASTE_TAG:()=>W$,ParagraphNode:()=>Wl,REDO_COMMAND:()=>xx,REMOVE_TEXT_COMMAND:()=>Kv,RootNode:()=>Vl,SELECTION_CHANGE_COMMAND:()=>ux,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>P$,SELECT_ALL_COMMAND:()=>qv,SKIP_COLLAB_TAG:()=>G$,SKIP_DOM_SELECTION_TAG:()=>CL,SKIP_SCROLL_INTO_VIEW_TAG:()=>yL,SKIP_SELECTION_FOCUS_TAG:()=>Xv,TEXT_TYPE_TO_FORMAT:()=>go,TabNode:()=>ql,TextNode:()=>Ps,UNDO_COMMAND:()=>vx,addClassNamesToElement:()=>WH,buildImportMap:()=>K$,configExtension:()=>UH,createCommand:()=>Je,createEditor:()=>gH,createSharedNodeState:()=>Bk,createState:()=>b$,declarePeerDependency:()=>KH,defineExtension:()=>HH,flipDirection:()=>_i,getDOMOwnerDocument:()=>Fx,getDOMSelection:()=>Nr,getDOMSelectionFromTarget:()=>ZL,getDOMTextNode:()=>Es,getEditorPropertyFromDOMNode:()=>tu,getNearestEditorFromDOMNode:()=>Mx,getRegisteredNode:()=>Ax,getRegisteredNodeOrThrow:()=>Px,getStaticNodeConfig:()=>ru,getTextDirection:()=>xH,getTransformSetFromKlass:()=>FL,isBlockDomNode:()=>nx,isCurrentlyReadOnlyMode:()=>Zl,isDOMDocumentNode:()=>$L,isDOMNode:()=>ed,isDOMTextNode:()=>sa,isDOMUnmanaged:()=>oP,isDocumentFragment:()=>eP,isExactShortcutMatch:()=>Mt,isHTMLAnchorElement:()=>TH,isHTMLElement:()=>ko,isInlineDomNode:()=>tP,isLexicalEditor:()=>rm,isModifierMatch:()=>GL,isSelectionCapturedInDecoratorInput:()=>Ex,isSelectionWithinEditor:()=>eu,makeStepwiseIterator:()=>qx,mergeRegister:()=>jH,normalizeClassNames:()=>au,removeClassNamesFromElement:()=>GH,removeFromParent:()=>ki,resetRandomKey:()=>hH,safeCast:()=>qH,setDOMUnmanaged:()=>PH,setNodeIndentFromDOM:()=>nP,shallowMergeConfig:()=>VH,toggleTextFormatType:()=>Xc});function J(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Ek(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);n.search=o.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Rr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,V5=Rr&&"documentMode"in document?document.documentMode:null,kr=Rr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Li=Rr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Np=!(!Rr||!("InputEvent"in window)||V5)&&"getTargetRanges"in new window.InputEvent("input"),Yp=Rr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Jc=Rr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,W5=Rr&&/Android/.test(navigator.userAgent),Mk=Rr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ev=Rr&&W5&&Mk,Jp=Rr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&kr&&!Mk,G5=0,j5=1,Q5=2,X5=1,Y5=2,J5=4,Z5=8,e$=16,t$=32,n$=64,sx=128,o$=2047,r$=1,a$=2,i$=3,s$=4,l$=5,d$=6,Hc=Yp||Jc||Jp?"\xA0":"\u200B",Zp=`
3698
3701
 
3699
- `,ox=yi?"\xA0":_c,SL="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",wL="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Z5=new RegExp("^[^"+wL+"]*["+SL+"]"),e$=new RegExp("^[^"+SL+"]*["+wL+"]"),fo={bold:1,capitalize:1024,code:16,highlight:nx,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},t$={directionless:1,unmergeable:2},Lv={center:2,end:6,justify:4,left:1,right:3,start:5},n$={[j5]:"center",[J5]:"end",[X5]:"justify",[G5]:"left",[Q5]:"right",[Y5]:"start"},o$={normal:0,segmented:2,token:1},r$={[O5]:"normal",[B5]:"segmented",[F5]:"token"},a$="$",ET="$config";function TL(e,t,n,o,r,a){let i=e.getFirstChild();for(;i!==null;){let s=i.__key;i.__parent===t&&(Q(i)&&TL(i,s,n,o,r,a),n.has(s)||a.delete(s),r.push(s)),i=i.getNextSibling()}}var kv=!1,rx=0;function i$(e){rx=e.timeStamp}function gv(e,t,n){let o=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||o&&e.previousSibling===r)||o&&Jp(e,n)!==void 0}function s$(e,t,n){let o=Er(qo(n)),r=null,a=null;o!==null&&o.anchorNode===e&&(r=o.anchorOffset,a=o.focusOffset);let i=e.nodeValue;i!==null&&Ex(t,i,r,a,!1)}function l$(e,t,n){if(Ue(e)){let o=e.anchor.getNode();if(o.is(n)&&e.format!==o.getFormat())return!1}return oa(t)&&n.isAttached()}function d$(e,t,n,o){for(let r=e;r&&!jk(r);r=Qc(r)){let a=Jp(r,t);if(a!==void 0){let i=Bn(a,n);if(i)return Qt(i)||!ko(r)?void 0:[r,i]}else if(r===o)return[o,_k(n)]}}function LL(e,t,n){kv=!0;let o=performance.now()-rx>100;try{na(e,()=>{let r=St()||(function(p){return p.getEditorState().read(()=>{let m=St();return m!==null?m.clone():null})})(e),a=new Map,i=e.getRootElement(),s=e._editorState,l=e._blockCursorElement,d=!1,c="";for(let p=0;p<t.length;p++){let m=t[p],h=m.type,g=m.target,v=d$(g,e,s,i);if(!v)continue;let[x,y]=v;if(h==="characterData")o&&Me(y)&&oa(g)&&l$(r,g,y)&&s$(g,y,e);else if(h==="childList"){d=!0;let C=m.addedNodes;for(let S=0;S<C.length;S++){let L=C[S],I=kx(L),T=L.parentNode;if(T!=null&&L!==l&&I===null&&!gv(L,T,e)){if(yi){let E=(ko(L)?L.innerText:null)||L.nodeValue;E&&(c+=E)}T.removeChild(L)}}let w=m.removedNodes,k=w.length;if(k>0){let S=0;for(let L=0;L<k;L++){let I=w[L];(gv(I,g,e)||l===I)&&(g.appendChild(I),S++)}k!==S&&a.set(x,y)}}}if(a.size>0)for(let[p,m]of a)m.reconcileObservedMutation(p,e);let f=n.takeRecords();if(f.length>0){for(let p=0;p<f.length;p++){let m=f[p],h=m.addedNodes,g=m.target;for(let v=0;v<h.length;v++){let x=h[v],y=x.parentNode;y==null||x.nodeName!=="BR"||gv(x,g,e)||y.removeChild(x)}}n.takeRecords()}r!==null&&(d&&Do(r),yi&&$k(e)&&r.insertRawText(c))})}finally{kv=!1}}function kL(e){let t=e._observer;t!==null&&LL(e,t.takeRecords(),t)}function PL(e){(function(t){rx===0&&qo(t).addEventListener("textInput",i$,!0)})(e),e._observer=new MutationObserver((t,n)=>{LL(e,t,n)})}var Pv=class{key;parse;unparse;isEqual;defaultValue;constructor(t,n){this.key=t,this.parse=n.parse.bind(n),this.unparse=(n.unparse||p$).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function c$(e,t){return new Pv(e,t)}function kp(e,t,n="latest"){let o=(n==="latest"?e.getLatest():e).__state;return o?o.getValue(t):t.defaultValue}function u$(e,t,n){let o=kp(e,n,"direct"),r=kp(t,n,"direct");return n.isEqual(o,r)?null:[o,r]}function f$(e,t,n){let o;if(Qn(),typeof n=="function"){let a=e.getLatest(),i=kp(a,t);if(o=n(i),t.isEqual(i,o))return a}else o=n;let r=e.getWritable();return ax(r).updateFromKnown(t,o),r}function AL(e){let t=new Map,n=new Set;for(let o=typeof e=="function"?e:e.replace;o.prototype&&o.prototype.getType!==void 0;o=Object.getPrototypeOf(o)){let{ownNodeConfig:r}=Yc(o);if(r&&r.stateConfigs)for(let a of r.stateConfigs){let i;"stateConfig"in a?(i=a.stateConfig,a.flat&&n.add(i.key)):i=a,t.set(i.key,i)}}return{flatKeys:n,sharedConfigMap:t}}var Av=class e{node;knownState;unknownState;sharedNodeState;size;constructor(t,n,o=void 0,r=new Map,a=void 0){this.node=t,this.sharedNodeState=n,this.unknownState=o,this.knownState=r;let{sharedConfigMap:i}=this.sharedNodeState,s=a!==void 0?a:(function(l,d,c){let f=c.size;if(d)for(let p in d){let m=l.get(p);m&&c.has(m)||f++}return f})(i,o,r);this.size=s}getValue(t){let n=this.knownState.get(t);if(n!==void 0)return n;this.sharedNodeState.sharedConfigMap.set(t.key,t);let o=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){let r=this.unknownState[t.key];r!==void 0&&(o=t.parse(r)),this.updateFromKnown(t,o)}return o}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let t={...this.unknownState},n={};for(let[o,r]of this.knownState)o.isEqual(r,o.defaultValue)?delete t[o.key]:t[o.key]=o.unparse(r);for(let o of this.sharedNodeState.flatKeys)o in t&&(n[o]=t[o],delete t[o]);return MT(t)&&(n.$=t),n}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:o}=this,r=new Map(this.knownState);return new e(t,n,(function(a,i,s){let l;if(s)for(let[d,c]of Object.entries(s)){let f=a.get(d);f?i.has(f)||i.set(f,f.parse(c)):(l=l||{},l[d]=c)}return l})(n.sharedConfigMap,r,o),r,this.size)}updateFromKnown(t,n){let o=t.key;this.sharedNodeState.sharedConfigMap.set(o,t);let{knownState:r,unknownState:a}=this;r.has(t)||a&&o in a||(a&&(delete a[o],this.unknownState=MT(a)),this.size++),r.set(t,n)}updateFromUnknown(t,n){let o=this.sharedNodeState.sharedConfigMap.get(t);o?this.updateFromKnown(o,o.parse(n)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=n)}updateFromJSON(t){let{knownState:n}=this;for(let o of n.keys())n.set(o,o.defaultValue);if(this.size=n.size,this.unknownState=void 0,t)for(let[o,r]of Object.entries(t))this.updateFromUnknown(o,r)}};function ax(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new Av(t,EL(t));return t.__state=n,n}function EL(e){return e.__state?e.__state.sharedNodeState:Sx(Dx(),e.getType()).sharedNodeState}function MT(e){if(e)for(let t in e)return e}function p$(e){return e}function RT(e,t,n){for(let[o,r]of t.knownState){if(e.has(o.key))continue;e.add(o.key);let a=n?n.getValue(o):o.defaultValue;if(a!==r&&!o.isEqual(a,r))return!0}return!1}function NT(e,t,n){let{unknownState:o}=t,r=n?n.unknownState:void 0;if(o){for(let[a,i]of Object.entries(o))if(!e.has(a)&&(e.add(a),i!==(r?r[a]:void 0)))return!0}return!1}function _T(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function DT(e,t){let n=e.__mode,o=e.__format,r=e.__style,a=t.__mode,i=t.__format,s=t.__style,l=e.__state,d=t.__state;return(n===null||n===a)&&(o===null||o===i)&&(r===null||r===s)&&(e.__state===null||l===d||(function(c,f){if(c===f)return!0;if(c&&f&&c.size!==f.size)return!1;let p=new Set;return!(c&&RT(p,c,f)||f&&RT(p,f,c)||c&&NT(p,c,f)||f&&NT(p,f,c))})(l,d))}function OT(e,t){let n=e.mergeWithSibling(t),o=Kt()._normalizedNodes;return o.add(e.__key),o.add(t.__key),n}function FT(e){let t,n,o=e;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(t=o.getPreviousSibling())!==null&&Me(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(DT(t,o)){o=OT(t,o);break}break}t.remove()}for(;(n=o.getNextSibling())!==null&&Me(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(DT(o,n)){o=OT(o,n);break}break}n.remove()}}else o.remove()}function Pp(e){return BT(e.anchor),BT(e.focus),e}function BT(e){for(;e.type==="element";){let t=e.getNode(),n=e.offset,o,r;if(n===t.getChildrenSize()?(o=t.getChildAtIndex(n-1),r=!0):(o=t.getChildAtIndex(n),r=!1),Me(o)){e.set(o.__key,r?o.getTextContentSize():0,"text",!0);break}if(!Q(o))break;e.set(o.__key,r?o.getChildrenSize():0,"element",!0)}}var ws,no,Dc,Gp,Ev,Mv,Ts,Tr,Rv,Oc,Fn="",ta=null,bs=null,kl=!1,Ap=!1;function Ep(e,t){let n=Ts.get(e);if(t!==null){let o=Ov(e);o.parentNode===t&&t.removeChild(o)}if(Tr.has(e)||no._keyToDOMMap.delete(e),Q(n)){let o=Rp(n,Ts);Nv(o,0,o.length-1,null)}n!==void 0&&Mx(Oc,Dc,Gp,n,"destroyed")}function Nv(e,t,n,o){for(let r=t;r<=n;++r){let a=e[r];a!==void 0&&Ep(a,o)}}function Cs(e,t){e.setProperty("text-align",t)}var m$="40px";function ML(e,t){let n=ws.theme.indent;if(typeof n=="string"){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(t===0)return void e.style.setProperty("padding-inline-start","");let o=getComputedStyle(no._rootElement||e).getPropertyValue("--lexical-indent-base-value")||m$;e.style.setProperty("padding-inline-start",`calc(${t} * ${o})`)}function RL(e,t){let n=e.style;t===0?Cs(n,""):t===1?Cs(n,"left"):t===2?Cs(n,"center"):t===3?Cs(n,"right"):t===4?Cs(n,"justify"):t===5?Cs(n,"start"):t===6&&Cs(n,"end")}function _v(e,t){let n=(function(o){let r=o.__dir;if(r!==null)return r;if(to(o))return null;let a=o.getParentOrThrow();return to(a)&&a.__dir===null?"auto":null})(t);n!==null?e.dir=n:e.removeAttribute("dir")}function Mp(e,t){let n=Tr.get(e);n===void 0&&Z(60);let o=n.createDOM(ws,no);if((function(r,a,i){let s=i._keyToDOMMap;(function(l,d,c){let f=`__lexicalKey_${d._key}`;l[f]=c})(a,i,r),s.set(r,a)})(e,o,no),Me(n)?o.setAttribute("data-lexical-text","true"):Qt(n)&&o.setAttribute("data-lexical-decorator","true"),Q(n)){let r=n.__indent,a=n.__size;if(_v(o,n),r!==0&&ML(o,r),a!==0){let s=a-1;Dv(Rp(n,Tr),n,0,s,n.getDOMSlot(o))}let i=n.__format;i!==0&&RL(o,i),n.isInline()||NL(null,n,o)}else{let r=n.getTextContent();if(Qt(n)){let a=n.decorate(no,ws);a!==null&&_L(e,a),o.contentEditable="false"}Fn+=r}return t!==null&&t.insertChild(o),Mx(Oc,Dc,Gp,n,"created"),o}function Dv(e,t,n,o,r){let a=Fn;Fn="";let i=n;for(;i<=o;++i){Mp(e[i],r);let s=Tr.get(e[i]);s!==null&&Me(s)?ta===null&&(ta=s.getFormat(),bs=s.getStyle()):Q(s)&&i<o&&!s.isInline()&&(Fn+=Wp)}r.element.__lexicalTextContent=Fn,Fn=a+Fn}function zT(e,t){if(e){let n=e.__last;if(n){let o=t.get(n);if(o)return Ss(o)?"line-break":Qt(o)&&o.isInline()?"decorator":null}return"empty"}return null}function NL(e,t,n){let o=zT(e,Ts),r=zT(t,Tr);o!==r&&t.getDOMSlot(n).setManagedLineBreak(r)}function g$(e,t,n){var o;ta=null,bs=null,(function(r,a,i){let s=Fn,l=r.__size,d=a.__size;Fn="";let c=i.element;if(l===1&&d===1){let f=r.__first,p=a.__first;if(f===p)Cp(f,c);else{let h=Ov(f),g=Mp(p,null);try{c.replaceChild(g,h)}catch(v){if(typeof v=="object"&&v!=null){let x=`${v.toString()} Parent: ${c.tagName}, new child: {tag: ${g.tagName} key: ${p}}, old child: {tag: ${h.tagName}, key: ${f}}.`;throw new Error(x)}throw v}Ep(f,null)}let m=Tr.get(p);Me(m)&&ta===null&&(ta=m.getFormat(),bs=m.getStyle())}else{let f=Rp(r,Ts),p=Rp(a,Tr);if(f.length!==l&&Z(227),p.length!==d&&Z(228),l===0)d!==0&&Dv(p,0,0,d-1,i);else if(d===0){if(l!==0){let m=i.after==null&&i.before==null&&i.element.__lexicalLineBreak==null;Nv(f,0,l-1,m?null:c),m&&(c.textContent="")}}else(function(m,h,g,v,x,y){let C=v-1,w=x-1,k,S,L=y.getFirstChild(),I=0,T=0;for(;I<=C&&T<=w;){let N=h[I],R=g[T];if(N===R)L=hv(Cp(R,y.element)),I++,T++;else{if(S===void 0&&(S=$T(g,T)),k===void 0)k=$T(h,I);else if(!k.has(N)){I++;continue}if(!S.has(N)){L=hv(Ov(N)),Ep(N,y.element),I++,k.delete(N);continue}if(k.has(R)){let H=zl(no,R);H!==L&&y.withBefore(L).insertChild(H),L=hv(Cp(R,y.element)),I++,T++}else Mp(R,y.withBefore(L)),T++}let $=Tr.get(R);$!==null&&Me($)?ta===null&&(ta=$.getFormat(),bs=$.getStyle()):Q($)&&T<=w&&!$.isInline()&&(Fn+=Wp)}let E=I>C,A=T>w;if(E&&!A){let N=g[w+1],R=N===void 0?null:no.getElementByKey(N);Dv(g,0,T,w,y.withBefore(R))}else A&&!E&&Nv(h,I,C,y.element)})(0,f,p,l,d,i)}c.__lexicalTextContent=Fn,Fn=s+Fn})(e,t,t.getDOMSlot(n)),o=t,ta==null||ta===o.__textFormat||Ap||o.setTextFormat(ta),(function(r){bs==null||bs===r.__textStyle||Ap||r.setTextStyle(bs)})(t)}function Rp(e,t){let n=[],o=e.__first;for(;o!==null;){let r=t.get(o);r===void 0&&Z(101),n.push(o),o=r.__next}return n}function Cp(e,t){let n=Ts.get(e),o=Tr.get(e);n!==void 0&&o!==void 0||Z(61);let r=kl||Mv.has(e)||Ev.has(e),a=zl(no,e);if(n===o&&!r){let i;if(Q(n)){let s=a.__lexicalTextContent;typeof s=="string"?i=s:(i=n.getTextContent(),a.__lexicalTextContent=i)}else i=n.getTextContent();return Fn+=i,a}if(n!==o&&r&&Mx(Oc,Dc,Gp,o,"updated"),o.updateDOM(n,a,ws)){let i=Mp(e,null);return t===null&&Z(62),t.replaceChild(i,a),Ep(e,null),i}if(Q(n)){Q(o)||Z(334,e);let i=o.__indent;(kl||i!==n.__indent)&&ML(a,i);let s=o.__format;if((kl||s!==n.__format)&&RL(a,s),r)g$(n,o,a),to(o)||o.isInline()||NL(n,o,a);else{let l=a.__lexicalTextContent,d;typeof l=="string"?d=l:(d=n.getTextContent(),a.__lexicalTextContent=d),Fn+=d}if((kl||o.__dir!==n.__dir)&&(_v(a,o),to(o)&&!kl))for(let l of o.getChildren())Q(l)&&_v(zl(no,l.getKey()),l)}else{let i=o.getTextContent();if(Qt(o)){let s=o.decorate(no,ws);s!==null&&_L(e,s)}Fn+=i}if(!Ap&&to(o)&&o.__cachedText!==Fn){let i=o.getWritable();i.__cachedText=Fn,o=i}return a}function _L(e,t){let n=no._pendingDecorators,o=no._decorators;if(n===null){if(o[e]===t)return;n=Nk(no)}n[e]=t}function hv(e){let t=e.nextSibling;return t!==null&&t===no._blockCursorElement&&(t=t.nextSibling),t}function $T(e,t){let n=new Set;for(let o=t;o<e.length;o++)n.add(e[o]);return n}function h$(e,t,n,o,r,a){Fn="",kl=o===2,no=n,ws=n._config,Dc=n._nodes,Gp=no._listeners.mutation,Ev=r,Mv=a,Ts=e._nodeMap,Tr=t._nodeMap,Ap=t._readOnly,Rv=new Map(n._keyToDOMMap);let i=new Map;return Oc=i,Cp("root",null),no=void 0,Dc=void 0,Ev=void 0,Mv=void 0,Ts=void 0,Tr=void 0,ws=void 0,Rv=void 0,Oc=void 0,i}function Ov(e){let t=Rv.get(e);return t===void 0&&Z(75,e),t}function Ge(e){return{type:e}}var ix=Ge("SELECTION_CHANGE_COMMAND"),v$=Ge("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),DL=Ge("CLICK_COMMAND"),sx=Ge("BEFORE_INPUT_COMMAND"),lx=Ge("INPUT_COMMAND"),dx=Ge("COMPOSITION_START_COMMAND"),cx=Ge("COMPOSITION_END_COMMAND"),Fc=Ge("DELETE_CHARACTER_COMMAND"),Pc=Ge("INSERT_LINE_BREAK_COMMAND"),Fv=Ge("INSERT_PARAGRAPH_COMMAND"),Ml=Ge("CONTROLLED_TEXT_INSERTION_COMMAND"),ux=Ge("PASTE_COMMAND"),Bv=Ge("REMOVE_TEXT_COMMAND"),Bc=Ge("DELETE_WORD_COMMAND"),zc=Ge("DELETE_LINE_COMMAND"),gi=Ge("FORMAT_TEXT_COMMAND"),fx=Ge("UNDO_COMMAND"),px=Ge("REDO_COMMAND"),mx=Ge("KEYDOWN_COMMAND"),OL=Ge("KEY_ARROW_RIGHT_COMMAND"),FL=Ge("MOVE_TO_END"),BL=Ge("KEY_ARROW_LEFT_COMMAND"),zL=Ge("MOVE_TO_START"),$L=Ge("KEY_ARROW_UP_COMMAND"),HL=Ge("KEY_ARROW_DOWN_COMMAND"),Np=Ge("KEY_ENTER_COMMAND"),UL=Ge("KEY_SPACE_COMMAND"),KL=Ge("KEY_BACKSPACE_COMMAND"),qL=Ge("KEY_ESCAPE_COMMAND"),VL=Ge("KEY_DELETE_COMMAND"),WL=Ge("KEY_TAB_COMMAND"),x$=Ge("INSERT_TAB_COMMAND"),y$=Ge("INDENT_CONTENT_COMMAND"),C$=Ge("OUTDENT_CONTENT_COMMAND"),GL=Ge("DROP_COMMAND"),b$=Ge("FORMAT_ELEMENT_COMMAND"),jL=Ge("DRAGSTART_COMMAND"),QL=Ge("DRAGOVER_COMMAND"),XL=Ge("DRAGEND_COMMAND"),gx=Ge("COPY_COMMAND"),hx=Ge("CUT_COMMAND"),zv=Ge("SELECT_ALL_COMMAND"),I$=Ge("CLEAR_EDITOR_COMMAND"),S$=Ge("CLEAR_HISTORY_COMMAND"),w$=Ge("CAN_REDO_COMMAND"),T$=Ge("CAN_UNDO_COMMAND"),YL=Ge("FOCUS_COMMAND"),JL=Ge("BLUR_COMMAND"),ZL=Ge("KEY_MODIFIER_COMMAND"),wa=Object.freeze({}),$v=[["keydown",function(e,t){$c=e.timeStamp,ek=e.key,!t.isComposing()&&Ce(t,mx,e)}],["pointerdown",function(e,t){let n=e.target,o=e.pointerType;Wl(n)&&o!=="touch"&&o!=="pen"&&e.button===0&&na(t,()=>{Ek(n)||(Kv=!0)})}],["compositionstart",function(e,t){Ce(t,dx,e)}],["compositionend",function(e,t){yi?kc=!0:Vc||!qp&&!Vp?Ce(t,cx,e):(bp=!0,Ip=e.data)}],["input",function(e,t){e.stopPropagation(),na(t,()=>{t.dispatchCommand(lx,e)},{event:e}),Pl=null}],["click",function(e,t){na(t,()=>{let n=St(),o=Er(qo(t)),r=Es();if(o){if(Ue(n)){let a=n.anchor,i=a.getNode();if(a.type==="element"&&a.offset===0&&n.isCollapsed()&&!to(i)&&Ko().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&r!==null&&n.is(r))o.removeAllRanges(),n.dirty=!0;else if(e.detail===3&&!n.isCollapsed()&&i!==n.focus.getNode()){let s=Mc(i,l=>Q(l)&&!l.isInline());Q(s)&&s.select(0)}}else if(e.pointerType==="touch"||e.pointerType==="pen"){let a=o.anchorNode;(ko(a)||oa(a))&&Do(Qp(r,o,t,e))}}Ce(t,DL,e)})}],["cut",wa],["copy",wa],["dragstart",wa],["dragover",wa],["dragend",wa],["paste",wa],["focus",wa],["blur",wa],["drop",wa]];Lp&&$v.push(["beforeinput",(e,t)=>(function(n,o){let r=n.inputType;r==="deleteCompositionText"||yi&&$k(o)||r!=="insertCompositionText"&&Ce(o,sx,n)})(e,t)]);var $c=0,ek=null,tk=0,Pl=null,Hv=new WeakMap,_p=new WeakMap,Uv=!1,Kv=!1,Ac=!1,kc=!1,bp=!1,Ip="",Is=null,nk=[0,"",0,"root",0];function ok(e,t,n,o,r){let a=e.anchor,i=e.focus,s=a.getNode(),l=Kt(),d=Er(qo(l)),c=d!==null?d.anchorNode:null,f=a.key,p=l.getElementByKey(f),m=n.length;return f!==i.key||!Me(s)||(!r&&(!Lp||tk<o+50)||s.isDirty()&&m<2||Dk(n))&&a.offset!==i.offset&&!s.isComposing()||ka(s)||s.isDirty()&&m>1||(r||!Lp)&&p!==null&&!s.isComposing()&&c!==Ps(p)||d!==null&&t!==null&&(!t.collapsed||t.startContainer!==d.anchorNode||t.startOffset!==d.anchorOffset)||!s.isComposing()&&(s.getFormat()!==e.format||s.getStyle()!==e.style)||(function(h,g){if(g.isSegmented())return!0;if(!h.isCollapsed())return!1;let v=h.anchor.offset,x=g.getParentOrThrow(),y=vi(g);return v===0?!g.canInsertTextBefore()||!x.canInsertTextBefore()&&!g.isComposing()||y||(function(C){let w=C.getPreviousSibling();return(Me(w)||Q(w)&&w.isInline())&&!w.canInsertTextAfter()})(g):v===g.getTextContentSize()&&(!g.canInsertTextAfter()||!x.canInsertTextAfter()&&!g.isComposing()||y)})(e,s)}function HT(e,t){return oa(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function UT(e,t,n){let{anchorNode:o,anchorOffset:r,focusNode:a,focusOffset:i}=e;Uv&&(Uv=!1,HT(o,r)&&HT(a,i)&&!Is)||na(t,()=>{if(!n)return void Do(null);if(!Gc(t,o,a))return;let s=St();if(Is&&Ue(s)&&s.isCollapsed()){let l=s.anchor,d=Is.anchor;(l.key===d.key&&l.offset===d.offset+1||l.offset===1&&d.getNode().is(l.getNode().getPreviousSibling()))&&(s=Is.clone(),Do(s))}if(Is=null,Ue(s)){let l=s.anchor,d=l.getNode();if(s.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(s.dirty=!0);let c=qo(t).event,f=c?c.timeStamp:performance.now(),[p,m,h,g,v]=nk,x=Ko(),y=t.isComposing()===!1&&x.getTextContent()==="";if(f<v+200&&l.offset===h&&l.key===g)Sp(s,p,m);else if(l.type==="text")Me(d)||Z(141),rk(s,d);else if(l.type==="element"&&!y){Q(d)||Z(259);let C=l.getNode();C.isEmpty()?(function(w,k){let S=k.getTextFormat(),L=k.getTextStyle();Sp(w,S,L)})(s,C):Sp(s,0,"")}}else{let c=l.key,f=s.focus.key,p=s.getNodes(),m=p.length,h=s.isBackward(),g=h?i:r,v=h?r:i,x=h?f:c,y=h?c:f,C=2047,w=!1;for(let k=0;k<m;k++){let S=p[k],L=S.getTextContentSize();if(Me(S)&&L!==0&&!(k===0&&S.__key===x&&g===L||k===m-1&&S.__key===y&&v===0)&&(w=!0,C&=S.getFormat(),C===0))break}s.format=w?C:0}}Ce(t,ix,void 0)})}function Sp(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function rk(e,t){Sp(e,t.getFormat(),t.getStyle())}function ak(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function L$(e){let t=e.inputType,n=ak(e),o=Kt(),r=St();if(t==="deleteContentBackward"){if(r===null){let f=Es();if(!Ue(f))return!0;Do(f.clone())}if(Ue(r)){let f=r.anchor.key===r.focus.key;if(a=e.timeStamp,ek==="MediaLast"&&a<$c+30&&o.isComposing()&&f){if(Xn(null),$c=0,setTimeout(()=>{na(o,()=>{Xn(null)})},30),Ue(r)){let p=r.anchor.getNode();p.markDirty(),Me(p)||Z(142),rk(r,p)}}else{Xn(null),e.preventDefault();let p=r.anchor.getNode(),m=p.getTextContent(),h=p.canInsertTextAfter(),g=r.anchor.offset===0&&r.focus.offset===m.length,v=Tv&&f&&!g&&h;if(v&&r.isCollapsed()&&(v=!Qt(zk(r.anchor,!0))),!v){Ce(o,Fc,!0);let x=St();Tv&&Ue(x)&&x.isCollapsed()&&(Is=x,setTimeout(()=>Is=null))}}return!0}}var a;if(!Ue(r))return!0;let i=e.data;Pl!==null&&Ax(!1,o,Pl),r.dirty&&Pl===null||!r.isCollapsed()||to(r.anchor.getNode())||n===null||r.applyDOMRange(n),Pl=null;let s=r.anchor,l=r.focus,d=s.getNode(),c=l.getNode();if(t==="insertText"||t==="insertTranspose"){if(i===`
3700
- `)e.preventDefault(),Ce(o,Pc,!1);else if(i===Wp)e.preventDefault(),Ce(o,Fv,void 0);else if(i==null&&e.dataTransfer){let f=e.dataTransfer.getData("text/plain");e.preventDefault(),r.insertRawText(f)}else i!=null&&ok(r,n,i,e.timeStamp,!0)?(e.preventDefault(),Ce(o,Ml,i)):Pl=i;return tk=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Ce(o,Ml,e);break;case"insertFromComposition":Xn(null),Ce(o,Ml,e);break;case"insertLineBreak":Xn(null),Ce(o,Pc,!1);break;case"insertParagraph":Xn(null),Ac&&!Vc?(Ac=!1,Ce(o,Pc,!1)):Ce(o,Fv,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Ce(o,ux,e);break;case"deleteByComposition":(function(f,p){return f!==p||Q(f)||Q(p)||!vi(f)||!vi(p)})(d,c)&&Ce(o,Bv,e);break;case"deleteByDrag":case"deleteByCut":Ce(o,Bv,e);break;case"deleteContent":Ce(o,Fc,!1);break;case"deleteWordBackward":Ce(o,Bc,!0);break;case"deleteWordForward":Ce(o,Bc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Ce(o,zc,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Ce(o,zc,!1);break;case"formatStrikeThrough":Ce(o,gi,"strikethrough");break;case"formatBold":Ce(o,gi,"bold");break;case"formatItalic":Ce(o,gi,"italic");break;case"formatUnderline":Ce(o,gi,"underline");break;case"historyUndo":Ce(o,fx,void 0);break;case"historyRedo":Ce(o,px,void 0)}return!0}function k$(e){if(ko(e.target)&&Ek(e.target))return!0;let t=Kt(),n=St(),o=e.data,r=ak(e);if(o!=null&&Ue(n)&&ok(n,r,o,e.timeStamp,!1)){kc&&(Dp(t,o),kc=!1);let a=n.anchor.getNode(),i=Er(qo(t));if(i===null)return!0;let s=n.isBackward(),l=s?n.anchor.offset:n.focus.offset,d=s?n.focus.offset:n.anchor.offset;Lp&&!n.isCollapsed()&&Me(a)&&i.anchorNode!==null&&a.getTextContent().slice(0,l)+o+a.getTextContent().slice(l+d)===Fk(i.anchorNode)||Ce(t,Ml,o);let c=o.length;yi&&c>1&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(n.anchor.offset-=c),Tv&&t.isComposing()&&($c=0,Xn(null))}else Ax(!1,t,o!==null?o:void 0),kc&&(Dp(t,o||void 0),kc=!1);return(function(){Qn();let a=Kt();kL(a)})(),!0}function P$(e){let t=Kt(),n=St();if(Ue(n)&&!t.isComposing()){let o=n.anchor,r=n.anchor.getNode();Xn(o.key),em(fk),(e.timeStamp<$c+30||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||Me(r)&&r.getStyle()!==n.style)&&Ce(t,Ml,ox)}return!0}function A$(e){return Dp(Kt(),e.data),em(pk),!0}function Dp(e,t){let n=e._compositionKey;if(Xn(null),n!==null&&t!=null){if(t===""){let o=Bn(n),r=Ps(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&Me(o)){let a=Er(qo(e)),i=null,s=null;a!==null&&a.anchorNode===r&&(i=a.anchorOffset,s=a.focusOffset),Ex(o,r.nodeValue,i,s,!0)}return}if(t[t.length-1]===`
3701
- `){let o=St();if(Ue(o)||Wc(o)){if(Ue(o)){let r=o.focus;o.anchor.set(r.key,r.offset,r.type)}return void Ce(e,Np,null)}}}Ax(!0,e,t)}function E$(e){let t=Kt();if(e.key==null)return!0;if(bp){if(gL(e))return na(t,()=>{Dp(t,Ip)}),bp=!1,Ip="",!0;bp=!1,Ip=""}if((function(n){return Pt(n,"ArrowRight",{shiftKey:"any"})})(e))Ce(t,OL,e);else if((function(n){return Pt(n,"ArrowRight",La)})(e))Ce(t,FL,e);else if((function(n){return Pt(n,"ArrowLeft",{shiftKey:"any"})})(e))Ce(t,BL,e);else if((function(n){return Pt(n,"ArrowLeft",La)})(e))Ce(t,zL,e);else if((function(n){return Pt(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))Ce(t,$L,e);else if((function(n){return Pt(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))Ce(t,HL,e);else if((function(n){return Pt(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))Ac=!0,Ce(t,Np,e);else if((function(n){return n.key===" "})(e))Ce(t,UL,e);else if((function(n){return Sr&&Pt(n,"o",{ctrlKey:!0})})(e))e.preventDefault(),Ac=!0,Ce(t,Pc,!0);else if((function(n){return Pt(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))Ac=!1,Ce(t,Np,e);else if((function(n){return Pt(n,"Backspace",{shiftKey:"any"})||Sr&&Pt(n,"h",{ctrlKey:!0})})(e))gL(e)?Ce(t,KL,e):(e.preventDefault(),Ce(t,Fc,!0));else if((function(n){return n.key==="Escape"})(e))Ce(t,qL,e);else if((function(n){return Pt(n,"Delete",{})||Sr&&Pt(n,"d",{ctrlKey:!0})})(e))(function(n){return n.key==="Delete"})(e)?Ce(t,VL,e):(e.preventDefault(),Ce(t,Fc,!1));else if((function(n){return Pt(n,"Backspace",mL)})(e))e.preventDefault(),Ce(t,Bc,!0);else if((function(n){return Pt(n,"Delete",mL)})(e))e.preventDefault(),Ce(t,Bc,!1);else if((function(n){return Sr&&Pt(n,"Backspace",{metaKey:!0})})(e))e.preventDefault(),Ce(t,zc,!0);else if((function(n){return Sr&&(Pt(n,"Delete",{metaKey:!0})||Pt(n,"k",{ctrlKey:!0}))})(e))e.preventDefault(),Ce(t,zc,!1);else if((function(n){return Pt(n,"b",La)})(e))e.preventDefault(),Ce(t,gi,"bold");else if((function(n){return Pt(n,"u",La)})(e))e.preventDefault(),Ce(t,gi,"underline");else if((function(n){return Pt(n,"i",La)})(e))e.preventDefault(),Ce(t,gi,"italic");else if((function(n){return Pt(n,"Tab",{shiftKey:"any"})})(e))Ce(t,WL,e);else if((function(n){return Pt(n,"z",La)})(e))e.preventDefault(),Ce(t,fx,void 0);else if((function(n){return Sr?Pt(n,"z",{metaKey:!0,shiftKey:!0}):Pt(n,"y",{ctrlKey:!0})||Pt(n,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),Ce(t,px,void 0);else{let n=t._editorState._selection;n===null||Ue(n)?hL(e)&&(e.preventDefault(),Ce(t,zv,e)):(function(o){return Pt(o,"c",La)})(e)?(e.preventDefault(),Ce(t,gx,e)):(function(o){return Pt(o,"x",La)})(e)?(e.preventDefault(),Ce(t,hx,e)):hL(e)&&(e.preventDefault(),Ce(t,zv,e))}return(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(e)&&t.dispatchCommand(ZL,e),!0}function ik(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var Rl=new Map;function sk(e){let t=qk(e.target);if(t===null)return;let n=Lx(t.anchorNode);if(n===null)return;Kv&&(Kv=!1,na(n,()=>{let l=Es(),d=t.anchorNode;(ko(d)||oa(d))&&Do(Qp(l,t,n,e))}));let o=Px(n),r=o[o.length-1],a=r._key,i=Rl.get(a),s=i||r;s!==n&&UT(t,s,!1),UT(t,n,!0),n!==r?Rl.set(a,n):i&&Rl.delete(a)}function KT(e){e._lexicalHandled=!0}function qT(e){return e._lexicalHandled===!0}var VT=()=>{};function M$(e){let t=Hv.get(e);if(t===void 0)return void VT();let n=_p.get(t);if(n===void 0)return void VT();let o=n-1;o>=0||Z(164),Hv.delete(e),_p.set(t,o),o===0&&t.removeEventListener("selectionchange",sk);let r=jc(e);Yp(r)?((function(i){if(i._parentEditor!==null){let s=Px(i),l=s[s.length-1]._key;Rl.get(l)===i&&Rl.delete(l)}else Rl.delete(i._key)})(r),e.__lexicalEditor=null):r&&Z(198);let a=ik(e);for(let i=0;i<a.length;i++)a[i]();e.__lexicalEventHandles=[]}function qv(e,t,n){Qn();let o=e.__key,r=e.getParent();if(r===null)return;let a=(function(s){let l=St();if(!Ue(l)||!Q(s))return l;let{anchor:d,focus:c}=l,f=d.getNode(),p=c.getNode();return Up(f,s)&&d.set(s.__key,0,"element"),Up(p,s)&&c.set(s.__key,0,"element"),l})(e),i=!1;if(Ue(a)&&t){let s=a.anchor,l=a.focus;s.key===o&&(zp(s,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0),l.key===o&&(zp(l,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0)}else Wc(a)&&t&&e.isSelected()&&e.selectPrevious();if(Ue(a)&&t&&!i){let s=e.getIndexWithinParent();xi(e),Bp(a,r,s,-1)}else xi(e);n||cr(r)||r.canBeEmpty()||!r.isEmpty()||qv(r,t),t&&a&&to(r)&&r.isEmpty()&&r.selectEnd()}function R$(e){return e}var lk=Symbol.for("ephemeral");function Op(e){return e[lk]||!1}var dr=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=Yc(this);return t===void 0&&Z(64,this.name),t}static clone(t){Z(65,this.name)}$config(){return{}}config(t,n){let o=n.extends||Object.getPrototypeOf(this.constructor);return Object.assign(n,{extends:o,type:t}),{[t]:n}}afterCloneFrom(t){this.__key===t.__key?(this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state):t.__state&&(this.__state=t.__state.getWritable(this))}static importDOM;constructor(t){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),Rk(this,t)}getType(){return this.__type}isInline(){Z(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let n=Bn(t);if(n===null)break;t=n.__parent}return!1}isSelected(t){let n=t||St();if(n==null)return!1;let o=n.getNodes().some(r=>r.__key===this.__key);if(Me(this))return o;if(Ue(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;let r=this.getParent();if(Qt(this)&&this.isInline()&&r){let a=n.isBackward()?n.focus:n.anchor;if(r.is(a.getNode())&&a.offset===r.getChildrenSize()&&this.is(r.getLastChild()))return!1}}return o}getKey(){return this.__key}getIndexWithinParent(){let t=this.getParent();if(t===null)return-1;let n=t.getFirstChild(),o=0;for(;n!==null;){if(this.is(n))return o;o++,n=n.getNextSibling()}return-1}getParent(){let t=this.getLatest().__parent;return t===null?null:Bn(t)}getParentOrThrow(){let t=this.getParent();return t===null&&Z(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let n=t.getParent();if(cr(n))return Q(t)||t===this&&Qt(t)||Z(194),t;t=n}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&Z(67,this.__key),t}getParents(){let t=[],n=this.getParent();for(;n!==null;)t.push(n),n=n.getParent();return t}getParentKeys(){let t=[],n=this.getParent();for(;n!==null;)t.push(n.__key),n=n.getParent();return t}getPreviousSibling(){let t=this.getLatest().__prev;return t===null?null:Bn(t)}getPreviousSiblings(){let t=[],n=this.getParent();if(n===null)return t;let o=n.getFirstChild();for(;o!==null&&!o.is(this);)t.push(o),o=o.getNextSibling();return t}getNextSibling(){let t=this.getLatest().__next;return t===null?null:Bn(t)}getNextSiblings(){let t=[],n=this.getNextSibling();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getCommonAncestor(t){let n=Q(this)?this:this.getParent(),o=Q(t)?t:t.getParent(),r=n&&o?Rc(n,o):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let n=Rc(this,t);return n!==null&&(n.type==="descendant"||(n.type==="branch"?Hx(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&Z(279),!1)))}isParentOf(t){let n=Rc(this,t);return n!==null&&n.type==="ancestor"}getNodesBetween(t){let n=this.isBefore(t),o=[],r=new Set,a=this;for(;a!==null;){let i=a.__key;if(r.has(i)||(r.add(i),o.push(a)),a===t)break;let s=Q(a)?n?a.getFirstChild():a.getLastChild():null;if(s!==null){a=s;continue}let l=n?a.getNextSibling():a.getPreviousSibling();if(l!==null){a=l;continue}let d=a.getParentOrThrow();if(r.has(d.__key)||o.push(d),d===t)break;let c=null,f=d;do{if(f===null&&Z(68),c=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),f===null)break;c!==null||r.has(f.__key)||o.push(f)}while(c===null);a=c}return n||o.reverse(),o}isDirty(){let t=Kt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(Op(this))return this;let t=Bn(this.__key);return t===null&&Z(113),t}getWritable(){if(Op(this))return this;Qn();let t=Na(),n=Kt(),o=t._nodeMap,r=this.__key,a=this.getLatest(),i=n._cloneNotNeeded,s=St();if(s!==null&&s.setCachedNodes(null),i.has(r))return Hp(a),a;let l=Ox(a);return i.add(r),Hp(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,n){Z(70)}updateDOM(t,n,o){Z(71)}exportDOM(t){return{element:this.createDOM(t._config,t)}}exportJSON(){let t=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...t}}static importJSON(t){Z(18,this.name)}updateFromJSON(t){return(function(n,o){let r=n.getWritable(),a=o.$,i=a;for(let s of EL(r).flatKeys)s in o&&(i!==void 0&&i!==a||(i={...a}),i[s]=o[s]);return(r.__state||i)&&ax(n).updateFromJSON(i),r})(this,t)}static transform(){return null}remove(t){qv(this,!0,t)}replace(t,n){Qn();let o=St();o!==null&&(o=o.clone()),Iv(this,t);let r=this.getLatest(),a=this.__key,i=t.__key,s=t.getWritable(),l=this.getParentOrThrow().getWritable(),d=l.__size;xi(s);let c=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,h=r.__parent;if(qv(r,!1,!0),c===null?l.__first=i:c.getWritable().__next=i,s.__prev=p,f===null?l.__last=i:f.getWritable().__prev=i,s.__next=m,s.__parent=h,l.__size=d,n&&(Q(this)&&Q(s)||Z(139),this.getChildren().forEach(g=>{s.append(g)})),Ue(o)){Do(o);let g=o.anchor,v=o.focus;g.key===a&&QT(g,s),v.key===a&&QT(v,s)}return hi()===a&&Xn(i),s}insertAfter(t,n=!0){Qn(),Iv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.getParent(),i=St(),s=!1,l=!1;if(a!==null){let m=t.getIndexWithinParent();if(xi(r),Ue(i)){let h=a.__key,g=i.anchor,v=i.focus;s=g.type==="element"&&g.key===h&&g.offset===m+1,l=v.type==="element"&&v.key===h&&v.offset===m+1}}let d=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),f=r.__key,p=o.__next;if(d===null?c.__last=f:d.getWritable().__prev=f,c.__size++,o.__next=f,r.__next=p,r.__prev=o.__key,r.__parent=o.__parent,n&&Ue(i)){let m=this.getIndexWithinParent();Bp(i,c,m+1);let h=c.__key;s&&i.anchor.set(h,m+2,"element"),l&&i.focus.set(h,m+2,"element")}return t}insertBefore(t,n=!0){Qn(),Iv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.__key;xi(r);let i=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=o.__prev,d=this.getIndexWithinParent();i===null?s.__first=a:i.getWritable().__next=a,s.__size++,o.__prev=a,r.__prev=l,r.__next=o.__key,r.__parent=o.__parent;let c=St();return n&&Ue(c)&&Bp(c,this.getParentOrThrow(),d),t}isParentRequired(){return!1}createParentElementNode(){return Ea()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,n){Qn();let o=this.getPreviousSibling(),r=this.getParentOrThrow();if(o===null)return r.select(0,0);if(Q(o))return o.select();if(!Me(o)){let a=o.getIndexWithinParent()+1;return r.select(a,a)}return o.select(t,n)}selectNext(t,n){Qn();let o=this.getNextSibling(),r=this.getParentOrThrow();if(o===null)return r.select();if(Q(o))return o.select(0,0);if(!Me(o)){let a=o.getIndexWithinParent();return r.select(a,a)}return o.select(t,n)}markDirty(){this.getWritable()}reconcileObservedMutation(t,n){this.markDirty()}},N$="historic",_$="history-push",wp="history-merge",D$="paste",dk="collaboration",O$="skip-collab",ck="skip-scroll-into-view",uk="skip-dom-selection",Vv="skip-selection-focus",fk="composition-start",pk="composition-end",_l=class e extends dr{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
3702
- `}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:t=>(function(n){let o=n.parentElement;if(o!==null&&Yv(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&hp(r)){let a=o.lastChild;if(a===n||a.previousSibling===n&&hp(a))return!0}}return!1})(t)||(function(n){let o=n.parentElement;if(o!==null&&Yv(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&hp(r))return!1;let a=o.lastChild;if(a===n||a.previousSibling===n&&hp(a))return!0}return!1})(t)?null:{conversion:F$,priority:0}}}static importJSON(t){return Dl().updateFromJSON(t)}};function F$(e){return{node:Dl()}}function Dl(){return Xc(new _l)}function Ss(e){return e instanceof _l}function hp(e){return oa(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function vv(e,t){return 16&t?"code":t&nx?"mark":32&t?"sub":64&t?"sup":null}function xv(e,t){return 1&t?"strong":2&t?"em":"span"}function mk(e,t,n,o,r){let a=o.classList,i=Nl(r,"base");i!==void 0&&a.add(...i),i=Nl(r,"underlineStrikethrough");let s=!1,l=8&t&&4&t;i!==void 0&&(8&n&&4&n?(s=!0,l||a.add(...i)):l&&a.remove(...i));for(let d in fo){let c=fo[d];if(i=Nl(r,d),i!==void 0)if(n&c){if(s&&(d==="underline"||d==="strikethrough")){t&c&&a.remove(...i);continue}((t&c)===0||l&&d==="underline"||d==="strikethrough")&&a.add(...i)}else t&c&&a.remove(...i)}}function gk(e,t,n){let o=t.firstChild,r=n.isComposing(),a=e+(r?_c:"");if(o==null)t.textContent=a;else{let i=o.nodeValue;if(i!==a)if(r||yi){let[s,l,d]=(function(c,f){let p=c.length,m=f.length,h=0,g=0;for(;h<p&&h<m&&c[h]===f[h];)h++;for(;g+h<p&&g+h<m&&c[p-g-1]===f[m-g-1];)g++;return[h,p-h-g,f.slice(h,m-g)]})(i,a);l!==0&&o.deleteData(s,l),o.insertData(s,d)}else o.nodeValue=a}}function WT(e,t,n,o,r,a){gk(r,e,t);let i=a.theme.text;i!==void 0&&mk(0,0,o,e,i)}function vp(e,t){let n=document.createElement(t);return n.appendChild(e),n}var Ls=class e extends dr{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(t){return new e(t.__text,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__text=t.__text,this.__format=t.__format,this.__style=t.__style,this.__mode=t.__mode,this.__detail=t.__detail}constructor(t="",n){super(n),this.__text=t,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let t=this.getLatest();return r$[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===hi()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){let n=fo[t];return(this.getFormat()&n)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,n){return Kc(this.getLatest().__format,t,n)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,n){let o=this.__format,r=vv(0,o),a=xv(0,o),i=r===null?a:r,s=document.createElement(i),l=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),r!==null&&(l=document.createElement(a),s.appendChild(l)),WT(l,this,0,o,this.__text,t);let d=this.__style;return d!==""&&(s.style.cssText=d),s}updateDOM(t,n,o){let r=this.__text,a=t.__format,i=this.__format,s=vv(0,a),l=vv(0,i),d=xv(0,a),c=xv(0,i);if((s===null?d:s)!==(l===null?c:l))return!0;if(s===l&&d!==c){let g=n.firstChild;g==null&&Z(48);let v=document.createElement(c);return WT(v,this,0,i,r,o),n.replaceChild(v,g),!1}let f=n;l!==null&&s!==null&&(f=n.firstChild,f==null&&Z(49)),gk(r,f,this);let p=o.theme.text;p!==void 0&&a!==i&&mk(0,a,i,f,p);let m=t.__style,h=this.__style;return m!==h&&(n.style.cssText=h),!1}static importDOM(){return{"#text":()=>({conversion:H$,priority:0}),b:()=>({conversion:z$,priority:0}),code:()=>({conversion:Ta,priority:0}),em:()=>({conversion:Ta,priority:0}),i:()=>({conversion:Ta,priority:0}),mark:()=>({conversion:Ta,priority:0}),s:()=>({conversion:Ta,priority:0}),span:()=>({conversion:B$,priority:0}),strong:()=>({conversion:Ta,priority:0}),sub:()=>({conversion:Ta,priority:0}),sup:()=>({conversion:Ta,priority:0}),u:()=>({conversion:Ta,priority:0})}}static importJSON(t){return jn().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(t){let{element:n}=super.exportDOM(t);return ko(n)||Z(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=vp(n,"b")),this.hasFormat("italic")&&(n=vp(n,"i")),this.hasFormat("strikethrough")&&(n=vp(n,"s")),this.hasFormat("underline")&&(n=vp(n,"u")),{element:n}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,n){}setFormat(t){let n=this.getWritable();return n.__format=typeof t=="string"?fo[t]:t,n}setDetail(t){let n=this.getWritable();return n.__detail=typeof t=="string"?t$[t]:t,n}setStyle(t){let n=this.getWritable();return n.__style=t,n}toggleFormat(t){let n=Kc(this.getFormat(),t,null);return this.setFormat(n)}toggleDirectionless(){let t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){let t=this.getWritable();return t.__detail^=2,t}setMode(t){let n=o$[t];if(this.__mode===n)return this;let o=this.getWritable();return o.__mode=n,o}setTextContent(t){if(this.__text===t)return this;let n=this.getWritable();return n.__text=t,n}select(t,n){Qn();let o=t,r=n,a=St(),i=this.getTextContent(),s=this.__key;if(typeof i=="string"){let l=i.length;o===void 0&&(o=l),r===void 0&&(r=l)}else o=0,r=0;if(!Ue(a))return xk(s,o,s,r,"text","text");{let l=hi();l!==a.anchor.key&&l!==a.focus.key||Xn(s),a.setTextNodeRange(this,o,this,r)}return a}selectStart(){return this.select(0,0)}selectEnd(){let t=this.getTextContentSize();return this.select(t,t)}spliceText(t,n,o,r){let a=this.getWritable(),i=a.__text,s=o.length,l=t;l<0&&(l=s+l,l<0&&(l=0));let d=St();if(r&&Ue(d)){let f=t+s;d.setTextNodeRange(a,f,a,f)}let c=i.slice(0,l)+o+i.slice(l+n);return a.__text=c,a}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){Qn();let n=this.getLatest(),o=n.getTextContent();if(o==="")return[];let r=n.__key,a=hi(),i=o.length;t.sort((I,T)=>I-T),t.push(i);let s=[],l=t.length;for(let I=0,T=0;I<i&&T<=l;T++){let E=t[T];E>I&&(s.push(o.slice(I,E)),I=E)}let d=s.length;if(d===1)return[n];let c=s[0],f=n.getParent(),p,m=n.getFormat(),h=n.getStyle(),g=n.__detail,v=!1,x=null,y=null,C=St();if(Ue(C)){let[I,T]=C.isBackward()?[C.focus,C.anchor]:[C.anchor,C.focus];I.type==="text"&&I.key===r&&(x=I),T.type==="text"&&T.key===r&&(y=T)}n.isSegmented()?(p=jn(c),p.__format=m,p.__style=h,p.__detail=g,p.__state=_T(n,p),v=!0):p=n.setTextContent(c);let w=[p];for(let I=1;I<d;I++){let T=jn(s[I]);T.__format=m,T.__style=h,T.__detail=g,T.__state=_T(n,T);let E=T.__key;a===r&&Xn(E),w.push(T)}let k=x?x.offset:null,S=y?y.offset:null,L=0;for(let I of w){if(!x&&!y)break;let T=L+I.getTextContentSize();if(x!==null&&k!==null&&k<=T&&k>=L&&(x.set(I.getKey(),k-L,"text"),k<T&&(x=null)),y!==null&&S!==null&&S<=T&&S>=L){y.set(I.getKey(),S-L,"text");break}L=T}if(f!==null){(function(E){let A=E.getPreviousSibling(),N=E.getNextSibling();A!==null&&Hp(A),N!==null&&Hp(N)})(this);let I=f.getWritable(),T=this.getIndexWithinParent();v?(I.splice(T,0,w),this.remove()):I.splice(T,1,w),Ue(C)&&Bp(C,f,T,d-1)}return w}mergeWithSibling(t){let n=t===this.getPreviousSibling();n||t===this.getNextSibling()||Z(50);let o=this.__key,r=t.__key,a=this.__text,i=a.length;hi()===r&&Xn(o);let s=St();if(Ue(s)){let f=s.anchor,p=s.focus;f!==null&&f.key===r&&nL(f,n,o,t,i),p!==null&&p.key===r&&nL(p,n,o,t,i)}let l=t.__text,d=n?l+a:a+l;this.setTextContent(d);let c=this.getWritable();return t.remove(),c}isTextEntity(){return!1}};function B$(e){return{forChild:vx(e.style),node:null}}function z$(e){let t=e,n=t.style.fontWeight==="normal";return{forChild:vx(t.style,n?void 0:"bold"),node:null}}var GT=new WeakMap;function $$(e){if(!ko(e))return!1;if(e.nodeName==="PRE")return!0;let t=e.style.whiteSpace;return typeof t=="string"&&t.startsWith("pre")}function H$(e){let t=e;e.parentElement===null&&Z(129);let n=t.textContent||"";if((function(o){let r,a=o.parentNode,i=[o];for(;a!==null&&(r=GT.get(a))===void 0&&!$$(a);)i.push(a),a=a.parentNode;let s=r===void 0?a:r;for(let l=0;l<i.length;l++)GT.set(i[l],s);return s})(t)!==null){let o=n.split(/(\r?\n|\t)/),r=[],a=o.length;for(let i=0;i<a;i++){let s=o[i];s===`
3702
+ `,lx=Li?"\xA0":Hc,Rk="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Nk="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",c$=new RegExp("^[^"+Nk+"]*["+Rk+"]"),u$=new RegExp("^[^"+Rk+"]*["+Nk+"]"),go={bold:1,capitalize:1024,code:16,highlight:sx,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},f$={directionless:1,unmergeable:2},Mv={center:2,end:6,justify:4,left:1,right:3,start:5},p$={[a$]:"center",[d$]:"end",[s$]:"justify",[r$]:"left",[i$]:"right",[l$]:"start"},m$={normal:0,segmented:2,token:1},g$={[G5]:"normal",[Q5]:"segmented",[j5]:"token"},h$="$",zT="$config";function _k(e,t,n,o,r,a){let i=e.getFirstChild();for(;i!==null;){let s=i.__key;i.__parent===t&&(Q(i)&&_k(i,s,n,o,r,a),n.has(s)||a.delete(s),r.push(s)),i=i.getNextSibling()}}var Rv=!1,dx=0;function v$(e){dx=e.timeStamp}function Cv(e,t,n){let o=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||o&&e.previousSibling===r)||o&&am(e,n)!==void 0}function x$(e,t,n){let o=Nr(Xo(n)),r=null,a=null;o!==null&&o.anchorNode===e&&(r=o.anchorOffset,a=o.focusOffset);let i=e.nodeValue;i!==null&&Dx(t,i,r,a,!1)}function y$(e,t,n){if(je(e)){let o=e.anchor.getNode();if(o.is(n)&&e.format!==o.getFormat())return!1}return sa(t)&&n.isAttached()}function C$(e,t,n,o){for(let r=e;r&&!oP(r);r=nu(r)){let a=am(r,t);if(a!==void 0){let i=$n(a,n);if(i)return Qt(i)||!ko(r)?void 0:[r,i]}else if(r===o)return[o,KL(n)]}}function Dk(e,t,n){Rv=!0;let o=performance.now()-dx>100;try{ia(e,()=>{let r=wt()||(function(p){return p.getEditorState().read(()=>{let m=wt();return m!==null?m.clone():null})})(e),a=new Map,i=e.getRootElement(),s=e._editorState,l=e._blockCursorElement,d=!1,c="";for(let p=0;p<t.length;p++){let m=t[p],h=m.type,g=m.target,v=C$(g,e,s,i);if(!v)continue;let[x,y]=v;if(h==="characterData")o&&Me(y)&&sa(g)&&y$(r,g,y)&&x$(g,y,e);else if(h==="childList"){d=!0;let C=m.addedNodes;for(let w=0;w<C.length;w++){let k=C[w],I=Rx(k),T=k.parentNode;if(T!=null&&k!==l&&I===null&&!Cv(k,T,e)){if(Li){let E=(ko(k)?k.innerText:null)||k.nodeValue;E&&(c+=E)}T.removeChild(k)}}let S=m.removedNodes,L=S.length;if(L>0){let w=0;for(let k=0;k<L;k++){let I=S[k];(Cv(I,g,e)||l===I)&&(g.appendChild(I),w++)}L!==w&&a.set(x,y)}}}if(a.size>0)for(let[p,m]of a)m.reconcileObservedMutation(p,e);let f=n.takeRecords();if(f.length>0){for(let p=0;p<f.length;p++){let m=f[p],h=m.addedNodes,g=m.target;for(let v=0;v<h.length;v++){let x=h[v],y=x.parentNode;y==null||x.nodeName!=="BR"||Cv(x,g,e)||y.removeChild(x)}}n.takeRecords()}r!==null&&(d&&$o(r),Li&&QL(e)&&r.insertRawText(c))})}finally{Rv=!1}}function Ok(e){let t=e._observer;t!==null&&Dk(e,t.takeRecords(),t)}function Fk(e){(function(t){dx===0&&Xo(t).addEventListener("textInput",v$,!0)})(e),e._observer=new MutationObserver((t,n)=>{Dk(e,t,n)})}var Nv=class{key;parse;unparse;isEqual;defaultValue;constructor(t,n){this.key=t,this.parse=n.parse.bind(n),this.unparse=(n.unparse||w$).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function b$(e,t){return new Nv(e,t)}function _p(e,t,n="latest"){let o=(n==="latest"?e.getLatest():e).__state;return o?o.getValue(t):t.defaultValue}function I$(e,t,n){let o=_p(e,n,"direct"),r=_p(t,n,"direct");return n.isEqual(o,r)?null:[o,r]}function S$(e,t,n){let o;if(Gn(),typeof n=="function"){let a=e.getLatest(),i=_p(a,t);if(o=n(i),t.isEqual(i,o))return a}else o=n;let r=e.getWritable();return cx(r).updateFromKnown(t,o),r}function Bk(e){let t=new Map,n=new Set;for(let o=typeof e=="function"?e:e.replace;o.prototype&&o.prototype.getType!==void 0;o=Object.getPrototypeOf(o)){let{ownNodeConfig:r}=ru(o);if(r&&r.stateConfigs)for(let a of r.stateConfigs){let i;"stateConfig"in a?(i=a.stateConfig,a.flat&&n.add(i.key)):i=a,t.set(i.key,i)}}return{flatKeys:n,sharedConfigMap:t}}var _v=class e{node;knownState;unknownState;sharedNodeState;size;constructor(t,n,o=void 0,r=new Map,a=void 0){this.node=t,this.sharedNodeState=n,this.unknownState=o,this.knownState=r;let{sharedConfigMap:i}=this.sharedNodeState,s=a!==void 0?a:(function(l,d,c){let f=c.size;if(d)for(let p in d){let m=l.get(p);m&&c.has(m)||f++}return f})(i,o,r);this.size=s}getValue(t){let n=this.knownState.get(t);if(n!==void 0)return n;this.sharedNodeState.sharedConfigMap.set(t.key,t);let o=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){let r=this.unknownState[t.key];r!==void 0&&(o=t.parse(r)),this.updateFromKnown(t,o)}return o}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let t={...this.unknownState},n={};for(let[o,r]of this.knownState)o.isEqual(r,o.defaultValue)?delete t[o.key]:t[o.key]=o.unparse(r);for(let o of this.sharedNodeState.flatKeys)o in t&&(n[o]=t[o],delete t[o]);return $T(t)&&(n.$=t),n}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:o}=this,r=new Map(this.knownState);return new e(t,n,(function(a,i,s){let l;if(s)for(let[d,c]of Object.entries(s)){let f=a.get(d);f?i.has(f)||i.set(f,f.parse(c)):(l=l||{},l[d]=c)}return l})(n.sharedConfigMap,r,o),r,this.size)}updateFromKnown(t,n){let o=t.key;this.sharedNodeState.sharedConfigMap.set(o,t);let{knownState:r,unknownState:a}=this;r.has(t)||a&&o in a||(a&&(delete a[o],this.unknownState=$T(a)),this.size++),r.set(t,n)}updateFromUnknown(t,n){let o=this.sharedNodeState.sharedConfigMap.get(t);o?this.updateFromKnown(o,o.parse(n)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=n)}updateFromJSON(t){let{knownState:n}=this;for(let o of n.keys())n.set(o,o.defaultValue);if(this.size=n.size,this.unknownState=void 0,t)for(let[o,r]of Object.entries(t))this.updateFromUnknown(o,r)}};function cx(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new _v(t,zk(t));return t.__state=n,n}function zk(e){return e.__state?e.__state.sharedNodeState:Px($x(),e.getType()).sharedNodeState}function $T(e){if(e)for(let t in e)return e}function w$(e){return e}function HT(e,t,n){for(let[o,r]of t.knownState){if(e.has(o.key))continue;e.add(o.key);let a=n?n.getValue(o):o.defaultValue;if(a!==r&&!o.isEqual(a,r))return!0}return!1}function UT(e,t,n){let{unknownState:o}=t,r=n?n.unknownState:void 0;if(o){for(let[a,i]of Object.entries(o))if(!e.has(a)&&(e.add(a),i!==(r?r[a]:void 0)))return!0}return!1}function KT(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function qT(e,t){let n=e.__mode,o=e.__format,r=e.__style,a=t.__mode,i=t.__format,s=t.__style,l=e.__state,d=t.__state;return(n===null||n===a)&&(o===null||o===i)&&(r===null||r===s)&&(e.__state===null||l===d||(function(c,f){if(c===f)return!0;if(c&&f&&c.size!==f.size)return!1;let p=new Set;return!(c&&HT(p,c,f)||f&&HT(p,f,c)||c&&UT(p,c,f)||f&&UT(p,f,c))})(l,d))}function VT(e,t){let n=e.mergeWithSibling(t),o=qt()._normalizedNodes;return o.add(e.__key),o.add(t.__key),n}function WT(e){let t,n,o=e;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(t=o.getPreviousSibling())!==null&&Me(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(qT(t,o)){o=VT(t,o);break}break}t.remove()}for(;(n=o.getNextSibling())!==null&&Me(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(qT(o,n)){o=VT(o,n);break}break}n.remove()}}else o.remove()}function Dp(e){return GT(e.anchor),GT(e.focus),e}function GT(e){for(;e.type==="element";){let t=e.getNode(),n=e.offset,o,r;if(n===t.getChildrenSize()?(o=t.getChildAtIndex(n-1),r=!0):(o=t.getChildAtIndex(n),r=!1),Me(o)){e.set(o.__key,r?o.getTextContentSize():0,"text",!0);break}if(!Q(o))break;e.set(o.__key,r?o.getChildrenSize():0,"element",!0)}}var ks,oo,Uc,em,Dv,Ov,Ls,Pr,Fv,Kc,zn="",aa=null,Ss=null,Dl=!1,Op=!1;function Fp(e,t){let n=Ls.get(e);if(t!==null){let o=Hv(e);o.parentNode===t&&t.removeChild(o)}if(Pr.has(e)||oo._keyToDOMMap.delete(e),Q(n)){let o=zp(n,Ls);Bv(o,0,o.length-1,null)}n!==void 0&&Ox(Kc,Uc,em,n,"destroyed")}function Bv(e,t,n,o){for(let r=t;r<=n;++r){let a=e[r];a!==void 0&&Fp(a,o)}}function Is(e,t){e.setProperty("text-align",t)}var T$="40px";function $k(e,t){let n=ks.theme.indent;if(typeof n=="string"){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(t===0)return void e.style.setProperty("padding-inline-start","");let o=getComputedStyle(oo._rootElement||e).getPropertyValue("--lexical-indent-base-value")||T$;e.style.setProperty("padding-inline-start",`calc(${t} * ${o})`)}function Hk(e,t){let n=e.style;t===0?Is(n,""):t===1?Is(n,"left"):t===2?Is(n,"center"):t===3?Is(n,"right"):t===4?Is(n,"justify"):t===5?Is(n,"start"):t===6&&Is(n,"end")}function zv(e,t){let n=(function(o){let r=o.__dir;if(r!==null)return r;if(no(o))return null;let a=o.getParentOrThrow();return no(a)&&a.__dir===null?"auto":null})(t);n!==null?e.dir=n:e.removeAttribute("dir")}function Bp(e,t){let n=Pr.get(e);n===void 0&&J(60);let o=n.createDOM(ks,oo);if((function(r,a,i){let s=i._keyToDOMMap;(function(l,d,c){let f=`__lexicalKey_${d._key}`;l[f]=c})(a,i,r),s.set(r,a)})(e,o,oo),Me(n)?o.setAttribute("data-lexical-text","true"):Qt(n)&&o.setAttribute("data-lexical-decorator","true"),Q(n)){let r=n.__indent,a=n.__size;if(zv(o,n),r!==0&&$k(o,r),a!==0){let s=a-1;$v(zp(n,Pr),n,0,s,n.getDOMSlot(o))}let i=n.__format;i!==0&&Hk(o,i),n.isInline()||Uk(null,n,o)}else{let r=n.getTextContent();if(Qt(n)){let a=n.decorate(oo,ks);a!==null&&Kk(e,a),o.contentEditable="false"}zn+=r}return t!==null&&t.insertChild(o),Ox(Kc,Uc,em,n,"created"),o}function $v(e,t,n,o,r){let a=zn;zn="";let i=n;for(;i<=o;++i){Bp(e[i],r);let s=Pr.get(e[i]);s!==null&&Me(s)?aa===null&&(aa=s.getFormat(),Ss=s.getStyle()):Q(s)&&i<o&&!s.isInline()&&(zn+=Zp)}r.element.__lexicalTextContent=zn,zn=a+zn}function jT(e,t){if(e){let n=e.__last;if(n){let o=t.get(n);if(o)return Ts(o)?"line-break":Qt(o)&&o.isInline()?"decorator":null}return"empty"}return null}function Uk(e,t,n){let o=jT(e,Ls),r=jT(t,Pr);o!==r&&t.getDOMSlot(n).setManagedLineBreak(r)}function k$(e,t,n){var o;aa=null,Ss=null,(function(r,a,i){let s=zn,l=r.__size,d=a.__size;zn="";let c=i.element;if(l===1&&d===1){let f=r.__first,p=a.__first;if(f===p)Lp(f,c);else{let h=Hv(f),g=Bp(p,null);try{c.replaceChild(g,h)}catch(v){if(typeof v=="object"&&v!=null){let x=`${v.toString()} Parent: ${c.tagName}, new child: {tag: ${g.tagName} key: ${p}}, old child: {tag: ${h.tagName}, key: ${f}}.`;throw new Error(x)}throw v}Fp(f,null)}let m=Pr.get(p);Me(m)&&aa===null&&(aa=m.getFormat(),Ss=m.getStyle())}else{let f=zp(r,Ls),p=zp(a,Pr);if(f.length!==l&&J(227),p.length!==d&&J(228),l===0)d!==0&&$v(p,0,0,d-1,i);else if(d===0){if(l!==0){let m=i.after==null&&i.before==null&&i.element.__lexicalLineBreak==null;Bv(f,0,l-1,m?null:c),m&&(c.textContent="")}}else(function(m,h,g,v,x,y){let C=v-1,S=x-1,L,w,k=y.getFirstChild(),I=0,T=0;for(;I<=C&&T<=S;){let N=h[I],R=g[T];if(N===R)k=bv(Lp(R,y.element)),I++,T++;else{if(w===void 0&&(w=QT(g,T)),L===void 0)L=QT(h,I);else if(!L.has(N)){I++;continue}if(!w.has(N)){k=bv(Hv(N)),Fp(N,y.element),I++,L.delete(N);continue}if(L.has(R)){let U=Gl(oo,R);U!==k&&y.withBefore(k).insertChild(U),k=bv(Lp(R,y.element)),I++,T++}else Bp(R,y.withBefore(k)),T++}let $=Pr.get(R);$!==null&&Me($)?aa===null&&(aa=$.getFormat(),Ss=$.getStyle()):Q($)&&T<=S&&!$.isInline()&&(zn+=Zp)}let E=I>C,A=T>S;if(E&&!A){let N=g[S+1],R=N===void 0?null:oo.getElementByKey(N);$v(g,0,T,S,y.withBefore(R))}else A&&!E&&Bv(h,I,C,y.element)})(0,f,p,l,d,i)}c.__lexicalTextContent=zn,zn=s+zn})(e,t,t.getDOMSlot(n)),o=t,aa==null||aa===o.__textFormat||Op||o.setTextFormat(aa),(function(r){Ss==null||Ss===r.__textStyle||Op||r.setTextStyle(Ss)})(t)}function zp(e,t){let n=[],o=e.__first;for(;o!==null;){let r=t.get(o);r===void 0&&J(101),n.push(o),o=r.__next}return n}function Lp(e,t){let n=Ls.get(e),o=Pr.get(e);n!==void 0&&o!==void 0||J(61);let r=Dl||Ov.has(e)||Dv.has(e),a=Gl(oo,e);if(n===o&&!r){let i;if(Q(n)){let s=a.__lexicalTextContent;typeof s=="string"?i=s:(i=n.getTextContent(),a.__lexicalTextContent=i)}else i=n.getTextContent();return zn+=i,a}if(n!==o&&r&&Ox(Kc,Uc,em,o,"updated"),o.updateDOM(n,a,ks)){let i=Bp(e,null);return t===null&&J(62),t.replaceChild(i,a),Fp(e,null),i}if(Q(n)){Q(o)||J(334,e);let i=o.__indent;(Dl||i!==n.__indent)&&$k(a,i);let s=o.__format;if((Dl||s!==n.__format)&&Hk(a,s),r)k$(n,o,a),no(o)||o.isInline()||Uk(n,o,a);else{let l=a.__lexicalTextContent,d;typeof l=="string"?d=l:(d=n.getTextContent(),a.__lexicalTextContent=d),zn+=d}if((Dl||o.__dir!==n.__dir)&&(zv(a,o),no(o)&&!Dl))for(let l of o.getChildren())Q(l)&&zv(Gl(oo,l.getKey()),l)}else{let i=o.getTextContent();if(Qt(o)){let s=o.decorate(oo,ks);s!==null&&Kk(e,s)}zn+=i}if(!Op&&no(o)&&o.__cachedText!==zn){let i=o.getWritable();i.__cachedText=zn,o=i}return a}function Kk(e,t){let n=oo._pendingDecorators,o=oo._decorators;if(n===null){if(o[e]===t)return;n=UL(oo)}n[e]=t}function bv(e){let t=e.nextSibling;return t!==null&&t===oo._blockCursorElement&&(t=t.nextSibling),t}function QT(e,t){let n=new Set;for(let o=t;o<e.length;o++)n.add(e[o]);return n}function L$(e,t,n,o,r,a){zn="",Dl=o===2,oo=n,ks=n._config,Uc=n._nodes,em=oo._listeners.mutation,Dv=r,Ov=a,Ls=e._nodeMap,Pr=t._nodeMap,Op=t._readOnly,Fv=new Map(n._keyToDOMMap);let i=new Map;return Kc=i,Lp("root",null),oo=void 0,Uc=void 0,Dv=void 0,Ov=void 0,Ls=void 0,Pr=void 0,ks=void 0,Fv=void 0,Kc=void 0,i}function Hv(e){let t=Fv.get(e);return t===void 0&&J(75,e),t}function Je(e){return{type:e}}var ux=Je("SELECTION_CHANGE_COMMAND"),P$=Je("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),qk=Je("CLICK_COMMAND"),fx=Je("BEFORE_INPUT_COMMAND"),px=Je("INPUT_COMMAND"),mx=Je("COMPOSITION_START_COMMAND"),gx=Je("COMPOSITION_END_COMMAND"),qc=Je("DELETE_CHARACTER_COMMAND"),Dc=Je("INSERT_LINE_BREAK_COMMAND"),Uv=Je("INSERT_PARAGRAPH_COMMAND"),zl=Je("CONTROLLED_TEXT_INSERTION_COMMAND"),hx=Je("PASTE_COMMAND"),Kv=Je("REMOVE_TEXT_COMMAND"),Vc=Je("DELETE_WORD_COMMAND"),Wc=Je("DELETE_LINE_COMMAND"),Si=Je("FORMAT_TEXT_COMMAND"),vx=Je("UNDO_COMMAND"),xx=Je("REDO_COMMAND"),yx=Je("KEYDOWN_COMMAND"),Vk=Je("KEY_ARROW_RIGHT_COMMAND"),Wk=Je("MOVE_TO_END"),Gk=Je("KEY_ARROW_LEFT_COMMAND"),jk=Je("MOVE_TO_START"),Qk=Je("KEY_ARROW_UP_COMMAND"),Xk=Je("KEY_ARROW_DOWN_COMMAND"),$p=Je("KEY_ENTER_COMMAND"),Yk=Je("KEY_SPACE_COMMAND"),Jk=Je("KEY_BACKSPACE_COMMAND"),Zk=Je("KEY_ESCAPE_COMMAND"),eL=Je("KEY_DELETE_COMMAND"),tL=Je("KEY_TAB_COMMAND"),A$=Je("INSERT_TAB_COMMAND"),E$=Je("INDENT_CONTENT_COMMAND"),M$=Je("OUTDENT_CONTENT_COMMAND"),nL=Je("DROP_COMMAND"),R$=Je("FORMAT_ELEMENT_COMMAND"),oL=Je("DRAGSTART_COMMAND"),rL=Je("DRAGOVER_COMMAND"),aL=Je("DRAGEND_COMMAND"),Cx=Je("COPY_COMMAND"),bx=Je("CUT_COMMAND"),qv=Je("SELECT_ALL_COMMAND"),N$=Je("CLEAR_EDITOR_COMMAND"),_$=Je("CLEAR_HISTORY_COMMAND"),D$=Je("CAN_REDO_COMMAND"),O$=Je("CAN_UNDO_COMMAND"),iL=Je("FOCUS_COMMAND"),sL=Je("BLUR_COMMAND"),lL=Je("KEY_MODIFIER_COMMAND"),Ma=Object.freeze({}),Vv=[["keydown",function(e,t){Gc=e.timeStamp,dL=e.key,!t.isComposing()&&ye(t,yx,e)}],["pointerdown",function(e,t){let n=e.target,o=e.pointerType;ed(n)&&o!=="touch"&&o!=="pen"&&e.button===0&&ia(t,()=>{zL(n)||(jv=!0)})}],["compositionstart",function(e,t){ye(t,mx,e)}],["compositionend",function(e,t){Li?_c=!0:Jc||!Yp&&!Jp?ye(t,gx,e):(Pp=!0,Ap=e.data)}],["input",function(e,t){e.stopPropagation(),ia(t,()=>{t.dispatchCommand(px,e)},{event:e}),Ol=null}],["click",function(e,t){ia(t,()=>{let n=wt(),o=Nr(Xo(t)),r=Rs();if(o){if(je(n)){let a=n.anchor,i=a.getNode();if(a.type==="element"&&a.offset===0&&n.isCollapsed()&&!no(i)&&Qo().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&r!==null&&n.is(r))o.removeAllRanges(),n.dirty=!0;else if(e.detail===3&&!n.isCollapsed()&&i!==n.focus.getNode()){let s=Bc(i,l=>Q(l)&&!l.isInline());Q(s)&&s.select(0)}}else if(e.pointerType==="touch"||e.pointerType==="pen"){let a=o.anchorNode;(ko(a)||sa(a))&&$o(nm(r,o,t,e))}}ye(t,qk,e)})}],["cut",Ma],["copy",Ma],["dragstart",Ma],["dragover",Ma],["dragend",Ma],["paste",Ma],["focus",Ma],["blur",Ma],["drop",Ma]];Np&&Vv.push(["beforeinput",(e,t)=>(function(n,o){let r=n.inputType;r==="deleteCompositionText"||Li&&QL(o)||r!=="insertCompositionText"&&ye(o,fx,n)})(e,t)]);var Gc=0,dL=null,cL=0,Ol=null,Wv=new WeakMap,Hp=new WeakMap,Gv=!1,jv=!1,Oc=!1,_c=!1,Pp=!1,Ap="",ws=null,uL=[0,"",0,"root",0];function fL(e,t,n,o,r){let a=e.anchor,i=e.focus,s=a.getNode(),l=qt(),d=Nr(Xo(l)),c=d!==null?d.anchorNode:null,f=a.key,p=l.getElementByKey(f),m=n.length;return f!==i.key||!Me(s)||(!r&&(!Np||cL<o+50)||s.isDirty()&&m<2||qL(n))&&a.offset!==i.offset&&!s.isComposing()||_a(s)||s.isDirty()&&m>1||(r||!Np)&&p!==null&&!s.isComposing()&&c!==Es(p)||d!==null&&t!==null&&(!t.collapsed||t.startContainer!==d.anchorNode||t.startOffset!==d.anchorOffset)||!s.isComposing()&&(s.getFormat()!==e.format||s.getStyle()!==e.style)||(function(h,g){if(g.isSegmented())return!0;if(!h.isCollapsed())return!1;let v=h.anchor.offset,x=g.getParentOrThrow(),y=Ti(g);return v===0?!g.canInsertTextBefore()||!x.canInsertTextBefore()&&!g.isComposing()||y||(function(C){let S=C.getPreviousSibling();return(Me(S)||Q(S)&&S.isInline())&&!S.canInsertTextAfter()})(g):v===g.getTextContentSize()&&(!g.canInsertTextAfter()||!x.canInsertTextAfter()&&!g.isComposing()||y)})(e,s)}function XT(e,t){return sa(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function YT(e,t,n){let{anchorNode:o,anchorOffset:r,focusNode:a,focusOffset:i}=e;Gv&&(Gv=!1,XT(o,r)&&XT(a,i)&&!ws)||ia(t,()=>{if(!n)return void $o(null);if(!eu(t,o,a))return;let s=wt();if(ws&&je(s)&&s.isCollapsed()){let l=s.anchor,d=ws.anchor;(l.key===d.key&&l.offset===d.offset+1||l.offset===1&&d.getNode().is(l.getNode().getPreviousSibling()))&&(s=ws.clone(),$o(s))}if(ws=null,je(s)){let l=s.anchor,d=l.getNode();if(s.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(s.dirty=!0);let c=Xo(t).event,f=c?c.timeStamp:performance.now(),[p,m,h,g,v]=uL,x=Qo(),y=t.isComposing()===!1&&x.getTextContent()==="";if(f<v+200&&l.offset===h&&l.key===g)Ep(s,p,m);else if(l.type==="text")Me(d)||J(141),pL(s,d);else if(l.type==="element"&&!y){Q(d)||J(259);let C=l.getNode();C.isEmpty()?(function(S,L){let w=L.getTextFormat(),k=L.getTextStyle();Ep(S,w,k)})(s,C):Ep(s,0,"")}}else{let c=l.key,f=s.focus.key,p=s.getNodes(),m=p.length,h=s.isBackward(),g=h?i:r,v=h?r:i,x=h?f:c,y=h?c:f,C=2047,S=!1;for(let L=0;L<m;L++){let w=p[L],k=w.getTextContentSize();if(Me(w)&&k!==0&&!(L===0&&w.__key===x&&g===k||L===m-1&&w.__key===y&&v===0)&&(S=!0,C&=w.getFormat(),C===0))break}s.format=S?C:0}}ye(t,ux,void 0)})}function Ep(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function pL(e,t){Ep(e,t.getFormat(),t.getStyle())}function mL(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function F$(e){let t=e.inputType,n=mL(e),o=qt(),r=wt();if(t==="deleteContentBackward"){if(r===null){let f=Rs();if(!je(f))return!0;$o(f.clone())}if(je(r)){let f=r.anchor.key===r.focus.key;if(a=e.timeStamp,dL==="MediaLast"&&a<Gc+30&&o.isComposing()&&f){if(jn(null),Gc=0,setTimeout(()=>{ia(o,()=>{jn(null)})},30),je(r)){let p=r.anchor.getNode();p.markDirty(),Me(p)||J(142),pL(r,p)}}else{jn(null),e.preventDefault();let p=r.anchor.getNode(),m=p.getTextContent(),h=p.canInsertTextAfter(),g=r.anchor.offset===0&&r.focus.offset===m.length,v=Ev&&f&&!g&&h;if(v&&r.isCollapsed()&&(v=!Qt(jL(r.anchor,!0))),!v){ye(o,qc,!0);let x=wt();Ev&&je(x)&&x.isCollapsed()&&(ws=x,setTimeout(()=>ws=null))}}return!0}}var a;if(!je(r))return!0;let i=e.data;Ol!==null&&_x(!1,o,Ol),r.dirty&&Ol===null||!r.isCollapsed()||no(r.anchor.getNode())||n===null||r.applyDOMRange(n),Ol=null;let s=r.anchor,l=r.focus,d=s.getNode(),c=l.getNode();if(t==="insertText"||t==="insertTranspose"){if(i===`
3703
+ `)e.preventDefault(),ye(o,Dc,!1);else if(i===Zp)e.preventDefault(),ye(o,Uv,void 0);else if(i==null&&e.dataTransfer){let f=e.dataTransfer.getData("text/plain");e.preventDefault(),r.insertRawText(f)}else i!=null&&fL(r,n,i,e.timeStamp,!0)?(e.preventDefault(),ye(o,zl,i)):Ol=i;return cL=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":ye(o,zl,e);break;case"insertFromComposition":jn(null),ye(o,zl,e);break;case"insertLineBreak":jn(null),ye(o,Dc,!1);break;case"insertParagraph":jn(null),Oc&&!Jc?(Oc=!1,ye(o,Dc,!1)):ye(o,Uv,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":ye(o,hx,e);break;case"deleteByComposition":(function(f,p){return f!==p||Q(f)||Q(p)||!Ti(f)||!Ti(p)})(d,c)&&ye(o,Kv,e);break;case"deleteByDrag":case"deleteByCut":ye(o,Kv,e);break;case"deleteContent":ye(o,qc,!1);break;case"deleteWordBackward":ye(o,Vc,!0);break;case"deleteWordForward":ye(o,Vc,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":ye(o,Wc,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":ye(o,Wc,!1);break;case"formatStrikeThrough":ye(o,Si,"strikethrough");break;case"formatBold":ye(o,Si,"bold");break;case"formatItalic":ye(o,Si,"italic");break;case"formatUnderline":ye(o,Si,"underline");break;case"historyUndo":ye(o,vx,void 0);break;case"historyRedo":ye(o,xx,void 0)}return!0}function B$(e){if(ko(e.target)&&zL(e.target))return!0;let t=qt(),n=wt(),o=e.data,r=mL(e);if(o!=null&&je(n)&&fL(n,r,o,e.timeStamp,!1)){_c&&(Up(t,o),_c=!1);let a=n.anchor.getNode(),i=Nr(Xo(t));if(i===null)return!0;let s=n.isBackward(),l=s?n.anchor.offset:n.focus.offset,d=s?n.focus.offset:n.anchor.offset;Np&&!n.isCollapsed()&&Me(a)&&i.anchorNode!==null&&a.getTextContent().slice(0,l)+o+a.getTextContent().slice(l+d)===WL(i.anchorNode)||ye(t,zl,o);let c=o.length;Li&&c>1&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(n.anchor.offset-=c),Ev&&t.isComposing()&&(Gc=0,jn(null))}else _x(!1,t,o!==null?o:void 0),_c&&(Up(t,o||void 0),_c=!1);return(function(){Gn();let a=qt();Ok(a)})(),!0}function z$(e){let t=qt(),n=wt();if(je(n)&&!t.isComposing()){let o=n.anchor,r=n.anchor.getNode();jn(o.key),sm(bL),(e.timeStamp<Gc+30||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||Me(r)&&r.getStyle()!==n.style)&&ye(t,zl,lx)}return!0}function $$(e){return Up(qt(),e.data),sm(IL),!0}function Up(e,t){let n=e._compositionKey;if(jn(null),n!==null&&t!=null){if(t===""){let o=$n(n),r=Es(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&Me(o)){let a=Nr(Xo(e)),i=null,s=null;a!==null&&a.anchorNode===r&&(i=a.anchorOffset,s=a.focusOffset),Dx(o,r.nodeValue,i,s,!0)}return}if(t[t.length-1]===`
3704
+ `){let o=wt();if(je(o)||Zc(o)){if(je(o)){let r=o.focus;o.anchor.set(r.key,r.offset,r.type)}return void ye(e,$p,null)}}}_x(!0,e,t)}function H$(e){let t=qt();if(e.key==null)return!0;if(Pp){if(wk(e))return ia(t,()=>{Up(t,Ap)}),Pp=!1,Ap="",!0;Pp=!1,Ap=""}if((function(n){return Mt(n,"ArrowRight",{shiftKey:"any"})})(e))ye(t,Vk,e);else if((function(n){return Mt(n,"ArrowRight",Na)})(e))ye(t,Wk,e);else if((function(n){return Mt(n,"ArrowLeft",{shiftKey:"any"})})(e))ye(t,Gk,e);else if((function(n){return Mt(n,"ArrowLeft",Na)})(e))ye(t,jk,e);else if((function(n){return Mt(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))ye(t,Qk,e);else if((function(n){return Mt(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))ye(t,Xk,e);else if((function(n){return Mt(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))Oc=!0,ye(t,$p,e);else if((function(n){return n.key===" "})(e))ye(t,Yk,e);else if((function(n){return kr&&Mt(n,"o",{ctrlKey:!0})})(e))e.preventDefault(),Oc=!0,ye(t,Dc,!0);else if((function(n){return Mt(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))Oc=!1,ye(t,$p,e);else if((function(n){return Mt(n,"Backspace",{shiftKey:"any"})||kr&&Mt(n,"h",{ctrlKey:!0})})(e))wk(e)?ye(t,Jk,e):(e.preventDefault(),ye(t,qc,!0));else if((function(n){return n.key==="Escape"})(e))ye(t,Zk,e);else if((function(n){return Mt(n,"Delete",{})||kr&&Mt(n,"d",{ctrlKey:!0})})(e))(function(n){return n.key==="Delete"})(e)?ye(t,eL,e):(e.preventDefault(),ye(t,qc,!1));else if((function(n){return Mt(n,"Backspace",Sk)})(e))e.preventDefault(),ye(t,Vc,!0);else if((function(n){return Mt(n,"Delete",Sk)})(e))e.preventDefault(),ye(t,Vc,!1);else if((function(n){return kr&&Mt(n,"Backspace",{metaKey:!0})})(e))e.preventDefault(),ye(t,Wc,!0);else if((function(n){return kr&&(Mt(n,"Delete",{metaKey:!0})||Mt(n,"k",{ctrlKey:!0}))})(e))e.preventDefault(),ye(t,Wc,!1);else if((function(n){return Mt(n,"b",Na)})(e))e.preventDefault(),ye(t,Si,"bold");else if((function(n){return Mt(n,"u",Na)})(e))e.preventDefault(),ye(t,Si,"underline");else if((function(n){return Mt(n,"i",Na)})(e))e.preventDefault(),ye(t,Si,"italic");else if((function(n){return Mt(n,"Tab",{shiftKey:"any"})})(e))ye(t,tL,e);else if((function(n){return Mt(n,"z",Na)})(e))e.preventDefault(),ye(t,vx,void 0);else if((function(n){return kr?Mt(n,"z",{metaKey:!0,shiftKey:!0}):Mt(n,"y",{ctrlKey:!0})||Mt(n,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),ye(t,xx,void 0);else{let n=t._editorState._selection;n===null||je(n)?Tk(e)&&(e.preventDefault(),ye(t,qv,e)):(function(o){return Mt(o,"c",Na)})(e)?(e.preventDefault(),ye(t,Cx,e)):(function(o){return Mt(o,"x",Na)})(e)?(e.preventDefault(),ye(t,bx,e)):Tk(e)&&(e.preventDefault(),ye(t,qv,e))}return(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(e)&&t.dispatchCommand(lL,e),!0}function gL(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var $l=new Map;function hL(e){let t=ZL(e.target);if(t===null)return;let n=Mx(t.anchorNode);if(n===null)return;jv&&(jv=!1,ia(n,()=>{let l=Rs(),d=t.anchorNode;(ko(d)||sa(d))&&$o(nm(l,t,n,e))}));let o=Nx(n),r=o[o.length-1],a=r._key,i=$l.get(a),s=i||r;s!==n&&YT(t,s,!1),YT(t,n,!0),n!==r?$l.set(a,n):i&&$l.delete(a)}function JT(e){e._lexicalHandled=!0}function ZT(e){return e._lexicalHandled===!0}var ek=()=>{};function U$(e){let t=Wv.get(e);if(t===void 0)return void ek();let n=Hp.get(t);if(n===void 0)return void ek();let o=n-1;o>=0||J(164),Wv.delete(e),Hp.set(t,o),o===0&&t.removeEventListener("selectionchange",hL);let r=tu(e);rm(r)?((function(i){if(i._parentEditor!==null){let s=Nx(i),l=s[s.length-1]._key;$l.get(l)===i&&$l.delete(l)}else $l.delete(i._key)})(r),e.__lexicalEditor=null):r&&J(198);let a=gL(e);for(let i=0;i<a.length;i++)a[i]();e.__lexicalEventHandles=[]}function Qv(e,t,n){Gn();let o=e.__key,r=e.getParent();if(r===null)return;let a=(function(s){let l=wt();if(!je(l)||!Q(s))return l;let{anchor:d,focus:c}=l,f=d.getNode(),p=c.getNode();return Qp(f,s)&&d.set(s.__key,0,"element"),Qp(p,s)&&c.set(s.__key,0,"element"),l})(e),i=!1;if(je(a)&&t){let s=a.anchor,l=a.focus;s.key===o&&(Wp(s,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0),l.key===o&&(Wp(l,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0)}else Zc(a)&&t&&e.isSelected()&&e.selectPrevious();if(je(a)&&t&&!i){let s=e.getIndexWithinParent();ki(e),Vp(a,r,s,-1)}else ki(e);n||pr(r)||r.canBeEmpty()||!r.isEmpty()||Qv(r,t),t&&a&&no(r)&&r.isEmpty()&&r.selectEnd()}function K$(e){return e}var vL=Symbol.for("ephemeral");function Kp(e){return e[vL]||!1}var fr=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=ru(this);return t===void 0&&J(64,this.name),t}static clone(t){J(65,this.name)}$config(){return{}}config(t,n){let o=n.extends||Object.getPrototypeOf(this.constructor);return Object.assign(n,{extends:o,type:t}),{[t]:n}}afterCloneFrom(t){this.__key===t.__key?(this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state):t.__state&&(this.__state=t.__state.getWritable(this))}static importDOM;constructor(t){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),HL(this,t)}getType(){return this.__type}isInline(){J(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let n=$n(t);if(n===null)break;t=n.__parent}return!1}isSelected(t){let n=t||wt();if(n==null)return!1;let o=n.getNodes().some(r=>r.__key===this.__key);if(Me(this))return o;if(je(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;let r=this.getParent();if(Qt(this)&&this.isInline()&&r){let a=n.isBackward()?n.focus:n.anchor;if(r.is(a.getNode())&&a.offset===r.getChildrenSize()&&this.is(r.getLastChild()))return!1}}return o}getKey(){return this.__key}getIndexWithinParent(){let t=this.getParent();if(t===null)return-1;let n=t.getFirstChild(),o=0;for(;n!==null;){if(this.is(n))return o;o++,n=n.getNextSibling()}return-1}getParent(){let t=this.getLatest().__parent;return t===null?null:$n(t)}getParentOrThrow(){let t=this.getParent();return t===null&&J(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let n=t.getParent();if(pr(n))return Q(t)||t===this&&Qt(t)||J(194),t;t=n}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&J(67,this.__key),t}getParents(){let t=[],n=this.getParent();for(;n!==null;)t.push(n),n=n.getParent();return t}getParentKeys(){let t=[],n=this.getParent();for(;n!==null;)t.push(n.__key),n=n.getParent();return t}getPreviousSibling(){let t=this.getLatest().__prev;return t===null?null:$n(t)}getPreviousSiblings(){let t=[],n=this.getParent();if(n===null)return t;let o=n.getFirstChild();for(;o!==null&&!o.is(this);)t.push(o),o=o.getNextSibling();return t}getNextSibling(){let t=this.getLatest().__next;return t===null?null:$n(t)}getNextSiblings(){let t=[],n=this.getNextSibling();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getCommonAncestor(t){let n=Q(this)?this:this.getParent(),o=Q(t)?t:t.getParent(),r=n&&o?zc(n,o):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let n=zc(this,t);return n!==null&&(n.type==="descendant"||(n.type==="branch"?Wx(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&J(279),!1)))}isParentOf(t){let n=zc(this,t);return n!==null&&n.type==="ancestor"}getNodesBetween(t){let n=this.isBefore(t),o=[],r=new Set,a=this;for(;a!==null;){let i=a.__key;if(r.has(i)||(r.add(i),o.push(a)),a===t)break;let s=Q(a)?n?a.getFirstChild():a.getLastChild():null;if(s!==null){a=s;continue}let l=n?a.getNextSibling():a.getPreviousSibling();if(l!==null){a=l;continue}let d=a.getParentOrThrow();if(r.has(d.__key)||o.push(d),d===t)break;let c=null,f=d;do{if(f===null&&J(68),c=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),f===null)break;c!==null||r.has(f.__key)||o.push(f)}while(c===null);a=c}return n||o.reverse(),o}isDirty(){let t=qt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(Kp(this))return this;let t=$n(this.__key);return t===null&&J(113),t}getWritable(){if(Kp(this))return this;Gn();let t=$a(),n=qt(),o=t._nodeMap,r=this.__key,a=this.getLatest(),i=n._cloneNotNeeded,s=wt();if(s!==null&&s.setCachedNodes(null),i.has(r))return jp(a),a;let l=Hx(a);return i.add(r),jp(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,n){J(70)}updateDOM(t,n,o){J(71)}exportDOM(t){return{element:this.createDOM(t._config,t)}}exportJSON(){let t=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...t}}static importJSON(t){J(18,this.name)}updateFromJSON(t){return(function(n,o){let r=n.getWritable(),a=o.$,i=a;for(let s of zk(r).flatKeys)s in o&&(i!==void 0&&i!==a||(i={...a}),i[s]=o[s]);return(r.__state||i)&&cx(n).updateFromJSON(i),r})(this,t)}static transform(){return null}remove(t){Qv(this,!0,t)}replace(t,n){Gn();let o=wt();o!==null&&(o=o.clone()),Lv(this,t);let r=this.getLatest(),a=this.__key,i=t.__key,s=t.getWritable(),l=this.getParentOrThrow().getWritable(),d=l.__size;ki(s);let c=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,h=r.__parent;if(Qv(r,!1,!0),c===null?l.__first=i:c.getWritable().__next=i,s.__prev=p,f===null?l.__last=i:f.getWritable().__prev=i,s.__next=m,s.__parent=h,l.__size=d,n&&(Q(this)&&Q(s)||J(139),this.getChildren().forEach(g=>{s.append(g)})),je(o)){$o(o);let g=o.anchor,v=o.focus;g.key===a&&rk(g,s),v.key===a&&rk(v,s)}return wi()===a&&jn(i),s}insertAfter(t,n=!0){Gn(),Lv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.getParent(),i=wt(),s=!1,l=!1;if(a!==null){let m=t.getIndexWithinParent();if(ki(r),je(i)){let h=a.__key,g=i.anchor,v=i.focus;s=g.type==="element"&&g.key===h&&g.offset===m+1,l=v.type==="element"&&v.key===h&&v.offset===m+1}}let d=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),f=r.__key,p=o.__next;if(d===null?c.__last=f:d.getWritable().__prev=f,c.__size++,o.__next=f,r.__next=p,r.__prev=o.__key,r.__parent=o.__parent,n&&je(i)){let m=this.getIndexWithinParent();Vp(i,c,m+1);let h=c.__key;s&&i.anchor.set(h,m+2,"element"),l&&i.focus.set(h,m+2,"element")}return t}insertBefore(t,n=!0){Gn(),Lv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.__key;ki(r);let i=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=o.__prev,d=this.getIndexWithinParent();i===null?s.__first=a:i.getWritable().__next=a,s.__size++,o.__prev=a,r.__prev=l,r.__next=o.__key,r.__parent=o.__parent;let c=wt();return n&&je(c)&&Vp(c,this.getParentOrThrow(),d),t}isParentRequired(){return!1}createParentElementNode(){return Fa()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,n){Gn();let o=this.getPreviousSibling(),r=this.getParentOrThrow();if(o===null)return r.select(0,0);if(Q(o))return o.select();if(!Me(o)){let a=o.getIndexWithinParent()+1;return r.select(a,a)}return o.select(t,n)}selectNext(t,n){Gn();let o=this.getNextSibling(),r=this.getParentOrThrow();if(o===null)return r.select();if(Q(o))return o.select(0,0);if(!Me(o)){let a=o.getIndexWithinParent();return r.select(a,a)}return o.select(t,n)}markDirty(){this.getWritable()}reconcileObservedMutation(t,n){this.markDirty()}},q$="historic",V$="history-push",Mp="history-merge",W$="paste",xL="collaboration",G$="skip-collab",yL="skip-scroll-into-view",CL="skip-dom-selection",Xv="skip-selection-focus",bL="composition-start",IL="composition-end",Ul=class e extends fr{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
3705
+ `}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:t=>(function(n){let o=n.parentElement;if(o!==null&&nx(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&Sp(r)){let a=o.lastChild;if(a===n||a.previousSibling===n&&Sp(a))return!0}}return!1})(t)||(function(n){let o=n.parentElement;if(o!==null&&nx(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&Sp(r))return!1;let a=o.lastChild;if(a===n||a.previousSibling===n&&Sp(a))return!0}return!1})(t)?null:{conversion:j$,priority:0}}}static importJSON(t){return Kl().updateFromJSON(t)}};function j$(e){return{node:Kl()}}function Kl(){return ou(new Ul)}function Ts(e){return e instanceof Ul}function Sp(e){return sa(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function Iv(e,t){return 16&t?"code":t&sx?"mark":32&t?"sub":64&t?"sup":null}function Sv(e,t){return 1&t?"strong":2&t?"em":"span"}function SL(e,t,n,o,r){let a=o.classList,i=Hl(r,"base");i!==void 0&&a.add(...i),i=Hl(r,"underlineStrikethrough");let s=!1,l=8&t&&4&t;i!==void 0&&(8&n&&4&n?(s=!0,l||a.add(...i)):l&&a.remove(...i));for(let d in go){let c=go[d];if(i=Hl(r,d),i!==void 0)if(n&c){if(s&&(d==="underline"||d==="strikethrough")){t&c&&a.remove(...i);continue}((t&c)===0||l&&d==="underline"||d==="strikethrough")&&a.add(...i)}else t&c&&a.remove(...i)}}function wL(e,t,n){let o=t.firstChild,r=n.isComposing(),a=e+(r?Hc:"");if(o==null)t.textContent=a;else{let i=o.nodeValue;if(i!==a)if(r||Li){let[s,l,d]=(function(c,f){let p=c.length,m=f.length,h=0,g=0;for(;h<p&&h<m&&c[h]===f[h];)h++;for(;g+h<p&&g+h<m&&c[p-g-1]===f[m-g-1];)g++;return[h,p-h-g,f.slice(h,m-g)]})(i,a);l!==0&&o.deleteData(s,l),o.insertData(s,d)}else o.nodeValue=a}}function tk(e,t,n,o,r,a){wL(r,e,t);let i=a.theme.text;i!==void 0&&SL(0,0,o,e,i)}function wp(e,t){let n=document.createElement(t);return n.appendChild(e),n}var Ps=class e extends fr{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(t){return new e(t.__text,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__text=t.__text,this.__format=t.__format,this.__style=t.__style,this.__mode=t.__mode,this.__detail=t.__detail}constructor(t="",n){super(n),this.__text=t,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let t=this.getLatest();return g$[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===wi()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){let n=go[t];return(this.getFormat()&n)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,n){return Xc(this.getLatest().__format,t,n)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,n){let o=this.__format,r=Iv(0,o),a=Sv(0,o),i=r===null?a:r,s=document.createElement(i),l=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),r!==null&&(l=document.createElement(a),s.appendChild(l)),tk(l,this,0,o,this.__text,t);let d=this.__style;return d!==""&&(s.style.cssText=d),s}updateDOM(t,n,o){let r=this.__text,a=t.__format,i=this.__format,s=Iv(0,a),l=Iv(0,i),d=Sv(0,a),c=Sv(0,i);if((s===null?d:s)!==(l===null?c:l))return!0;if(s===l&&d!==c){let g=n.firstChild;g==null&&J(48);let v=document.createElement(c);return tk(v,this,0,i,r,o),n.replaceChild(v,g),!1}let f=n;l!==null&&s!==null&&(f=n.firstChild,f==null&&J(49)),wL(r,f,this);let p=o.theme.text;p!==void 0&&a!==i&&SL(0,a,i,f,p);let m=t.__style,h=this.__style;return m!==h&&(n.style.cssText=h),!1}static importDOM(){return{"#text":()=>({conversion:J$,priority:0}),b:()=>({conversion:X$,priority:0}),code:()=>({conversion:Ra,priority:0}),em:()=>({conversion:Ra,priority:0}),i:()=>({conversion:Ra,priority:0}),mark:()=>({conversion:Ra,priority:0}),s:()=>({conversion:Ra,priority:0}),span:()=>({conversion:Q$,priority:0}),strong:()=>({conversion:Ra,priority:0}),sub:()=>({conversion:Ra,priority:0}),sup:()=>({conversion:Ra,priority:0}),u:()=>({conversion:Ra,priority:0})}}static importJSON(t){return Wn().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(t){let{element:n}=super.exportDOM(t);return ko(n)||J(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=wp(n,"b")),this.hasFormat("italic")&&(n=wp(n,"i")),this.hasFormat("strikethrough")&&(n=wp(n,"s")),this.hasFormat("underline")&&(n=wp(n,"u")),{element:n}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,n){}setFormat(t){let n=this.getWritable();return n.__format=typeof t=="string"?go[t]:t,n}setDetail(t){let n=this.getWritable();return n.__detail=typeof t=="string"?f$[t]:t,n}setStyle(t){let n=this.getWritable();return n.__style=t,n}toggleFormat(t){let n=Xc(this.getFormat(),t,null);return this.setFormat(n)}toggleDirectionless(){let t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){let t=this.getWritable();return t.__detail^=2,t}setMode(t){let n=m$[t];if(this.__mode===n)return this;let o=this.getWritable();return o.__mode=n,o}setTextContent(t){if(this.__text===t)return this;let n=this.getWritable();return n.__text=t,n}select(t,n){Gn();let o=t,r=n,a=wt(),i=this.getTextContent(),s=this.__key;if(typeof i=="string"){let l=i.length;o===void 0&&(o=l),r===void 0&&(r=l)}else o=0,r=0;if(!je(a))return LL(s,o,s,r,"text","text");{let l=wi();l!==a.anchor.key&&l!==a.focus.key||jn(s),a.setTextNodeRange(this,o,this,r)}return a}selectStart(){return this.select(0,0)}selectEnd(){let t=this.getTextContentSize();return this.select(t,t)}spliceText(t,n,o,r){let a=this.getWritable(),i=a.__text,s=o.length,l=t;l<0&&(l=s+l,l<0&&(l=0));let d=wt();if(r&&je(d)){let f=t+s;d.setTextNodeRange(a,f,a,f)}let c=i.slice(0,l)+o+i.slice(l+n);return a.__text=c,a}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){Gn();let n=this.getLatest(),o=n.getTextContent();if(o==="")return[];let r=n.__key,a=wi(),i=o.length;t.sort((I,T)=>I-T),t.push(i);let s=[],l=t.length;for(let I=0,T=0;I<i&&T<=l;T++){let E=t[T];E>I&&(s.push(o.slice(I,E)),I=E)}let d=s.length;if(d===1)return[n];let c=s[0],f=n.getParent(),p,m=n.getFormat(),h=n.getStyle(),g=n.__detail,v=!1,x=null,y=null,C=wt();if(je(C)){let[I,T]=C.isBackward()?[C.focus,C.anchor]:[C.anchor,C.focus];I.type==="text"&&I.key===r&&(x=I),T.type==="text"&&T.key===r&&(y=T)}n.isSegmented()?(p=Wn(c),p.__format=m,p.__style=h,p.__detail=g,p.__state=KT(n,p),v=!0):p=n.setTextContent(c);let S=[p];for(let I=1;I<d;I++){let T=Wn(s[I]);T.__format=m,T.__style=h,T.__detail=g,T.__state=KT(n,T);let E=T.__key;a===r&&jn(E),S.push(T)}let L=x?x.offset:null,w=y?y.offset:null,k=0;for(let I of S){if(!x&&!y)break;let T=k+I.getTextContentSize();if(x!==null&&L!==null&&L<=T&&L>=k&&(x.set(I.getKey(),L-k,"text"),L<T&&(x=null)),y!==null&&w!==null&&w<=T&&w>=k){y.set(I.getKey(),w-k,"text");break}k=T}if(f!==null){(function(E){let A=E.getPreviousSibling(),N=E.getNextSibling();A!==null&&jp(A),N!==null&&jp(N)})(this);let I=f.getWritable(),T=this.getIndexWithinParent();v?(I.splice(T,0,S),this.remove()):I.splice(T,1,S),je(C)&&Vp(C,f,T,d-1)}return S}mergeWithSibling(t){let n=t===this.getPreviousSibling();n||t===this.getNextSibling()||J(50);let o=this.__key,r=t.__key,a=this.__text,i=a.length;wi()===r&&jn(o);let s=wt();if(je(s)){let f=s.anchor,p=s.focus;f!==null&&f.key===r&&uk(f,n,o,t,i),p!==null&&p.key===r&&uk(p,n,o,t,i)}let l=t.__text,d=n?l+a:a+l;this.setTextContent(d);let c=this.getWritable();return t.remove(),c}isTextEntity(){return!1}};function Q$(e){return{forChild:Ix(e.style),node:null}}function X$(e){let t=e,n=t.style.fontWeight==="normal";return{forChild:Ix(t.style,n?void 0:"bold"),node:null}}var nk=new WeakMap;function Y$(e){if(!ko(e))return!1;if(e.nodeName==="PRE")return!0;let t=e.style.whiteSpace;return typeof t=="string"&&t.startsWith("pre")}function J$(e){let t=e;e.parentElement===null&&J(129);let n=t.textContent||"";if((function(o){let r,a=o.parentNode,i=[o];for(;a!==null&&(r=nk.get(a))===void 0&&!Y$(a);)i.push(a),a=a.parentNode;let s=r===void 0?a:r;for(let l=0;l<i.length;l++)nk.set(i[l],s);return s})(t)!==null){let o=n.split(/(\r?\n|\t)/),r=[],a=o.length;for(let i=0;i<a;i++){let s=o[i];s===`
3703
3706
  `||s===`\r
3704
- `?r.push(Dl()):s===" "?r.push(jp()):s!==""&&r.push(jn(s))}return{node:r}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),n==="")return{node:null};if(n[0]===" "){let o=t,r=!0;for(;o!==null&&(o=jT(o,!1))!==null;){let a=o.textContent||"";if(a.length>0){/[ \t\n]$/.test(a)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===" "){let o=t,r=!0;for(;o!==null&&(o=jT(o,!0))!==null;)if((o.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===""?{node:null}:{node:jn(n)}}function jT(e,t){let n=e;for(;;){let o;for(;(o=t?n.nextSibling:n.previousSibling)===null;){let a=n.parentElement;if(a===null)return null;n=a}if(n=o,ko(n)){let a=n.style.display;if(a===""&&!Wk(n)||a!==""&&!a.startsWith("inline"))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(oa(n))return n;if(n.nodeName==="BR")return null}}var U$={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Ta(e){let t=U$[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:vx(e.style,t),node:null}}function jn(e=""){return Xc(new Ls(e))}function Me(e){return e instanceof Ls}function vx(e,t){let n=e.fontWeight,o=e.textDecoration.split(" "),r=n==="700"||n==="bold",a=o.includes("line-through"),i=e.fontStyle==="italic",s=o.includes("underline"),l=e.verticalAlign;return d=>(Me(d)&&(r&&!d.hasFormat("bold")&&d.toggleFormat("bold"),a&&!d.hasFormat("strikethrough")&&d.toggleFormat("strikethrough"),i&&!d.hasFormat("italic")&&d.toggleFormat("italic"),s&&!d.hasFormat("underline")&&d.toggleFormat("underline"),l!=="sub"||d.hasFormat("subscript")||d.toggleFormat("subscript"),l!=="super"||d.hasFormat("superscript")||d.toggleFormat("superscript"),t&&!d.hasFormat(t)&&d.toggleFormat(t)),d)}var Ol=class e extends Ls{static getType(){return"tab"}static clone(t){return new e(t.__key)}constructor(t){super(" ",t),this.__detail=2}static importDOM(){return null}createDOM(t){let n=super.createDOM(t),o=Nl(t.theme,"tab");return o!==void 0&&n.classList.add(...o),n}static importJSON(t){return jp().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&bL(126),super.setTextContent(" ")}spliceText(t,n,o,r){return o===""&&n===0||o===" "&&n===1||Z(286),this}setDetail(t){return t!==2&&Z(127),this}setMode(t){return t!=="normal"&&Z(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function jp(){return Xc(new Ol)}function xx(e){return e instanceof Ol}var Wv=class{key;offset;type;_selection;constructor(t,n,o){this._selection=null,this.key=t,this.offset=n,this.type=o}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){return this.key===t.key?this.offset<t.offset:$x(wr(wi(this,"next")),wr(wi(t,"next")))<0}getNode(){let t=Bn(this.key);return t===null&&Z(20),t}set(t,n,o,r){let a=this._selection,i=this.key;r&&this.key===t&&this.offset===n&&this.type===o||(this.key=t,this.offset=n,this.type=o,Vl()||(hi()===i&&Xn(t),a!==null&&(a.setCachedNodes(null),a.dirty=!0)))}};function Pr(e,t,n){return new Wv(e,t,n)}function yv(e,t){let n=t.__key,o=e.offset,r="element";if(Me(t)){r="text";let a=t.getTextContentSize();o>a&&(o=a)}else if(!Q(t)){let a=t.getNextSibling();if(Me(a))n=a.__key,o=0,r="text";else{let i=t.getParent();i&&(n=i.__key,o=t.getIndexWithinParent()+1)}}e.set(n,o,r)}function QT(e,t){if(Q(t)){let n=t.getLastDescendant();Q(n)||Me(n)?yv(e,n):yv(e,t)}else yv(e,t)}var Fp=class e{_nodes;_cachedNodes;dirty;constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){if(!Wc(t))return!1;let n=this._nodes,o=t._nodes;return n.size===o.size&&Array.from(n).every(r=>o.has(r))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(t){this.dirty=!0,this._nodes.add(t),this._cachedNodes=null}delete(t){this.dirty=!0,this._nodes.delete(t),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(t){return this._nodes.has(t)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){let n=this.getNodes(),o=n.length,r=n[o-1],a;if(Me(r))a=r.select();else{let i=r.getIndexWithinParent()+1;a=r.getParentOrThrow().select(i,i)}a.insertNodes(t);for(let i=0;i<o;i++)n[i].remove()}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let n=this._nodes,o=[];for(let r of n){let a=Bn(r);a!==null&&o.push(a)}return Vl()||(this._cachedNodes=o),o}getTextContent(){let t=this.getNodes(),n="";for(let o=0;o<t.length;o++)n+=t[o].getTextContent();return n}deleteNodes(){let t=this.getNodes();if((St()||Es())===this&&t[0]){let n=Zn(t[0],"next");Yk(Si(n,n))}for(let n of t)n.remove()}};function Ue(e){return e instanceof ks}var ks=class e{format;style;anchor;focus;_cachedNodes;dirty;constructor(t,n,o,r){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.format=o,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!Ue(t)&&this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let n=(function(o){let r=[],[a,i]=o.getTextSlices();a&&r.push(a.caret.origin);let s=new Set,l=new Set;for(let d of o)if(Lr(d)){let{origin:c}=d;r.length===0?s.add(c):(l.add(c),r.push(c))}else{let{origin:c}=d;Q(c)&&l.has(c)||r.push(c)}if(i&&r.push(i.caret.origin),As(o.focus)&&Q(o.focus.origin)&&o.focus.getNodeAtCaret()===null)for(let d=Ra(o.focus.origin,"previous");Lr(d)&&s.has(d.origin)&&!d.origin.isEmpty()&&d.origin.is(r[r.length-1]);d=Kl(d))s.delete(d.origin),r.pop();for(;r.length>1;){let d=r[r.length-1];if(!Q(d)||l.has(d)||d.isEmpty()||s.has(d))break;r.pop()}if(r.length===0&&o.isCollapsed()){let d=wr(o.anchor),c=wr(o.anchor.getFlipped()),f=m=>Ma(m)?m.origin:m.getNodeAtCaret(),p=f(d)||f(c)||(o.anchor.getNodeAtCaret()?d.origin:c.origin);r.push(p)}return r})(Ux(tx(this),"next"));return Vl()||(this._cachedNodes=n),n}setTextNodeRange(t,n,o,r){this.anchor.set(t.__key,n,"text"),this.focus.set(o.__key,r,"text")}getTextContent(){let t=this.getNodes();if(t.length===0)return"";let n=t[0],o=t[t.length-1],r=this.anchor,a=this.focus,i=r.isBefore(a),[s,l]=Gv(this),d="",c=!0;for(let f=0;f<t.length;f++){let p=t[f];if(Q(p)&&!p.isInline())c||(d+=`
3705
- `),c=!p.isEmpty();else if(c=!1,Me(p)){let m=p.getTextContent();p===n?p===o?r.type==="element"&&a.type==="element"&&a.offset!==r.offset||(m=s<l?m.slice(s,l):m.slice(l,s)):m=i?m.slice(s):m.slice(l):p===o&&(m=i?m.slice(0,l):m.slice(0,s)),d+=m}else!Qt(p)&&!Ss(p)||p===o&&this.isCollapsed()||(d+=p.getTextContent())}return d}applyDOMRange(t){let n=Kt(),o=n.getEditorState()._selection,r=vk(t.startContainer,t.startOffset,t.endContainer,t.endOffset,n,o);if(r===null)return;let[a,i]=r;this.anchor.set(a.key,a.offset,a.type,!0),this.focus.set(i.key,i.offset,i.type,!0),Pp(this)}clone(){let t=this.anchor,n=this.focus;return new e(Pr(t.key,t.offset,t.type),Pr(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(t){this.format=Kc(this.format,t,null),this.dirty=!0}setFormat(t){this.format=t,this.dirty=!0}setStyle(t){this.style=t,this.dirty=!0}hasFormat(t){let n=fo[t];return(this.format&n)!==0}insertRawText(t){let n=t.split(/(\r?\n|\t)/),o=[],r=n.length;for(let a=0;a<r;a++){let i=n[a];i===`
3707
+ `?r.push(Kl()):s===" "?r.push(tm()):s!==""&&r.push(Wn(s))}return{node:r}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),n==="")return{node:null};if(n[0]===" "){let o=t,r=!0;for(;o!==null&&(o=ok(o,!1))!==null;){let a=o.textContent||"";if(a.length>0){/[ \t\n]$/.test(a)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===" "){let o=t,r=!0;for(;o!==null&&(o=ok(o,!0))!==null;)if((o.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===""?{node:null}:{node:Wn(n)}}function ok(e,t){let n=e;for(;;){let o;for(;(o=t?n.nextSibling:n.previousSibling)===null;){let a=n.parentElement;if(a===null)return null;n=a}if(n=o,ko(n)){let a=n.style.display;if(a===""&&!tP(n)||a!==""&&!a.startsWith("inline"))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(sa(n))return n;if(n.nodeName==="BR")return null}}var Z$={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Ra(e){let t=Z$[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Ix(e.style,t),node:null}}function Wn(e=""){return ou(new Ps(e))}function Me(e){return e instanceof Ps}function Ix(e,t){let n=e.fontWeight,o=e.textDecoration.split(" "),r=n==="700"||n==="bold",a=o.includes("line-through"),i=e.fontStyle==="italic",s=o.includes("underline"),l=e.verticalAlign;return d=>(Me(d)&&(r&&!d.hasFormat("bold")&&d.toggleFormat("bold"),a&&!d.hasFormat("strikethrough")&&d.toggleFormat("strikethrough"),i&&!d.hasFormat("italic")&&d.toggleFormat("italic"),s&&!d.hasFormat("underline")&&d.toggleFormat("underline"),l!=="sub"||d.hasFormat("subscript")||d.toggleFormat("subscript"),l!=="super"||d.hasFormat("superscript")||d.toggleFormat("superscript"),t&&!d.hasFormat(t)&&d.toggleFormat(t)),d)}var ql=class e extends Ps{static getType(){return"tab"}static clone(t){return new e(t.__key)}constructor(t){super(" ",t),this.__detail=2}static importDOM(){return null}createDOM(t){let n=super.createDOM(t),o=Hl(t.theme,"tab");return o!==void 0&&n.classList.add(...o),n}static importJSON(t){return tm().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&Ek(126),super.setTextContent(" ")}spliceText(t,n,o,r){return o===""&&n===0||o===" "&&n===1||J(286),this}setDetail(t){return t!==2&&J(127),this}setMode(t){return t!=="normal"&&J(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function tm(){return ou(new ql)}function Sx(e){return e instanceof ql}var Yv=class{key;offset;type;_selection;constructor(t,n,o){this._selection=null,this.key=t,this.offset=n,this.type=o}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){return this.key===t.key?this.offset<t.offset:Vx(Lr(Ri(this,"next")),Lr(Ri(t,"next")))<0}getNode(){let t=$n(this.key);return t===null&&J(20),t}set(t,n,o,r){let a=this._selection,i=this.key;r&&this.key===t&&this.offset===n&&this.type===o||(this.key=t,this.offset=n,this.type=o,Zl()||(wi()===i&&jn(t),a!==null&&(a.setCachedNodes(null),a.dirty=!0)))}};function Mr(e,t,n){return new Yv(e,t,n)}function wv(e,t){let n=t.__key,o=e.offset,r="element";if(Me(t)){r="text";let a=t.getTextContentSize();o>a&&(o=a)}else if(!Q(t)){let a=t.getNextSibling();if(Me(a))n=a.__key,o=0,r="text";else{let i=t.getParent();i&&(n=i.__key,o=t.getIndexWithinParent()+1)}}e.set(n,o,r)}function rk(e,t){if(Q(t)){let n=t.getLastDescendant();Q(n)||Me(n)?wv(e,n):wv(e,t)}else wv(e,t)}var qp=class e{_nodes;_cachedNodes;dirty;constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){if(!Zc(t))return!1;let n=this._nodes,o=t._nodes;return n.size===o.size&&Array.from(n).every(r=>o.has(r))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(t){this.dirty=!0,this._nodes.add(t),this._cachedNodes=null}delete(t){this.dirty=!0,this._nodes.delete(t),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(t){return this._nodes.has(t)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){let n=this.getNodes(),o=n.length,r=n[o-1],a;if(Me(r))a=r.select();else{let i=r.getIndexWithinParent()+1;a=r.getParentOrThrow().select(i,i)}a.insertNodes(t);for(let i=0;i<o;i++)n[i].remove()}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let n=this._nodes,o=[];for(let r of n){let a=$n(r);a!==null&&o.push(a)}return Zl()||(this._cachedNodes=o),o}getTextContent(){let t=this.getNodes(),n="";for(let o=0;o<t.length;o++)n+=t[o].getTextContent();return n}deleteNodes(){let t=this.getNodes();if((wt()||Rs())===this&&t[0]){let n=Yn(t[0],"next");iP(Mi(n,n))}for(let n of t)n.remove()}};function je(e){return e instanceof As}var As=class e{format;style;anchor;focus;_cachedNodes;dirty;constructor(t,n,o,r){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.format=o,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!je(t)&&this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let t=this._cachedNodes;if(t!==null)return t;let n=(function(o){let r=[],[a,i]=o.getTextSlices();a&&r.push(a.caret.origin);let s=new Set,l=new Set;for(let d of o)if(Ar(d)){let{origin:c}=d;r.length===0?s.add(c):(l.add(c),r.push(c))}else{let{origin:c}=d;Q(c)&&l.has(c)||r.push(c)}if(i&&r.push(i.caret.origin),Ms(o.focus)&&Q(o.focus.origin)&&o.focus.getNodeAtCaret()===null)for(let d=za(o.focus.origin,"previous");Ar(d)&&s.has(d.origin)&&!d.origin.isEmpty()&&d.origin.is(r[r.length-1]);d=Yl(d))s.delete(d.origin),r.pop();for(;r.length>1;){let d=r[r.length-1];if(!Q(d)||l.has(d)||d.isEmpty()||s.has(d))break;r.pop()}if(r.length===0&&o.isCollapsed()){let d=Lr(o.anchor),c=Lr(o.anchor.getFlipped()),f=m=>Ba(m)?m.origin:m.getNodeAtCaret(),p=f(d)||f(c)||(o.anchor.getNodeAtCaret()?d.origin:c.origin);r.push(p)}return r})(Gx(ix(this),"next"));return Zl()||(this._cachedNodes=n),n}setTextNodeRange(t,n,o,r){this.anchor.set(t.__key,n,"text"),this.focus.set(o.__key,r,"text")}getTextContent(){let t=this.getNodes();if(t.length===0)return"";let n=t[0],o=t[t.length-1],r=this.anchor,a=this.focus,i=r.isBefore(a),[s,l]=Jv(this),d="",c=!0;for(let f=0;f<t.length;f++){let p=t[f];if(Q(p)&&!p.isInline())c||(d+=`
3708
+ `),c=!p.isEmpty();else if(c=!1,Me(p)){let m=p.getTextContent();p===n?p===o?r.type==="element"&&a.type==="element"&&a.offset!==r.offset||(m=s<l?m.slice(s,l):m.slice(l,s)):m=i?m.slice(s):m.slice(l):p===o&&(m=i?m.slice(0,l):m.slice(0,s)),d+=m}else!Qt(p)&&!Ts(p)||p===o&&this.isCollapsed()||(d+=p.getTextContent())}return d}applyDOMRange(t){let n=qt(),o=n.getEditorState()._selection,r=kL(t.startContainer,t.startOffset,t.endContainer,t.endOffset,n,o);if(r===null)return;let[a,i]=r;this.anchor.set(a.key,a.offset,a.type,!0),this.focus.set(i.key,i.offset,i.type,!0),Dp(this)}clone(){let t=this.anchor,n=this.focus;return new e(Mr(t.key,t.offset,t.type),Mr(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(t){this.format=Xc(this.format,t,null),this.dirty=!0}setFormat(t){this.format=t,this.dirty=!0}setStyle(t){this.style=t,this.dirty=!0}hasFormat(t){let n=go[t];return(this.format&n)!==0}insertRawText(t){let n=t.split(/(\r?\n|\t)/),o=[],r=n.length;for(let a=0;a<r;a++){let i=n[a];i===`
3706
3709
  `||i===`\r
3707
- `?o.push(Dl()):i===" "?o.push(jp()):o.push(jn(i))}this.insertNodes(o)}insertText(t){let n=this.anchor,o=this.focus,r=this.format,a=this.style,i=n,s=o;!this.isCollapsed()&&o.isBefore(n)&&(i=o,s=n),i.type==="element"&&(function(v,x,y,C){let w=v.getNode(),k=w.getChildAtIndex(v.offset),S=jn();if(S.setFormat(y),S.setStyle(C),Lk(k))k.splice(0,0,[S]);else{let L=to(w)?Ea().append(S):S;k===null?w.append(L):k.insertBefore(L)}v.is(x)&&x.set(S.__key,0,"text"),v.set(S.__key,0,"text")})(i,s,r,a),s.type==="element"&&ql(s,wr(wi(s,"next")));let l=i.offset,d=s.offset,c=this.getNodes(),f=c.length,p=c[0];Me(p)||Z(26);let m=p.getTextContent().length,h=p.getParentOrThrow(),g=c[f-1];if(f===1&&s.type==="element"&&(d=m,s.set(i.key,d,"text")),this.isCollapsed()&&l===m&&(ka(p)||!p.canInsertTextAfter()||!h.canInsertTextAfter()&&p.getNextSibling()===null)){let v=p.getNextSibling();if(Me(v)&&v.canInsertTextBefore()&&!ka(v)||(v=jn(),v.setFormat(r),v.setStyle(a),h.canInsertTextAfter()?p.insertAfter(v):h.insertAfter(v)),v.select(0,0),p=v,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&l===0&&(ka(p)||!p.canInsertTextBefore()||!h.canInsertTextBefore()&&p.getPreviousSibling()===null)){let v=p.getPreviousSibling();if(Me(v)&&!ka(v)||(v=jn(),v.setFormat(r),h.canInsertTextBefore()?p.insertBefore(v):h.insertBefore(v)),v.select(),p=v,t!=="")return void this.insertText(t)}else if(p.isSegmented()&&l!==m){let v=jn(p.getTextContent());v.setFormat(r),p.replace(v),p=v}else if(!this.isCollapsed()&&t!==""){let v=g.getParent();if(!h.canInsertTextBefore()||!h.canInsertTextAfter()||Q(v)&&(!v.canInsertTextBefore()||!v.canInsertTextAfter()))return this.insertText(""),hk(this.anchor,this.focus),void this.insertText(t)}if(f===1){if(vi(p)){let C=jn(t);return C.select(),void p.replace(C)}let v=p.getFormat(),x=p.getStyle();if(l!==d||v===r&&x===a){if(xx(p)){let C=jn(t);return C.setFormat(r),C.setStyle(a),C.select(),void p.replace(C)}}else{if(p.getTextContent()!==""){let C=jn(t);if(C.setFormat(r),C.setStyle(a),C.select(),l===0)p.insertBefore(C,!1);else{let[w]=p.splitText(l);w.insertAfter(C,!1)}return void(C.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length))}p.setFormat(r),p.setStyle(a)}let y=d-l;p=p.spliceText(l,y,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=v,this.style=x,p.isComposing()&&(this.anchor.offset-=t.length))}else{let v=new Set([...p.getParentKeys(),...g.getParentKeys()]),x=Q(p)?p:p.getParentOrThrow(),y=Q(g)?g:g.getParentOrThrow(),C=g;if(!x.is(y)&&y.isInline())do C=y,y=y.getParentOrThrow();while(y.isInline());if(s.type==="text"&&(d!==0||g.getTextContent()==="")||s.type==="element"&&g.getIndexWithinParent()<d)if(Me(g)&&!vi(g)&&d!==g.getTextContentSize()){if(g.isSegmented()){let I=jn(g.getTextContent());g.replace(I),g=I}to(s.getNode())||s.type!=="text"||(g=g.spliceText(0,d,"")),v.add(g.__key)}else{let I=g.getParentOrThrow();I.canBeEmpty()||I.getChildrenSize()!==1?g.remove():I.remove()}else v.add(g.__key);let w=y.getChildren(),k=new Set(c),S=x.is(y),L=x.isInline()&&p.getNextSibling()===null?x:p;for(let I=w.length-1;I>=0;I--){let T=w[I];if(T.is(p)||Q(T)&&T.isParentOf(p))break;T.isAttached()&&(!k.has(T)||T.is(C)?S||L.insertAfter(T,!1):T.remove())}if(!S){let I=y,T=null;for(;I!==null;){let E=I.getChildren(),A=E.length;(A===0||E[A-1].is(T))&&(v.delete(I.__key),T=I),I=I.getParent()}}if(vi(p))if(l===m)p.select();else{let I=jn(t);I.select(),p.replace(I)}else p=p.spliceText(l,m-l,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=p.getFormat(),this.style=p.getStyle(),p.isComposing()&&(this.anchor.offset-=t.length));for(let I=1;I<f;I++){let T=c[I],E=T.__key;v.has(E)||T.remove()}}}removeText(){let t=St()===this;Nc(this,Jk(tx(this))),t&&St()!==this&&Do(this)}formatText(t,n=null){if(this.isCollapsed())return this.toggleFormat(t),void Xn(null);let o=this.getNodes(),r=[];for(let w of o)Me(w)&&r.push(w);let a=w=>{o.forEach(k=>{if(Q(k)){let S=k.getFormatFlags(t,w);k.setTextFormat(S)}})},i=r.length;if(i===0)return this.toggleFormat(t),Xn(null),void a(n);let s=this.anchor,l=this.focus,d=this.isBackward(),c=d?l:s,f=d?s:l,p=0,m=r[0],h=c.type==="element"?0:c.offset;if(c.type==="text"&&h===m.getTextContentSize()&&(p=1,m=r[1],h=0),m==null)return;let g=m.getFormatFlags(t,n);a(g);let v=i-1,x=r[v],y=f.type==="text"?f.offset:x.getTextContentSize();if(m.is(x)){if(h===y)return;if(ka(m)||h===0&&y===m.getTextContentSize())m.setFormat(g);else{let w=m.splitText(h,y),k=h===0?w[0]:w[1];k.setFormat(g),c.type==="text"&&c.set(k.__key,0,"text"),f.type==="text"&&f.set(k.__key,y-h,"text")}return void(this.format=g)}h===0||ka(m)||([,m]=m.splitText(h),h=0),m.setFormat(g);let C=x.getFormatFlags(t,g);y>0&&(y===x.getTextContentSize()||ka(x)||([x]=x.splitText(y)),x.setFormat(C));for(let w=p+1;w<v;w++){let k=r[w],S=k.getFormatFlags(t,C);k.setFormat(S)}c.type==="text"&&c.set(m.__key,h,"text"),f.type==="text"&&f.set(x.__key,y,"text"),this.format=g|C}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let h=St();return Ue(h)||Z(134),h.insertNodes(t)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=Mc(n,Aa),r=t[t.length-1];if(Q(o)&&"__language"in o){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let h=Cv(this);o.splice(h,0,t),r.selectEnd()}return}if(!t.some(h=>(Q(h)||Qt(h))&&!h.isInline())){Q(o)||Z(211,n.constructor.name,n.getType());let h=Cv(this);return o.splice(h,0,t),void r.selectEnd()}let a=(function(h){let g=Ea(),v=null;for(let x=0;x<h.length;x++){let y=h[x],C=Ss(y);if(C||Qt(y)&&y.isInline()||Q(y)&&y.isInline()||Me(y)||y.isParentRequired()){if(v===null&&(v=y.createParentElementNode(),g.append(v),C))continue;v!==null&&v.append(y)}else g.append(y),v=null}return g})(t),i=a.getLastDescendant(),s=a.getChildren(),l=!Q(o)||!o.isEmpty()?this.insertParagraph():null,d=s[s.length-1],c=s[0];var f;Q(f=c)&&Aa(f)&&!f.isEmpty()&&Q(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(Q(o)||Z(211,n.constructor.name,n.getType()),o.append(...c.getChildren()),c=s[1]),c&&(o===null&&Z(212,n.constructor.name,n.getType()),(function(h,g){let v=g.getParentOrThrow().getLastChild(),x=g,y=[g];for(;x!==v;)x.getNextSibling()||Z(140),x=x.getNextSibling(),y.push(x);let C=h;for(let w of y)C=C.insertAfter(w)})(o,c));let p=Mc(i,Aa);l&&Q(p)&&(l.canMergeWhenEmpty()||Aa(d))&&(p.append(...l.getChildren()),l.remove()),Q(o)&&o.isEmpty()&&o.remove(),i.selectEnd();let m=Q(o)?o.getLastChild():null;Ss(m)&&p!==o&&m.remove()}insertParagraph(){if(this.anchor.key==="root"){let i=Ea();return Ko().splice(this.anchor.offset,0,[i]),i.select(),i}let t=Cv(this),n=Mc(this.anchor.getNode(),Aa);Q(n)||Z(213);let o=n.getChildAtIndex(t),r=o?[o,...o.getNextSiblings()]:[],a=n.insertNewAfter(this,!1);return a?(a.append(...r),a.selectStart(),a):null}insertLineBreak(t){let n=Dl();if(this.insertNodes([n]),t){let o=n.getParentOrThrow(),r=n.getIndexWithinParent();o.select(r,r)}}extract(){let t=[...this.getNodes()],n=t.length,o=t[0],r=t[n-1],[a,i]=Gv(this),s=this.isBackward(),[l,d]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[c,f]=s?[i,a]:[a,i];if(n===0)return[];if(n===1){if(Me(o)&&!this.isCollapsed()){let p=o.splitText(c,f),m=c===0?p[0]:p[1];return m?(l.set(m.getKey(),0,"text"),d.set(m.getKey(),m.getTextContentSize(),"text"),[m]):[]}return[o]}if(Me(o)&&(c===o.getTextContentSize()?t.shift():c!==0&&([,o]=o.splitText(c),t[0]=o,l.set(o.getKey(),0,"text"))),Me(r)){let p=r.getTextContent().length;f===0?t.pop():f!==p&&([r]=r.splitText(f),t[t.length-1]=r,d.set(r.getKey(),r.getTextContentSize(),"text"))}return t}modify(t,n,o){if(rL(this,t,n,o))return;let r=t==="move",a=Kt(),i=Er(qo(a));if(!i)return;let s=a._blockCursorElement,l=a._rootElement,d=this.focus.getNode();if(l===null||s===null||!Q(d)||d.isInline()||d.canBeEmpty()||Xv(s,a,l),this.dirty){let c=zl(a,this.anchor.key),f=zl(a,this.focus.key);this.anchor.type==="text"&&(c=Ps(c)),this.focus.type==="text"&&(f=Ps(f)),c&&f&&Ck(i,c,this.anchor.offset,f,this.focus.offset)}if((function(c,f,p,m){c.modify(f,p,m)})(i,t,n?"backward":"forward",o),i.rangeCount>0){let c=i.getRangeAt(0),f=this.anchor.getNode(),p=to(f)?f:Uk(f);if(this.applyDOMRange(c),this.dirty=!0,!r){let m=this.getNodes(),h=[],g=!1;for(let v=0;v<m.length;v++){let x=m[v];Up(x,p)?h.push(x):g=!0}if(g&&h.length>0)if(n){let v=h[0];Q(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{let v=h[h.length-1];Q(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}i.anchorNode===c.startContainer&&i.anchorOffset===c.startOffset||(function(v){let x=v.focus,y=v.anchor,C=y.key,w=y.offset,k=y.type;y.set(x.key,x.offset,x.type,!0),x.set(C,w,k,!0)})(this)}}o==="lineboundary"&&rL(this,t,n,o,"decorators")}forwardDeletion(t,n,o){if(!o&&(t.type==="element"&&Q(n)&&t.offset===n.getChildrenSize()||t.type==="text"&&t.offset===n.getTextContentSize())){let r=n.getParent(),a=n.getNextSibling()||(r===null?null:r.getNextSibling());if(Q(a)&&a.isShadowRoot())return!0}return!1}deleteCharacter(t){let n=this.isCollapsed();if(this.isCollapsed()){let o=this.anchor,r=o.getNode();if(this.forwardDeletion(o,r,t))return;let a=Bx(wi(o,t?"previous":"next"));if(a.getTextSlices().every(s=>s===null||s.distance===0)){let s={type:"initial"};for(let l of a.iterNodeCarets("shadowRoot"))if(Lr(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(s.type==="merge-block")break;if(Q(a.anchor.origin)&&a.anchor.origin.isEmpty()){let d=wr(l);Nc(this,Si(d,d)),a.anchor.origin.remove()}return}s.type!=="merge-next-block"&&s.type!=="merge-block"||(s={block:s.block,caret:l,type:"merge-block"})}}else{if(s.type==="merge-block")break;if(As(l)){if(Q(l.origin)){if(l.origin.isInline()){if(!l.origin.isParentOf(a.anchor.origin))break}else s={block:l.origin,type:"merge-next-block"};continue}if(Qt(l.origin)){if(!l.origin.isIsolated())if(s.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&Q(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let d=yx();d.add(l.origin.getKey()),Do(d)}else l.origin.remove();return}break}}if(s.type==="merge-block"){let{caret:l,block:d}=s;return Nc(this,Si(!l.origin.isEmpty()&&d.isEmpty()?Gl(Zn(d,l.direction)):a.anchor,l)),this.removeText()}}let i=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&o.offset===0&&YT(this,o.getNode()))return}else{let s=i.type==="text"?i.getNode():null;if(r=o.type==="text"?o.getNode():null,s!==null&&s.isSegmented()){let l=i.offset,d=s.getTextContentSize();if(s.is(r)||t&&l!==d||!t&&l!==0)return void JT(s,t,l)}else if(r!==null&&r.isSegmented()){let l=o.offset,d=r.getTextContentSize();if(r.is(s)||t&&l!==0||!t&&l!==d)return void JT(r,t,l)}(function(l,d){let c=l.anchor,f=l.focus,p=c.getNode(),m=f.getNode();if(p===m&&c.type==="text"&&f.type==="text"){let h=c.offset,g=f.offset,v=h<g,x=v?h:g,y=v?g:h,C=y-1;x!==C&&(function(w){return!(Dk(w)||K$(w))})(p.getTextContent().slice(x,y))&&(d?f.set(f.key,C,f.type):c.set(c.key,C,c.type))}})(this,t)}}if(this.removeText(),t&&!n&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let o=this.anchor.getNode();o.isEmpty()&&to(o.getParent())&&o.getPreviousSibling()===null&&YT(this,o)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){let n=this.anchor,o=n.getNode();if(this.forwardDeletion(n,o,t))return;this.modify("extend",t,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function Wc(e){return e instanceof Fp}function XT(e){let t=e.offset;if(e.type==="text")return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function Gv(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,o]=t;return n.type==="element"&&o.type==="element"&&n.key===o.key&&n.offset===o.offset?[0,0]:[XT(n),XT(o)]}function YT(e,t){for(let n=t;n;n=n.getParent()){if(Q(n)){if(n.collapseAtStart(e))return!0;if(cr(n))break}if(n.getPreviousSibling())break}return!1}var K$=(()=>{try{let e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("\u2764\uFE0F")&&t("#\uFE0F\u20E3")&&t("\u{1F44D}"))return t}catch{}return()=>!1})();function JT(e,t,n){let o=e,r=o.getTextContent().split(/(?=\s)/g),a=r.length,i=0,s=0;for(let d=0;d<a;d++){let c=d===a-1;if(s=i,i+=r[d].length,t&&i===n||i>n||c){r.splice(d,1),c&&(s=void 0);break}}let l=r.join("").trim();l===""?o.remove():(o.setTextContent(l),o.select(s,s))}function ZT(e,t,n,o){let r,a=t;if(ko(e)){let i=!1,s=e.childNodes,l=s.length,d=o._blockCursorElement;a===l&&(i=!0,a=l-1);let c=s[a],f=!1;if(c===d)c=s[a+1],f=!0;else if(d!==null){let p=d.parentNode;e===p&&t>Array.prototype.indexOf.call(p.children,d)&&a--}if(r=El(c),Me(r))a=kr(r,i?"next":"previous");else{let p=El(e);if(p===null)return null;if(Q(p)){let m=o.getElementByKey(p.getKey());m===null&&Z(214),[p,a]=p.getDOMSlot(m).resolveChildIndex(p,m,e,t),Q(p)||Z(215),i&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let g=p.getChildAtIndex(a);if(Q(g)&&(function(v,x,y){let C=v.getParent();return y===null||C===null||!C.canBeEmpty()||C!==y.getNode()})(g,0,n)){let v=i?g.getLastDescendant():g.getFirstDescendant();v===null?p=g:(g=v,p=Q(g)?g:g.getParentOrThrow()),a=0}Me(g)?(r=g,p=null,a=kr(g,i?"next":"previous")):g!==p&&i&&!f&&(Q(p)||Z(216),a=Math.min(p.getChildrenSize(),a+1))}else{let m=p.getIndexWithinParent();a=t===0&&Qt(p)&&El(e)===p?m:m+1,p=p.getParentOrThrow()}if(Q(p))return Pr(p.__key,a,"element")}}else r=El(e);return Me(r)?Pr(r.__key,kr(r,a,"clamp"),"text"):null}function eL(e,t,n){let o=e.offset,r=e.getNode();if(o===0){let a=r.getPreviousSibling(),i=r.getParent();if(t){if((n||!t)&&a===null&&Q(i)&&i.isInline()){let s=i.getPreviousSibling();Me(s)&&e.set(s.__key,s.getTextContent().length,"text")}}else Q(a)&&!n&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):Me(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(o===r.getTextContent().length){let a=r.getNextSibling(),i=r.getParent();if(t&&Q(a)&&a.isInline())e.set(a.__key,0,"element");else if((n||t)&&a===null&&Q(i)&&i.isInline()&&!i.canInsertTextAfter()){let s=i.getNextSibling();Me(s)&&e.set(s.__key,0,"text")}}}function hk(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);eL(e,o,r),eL(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function vk(e,t,n,o,r,a){if(e===null||n===null||!Gc(r,e,n))return null;let i=ZT(e,t,Ue(a)?a.anchor:null,r);if(i===null)return null;let s=ZT(n,o,Ue(a)?a.focus:null,r);if(s===null)return null;if(i.type==="element"&&s.type==="element"){let l=El(e),d=El(n);if(Qt(l)&&Qt(d))return null}return hk(i,s),[i,s]}function q$(e){return Q(e)&&!e.isInline()}function xk(e,t,n,o,r,a){let i=Na(),s=new ks(Pr(e,t,r),Pr(n,o,a),0,"");return s.dirty=!0,i._selection=s,s}function yk(){let e=Pr("root",0,"element"),t=Pr("root",0,"element");return new ks(e,t,0,"")}function yx(){return new Fp(new Set)}function V$(e,t){return Qp(null,e,t,null)}function Qp(e,t,n,o){let r=n._window;if(r===null)return null;let a=o||r.event,i=a?a.type:void 0,s=i==="selectionchange",l=!kv&&(s||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&a&&a.detail===3||i==="drop"||i===void 0),d,c,f,p;if(Ue(e)&&!l)return e.clone();if(t===null)return null;if(d=t.anchorNode,c=t.focusNode,f=t.anchorOffset,p=t.focusOffset,(s||i===void 0)&&Ue(e)&&!Gc(n,d,c))return e.clone();let m=vk(d,f,c,p,n,e);if(m===null)return null;let[h,g]=m,v=0,x="";if(Ue(e)){let y=e.anchor;if(h.key===y.key)v=e.format,x=e.style;else{let C=h.getNode();Me(C)?(v=C.getFormat(),x=C.getStyle()):Q(C)&&(v=C.getTextFormat(),x=C.getTextStyle())}}return new ks(h,g,v,x)}function St(){return Na()._selection}function Es(){return Kt()._editorState._selection}function Bp(e,t,n,o=1){let r=e.anchor,a=e.focus,i=r.getNode(),s=a.getNode();if(!t.is(i)&&!t.is(s))return;let l=t.__key;if(e.isCollapsed()){let d=r.offset;if(n<=d&&o>0||n<d&&o<0){let c=Math.max(0,d+o);r.set(l,c,"element"),a.set(l,c,"element"),tL(e)}}else{let d=e.isBackward(),c=d?a:r,f=c.getNode(),p=d?r:a,m=p.getNode();if(t.is(f)){let h=c.offset;(n<=h&&o>0||n<h&&o<0)&&c.set(l,Math.max(0,h+o),"element")}if(t.is(m)){let h=p.offset;(n<=h&&o>0||n<h&&o<0)&&p.set(l,Math.max(0,h+o),"element")}}tL(e)}function tL(e){let t=e.anchor,n=t.offset,o=e.focus,r=o.offset,a=t.getNode(),i=o.getNode();if(e.isCollapsed()){if(!Q(a))return;let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Me(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text"),o.set(d.__key,c,"text")}return}if(Q(a)){let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Me(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text")}}if(Q(i)){let s=i.getChildrenSize(),l=r>=s,d=l?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(Me(d)){let c=0;l&&(c=d.getTextContentSize()),o.set(d.__key,c,"text")}}}function zp(e,t,n,o,r){let a=null,i=0,s=null;o!==null?(a=o.__key,Me(o)?(i=o.getTextContentSize(),s="text"):Q(o)&&(i=o.getChildrenSize(),s="element")):r!==null&&(a=r.__key,Me(r)?s="text":Q(r)&&(s="element")),a!==null&&s!==null?e.set(a,i,s):(i=t.getIndexWithinParent(),i===-1&&(i=n.getChildrenSize()),e.set(n.__key,i,"element"))}function nL(e,t,n,o,r){e.type==="text"?e.set(n,e.offset+(t?0:r),"text"):e.offset>o.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function Ck(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function oL(e,t,n){let o=zl(e,t.getKey());if(Q(t)){let r=t.getDOMSlot(o);return[r.element,n+r.getFirstChildOffset()]}return[o,n]}function W$(e,t,n,o,r,a,i){let s=o.anchorNode,l=o.focusNode,d=o.anchorOffset,c=o.focusOffset,f=document.activeElement;if(r.has(dk)&&f!==a||f!==null&&Tx(f))return;if(!Ue(t))return void(e!==null&&Gc(n,s,l)&&o.removeAllRanges());let p=t.anchor,m=t.focus,h=p.getNode(),g=m.getNode(),[v,x]=oL(n,h,p.offset),[y,C]=oL(n,g,m.offset),w=t.format,k=t.style,S=t.isCollapsed(),L=v,I=y,T=!1;var E,A,N,R,$;if(p.type==="text"?(L=Ps(v),T=h.getFormat()!==w||h.getStyle()!==k):Ue(e)&&e.anchor.type==="text"&&(T=!0),m.type==="text"&&(I=Ps(y)),L!==null&&I!==null&&(S&&(e===null||T||Ue(e)&&(e.format!==w||e.style!==k))&&(E=w,A=k,N=x,R=p.key,$=performance.now(),nk=[E,A,N,R,$]),d!==x||c!==C||s!==L||l!==I||o.type==="Range"&&S||(f!==null&&a.contains(f)||r.has(Vv)||a.focus({preventScroll:!0}),p.type==="element"))){if(Ck(o,L,x,I,C),!yi||!t.isCollapsed()||a===null||r.has(Vv)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(ck)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let H=Ue(t)&&t.anchor.type==="element"?L.childNodes[x]||null:o.rangeCount>0?o.getRangeAt(0):null;if(H!==null){let K;if(H instanceof Text){let O=document.createRange();O.selectNode(H),K=O.getBoundingClientRect()}else K=H.getBoundingClientRect();(function(O,oe,ee){let W=Rx(ee),qe=Nx(W);if(W===null||qe===null)return;let{top:ve,bottom:fe}=oe,Ne=0,Ae=0,ae=ee;for(;ae!==null;){let Ee=ae===W.body;if(Ee)Ne=0,Ae=qo(O).innerHeight;else{let re=ae.getBoundingClientRect();Ne=re.top,Ae=re.bottom}let xe=0;if(ve<Ne?xe=-(Ne-ve):fe>Ae&&(xe=fe-Ae),xe!==0)if(Ee)qe.scrollBy(0,xe);else{let re=ae.scrollTop;ae.scrollTop+=xe;let Ie=ae.scrollTop-re;ve-=Ie,fe-=Ie}if(Ee)break;ae=Qc(ae)}})(n,K,a)}}Uv=!0}}function G$(e){let t=St()||Es();t===null&&(t=Ko().selectEnd()),t.insertNodes(e)}function j$(){let e=St();return e===null?"":e.getTextContent()}function Cv(e){let t=e;e.isCollapsed()||t.removeText();let n=St();Ue(n)&&(t=n),Ue(t)||Z(161);let o=t.anchor,r=o.getNode(),a=o.offset;for(;!Aa(r);){let i=r;if([r,a]=Q$(r,a),i.is(r))break}return a}function Q$(e,t){let n=e.getParent();if(!n){let r=Ea();return Ko().append(r),r.select(),[Ko(),0]}if(Me(e)){let r=e.splitText(t);if(r.length===0)return[n,e.getIndexWithinParent()];let a=t===0?0:1;return[n,r[0].getIndexWithinParent()+a]}if(!Q(e)||t===0)return[n,e.getIndexWithinParent()];let o=e.getChildAtIndex(t);if(o){let r=new ks(Pr(e.__key,t,"element"),Pr(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(o,...o.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function rL(e,t,n,o,r="decorators-and-blocks"){if(t==="move"&&o==="character"&&!e.isCollapsed()){let[c,f]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return f.set(c.key,c.offset,c.type),!0}let a=wi(e.focus,n?"previous":"next"),i=o==="lineboundary",s=t==="move",l=a,d=r==="decorators-and-blocks";if(!Zk(l)){for(let c of l){d=!1;let{origin:f}=c;if(!Qt(f)||f.isIsolated()||(l=c,!i||!f.isInline()))break}if(d)for(let c of Bx(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Lr(c))c.origin.isInline()||(l=c);else{if(Q(c.origin))continue;Qt(c.origin)&&!c.origin.isInline()&&(l=c)}break}}if(l===a)return!1;if(s&&!i&&Qt(l.origin)&&l.origin.isKeyboardSelectable()){let c=yx();return c.add(l.origin.getKey()),Do(c),!0}return l=wr(l),s&&ql(e.anchor,l),ql(e.focus,l),d||!i}var Yn=null,Jn=null,_o=!1,bv=!1,Tp=0,aL={characterData:!0,childList:!0,subtree:!0};function Vl(){return _o||Yn!==null&&Yn._readOnly}function Qn(){_o&&Z(13)}function bk(){Tp>99&&Z(14)}function Na(){return Yn===null&&Z(195,Ik()),Yn}function Kt(){return Jn===null&&Z(196,Ik()),Jn}function Ik(){let e=0,t=new Set,n=bi.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=jc(r);if(Yp(a))e++;else if(a){let i=String(a.constructor.version||"<0.17.1");i===n&&(i+=" (separately built, likely a bundler configuration issue)"),t.add(i)}}let o=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(o+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),o}function X$(){return Jn}function iL(e,t,n){let o=t.__type,r=Sx(e,o),a=n.get(o);a===void 0&&(a=Array.from(r.transforms),n.set(o,a));let i=a.length;for(let s=0;s<i&&(a[s](t),t.isAttached());s++);}function sL(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function Sk(e,t){if(!t)return;let n=e._updateTags,o=t;Array.isArray(t)||(o=[t]);for(let r of o)n.add(r)}function Y$(e){return Cx(e,Kt()._nodes)}function Cx(e,t){let n=e.type,o=t.get(n);o===void 0&&Z(17,n);let r=o.klass;e.type!==r.getType()&&Z(18,r.name);let a=r.importJSON(e),i=e.children;if(Q(a)&&Array.isArray(i))for(let s=0;s<i.length;s++){let l=Cx(i[s],t);a.append(l)}return a}function lL(e,t,n){let o=Yn,r=_o,a=Jn;Yn=t,_o=!0,Jn=e;try{return n()}finally{Yn=o,_o=r,Jn=a}}function Pa(e,t){let n=e._pendingEditorState,o=e._rootElement,r=e._headless||o===null;if(n===null)return;let a=e._editorState,i=a._selection,s=n._selection,l=e._dirtyType!==0,d=Yn,c=_o,f=Jn,p=e._updating,m=e._observer,h=null;if(e._pendingEditorState=null,e._editorState=n,!r&&l&&m!==null){Jn=e,Yn=n,_o=!1,e._updating=!0;try{let S=e._dirtyType,L=e._dirtyElements,I=e._dirtyLeaves;m.disconnect(),h=h$(a,n,e,S,L,I)}catch(S){if(S instanceof Error&&e._onError(S),bv)throw S;return kk(e,null,o,n),PL(e),e._dirtyType=2,bv=!0,Pa(e,a),void(bv=!1)}finally{m.observe(o,aL),e._updating=p,Yn=d,_o=c,Jn=f}}n._readOnly||(n._readOnly=!0);let g=e._dirtyLeaves,v=e._dirtyElements,x=e._normalizedNodes,y=e._updateTags,C=e._deferred;l&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),(function(S,L){let I=S._decorators,T=S._pendingDecorators||I,E=L._nodeMap,A;for(A in T)E.has(A)||(T===I&&(T=Nk(S)),delete T[A])})(e,n);let w=r?null:Er(qo(e));if(e._editable&&w!==null&&(l||s===null||s.dirty||!s.is(i))&&o!==null&&!y.has(uk)){Jn=e,Yn=n;try{if(m!==null&&m.disconnect(),l||s===null||s.dirty){let S=e._blockCursorElement;S!==null&&Xv(S,e,o),W$(i,s,e,w,y,o)}(function(S,L,I){let T=S._blockCursorElement;if(Ue(I)&&I.isCollapsed()&&I.anchor.type==="element"&&L.contains(document.activeElement)){let E=I.anchor,A=E.getNode(),N=E.offset,R=!1,$=null;if(N===A.getChildrenSize())Sv(A.getChildAtIndex(N-1))&&(R=!0);else{let H=A.getChildAtIndex(N);if(H!==null&&Sv(H)){let K=H.getPreviousSibling();(K===null||Sv(K))&&(R=!0,$=S.getElementByKey(H.__key))}}if(R){let H=S.getElementByKey(A.__key);return T===null&&(S._blockCursorElement=T=(function(K){let O=K.theme,oe=document.createElement("div");oe.contentEditable="false",oe.setAttribute("data-lexical-cursor","true");let ee=O.blockCursor;if(ee!==void 0){if(typeof ee=="string"){let W=Jc(ee);ee=O.blockCursor=W}ee!==void 0&&oe.classList.add(...ee)}return oe})(S._config)),L.style.caretColor="transparent",void($===null?H.appendChild(T):H.insertBefore(T,$))}}T!==null&&Xv(T,S,L)})(e,o,s)}finally{m!==null&&m.observe(o,aL),Jn=f,Yn=d}}h!==null&&(function(S,L,I,T,E){let A=Array.from(S._listeners.mutation),N=A.length;for(let R=0;R<N;R++){let[$,H]=A[R];for(let K of H){let O=L.get(K);O!==void 0&&$(O,{dirtyLeaves:T,prevEditorState:E,updateTags:I})}}})(e,h,y,g,a),Ue(s)||s===null||i!==null&&i.is(s)||e.dispatchCommand(ix,void 0);let k=e._pendingDecorators;k!==null&&(e._decorators=k,e._pendingDecorators=null,Ec("decorator",e,!0,k)),(function(S,L,I){let T=fL(L),E=fL(I);T!==E&&Ec("textcontent",S,!0,E)})(e,t||a,n),Ec("update",e,!0,{dirtyElements:v,dirtyLeaves:g,editorState:n,mutatedNodes:h,normalizedNodes:x,prevEditorState:t||a,tags:y}),(function(S,L){if(S._deferred=[],L.length!==0){let I=S._updating;S._updating=!0;try{for(let T=0;T<L.length;T++)L[T]()}finally{S._updating=I}}})(e,C),(function(S){let L=S._updates;if(L.length!==0){let I=L.shift();if(I){let[T,E]=I;Xp(S,T,E)}}})(e)}function Ec(e,t,n,...o){let r=t._updating;t._updating=n;try{let a=Array.from(t._listeners[e]);for(let i=0;i<a.length;i++)a[i].apply(null,o)}finally{t._updating=r}}function dL(e,t){let n=e._updates,o=t||!1;for(;n.length!==0;){let r=n.shift();if(r){let[a,i]=r,s=e._pendingEditorState,l;i!==void 0&&(l=i.onUpdate,i.skipTransforms&&(o=!0),i.discrete&&(s===null&&Z(191),s._flushSync=!0),l&&e._deferred.push(l),Sk(e,i.tag)),s==null?Xp(e,a,i):a()}}return o}function Xp(e,t,n){let o=e._updateTags,r,a=!1,i=!1;n!==void 0&&(r=n.onUpdate,Sk(e,n.tag),a=n.skipTransforms||!1,i=n.discrete||!1),r&&e._deferred.push(r);let s=e._editorState,l=e._pendingEditorState,d=!1;(l===null||l._readOnly)&&(l=e._pendingEditorState=wk(l||s),d=!0),l._flushSync=i;let c=Yn,f=_o,p=Jn,m=e._updating;Yn=l,_o=!1,e._updating=!0,Jn=e;let h=e._headless||e.getRootElement()===null;Ix(null);try{d&&(h?s._selection!==null&&(l._selection=s._selection.clone()):l._selection=(function(y,C){let w=y.getEditorState()._selection,k=Er(qo(y));return Ue(w)||w==null?Qp(w,k,y,C):w.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=dL(e,a),(function(y,C){let w=C.getEditorState()._selection,k=y._selection;if(Ue(k)){let S=k.anchor,L=k.focus,I;if(S.type==="text"&&(I=S.getNode(),I.selectionTransform(w,k)),L.type==="text"){let T=L.getNode();I!==T&&T.selectionTransform(w,k)}}})(l,e),e._dirtyType!==0&&(a?(function(y,C){let w=C._dirtyLeaves,k=y._nodeMap;for(let S of w){let L=k.get(S);Me(L)&&L.isAttached()&&L.isSimpleText()&&!L.isUnmergeable()&&FT(L)}})(l,e):(function(y,C){let w=C._dirtyLeaves,k=C._dirtyElements,S=y._nodeMap,L=hi(),I=new Map,T=w,E=T.size,A=k,N=A.size;for(;E>0||N>0;){if(E>0){C._dirtyLeaves=new Set;for(let R of T){let $=S.get(R);Me($)&&$.isAttached()&&$.isSimpleText()&&!$.isUnmergeable()&&FT($),$!==void 0&&sL($,L)&&iL(C,$,I),w.add(R)}if(T=C._dirtyLeaves,E=T.size,E>0){Tp++;continue}}C._dirtyLeaves=new Set,C._dirtyElements=new Map,A.delete("root")&&A.set("root",!0);for(let R of A){let $=R[0],H=R[1];if(k.set($,H),!H)continue;let K=S.get($);K!==void 0&&sL(K,L)&&iL(C,K,I)}T=C._dirtyLeaves,E=T.size,A=C._dirtyElements,N=A.size,Tp++}C._dirtyLeaves=w,C._dirtyElements=k})(l,e),dL(e),(function(y,C,w,k){let S=y._nodeMap,L=C._nodeMap,I=[];for(let[T]of k){let E=L.get(T);E!==void 0&&(E.isAttached()||(Q(E)&&TL(E,T,S,L,I,k),S.has(T)||k.delete(T),I.push(T)))}for(let T of I)L.delete(T);for(let T of w){let E=L.get(T);E===void 0||E.isAttached()||(S.has(T)||w.delete(T),L.delete(T))}})(s,l,e._dirtyLeaves,e._dirtyElements)),v!==e._compositionKey&&(l._flushSync=!0);let x=l._selection;if(Ue(x)){let y=l._nodeMap,C=x.anchor.key,w=x.focus.key;y.get(C)!==void 0&&y.get(w)!==void 0||Z(19)}else Wc(x)&&x._nodes.size===0&&(l._selection=null)}catch(v){return v instanceof Error&&e._onError(v),e._pendingEditorState=s,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Pa(e)}finally{Yn=c,_o=f,Jn=p,e._updating=m,Tp=0}e._dirtyType!==0||e._deferred.length>0||(function(v,x){let y=x.getEditorState()._selection,C=v._selection;if(C!==null){if(C.dirty||!C.is(y))return!0}else if(y!==null)return!0;return!1})(l,e)?l._flushSync?(l._flushSync=!1,Pa(e)):d&&iH(()=>{Pa(e)}):(l._flushSync=!1,d&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function na(e,t,n){Jn===e&&n===void 0?t():Xp(e,t,n)}var jv=class e{element;before;after;constructor(t,n,o){this.element=t,this.before=n||null,this.after=o||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(t){let n=this.before||this.getManagedLineBreak();return n!==null&&n.parentElement!==this.element&&Z(222),this.element.insertBefore(t,n),this}removeChild(t){return t.parentElement!==this.element&&Z(223),this.element.removeChild(t),this}replaceChild(t,n){return n.parentElement!==this.element&&Z(224),this.element.replaceChild(t,n),this}getFirstChild(){let t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(t===null)this.removeManagedLineBreak();else{let n=t==="decorator"&&(Vp||Vc||qp);this.insertManagedLineBreak(n)}}removeManagedLineBreak(){let t=this.getManagedLineBreak();if(t){let n=this.element,o=t.nodeName==="IMG"?t.nextSibling:null;o&&n.removeChild(o),n.removeChild(t),n.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){let n=this.getManagedLineBreak();if(n){if(t===(n.nodeName==="IMG"))return;this.removeManagedLineBreak()}let o=this.element,r=this.before,a=document.createElement("br");if(o.insertBefore(a,r),t){let i=document.createElement("img");i.setAttribute("data-lexical-linebreak","true"),i.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",i.alt="",o.insertBefore(i,a),o.__lexicalLineBreak=i}else o.__lexicalLineBreak=a}getFirstChildOffset(){let t=0;for(let n=this.after;n!==null;n=n.previousSibling)t++;return t}resolveChildIndex(t,n,o,r){if(o===this.element){let l=this.getFirstChildOffset();return[t,Math.min(l+t.getChildrenSize(),Math.max(l,r))]}let a=cL(n,o);a.push(r);let i=cL(n,this.element),s=t.getIndexWithinParent();for(let l=0;l<i.length;l++){let d=a[l],c=i[l];if(d===void 0||d<c)break;if(d>c){s+=1;break}}return[t.getParentOrThrow(),s]}};function cL(e,t){let n=[],o=t;for(;o!==e&&o!==null;o=o.parentNode){let r=0;for(let a=o.previousSibling;a!==null;a=a.previousSibling)r++;n.push(r)}return o!==e&&Z(225),n.reverse()}var Ci=class extends dr{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(t){super(t),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){let t=this.getFormat();return n$[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getChildrenKeys(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n.__key),n=n.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let t=Kt()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){let t=this.getLatest(),n=this.getParentOrThrow().getLastChild();return n!==null&&n.is(t)}getAllTextNodes(){let t=[],n=this.getFirstChild();for(;n!==null;){if(Me(n)&&t.push(n),Q(n)){let o=n.getAllTextNodes();t.push(...o)}n=n.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;Q(t);){let n=t.getFirstChild();if(n===null)break;t=n}return t}getLastDescendant(){let t=this.getLastChild();for(;Q(t);){let n=t.getLastChild();if(n===null)break;t=n}return t}getDescendantByIndex(t){let n=this.getChildren(),o=n.length;if(t>=o){let a=n[o-1];return Q(a)&&a.getLastDescendant()||a||null}let r=n[t];return Q(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:Bn(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&Z(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:Bn(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&Z(96,this.__key),t}getChildAtIndex(t){let n=this.getChildrenSize(),o,r;if(t<n/2){for(o=this.getFirstChild(),r=0;o!==null&&r<=t;){if(r===t)return o;o=o.getNextSibling(),r++}return null}for(o=this.getLastChild(),r=n-1;o!==null&&r>=t;){if(r===t)return o;o=o.getPreviousSibling(),r--}return null}getTextContent(){let t="",n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContent(),Q(a)&&r!==o-1&&!a.isInline()&&(t+=Wp)}return t}getTextContentSize(){let t=0,n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContentSize(),Q(a)&&r!==o-1&&!a.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(t!==""){let n=Lv[t];return(this.getFormat()&n)!==0}return!1}hasTextFormat(t){let n=fo[t];return(this.getTextFormat()&n)!==0}getFormatFlags(t,n){return Kc(this.getLatest().__textFormat,t,n)}getTextStyle(){return this.getLatest().__textStyle}select(t,n){Qn();let o=St(),r=t,a=n,i=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&n===0){let l=this.getFirstChild();if(Me(l)||Q(l))return l.select(0,0)}else if(!(t!==void 0&&t!==i||n!==void 0&&n!==i)){let l=this.getLastChild();if(Me(l)||Q(l))return l.select()}}r===void 0&&(r=i),a===void 0&&(a=i);let s=this.__key;return Ue(o)?(o.anchor.set(s,r,"element"),o.focus.set(s,a,"element"),o.dirty=!0,o):xk(s,r,s,a,"element","element")}selectStart(){let t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){let t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){let t=this.getWritable();return this.getChildren().forEach(n=>n.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){let n=this.getWritable();return n.__dir=t,n}setFormat(t){return this.getWritable().__format=t!==""?Lv[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){let n=this.getWritable();return n.__textFormat=t,n}setTextStyle(t){let n=this.getWritable();return n.__textStyle=t,n}setIndent(t){return this.getWritable().__indent=t,this}splice(t,n,o){Op(this)&&Z(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+n<=r||Z(226,String(t),String(n),String(r));let i=a.__key,s=[],l=[],d=this.getChildAtIndex(t+n),c=null,f=r-n+o.length;if(t!==0)if(t===r)c=this.getLastChild();else{let m=this.getChildAtIndex(t);m!==null&&(c=m.getPreviousSibling())}if(n>0){let m=c===null?this.getFirstChild():c.getNextSibling();for(let h=0;h<n;h++){m===null&&Z(100);let g=m.getNextSibling(),v=m.__key;xi(m.getWritable()),l.push(v),m=g}}let p=c;for(let m of o){p!==null&&m.is(p)&&(c=p=p.getPreviousSibling());let h=m.getWritable();h.__parent===i&&f--,xi(h);let g=m.__key;if(p===null)a.__first=g,h.__prev=null;else{let v=p.getWritable();v.__next=g,h.__prev=v.__key}m.__key===i&&Z(76),h.__parent=i,s.push(g),p=m}if(t+n===r)p!==null&&(p.getWritable().__next=null,a.__last=p.__key);else if(d!==null){let m=d.getWritable();if(p!==null){let h=p.getWritable();m.__prev=p.__key,h.__next=d.__key}else m.__prev=null}if(a.__size=f,l.length){let m=St();if(Ue(m)){let h=new Set(l),g=new Set(s),{anchor:v,focus:x}=m;uL(v,h,g)&&zp(v,v.getNode(),this,c,d),uL(x,h,g)&&zp(x,x.getNode(),this,c,d),f!==0||this.canBeEmpty()||cr(this)||this.remove()}}return a}getDOMSlot(t){return new jv(t)}exportDOM(t){let{element:n}=super.exportDOM(t);if(ko(n)){let o=this.getIndent();o>0&&(n.style.paddingInlineStart=40*o+"px");let r=this.getDirection();r&&(n.dir=r)}return{element:n}}exportJSON(){let t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},n=this.getTextFormat(),o=this.getTextStyle();return n===0&&o===""||cr(this)||this.getChildren().some(Me)||(n!==0&&(t.textFormat=n),o!==""&&(t.textStyle=o)),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,n){return null}canIndent(){return!0}collapseAtStart(t){return!1}excludeFromCopy(t){return!1}canReplaceWith(t){return!0}canInsertAfter(t){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(t){return!1}extractWithChild(t,n,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,n){let o=this.getDOMSlot(t),r=o.getFirstChild();for(let a=this.getFirstChild();a;a=a.getNextSibling()){let i=n.getElementByKey(a.getKey());i!==null&&(r==null?(o.insertChild(i),r=i):r!==i&&o.replaceChild(i,r),r=r.nextSibling)}}};function Q(e){return e instanceof Ci}function uL(e,t,n){let o=e.getNode();for(;o;){let r=o.__key;if(t.has(r)&&!n.has(r))return!0;o=o.getParent()}return!1}var Hc=class extends dr{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Qt(e){return e instanceof Hc}var Fl=class e extends Ci{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){Z(51)}getTextContent(){let t=this.__cachedText;return!Vl()&&Kt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){Z(52)}replace(t){Z(53)}insertBefore(t){Z(54)}insertAfter(t){Z(55)}updateDOM(t,n){return!1}splice(t,n,o){for(let r of o)Q(r)||Qt(r)||Z(282);return super.splice(t,n,o)}static importJSON(t){return Ko().updateFromJSON(t)}collapseAtStart(){return!0}};function to(e){return e instanceof Fl}function wk(e){return new Uc(new Map(e._nodeMap))}function bx(){return new Uc(new Map([["root",new Fl]]))}function Tk(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&Z(130,n.name),Q(e)){let o=t.children;Array.isArray(o)||Z(59,n.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let i=Tk(r[a]);o.push(i)}}return t}function J$(e){return e instanceof Uc}var Uc=class e{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,n){this._nodeMap=t,this._selection=n||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t,n){return lL(n&&n.editor||null,this,t)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t);return n._readOnly=!0,n}toJSON(){return lL(null,this,()=>({root:Tk(Ko())}))}},$p=class extends Ci{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},Bl=class e extends Ci{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let n=document.createElement("p"),o=Nl(t.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(t,n,o){return!1}static importDOM(){return{p:t=>({conversion:Z$,priority:0})}}exportDOM(t){let{element:n}=super.exportDOM(t);if(ko(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o)}return{element:n}}static importJSON(t){return Ea().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(Me);n?(t.textFormat=n.getFormat(),t.textStyle=n.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,n){let o=Ea();o.setTextFormat(t.format),o.setTextStyle(t.style);let r=this.getDirection();return o.setDirection(r),o.setFormat(this.getFormatType()),o.setStyle(this.getStyle()),this.insertAfter(o,n),o}collapseAtStart(){let t=this.getChildren();if(t.length===0||Me(t[0])&&t[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function Z$(e){let t=Ea();if(e.style&&(t.setFormat(e.style.textAlign),Gk(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in Lv&&t.setFormat(n)}return{node:t}}function Ea(){return Xc(new Bl)}function Lk(e){return e instanceof Bl}var Al=0,eH=1,tH=2,nH=3,oH=4;function kk(e,t,n,o){let r=e._keyToDOMMap;r.clear(),e._editorState=bx(),e._pendingEditorState=o,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;let a=e._observer;a!==null&&(a.disconnect(),e._observer=null),t!==null&&(t.textContent=""),n!==null&&(n.textContent="",r.set("root",n))}function Pk(e){let t=new Set,n=new Set,o=e;for(;o;){let{ownNodeConfig:r}=Yc(o),a=o.transform;if(!n.has(a)){n.add(a);let i=o.transform();i&&t.add(i)}if(r){let i=r.$transform;i&&t.add(i),o=r.extends}else{let i=Object.getPrototypeOf(o);o=i.prototype instanceof dr&&i!==dr?i:void 0}}return t}function rH(e){let t=e||{},n=X$(),o=t.theme||{},r=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,i=bx(),s=t.namespace||(r!==null?r._config.namespace:Ok()),l=t.editorState,d=[Fl,Ls,_l,Ol,Bl,$p,...t.nodes||[]],{onError:c,html:f}=t,p=t.editable===void 0||t.editable,m;if(e===void 0&&n!==null)m=n._nodes;else{m=new Map;for(let g=0;g<d.length;g++){let v=d[g],x=null,y=null;if(typeof v!="function"){let k=v;v=k.replace,x=k.with,y=k.withKlass||null}Yc(v);let C=v.getType(),w=Pk(v);m.set(C,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:x,replaceWithKlass:y,sharedNodeState:AL(d[g]),transforms:w})}}let h=new bi(i,r,m,{disableEvents:a,namespace:s,theme:o},c||console.error,(function(g,v){let x=new Map,y=new Set,C=w=>{Object.keys(w).forEach(k=>{let S=x.get(k);S===void 0&&(S=[],x.set(k,S)),S.push(w[k])})};return g.forEach(w=>{let k=w.klass.importDOM;if(k==null||y.has(k))return;y.add(k);let S=k.call(w.klass);S!==null&&C(S)}),v&&C(v),x})(m,f?f.import:void 0),p,e);return l!==void 0&&(h._pendingEditorState=l,h._dirtyType=2),(function(g){g.registerCommand(sx,L$,Al),g.registerCommand(lx,k$,Al),g.registerCommand(dx,P$,Al),g.registerCommand(cx,A$,Al),g.registerCommand(mx,E$,Al)})(h),h}var bi=class{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(t,n,o,r,a,i,s,l){this._createEditorArgs=l,this._parentEditor=n,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=o,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Ok(),this._onError=a,this._htmlConversions=i,this._editable=s,this._headless=n!==null&&n._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){let n=this._listeners.update;return n.add(t),()=>{n.delete(t)}}registerEditableListener(t){let n=this._listeners.editable;return n.add(t),()=>{n.delete(t)}}registerDecoratorListener(t){let n=this._listeners.decorator;return n.add(t),()=>{n.delete(t)}}registerTextContentListener(t){let n=this._listeners.textcontent;return n.add(t),()=>{n.delete(t)}}registerRootListener(t){let n=this._listeners.root;return t(this._rootElement,null),n.add(t),()=>{t(null,this._rootElement),n.delete(t)}}registerCommand(t,n,o){o===void 0&&Z(35);let r=this._commands;r.has(t)||r.set(t,[new Set,new Set,new Set,new Set,new Set]);let a=r.get(t);a===void 0&&Z(36,String(t));let i=a[o];return i.add(n),()=>{i.delete(n),a.every(s=>s.size===0)&&r.delete(t)}}registerMutationListener(t,n,o){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,a=this._listeners.mutation,i=a.get(n);i===void 0&&(i=new Set,a.set(n,i)),i.add(r);let s=o&&o.skipInitialization;return s!==void 0&&s||this.initializeMutationListener(n,r),()=>{i.delete(r),i.size===0&&a.delete(n)}}getRegisteredNode(t){let n=this._nodes.get(t.getType());return n===void 0&&Z(37,t.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,n){let o=this._editorState,r=Jv(o).get(n.getType());if(!r)return;let a=new Map;for(let i of r.keys())a.set(i,"created");a.size>0&&t(a,{dirtyLeaves:new Set,prevEditorState:o,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,n){let o=this.getRegisteredNode(t);return o.transforms.add(n),o}registerNodeTransform(t,n){let o=this.registerNodeTransformToKlass(t,n),r=[o],a=o.replaceWithKlass;if(a!=null){let i=this.registerNodeTransformToKlass(a,n);r.push(i)}return(function(i,s){let l=Jv(i.getEditorState()),d=[];for(let c of s){let f=l.get(c);f&&d.push(f)}d.length!==0&&i.update(()=>{for(let c of d)for(let f of c.keys()){let p=Bn(f);p&&p.markDirty()}},i._pendingEditorState===null?{tag:wp}:void 0)})(this,r.map(i=>i.klass.getType())),()=>{r.forEach(i=>i.transforms.delete(n))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,n){return Ce(this,t,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){let n=this._rootElement;if(t!==n){let o=Nl(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,kk(this,n,t,r),n!==null&&(this._config.disableEvents||M$(n),o!=null&&n.classList.remove(...o)),t!==null){let a=Nx(t),i=t.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=a,this._dirtyType=2,PL(this),this._updateTags.add(wp),Pa(this),this._config.disableEvents||(function(s,l){let d=s.ownerDocument;Hv.set(s,d);let c=_p.get(d)??0;c<1&&d.addEventListener("selectionchange",sk),_p.set(d,c+1),s.__lexicalEditor=l;let f=ik(s);for(let p=0;p<$v.length;p++){let[m,h]=$v[p],g=typeof h=="function"?v=>{qT(v)||(KT(v),(l.isEditable()||m==="click")&&h(v,l))}:v=>{if(qT(v))return;KT(v);let x=l.isEditable();switch(m){case"cut":return x&&Ce(l,hx,v);case"copy":return Ce(l,gx,v);case"paste":return x&&Ce(l,ux,v);case"dragstart":return x&&Ce(l,jL,v);case"dragover":return x&&Ce(l,QL,v);case"dragend":return x&&Ce(l,XL,v);case"focus":return x&&Ce(l,YL,v);case"blur":return x&&Ce(l,JL,v);case"drop":return x&&Ce(l,GL,v)}};s.addEventListener(m,g),f.push(()=>{s.removeEventListener(m,g)})}})(t,this),o!=null&&t.classList.add(...o)}else this._window=null,this._updateTags.add(wp),Pa(this);Ec("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&Z(38);let o=t;o._readOnly&&(o=wk(t),o._selection=t._selection?t._selection.clone():null),kL(this);let r=this._pendingEditorState,a=this._updateTags,i=n!==void 0?n.tag:null;r===null||r.isEmpty()||(i!=null&&a.add(i),Pa(this)),this._pendingEditorState=o,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&a.add(i),this._updating||Pa(this)}parseEditorState(t,n){return(function(o,r,a){let i=bx(),s=Yn,l=_o,d=Jn,c=r._dirtyElements,f=r._dirtyLeaves,p=r._cloneNotNeeded,m=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,Yn=i,_o=!1,Jn=r,Ix(null);try{let h=r._nodes;Cx(o.root,h),a&&a(),i._readOnly=!0}catch(h){h instanceof Error&&r._onError(h)}finally{r._dirtyElements=c,r._dirtyLeaves=f,r._cloneNotNeeded=p,r._dirtyType=m,Yn=s,_o=l,Jn=d}return i})(typeof t=="string"?JSON.parse(t):t,this,n)}read(t){return Pa(this),this.getEditorState().read(t,{editor:this})}update(t,n){(function(o,r,a){o._updating?o._updates.push([r,a]):Xp(o,r,a)})(this,t,n)}focus(t,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),na(this,()=>{let r=St(),a=Ko();r!==null?r.dirty||Do(r.clone()):a.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),em("focus"),Hk(()=>{o.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let n=Er(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,Ec("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};bi.version="0.41.0+prod.esm";var Qv=null;function Ix(e){Qv=e}var Ak=1;function aH(){Ak=1}function Sx(e,t){let n=wx(e,t);return n===void 0&&Z(30,t),n}function wx(e,t){return e._nodes.get(t)}var iH=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function Ek(e){return Qt(Zp(e))}function Tx(e){let t=document.activeElement;if(!ko(t))return!1;let n=t.nodeName;return Qt(Zp(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&jc(t)==null)}function Gc(e,t,n){let o=e.getRootElement();try{return o!==null&&o.contains(t)&&o.contains(n)&&t!==null&&!Tx(t)&&Lx(t)===e}catch{return!1}}function Yp(e){return e instanceof bi}function Lx(e){let t=e;for(;t!=null;){let n=jc(t);if(Yp(n))return n;t=Qc(t)}return null}function jc(e){return e?e.__lexicalEditor:null}function sH(e){return Z5.test(e)?"rtl":e$.test(e)?"ltr":null}function vi(e){return xx(e)||e.isToken()}function ka(e){return vi(e)||e.isSegmented()}function oa(e){return Wl(e)&&e.nodeType===3}function Mk(e){return Wl(e)&&e.nodeType===9}function Ps(e){let t=e;for(;t!=null;){if(oa(t))return t;t=t.firstChild}return null}function Kc(e,t,n){let o=fo[t];if(n!==null&&(e&o)===(n&o))return e;let r=e^o;return t==="subscript"?r&=~fo.superscript:t==="superscript"?r&=~fo.subscript:t==="lowercase"?(r&=~fo.uppercase,r&=~fo.capitalize):t==="uppercase"?(r&=~fo.lowercase,r&=~fo.capitalize):t==="capitalize"&&(r&=~fo.lowercase,r&=~fo.uppercase),r}function lH(e){return Me(e)||Ss(e)||Qt(e)}function Rk(e,t){let n=(function(){let i=Qv;return Qv=null,i})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);Qn(),bk();let o=Kt(),r=Na(),a=""+Ak++;r._nodeMap.set(a,e),Q(e)?o._dirtyElements.set(a,!0):o._dirtyLeaves.add(a),o._cloneNotNeeded.add(a),o._dirtyType=1,e.__key=a}function xi(e){let t=e.getParent();if(t!==null){let n=e.getWritable(),o=t.getWritable(),r=e.getPreviousSibling(),a=e.getNextSibling(),i=a!==null?a.__key:null,s=r!==null?r.__key:null,l=r!==null?r.getWritable():null,d=a!==null?a.getWritable():null;r===null&&(o.__first=i),a===null&&(o.__last=s),l!==null&&(l.__next=i),d!==null&&(d.__prev=s),n.__prev=null,n.__next=null,n.__parent=null,o.__size--}}function Hp(e){bk(),Op(e)&&Z(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,o=Na(),r=Kt(),a=o._nodeMap,i=r._dirtyElements;n!==null&&(function(l,d,c){let f=l;for(;f!==null;){if(c.has(f))return;let p=d.get(f);if(p===void 0)break;c.set(f,!1),f=p.__parent}})(n,a,i);let s=t.__key;r._dirtyType=1,Q(e)?i.set(s,!0):r._dirtyLeaves.add(s)}function Xn(e){Qn();let t=Kt(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let o=Bn(n);o!==null&&o.getWritable()}if(e!==null){let o=Bn(e);o!==null&&o.getWritable()}}}function hi(){return Vl()?null:Kt()._compositionKey}function Bn(e,t){let n=(t||Na())._nodeMap.get(e);return n===void 0?null:n}function kx(e,t){let n=Jp(e,Kt());return n!==void 0?Bn(n,t):null}function Jp(e,t){return e[`__lexicalKey_${t._key}`]}function Zp(e,t){let n=e;for(;n!=null;){let o=kx(n,t);if(o!==null)return o;n=Qc(n)}return null}function Nk(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function fL(e){return e.read(()=>Ko().getTextContent())}function Ko(){return _k(Na())}function _k(e){return e._nodeMap.get("root")}function Do(e){Qn();let t=Na();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function El(e){let t=Kt(),n=(function(o,r){let a=o;for(;a!=null;){let i=Jp(a,r);if(i!==void 0)return i;a=Qc(a)}return null})(e,t);return n===null?e===t.getRootElement()?Bn("root"):null:Bn(n)}function Dk(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Px(e){let t=[],n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function Ok(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Fk(e){return oa(e)?e.nodeValue:null}function Ax(e,t,n){let o=Er(qo(t));if(o===null)return;let r=o.anchorNode,{anchorOffset:a,focusOffset:i}=o;if(r!==null){let s=Fk(r),l=Zp(r);if(s!==null&&Me(l)){if((s===_c||s===ox)&&n){let d=n.length;s=n,a=d,i=d}s!==null&&Ex(l,s,a,i,e)}}}function Ex(e,t,n,o,r){let a=e;if(a.isAttached()&&(r||!a.isDirty())){let i=a.isComposing(),s=t;if((i||r)&&(t.endsWith(_c)&&(s=t.slice(0,-_c.length)),r)){let d=ox,c;for(;(c=s.indexOf(d))!==-1;)s=s.slice(0,c)+s.slice(c+d.length),n!==null&&n>c&&(n=Math.max(c,n-d.length)),o!==null&&o>c&&(o=Math.max(c,o-d.length))}let l=a.getTextContent();if(r||s!==l){if(s===""){if(Xn(null),qp||Vc||Vp)a.remove();else{let g=Kt();setTimeout(()=>{g.update(()=>{a.isAttached()&&a.remove()})},20)}return}let d=a.getParent(),c=Es(),f=a.getTextContentSize(),p=hi(),m=a.getKey();if(a.isToken()||p!==null&&m===p&&!i||Ue(c)&&(d!==null&&!d.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===e.__key&&c.anchor.offset===0&&!a.canInsertTextBefore()&&!i||c.focus.key===e.__key&&c.focus.offset===f&&!a.canInsertTextAfter()&&!i))return void a.markDirty();let h=St();if(!Ue(h)||n===null||o===null)return void pL(a,s,h);if(h.setTextNodeRange(a,n,a,o),a.isSegmented()){let g=jn(a.getTextContent());a.replace(g),a=g}pL(a,s,h)}}}function pL(e,t,n){if(e.setTextContent(t),Ue(n)){let o=e.getKey();for(let r of["anchor","focus"]){let a=n[r];a.type==="text"&&a.key===o&&(a.offset=kr(e,a.offset,"clamp"))}}}function xp(e,t,n){let o=t[n]||!1;return o==="any"||o===e[n]}function Bk(e,t){return xp(e,t,"altKey")&&xp(e,t,"ctrlKey")&&xp(e,t,"shiftKey")&&xp(e,t,"metaKey")}function Pt(e,t,n){if(!Bk(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||e.key.length===1&&e.key.charCodeAt(0)<=127)return!1;let o="Key"+t.toUpperCase();return e.code===o}var La={ctrlKey:!Sr,metaKey:Sr},mL={altKey:Sr,ctrlKey:!Sr};function gL(e){return e.key==="Backspace"}function hL(e){return Pt(e,"a",La)}function dH(e){let t=Ko();if(Ue(e)){let n=e.anchor,o=e.focus,r=n.getNode().getTopLevelElementOrThrow().getParentOrThrow();return n.set(r.getKey(),0,"element"),o.set(r.getKey(),r.getChildrenSize(),"element"),Pp(e),e}{let n=t.select(0,t.getChildrenSize());return Do(Pp(n)),n}}function Nl(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,o=n[t];if(o!==void 0)return o;let r=e[t];if(typeof r=="string"){let a=Jc(r);return n[t]=a,a}return r}function Mx(e,t,n,o,r){if(n.size===0)return;let a=o.__type,i=o.__key,s=t.get(a);s===void 0&&Z(33,a);let l=s.klass,d=e.get(l);d===void 0&&(d=new Map,e.set(l,d));let c=d.get(i),f=c==="destroyed"&&r==="created";(c===void 0||f)&&d.set(i,f?"updated":r)}function cH(e){let t=e.getType(),n=Na();if(n._readOnly){let a=Jv(n).get(t);return a?Array.from(a.values()):[]}let o=n._nodeMap,r=[];for(let[,a]of o)a instanceof e&&a.__type===t&&a.isAttached()&&r.push(a);return r}function vL(e,t,n){let o=e.getParent(),r=n,a=e;return o!==null&&(t&&n===0?(r=a.getIndexWithinParent(),a=o):t||n!==a.getChildrenSize()||(r=a.getIndexWithinParent()+1,a=o)),a.getChildAtIndex(t?r-1:r)}function zk(e,t){let n=e.offset;if(e.type==="element")return vL(e.getNode(),t,n);{let o=e.getNode();if(t&&n===0||!t&&n===o.getTextContentSize()){let r=t?o.getPreviousSibling():o.getNextSibling();return r===null?vL(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function $k(e){let t=qo(e).event,n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function Ce(e,t,n){return(function(o,r,a){let i=Px(o);for(let s=4;s>=0;s--)for(let l=0;l<i.length;l++){let d=i[l],c=d._commands.get(r);if(c!==void 0){let f=c[s];if(f!==void 0){let p=Array.from(f),m=p.length,h=!1;if(na(d,()=>{for(let g=0;g<m;g++)if(p[g](a,o))return void(h=!0)}),h)return h}}}return!1})(e,t,n)}function zl(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&Z(75,t),n}function Qc(e){let t=e.assignedSlot||e.parentElement;return Vk(t)?t.host:t}function Rx(e){return Mk(e)?e:ko(e)?e.ownerDocument:null}function uH(e){return Kt()._updateTags.has(e)}function em(e){Qn(),Kt()._updateTags.add(e)}function Hk(e){Qn(),Kt()._deferred.push(e)}function Up(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function Nx(e){let t=Rx(e);return t?t.defaultView:null}function qo(e){let t=e._window;return t===null&&Z(78),t}function fH(e){return Q(e)&&e.isInline()||Qt(e)&&e.isInline()}function Uk(e){let t=e.getParentOrThrow();for(;t!==null;){if(cr(t))return t;t=t.getParentOrThrow()}return t}function cr(e){return to(e)||Q(e)&&e.isShadowRoot()}function _x(e){let t=e.constructor.clone(e);return Rk(t,null),t.afterCloneFrom(e),t}function Xc(e){let t=Kt(),n=e.getType(),o=wx(t,n);o===void 0&&Z(200,e.constructor.name,n);let{replace:r,replaceWithKlass:a}=o;if(r!==null){let i=r(e),s=i.constructor;return a!==null?i instanceof a||Z(201,a.name,a.getType(),s.name,s.getType(),e.constructor.name,n):i instanceof e.constructor&&s!==e.constructor||Z(202,s.name,s.getType(),e.constructor.name,n),i.__key===e.__key&&Z(203,e.constructor.name,n,s.name,s.getType()),i}return e}function Iv(e,t){!to(e.getParent())||Q(t)||Qt(t)||Z(99)}function Kk(e){let t=Bn(e);return t===null&&Z(63,e),t}function Sv(e){return(Qt(e)||Q(e)&&!e.canBeEmpty())&&!e.isInline()}function Xv(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;let o=e.parentElement;o!==null&&o.removeChild(e)}function Er(e){return Ar?(e||window).getSelection():null}function qk(e){let t=Nx(e);return t?t.getSelection():null}function pH(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),cr(e)&&Z(102);let o=i=>{let s=i.getParentOrThrow(),l=cr(s),d=i!==n||l?_x(i):i;if(l)return Q(i)&&Q(d)||Z(133),i.insertAfter(d),[i,d,d];{let[c,f,p]=o(s),m=i.getNextSiblings();return p.append(d,...m),[c,f,d]}},[r,a]=o(n);return[r,a]}function mH(e){return ko(e)&&e.tagName==="A"}function ko(e){return Wl(e)&&e.nodeType===1}function Wl(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function Vk(e){return Wl(e)&&e.nodeType===11}function Wk(e){let t=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return e.nodeName.match(t)!==null}function Yv(e){let t=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return e.nodeName.match(t)!==null}function Aa(e){if(Qt(e)&&!e.isInline())return!0;if(!Q(e)||cr(e))return!1;let t=e.getFirstChild(),n=t===null||Ss(t)||Me(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&n}function Dx(){return Kt()}var xL=new WeakMap,gH=new Map;function Jv(e){if(!e._readOnly&&e.isEmpty())return gH;e._readOnly||Z(192);let t=xL.get(e);return t||(t=(function(n){let o=new Map;for(let[r,a]of n._nodeMap){let i=a.__type,s=o.get(i);s||(s=new Map,o.set(i,s)),s.set(r,a)}return o})(e),xL.set(e,t)),t}function Ox(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function hH(e){return(t=Ox(e))[lk]=!0,t;var t}function Gk(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function vH(e){e.__lexicalUnmanaged=!0}function jk(e){return e.__lexicalUnmanaged===!0}function Lc(e,t){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(e,t)&&e[t]!==dr[t]}function Yc(e){let t=ET in e.prototype?e.prototype[ET]():void 0,n=(function(i){if(!(i===dr||i.prototype instanceof dr)){let s="<unknown>",l="<unknown>";try{s=i.getType()}catch{}try{bi.version&&(l=JSON.parse(bi.version))}catch{}Z(290,i.name,s,l)}return i===Hc||i===Ci||i===dr})(e),o=!n&&Lc(e,"getType")?e.getType():void 0,r,a=o;if(t)if(o)r=t[o];else for(let[i,s]of Object.entries(t))a=i,r=s;if(!n&&a&&(Lc(e,"getType")||(e.getType=()=>a),Lc(e,"clone")||(e.clone=i=>(Ix(i),new e)),Lc(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(i=>new e().updateFromJSON(i))),!Lc(e,"importDOM")&&r)){let{importDOM:i}=r;i&&(e.importDOM=()=>i)}return{ownNodeConfig:r,ownNodeType:a}}function xH(e){let t=Dx();return Qn(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Mc=(e,t)=>{let n=e;for(;n!=null&&!to(n);){if(t(n))return n;n=n.getParent()}return null},yH={next:"previous",previous:"next"},$l=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return zx({hasNext:As,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return Zn(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Zn(this.origin,this.direction)}remove(){let t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,n){let o=this.getNodeAtCaret();return t.is(this.origin)||t.is(o)||(o===null?this.insert(t):o.replace(t,n)),this}splice(t,n,o="next"){let r=o===this.direction?n:Array.from(n).reverse(),a=this,i=this.getParentAtCaret(),s=new Map;for(let l=a.getAdjacentCaret();l!==null&&s.size<t;l=l.getAdjacentCaret()){let d=l.origin.getWritable();s.set(d.getKey(),d)}for(let l of r){if(s.size>0){let d=a.getNodeAtCaret();if(d){if(s.delete(d.getKey()),s.delete(l.getKey()),!(d.is(l)||a.origin.is(l))){let c=l.getParent();c&&c.is(i)&&l.remove(),d.replace(l)}}else d===null&&Z(263,Array.from(s).join(" "))}else a.insert(l);a=Zn(l,this.direction)}for(let l of s.values())l.remove();return this}},qc=class e extends $l{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Ra(t,this.direction)}getParentCaret(t="root"){return Zn(Fx(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Li(this.direction);return Zn(this.getNodeAtCaret(),t)||Ra(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}},CH={root:to,shadowRoot:cr};function Li(e){return yH[e]}function Fx(e,t="root"){return CH[t](e)?null:e}var Hl=class e extends $l{type="sibling";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Zn(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Q(this.origin)?Ra(this.origin,this.direction):null}getParentCaret(t="root"){return Zn(Fx(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Li(this.direction);return Zn(this.getNodeAtCaret(),t)||Ra(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof e||t instanceof Ul)&&this.direction===t.direction&&this.origin.is(t.origin)}},Ul=class e extends $l{type="text";offset;constructor(t,n){super(t),this.offset=n}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Ii(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return Zn(Fx(this.getParentAtCaret(),t),this.direction)}getFlipped(){return Ii(this.origin,Li(this.direction),this.offset)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof Hl||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Zn(this.origin,this.direction)}};function Ma(e){return e instanceof Ul}function bH(e){return e instanceof $l}function As(e){return e instanceof Hl}function Lr(e){return e instanceof qc}var IH={next:class extends Ul{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ul{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},SH={next:class extends Hl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Hl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},wH={next:class extends qc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends qc{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Zn(e,t){return e?new SH[t](e):null}function Ii(e,t,n){return e?new IH[t](e,kr(e,n)):null}function kr(e,t,n="error"){let o=e.getTextContentSize(),r=t==="next"?o:t==="previous"?0:t;return(r<0||r>o)&&(n!=="clamp"&&bL(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function Zv(e,t){return new Kp(e,t)}function Ra(e,t){return Q(e)?new wH[t](e):null}function Qk(e){return e&&e.getChildCaret()||e}function Kl(e){return e&&Qk(e.getAdjacentCaret())}var ex=class e{type="node-caret-range";direction;anchor;focus;constructor(t,n,o){this.anchor=t,this.focus=n,this.direction=o}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let t=r=>{let a=this[r].getLatest();return Ma(a)?(function(i,s){let{direction:l,origin:d}=i,c=kr(d,s==="focus"?Li(l):l);return Zv(i,c-i.offset)})(a,r):null},n=t("anchor"),o=t("focus");if(n&&o){let{caret:r}=n,{caret:a}=o;if(r.isSameNodeCaret(a))return[Zv(r,a.offset-r.offset),null]}return[n,o]}iterNodeCarets(t="root"){let n=Ma(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=Ma(o),a=i=>i.isSameNodeCaret(o)?null:Kl(i)||i.getParentCaret(t);return zx({hasNext:i=>i!==null&&!(r&&o.isSameNodeCaret(i)),initial:n.isSameNodeCaret(o)?null:a(n),map:i=>i,step:a})}[Symbol.iterator](){return this.iterNodeCarets("root")}},Kp=class{type="slice";caret;distance;constructor(t,n){this.caret=t,this.distance=n}getSliceIndices(){let{distance:t,caret:{offset:n}}=this,o=n+t;return o<n?[o,n]:[n,o]}getTextContent(){let[t,n]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,n)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:t,direction:n}}=this,[o,r]=this.getSliceIndices(),a=t.getTextContent();return Ii(t.setTextContent(a.slice(0,o)+a.slice(r)),n,o)}};function TH(e){return e instanceof Kp}function Bx(e){return Si(e,Zn(Ko(),e.direction))}function Xk(e){return Si(e,e)}function Si(e,t){return e.direction!==t.direction&&Z(265),new ex(e,t,e.direction)}function zx(e){let{initial:t,hasNext:n,step:o,map:r}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let i={done:!1,value:r(a)};return a=o(a),i}}}function $x(e,t){let n=Rc(e.origin,t.origin);switch(n===null&&Z(275,e.origin.getKey(),t.origin.getKey()),n.type){case"same":{let o=e.type==="text",r=t.type==="text";return o&&r?(function(a,i){return Math.sign(a-i)})(e.offset,t.offset):e.type===t.type?0:o?-1:r?1:e.type==="child"?-1:1}case"ancestor":return e.type==="child"?-1:1;case"descendant":return t.type==="child"?1:-1;case"branch":return Hx(n)}}function Hx(e){let{a:t,b:n}=e,o=t.__key,r=n.__key,a=t,i=n;for(;a&&i;a=a.getNextSibling(),i=i.getNextSibling()){if(a.__key===r)return-1;if(i.__key===o)return 1}return a===null?1:-1}function yp(e,t){return t.is(e)}function yL(e){return Q(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function Rc(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[o,r]=yL(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=yL(t);o;r=o,o=o.getParent()){let a=n.get(o);if(a!==void 0)return a===null?(yp(e,o)||Z(276),{commonAncestor:o,type:"ancestor"}):r===null?(yp(t,o)||Z(277),{commonAncestor:o,type:"descendant"}):((Q(a)||yp(e,a))&&(Q(r)||yp(t,r))&&o.is(a.getParent())&&o.is(r.getParent())||Z(278),{a,b:r,commonAncestor:o,type:"branch"})}return null}function wi(e,t){let{type:n,key:o,offset:r}=e,a=Kk(e.key);return n==="text"?(Me(a)||Z(266,a.getType(),o),Ii(a,t,r)):(Q(a)||Z(267,a.getType(),o),eP(a,e.offset,t))}function ql(e,t){let{origin:n,direction:o}=t,r=o==="next";Ma(t)?e.set(n.getKey(),t.offset,"text"):As(t)?Me(n)?e.set(n.getKey(),kr(n,o),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(Lr(t)&&Q(n)||Z(268),e.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function Yk(e){let t=St(),n=Ue(t)?t:yk();return Nc(n,e),Do(n),n}function Nc(e,t){ql(e.anchor,t.anchor),ql(e.focus,t.focus)}function tx(e){let{anchor:t,focus:n}=e,o=wi(t,"next"),r=wi(n,"next"),a=$x(o,r)<=0?"next":"previous";return Si(Ti(o,a),Ti(r,a))}function Gl(e){let{direction:t,origin:n}=e,o=Zn(n,Li(t)).getNodeAtCaret();return o?Zn(o,t):Ra(n.getParentOrThrow(),t)}function CL(e,t="root"){let n=[e];for(let o=Lr(e)?e.getParentCaret(t):e.getSiblingCaret();o!==null;o=o.getParentCaret(t))n.push(Gl(o));return n}function wv(e){return!!e&&e.origin.isAttached()}function Jk(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=Ux(e,o),i=CL(a.anchor,n),s=CL(a.focus.getFlipped(),n),l=new Set,d=[];for(let h of a.iterNodeCarets(n))if(Lr(h))l.add(h.origin.getKey());else if(As(h)){let{origin:g}=h;Q(g)&&!l.has(g.getKey())||d.push(g)}for(let h of d)h.remove();for(let h of a.getTextSlices()){if(!h)continue;let{origin:g}=h.caret,v=g.getTextContentSize(),x=Gl(Zn(g,o)),y=g.getMode();if(Math.abs(h.distance)===v&&r==="removeEmptySlices"||y==="token"&&h.distance!==0)x.remove();else if(h.distance!==0){r="removeEmptySlices";let C=h.removeTextSlice(),w=h.caret.origin;if(y==="segmented"){let k=C.origin,S=jn(k.getTextContent()).setStyle(k.getStyle()).setFormat(k.getFormat());x.replaceOrInsert(S),C=Ii(S,o,C.offset)}w.is(i[0].origin)&&(i[0]=C),w.is(s[0].origin)&&(s[0]=C.getFlipped())}}let c,f;for(let h of i)if(wv(h)){c=wr(h);break}for(let h of s)if(wv(h)){f=wr(h);break}let p=(function(h,g,v){if(!h||!g)return null;let x=h.getParentAtCaret(),y=g.getParentAtCaret();if(!x||!y)return null;let C=x.getParents().reverse();C.push(x);let w=y.getParents().reverse();w.push(y);let k=Math.min(C.length,w.length),S;for(S=0;S<k&&C[S]===w[S];S++);let L=(E,A)=>{let N;for(let R=S;R<E.length;R++){let $=E[R];if(cr($))return;!N&&A($)&&(N=$)}return N},I=L(C,Aa),T=I&&L(w,E=>v.has(E.getKey())&&Aa(E));return I&&T?[I,T]:null})(c,f,l);if(p){let[h,g]=p;Ra(h,"previous").splice(0,g.getChildren());let v=g.getParent();for(g.remove(!0);v&&v.isEmpty();){let x=v;v=v.getParent(),x.remove(!0)}}let m=[c,f,...i,...s].find(wv);if(m)return Xk(Ti(wr(m),e.direction));Z(269,JSON.stringify(i.map(h=>h.origin.__key)))}function wr(e){let t=(function(r){let a=r;for(;Lr(a);){let i=Kl(a);if(!Lr(i))break;a=i}return a})(e.getLatest()),{direction:n}=t;if(Me(t.origin))return Ma(t)?t:Ii(t.origin,n,n);let o=t.getAdjacentCaret();return As(o)&&Me(o.origin)?Ii(o.origin,n,Li(n)):t}function Zk(e){return Ma(e)&&e.offset!==kr(e.origin,e.direction)}function Ti(e,t){return e.direction===t?e:e.getFlipped()}function Ux(e,t){return e.direction===t?e:Si(Ti(e.focus,t),Ti(e.anchor,t))}function eP(e,t,n){let o=Ra(e,"next");for(let r=0;r<t;r++){let a=o.getAdjacentCaret();if(a===null)break;o=a}return Ti(o,n)}function LH(e,t="root"){let n=0,o=e,r=Kl(o);for(;r===null;){if(n--,r=o.getParentCaret(t),!r)return null;o=r,r=Kl(o)}return r&&[r,n]}function kH(e){let{origin:t,offset:n,direction:o}=e;if(n===kr(t,o))return e.getSiblingCaret();if(n===kr(t,Li(o)))return Gl(e.getSiblingCaret());let[r]=t.splitText(n);return Me(r)||Z(281),Ti(Zn(r,"next"),o)}function PH(e,t){return!0}function AH(e,{$copyElementNode:t=_x,$splitTextPointCaretNext:n=kH,rootMode:o="shadowRoot",$shouldSplit:r=PH}={}){if(Ma(e))return n(e);let a=e.getParentCaret(o);if(a){let{origin:i}=a;if(Lr(e)&&(!i.canBeEmpty()||!r(i,"first")))return Gl(a);let s=(function(l){let d=[];for(let c=l.getAdjacentCaret();c;c=c.getAdjacentCaret())d.push(c.origin);return d})(e);(s.length>0||i.canBeEmpty()&&r(i,"last"))&&a.insert(t(i).splice(0,0,s))}return a}function EH(e){return e}function MH(...e){return e}function RH(e,t){return[e,t]}function NH(e){return e}function _H(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function Jc(...e){let t=[];for(let n of e)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))t.push(o);return t}function DH(e,...t){let n=Jc(...t);n.length>0&&e.classList.add(...n)}function OH(e,...t){let n=Jc(...t);n.length>0&&e.classList.remove(...n)}function FH(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var M=Kx,Jte=M.$addUpdateTag,tm=M.$applyNodeReplacement,jl=M.$caretFromPoint,tP=M.$caretRangeFromSelection,nm=M.$cloneWithProperties,nP=M.$cloneWithPropertiesEphemeral,Zte=M.$comparePointCaretNext,ene=M.$copyNode,oP=M.$create,Ms=M.$createLineBreakNode,rP=M.$createNodeSelection,ur=M.$createParagraphNode,tne=M.$createPoint,Rs=M.$createRangeSelection,aP=M.$createRangeSelectionFromDom,iP=M.$createTabNode,Mr=M.$createTextNode,sP=M.$extendCaretToRange,_a=M.$findMatchingParent,qx=M.$getAdjacentChildCaret,nne=M.$getAdjacentNode,Ns=M.$getAdjacentSiblingOrParentSiblingCaret,Vx=M.$getCaretInDirection,lP=M.$getCaretRange,one=M.$getCaretRangeInDirection,dP=M.$getCharacterOffsets,ki=M.$getChildCaret,rne=M.$getChildCaretAtIndex,Wx=M.$getChildCaretOrSelf,cP=M.$getCollapsedCaretRange,ane=M.$getCommonAncestor,ine=M.$getCommonAncestorResultBranchOrder,om=M.$getEditor,sne=M.$getNearestNodeFromDOMNode,lne=M.$getNearestRootOrShadowRoot,rm=M.$getNodeByKey,dne=M.$getNodeByKeyOrThrow,uP=M.$getNodeFromDOMNode,Zc=M.$getPreviousSelection,Ct=M.$getRoot,Oe=M.$getSelection,Da=M.$getSiblingCaret,am=M.$getState,cne=M.$getStateChange,une=M.$getTextContent,fne=M.$getTextNodeOffset,pne=M.$getTextPointCaret,mne=M.$getTextPointCaretSlice,gne=M.$getWritableNodeState,fP=M.$hasAncestor,hne=M.$hasUpdateTag,vne=M.$insertNodes,Ql=M.$isBlockElementNode,eu=M.$isChildCaret,im=M.$isDecoratorNode,pP=M.$isEditorState,Ke=M.$isElementNode,mP=M.$isExtendableTextPointCaret,xne=M.$isInlineElementOrDecoratorNode,gP=M.$isLeafNode,Xl=M.$isLineBreakNode,yne=M.$isNodeCaret,Gx=M.$isNodeSelection,hP=M.$isParagraphNode,we=M.$isRangeSelection,tu=M.$isRootNode,_s=M.$isRootOrShadowRoot,vP=M.$isSiblingCaret,Cne=M.$isTabNode,tt=M.$isTextNode,sm=M.$isTextPointCaret,bne=M.$isTextPointCaretSlice,jx=M.$isTokenOrSegmented,Ine=M.$isTokenOrTab,Sne=M.$nodesOfType,xP=M.$normalizeCaret,yP=M.$normalizeSelection__EXPERIMENTAL,wne=M.$onUpdate,CP=M.$parseSerializedNode,Tne=M.$removeTextFromCaretRange,bP=M.$rewindSiblingCaret,lm=M.$selectAll,Lne=M.$setCompositionKey,kne=M.$setPointFromCaret,Rr=M.$setSelection,IP=M.$setSelectionFromCaretRange,dm=M.$setState,SP=M.$splitAtPointCaretNext,wP=M.$splitNode,Pne=M.$updateRangeSelectionFromCaretRange,Qx=M.ArtificialNode__DO_NOT_USE,Ane=M.BEFORE_INPUT_COMMAND,TP=M.BLUR_COMMAND,nu=M.CAN_REDO_COMMAND,ou=M.CAN_UNDO_COMMAND,cm=M.CLEAR_EDITOR_COMMAND,LP=M.CLEAR_HISTORY_COMMAND,kP=M.CLICK_COMMAND,Ene=M.COLLABORATION_TAG,um=M.COMMAND_PRIORITY_CRITICAL,Xt=M.COMMAND_PRIORITY_EDITOR,Nr=M.COMMAND_PRIORITY_HIGH,Yl=M.COMMAND_PRIORITY_LOW,Mne=M.COMMAND_PRIORITY_NORMAL,Rne=M.COMPOSITION_END_COMMAND,PP=M.COMPOSITION_END_TAG,Nne=M.COMPOSITION_START_COMMAND,AP=M.COMPOSITION_START_TAG,EP=M.CONTROLLED_TEXT_INSERTION_COMMAND,fm=M.COPY_COMMAND,MP=M.CUT_COMMAND,pm=M.DELETE_CHARACTER_COMMAND,RP=M.DELETE_LINE_COMMAND,NP=M.DELETE_WORD_COMMAND,_ne=M.DRAGEND_COMMAND,Dne=M.DRAGOVER_COMMAND,_P=M.DRAGSTART_COMMAND,DP=M.DROP_COMMAND,Oa=M.DecoratorNode,One=M.ElementNode,OP=M.FOCUS_COMMAND,Fne=M.FORMAT_ELEMENT_COMMAND,FP=M.FORMAT_TEXT_COMMAND,mm=M.HISTORIC_TAG,_r=M.HISTORY_MERGE_TAG,BP=M.HISTORY_PUSH_TAG,Xx=M.INDENT_CONTENT_COMMAND,Bne=M.INPUT_COMMAND,Yx=M.INSERT_LINE_BREAK_COMMAND,zP=M.INSERT_PARAGRAPH_COMMAND,$P=M.INSERT_TAB_COMMAND,ru=M.INTERNAL_$isBlock,zne=M.IS_ALL_FORMATTING,$ne=M.IS_BOLD,Hne=M.IS_CODE,Une=M.IS_HIGHLIGHT,Kne=M.IS_ITALIC,qne=M.IS_STRIKETHROUGH,Vne=M.IS_SUBSCRIPT,Wne=M.IS_SUPERSCRIPT,Gne=M.IS_UNDERLINE,HP=M.KEY_ARROW_DOWN_COMMAND,gm=M.KEY_ARROW_LEFT_COMMAND,hm=M.KEY_ARROW_RIGHT_COMMAND,UP=M.KEY_ARROW_UP_COMMAND,vm=M.KEY_BACKSPACE_COMMAND,KP=M.KEY_DELETE_COMMAND,qP=M.KEY_DOWN_COMMAND,xm=M.KEY_ENTER_COMMAND,jne=M.KEY_ESCAPE_COMMAND,Qne=M.KEY_MODIFIER_COMMAND,Xne=M.KEY_SPACE_COMMAND,ym=M.KEY_TAB_COMMAND,VP=M.LineBreakNode,Yne=M.MOVE_TO_END,Jne=M.MOVE_TO_START,Zne=M.NODE_STATE_KEY,WP=M.OUTDENT_CONTENT_COMMAND,Cm=M.PASTE_COMMAND,GP=M.PASTE_TAG,jP=M.ParagraphNode,QP=M.REDO_COMMAND,XP=M.REMOVE_TEXT_COMMAND,YP=M.RootNode,eoe=M.SELECTION_CHANGE_COMMAND,JP=M.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,ZP=M.SELECT_ALL_COMMAND,toe=M.SKIP_COLLAB_TAG,noe=M.SKIP_DOM_SELECTION_TAG,ooe=M.SKIP_SCROLL_INTO_VIEW_TAG,roe=M.SKIP_SELECTION_FOCUS_TAG,eA=M.TEXT_TYPE_TO_FORMAT,tA=M.TabNode,bm=M.TextNode,nA=M.UNDO_COMMAND,au=M.addClassNamesToElement,aoe=M.buildImportMap,Im=M.configExtension,oA=M.createCommand,Sm=M.createEditor,ioe=M.createSharedNodeState,rA=M.createState,aA=M.declarePeerDependency,Mn=M.defineExtension,soe=M.flipDirection,loe=M.getDOMOwnerDocument,Jx=M.getDOMSelection,doe=M.getDOMSelectionFromTarget,iA=M.getDOMTextNode,coe=M.getEditorPropertyFromDOMNode,uoe=M.getNearestEditorFromDOMNode,sA=M.getRegisteredNode,foe=M.getRegisteredNodeOrThrow,poe=M.getStaticNodeConfig,moe=M.getTextDirection,goe=M.getTransformSetFromKlass,lA=M.isBlockDomNode,hoe=M.isCurrentlyReadOnlyMode,dA=M.isDOMDocumentNode,cA=M.isDOMNode,voe=M.isDOMTextNode,xoe=M.isDOMUnmanaged,Zx=M.isDocumentFragment,yoe=M.isExactShortcutMatch,uA=M.isHTMLAnchorElement,wm=M.isHTMLElement,iu=M.isInlineDomNode,Coe=M.isLexicalEditor,boe=M.isModifierMatch,Ioe=M.isSelectionCapturedInDecoratorInput,fA=M.isSelectionWithinEditor,ey=M.makeStepwiseIterator,ra=M.mergeRegister,Soe=M.normalizeClassNames,Tm=M.removeClassNamesFromElement,woe=M.removeFromParent,Toe=M.resetRandomKey,Dr=M.safeCast,Loe=M.setDOMUnmanaged,koe=M.setNodeIndentFromDOM,Lm=M.shallowMergeConfig,ty=M.toggleTextFormatType;var ny={};An(ny,{LexicalComposer:()=>zH});me();var pA=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,BH=pA?ye:q,km={tag:_r};function zH({initialConfig:e,children:t}){let n=z(()=>{let{theme:o,namespace:r,nodes:a,onError:i,editorState:s,html:l}=e,d=AT(null,o),c=Sm({editable:e.editable,html:l,namespace:r,nodes:a,onError:f=>i(f,c),theme:o});return(function(f,p){if(p!==null){if(p===void 0)f.update(()=>{let m=Ct();if(m.isEmpty()){let h=ur();m.append(h);let g=pA?document.activeElement:null;(Oe()!==null||g!==null&&g===f.getRootElement())&&h.select()}},km);else if(p!==null)switch(typeof p){case"string":{let m=f.parseEditorState(p);f.setEditorState(m,km);break}case"object":f.setEditorState(p,km);break;case"function":f.update(()=>{Ct().isEmpty()&&p(f)},km)}}})(c,s),[c,d]},[]);return BH(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),u(PT.Provider,{value:n,children:t})}var $H=ny,mA=$H.LexicalComposer;var ry={};An(ry,{$canShowPlaceholder:()=>hA,$canShowPlaceholderCurry:()=>UH,$findTextIntersectionFromCharacters:()=>KH,$isRootTextContentEmpty:()=>oy,$isRootTextContentEmptyCurry:()=>HH,$rootTextContent:()=>gA,registerLexicalTextEntity:()=>VH});function gA(){return Ct().getTextContent()}function oy(e,t=!0){if(e)return!1;let n=gA();return t&&(n=n.trim()),n===""}function HH(e,t){return()=>oy(e,t)}function hA(e){if(!oy(e,!1))return!1;let t=Ct().getChildren(),n=t.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=t[o];if(im(r))return!1;if(Ke(r)){if(!hP(r)||r.__indent!==0)return!1;let a=r.getChildren(),i=a.length;for(let s=0;s<i;s++){let l=a[o];if(!tt(l))return!1}}}return!0}function UH(e){return()=>hA(e)}function KH(e,t){let n=e.getFirstChild(),o=0;e:for(;n!==null;){if(Ke(n)){let i=n.getFirstChild();if(i!==null){n=i;continue}}else if(tt(n)){let i=n.getTextContentSize();if(o+i>t)return{node:n,offset:t-o};o+=i}let r=n.getNextSibling();if(r!==null){n=r;continue}let a=n.getParent();for(;a!==null;){let i=a.getNextSibling();if(i!==null){n=i;continue e}a=a.getParent()}break}return null}function qH(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function VH(e,t,n,o){let r=i=>i instanceof n,a=i=>{let s=Mr(i.getTextContent());s.setFormat(i.getFormat()),i.replace(s)};return[e.registerNodeTransform(bm,i=>{if(!i.isSimpleText())return;let s,l=i.getPreviousSibling(),d=i.getTextContent(),c=i;if(tt(l)){let p=l.getTextContent(),m=t(p+d);if(r(l)){if(m===null||(h=>h.getLatest().__mode)(l)!==0)return void a(l);{let h=m.end-p.length;if(h>0){let g=p+d.slice(0,h);if(l.select(),l.setTextContent(g),h===d.length)i.remove();else{let v=d.slice(h);i.setTextContent(v)}return}}}else if(m===null||m.start<p.length)return}let f=0;for(;;){s=t(d);let p,m=s===null?"":d.slice(s.end);if(d=m,m===""){let g=c.getNextSibling();if(tt(g)){m=c.getTextContent()+g.getTextContent();let v=t(m);if(v===null)return void(r(g)?a(g):g.markDirty());if(v.start!==0)return}}if(s===null)return;if(s.start===0&&tt(l)&&l.isTextEntity()){f+=s.end;continue}s.start===0?[p,c]=c.splitText(s.end):[,p,c]=c.splitText(s.start+f,s.end+f),p===void 0&&qH(165,"nodeToReplace");let h=o(p);if(h.setFormat(p.getFormat()),p.replace(h),c==null)return;f=0,l=h}}),e.registerNodeTransform(n,i=>{let s=i.getTextContent(),l=t(s);if(l===null||l.start!==0)return void a(i);if(s.length>l.end)return void i.splitText(l.end);let d=i.getPreviousSibling();tt(d)&&d.isTextEntity()&&(a(d),a(i));let c=i.getNextSibling();tt(c)&&c.isTextEntity()&&(a(c),r(i)&&a(i))})]}var Ds=ry,Doe=Ds.$canShowPlaceholder,Pm=Ds.$canShowPlaceholderCurry,Ooe=Ds.$findTextIntersectionFromCharacters,Foe=Ds.$isRootTextContentEmpty,Boe=Ds.$isRootTextContentEmptyCurry,zoe=Ds.$rootTextContent,$oe=Ds.registerLexicalTextEntity;var cy={};An(cy,{$addNodeStyle:()=>YH,$cloneWithProperties:()=>nm,$copyBlockFormatIndent:()=>TA,$ensureForwardRangeSelection:()=>wA,$forEachSelectedTextNode:()=>SA,$getComputedStyleForElement:()=>sy,$getComputedStyleForParent:()=>ly,$getSelectionStyleValueForProperty:()=>aU,$isAtNodeEnd:()=>XH,$isParentElementRTL:()=>dy,$isParentRTL:()=>jH,$moveCaretSelection:()=>PA,$moveCharacter:()=>oU,$patchStyleText:()=>JH,$selectAll:()=>lm,$setBlocksType:()=>ZH,$shouldOverrideDefaultCharacterSelection:()=>nU,$sliceSelectedTextNodeContent:()=>QH,$trimTextContentFromAnchor:()=>IA,$wrapNodes:()=>tU,createDOMRange:()=>WH,createRectsFromDOMRange:()=>GH,getCSSFromStyleObject:()=>bA,getStyleObjectFromCSS:()=>Mm,trimTextContentFromAnchor:()=>iU});function iy(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Em=new Map;function vA(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function xA(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function WH(e,t,n,o,r){let a=t.getKey(),i=o.getKey(),s=document.createRange(),l=e.getElementByKey(a),d=e.getElementByKey(i),c=n,f=r;if(tt(t)&&(l=vA(l)),tt(o)&&(d=vA(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,c]=xA(l)),d.nodeName==="BR"&&([d,f]=xA(d));let p=l.firstChild;l===d&&p!=null&&p.nodeName==="BR"&&c===0&&f===0&&(f=1);try{s.setStart(l,c),s.setEnd(d,f)}catch{return null}return!s.collapsed||c===f&&a===i||(s.setStart(d,f),s.setEnd(l,c)),s}function GH(e,t){let n=e.getRootElement();if(n===null)return[];let o=n.getBoundingClientRect(),r=getComputedStyle(n),a=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),i=Array.from(t.getClientRects()),s,l=i.length;i.sort((d,c)=>{let f=d.top-c.top;return Math.abs(f)<=3?d.left-c.left:f});for(let d=0;d<l;d++){let c=i[d],f=s&&s.top<=c.top&&s.top+s.height>c.top&&s.left+s.width>c.left,p=c.width+a===o.width;f||p?(i.splice(d--,1),l--):s=c}return i}function CA(e){let t={};if(!e)return t;let n=e.split(";");for(let o of n)if(o!==""){let[r,a]=o.split(/:([^]+)/);r&&a&&(t[r.trim()]=a.trim())}return t}function Mm(e){let t=Em.get(e);return t===void 0&&(t=CA(e),Em.set(e,t)),t}function bA(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function sy(e){let t=om().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function ly(e){return sy(tu(e)?e:e.getParentOrThrow())}function jH(e){let t=ly(e);return t!==null&&t.direction==="rtl"}function QH(e,t,n="self"){let o=e.getStartEndPoints();if(t.isSelected(e)&&!jx(t)&&o!==null){let[r,a]=o,i=e.isBackward(),s=r.getNode(),l=a.getNode(),d=t.is(s),c=t.is(l);if(d||c){let[f,p]=dP(e),m=s.is(l),h=t.is(i?l:s),g=t.is(i?s:l),v,x=0;m?(x=f>p?p:f,v=f>p?f:p):h?(x=i?p:f,v=void 0):g&&(x=0,v=i?f:p);let y=t.__text.slice(x,v);y!==t.__text&&(n==="clone"&&(t=nP(t)),t.__text=y)}}return t}function XH(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return Ke(t)||iy(177),e.offset===t.getChildrenSize()}function IA(e,t,n){let o=t.getNode(),r=n;if(Ke(o)){let a=o.getDescendantByIndex(t.offset);a!==null&&(o=a)}for(;r>0&&o!==null;){if(Ke(o)){let d=o.getLastDescendant();d!==null&&(o=d)}let a=o.getPreviousSibling(),i=0;if(a===null){let d=o.getParentOrThrow(),c=d.getPreviousSibling();for(;c===null;){if(d=d.getParent(),d===null){a=null;break}c=d.getPreviousSibling()}d!==null&&(i=d.isInline()?0:2,a=c)}let s=o.getTextContent();s===""&&Ke(o)&&!o.isInline()&&(s=`
3710
+ `?o.push(Kl()):i===" "?o.push(tm()):o.push(Wn(i))}this.insertNodes(o)}insertText(t){let n=this.anchor,o=this.focus,r=this.format,a=this.style,i=n,s=o;!this.isCollapsed()&&o.isBefore(n)&&(i=o,s=n),i.type==="element"&&(function(v,x,y,C){let S=v.getNode(),L=S.getChildAtIndex(v.offset),w=Wn();if(w.setFormat(y),w.setStyle(C),DL(L))L.splice(0,0,[w]);else{let k=no(S)?Fa().append(w):w;L===null?S.append(k):L.insertBefore(k)}v.is(x)&&x.set(w.__key,0,"text"),v.set(w.__key,0,"text")})(i,s,r,a),s.type==="element"&&Jl(s,Lr(Ri(s,"next")));let l=i.offset,d=s.offset,c=this.getNodes(),f=c.length,p=c[0];Me(p)||J(26);let m=p.getTextContent().length,h=p.getParentOrThrow(),g=c[f-1];if(f===1&&s.type==="element"&&(d=m,s.set(i.key,d,"text")),this.isCollapsed()&&l===m&&(_a(p)||!p.canInsertTextAfter()||!h.canInsertTextAfter()&&p.getNextSibling()===null)){let v=p.getNextSibling();if(Me(v)&&v.canInsertTextBefore()&&!_a(v)||(v=Wn(),v.setFormat(r),v.setStyle(a),h.canInsertTextAfter()?p.insertAfter(v):h.insertAfter(v)),v.select(0,0),p=v,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&l===0&&(_a(p)||!p.canInsertTextBefore()||!h.canInsertTextBefore()&&p.getPreviousSibling()===null)){let v=p.getPreviousSibling();if(Me(v)&&!_a(v)||(v=Wn(),v.setFormat(r),h.canInsertTextBefore()?p.insertBefore(v):h.insertBefore(v)),v.select(),p=v,t!=="")return void this.insertText(t)}else if(p.isSegmented()&&l!==m){let v=Wn(p.getTextContent());v.setFormat(r),p.replace(v),p=v}else if(!this.isCollapsed()&&t!==""){let v=g.getParent();if(!h.canInsertTextBefore()||!h.canInsertTextAfter()||Q(v)&&(!v.canInsertTextBefore()||!v.canInsertTextAfter()))return this.insertText(""),TL(this.anchor,this.focus),void this.insertText(t)}if(f===1){if(Ti(p)){let C=Wn(t);return C.select(),void p.replace(C)}let v=p.getFormat(),x=p.getStyle();if(l!==d||v===r&&x===a){if(Sx(p)){let C=Wn(t);return C.setFormat(r),C.setStyle(a),C.select(),void p.replace(C)}}else{if(p.getTextContent()!==""){let C=Wn(t);if(C.setFormat(r),C.setStyle(a),C.select(),l===0)p.insertBefore(C,!1);else{let[S]=p.splitText(l);S.insertAfter(C,!1)}return void(C.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length))}p.setFormat(r),p.setStyle(a)}let y=d-l;p=p.spliceText(l,y,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=v,this.style=x,p.isComposing()&&(this.anchor.offset-=t.length))}else{let v=new Set([...p.getParentKeys(),...g.getParentKeys()]),x=Q(p)?p:p.getParentOrThrow(),y=Q(g)?g:g.getParentOrThrow(),C=g;if(!x.is(y)&&y.isInline())do C=y,y=y.getParentOrThrow();while(y.isInline());if(s.type==="text"&&(d!==0||g.getTextContent()==="")||s.type==="element"&&g.getIndexWithinParent()<d)if(Me(g)&&!Ti(g)&&d!==g.getTextContentSize()){if(g.isSegmented()){let I=Wn(g.getTextContent());g.replace(I),g=I}no(s.getNode())||s.type!=="text"||(g=g.spliceText(0,d,"")),v.add(g.__key)}else{let I=g.getParentOrThrow();I.canBeEmpty()||I.getChildrenSize()!==1?g.remove():I.remove()}else v.add(g.__key);let S=y.getChildren(),L=new Set(c),w=x.is(y),k=x.isInline()&&p.getNextSibling()===null?x:p;for(let I=S.length-1;I>=0;I--){let T=S[I];if(T.is(p)||Q(T)&&T.isParentOf(p))break;T.isAttached()&&(!L.has(T)||T.is(C)?w||k.insertAfter(T,!1):T.remove())}if(!w){let I=y,T=null;for(;I!==null;){let E=I.getChildren(),A=E.length;(A===0||E[A-1].is(T))&&(v.delete(I.__key),T=I),I=I.getParent()}}if(Ti(p))if(l===m)p.select();else{let I=Wn(t);I.select(),p.replace(I)}else p=p.spliceText(l,m-l,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=p.getFormat(),this.style=p.getStyle(),p.isComposing()&&(this.anchor.offset-=t.length));for(let I=1;I<f;I++){let T=c[I],E=T.__key;v.has(E)||T.remove()}}}removeText(){let t=wt()===this;$c(this,sP(ix(this))),t&&wt()!==this&&$o(this)}formatText(t,n=null){if(this.isCollapsed())return this.toggleFormat(t),void jn(null);let o=this.getNodes(),r=[];for(let S of o)Me(S)&&r.push(S);let a=S=>{o.forEach(L=>{if(Q(L)){let w=L.getFormatFlags(t,S);L.setTextFormat(w)}})},i=r.length;if(i===0)return this.toggleFormat(t),jn(null),void a(n);let s=this.anchor,l=this.focus,d=this.isBackward(),c=d?l:s,f=d?s:l,p=0,m=r[0],h=c.type==="element"?0:c.offset;if(c.type==="text"&&h===m.getTextContentSize()&&(p=1,m=r[1],h=0),m==null)return;let g=m.getFormatFlags(t,n);a(g);let v=i-1,x=r[v],y=f.type==="text"?f.offset:x.getTextContentSize();if(m.is(x)){if(h===y)return;if(_a(m)||h===0&&y===m.getTextContentSize())m.setFormat(g);else{let S=m.splitText(h,y),L=h===0?S[0]:S[1];L.setFormat(g),c.type==="text"&&c.set(L.__key,0,"text"),f.type==="text"&&f.set(L.__key,y-h,"text")}return void(this.format=g)}h===0||_a(m)||([,m]=m.splitText(h),h=0),m.setFormat(g);let C=x.getFormatFlags(t,g);y>0&&(y===x.getTextContentSize()||_a(x)||([x]=x.splitText(y)),x.setFormat(C));for(let S=p+1;S<v;S++){let L=r[S],w=L.getFormatFlags(t,C);L.setFormat(w)}c.type==="text"&&c.set(m.__key,h,"text"),f.type==="text"&&f.set(x.__key,y,"text"),this.format=g|C}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let h=wt();return je(h)||J(134),h.insertNodes(t)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=Bc(n,Oa),r=t[t.length-1];if(Q(o)&&"__language"in o){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let h=Tv(this);o.splice(h,0,t),r.selectEnd()}return}if(!t.some(h=>(Q(h)||Qt(h))&&!h.isInline())){Q(o)||J(211,n.constructor.name,n.getType());let h=Tv(this);return o.splice(h,0,t),void r.selectEnd()}let a=(function(h){let g=Fa(),v=null;for(let x=0;x<h.length;x++){let y=h[x],C=Ts(y);if(C||Qt(y)&&y.isInline()||Q(y)&&y.isInline()||Me(y)||y.isParentRequired()){if(v===null&&(v=y.createParentElementNode(),g.append(v),C))continue;v!==null&&v.append(y)}else g.append(y),v=null}return g})(t),i=a.getLastDescendant(),s=a.getChildren(),l=!Q(o)||!o.isEmpty()?this.insertParagraph():null,d=s[s.length-1],c=s[0];var f;Q(f=c)&&Oa(f)&&!f.isEmpty()&&Q(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(Q(o)||J(211,n.constructor.name,n.getType()),o.append(...c.getChildren()),c=s[1]),c&&(o===null&&J(212,n.constructor.name,n.getType()),(function(h,g){let v=g.getParentOrThrow().getLastChild(),x=g,y=[g];for(;x!==v;)x.getNextSibling()||J(140),x=x.getNextSibling(),y.push(x);let C=h;for(let S of y)C=C.insertAfter(S)})(o,c));let p=Bc(i,Oa);l&&Q(p)&&(l.canMergeWhenEmpty()||Oa(d))&&(p.append(...l.getChildren()),l.remove()),Q(o)&&o.isEmpty()&&o.remove(),i.selectEnd();let m=Q(o)?o.getLastChild():null;Ts(m)&&p!==o&&m.remove()}insertParagraph(){if(this.anchor.key==="root"){let i=Fa();return Qo().splice(this.anchor.offset,0,[i]),i.select(),i}let t=Tv(this),n=Bc(this.anchor.getNode(),Oa);Q(n)||J(213);let o=n.getChildAtIndex(t),r=o?[o,...o.getNextSiblings()]:[],a=n.insertNewAfter(this,!1);return a?(a.append(...r),a.selectStart(),a):null}insertLineBreak(t){let n=Kl();if(this.insertNodes([n]),t){let o=n.getParentOrThrow(),r=n.getIndexWithinParent();o.select(r,r)}}extract(){let t=[...this.getNodes()],n=t.length,o=t[0],r=t[n-1],[a,i]=Jv(this),s=this.isBackward(),[l,d]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[c,f]=s?[i,a]:[a,i];if(n===0)return[];if(n===1){if(Me(o)&&!this.isCollapsed()){let p=o.splitText(c,f),m=c===0?p[0]:p[1];return m?(l.set(m.getKey(),0,"text"),d.set(m.getKey(),m.getTextContentSize(),"text"),[m]):[]}return[o]}if(Me(o)&&(c===o.getTextContentSize()?t.shift():c!==0&&([,o]=o.splitText(c),t[0]=o,l.set(o.getKey(),0,"text"))),Me(r)){let p=r.getTextContent().length;f===0?t.pop():f!==p&&([r]=r.splitText(f),t[t.length-1]=r,d.set(r.getKey(),r.getTextContentSize(),"text"))}return t}modify(t,n,o){if(pk(this,t,n,o))return;let r=t==="move",a=qt(),i=Nr(Xo(a));if(!i)return;let s=a._blockCursorElement,l=a._rootElement,d=this.focus.getNode();if(l===null||s===null||!Q(d)||d.isInline()||d.canBeEmpty()||tx(s,a,l),this.dirty){let c=Gl(a,this.anchor.key),f=Gl(a,this.focus.key);this.anchor.type==="text"&&(c=Es(c)),this.focus.type==="text"&&(f=Es(f)),c&&f&&AL(i,c,this.anchor.offset,f,this.focus.offset)}if((function(c,f,p,m){c.modify(f,p,m)})(i,t,n?"backward":"forward",o),i.rangeCount>0){let c=i.getRangeAt(0),f=this.anchor.getNode(),p=no(f)?f:YL(f);if(this.applyDOMRange(c),this.dirty=!0,!r){let m=this.getNodes(),h=[],g=!1;for(let v=0;v<m.length;v++){let x=m[v];Qp(x,p)?h.push(x):g=!0}if(g&&h.length>0)if(n){let v=h[0];Q(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{let v=h[h.length-1];Q(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}i.anchorNode===c.startContainer&&i.anchorOffset===c.startOffset||(function(v){let x=v.focus,y=v.anchor,C=y.key,S=y.offset,L=y.type;y.set(x.key,x.offset,x.type,!0),x.set(C,S,L,!0)})(this)}}o==="lineboundary"&&pk(this,t,n,o,"decorators")}forwardDeletion(t,n,o){if(!o&&(t.type==="element"&&Q(n)&&t.offset===n.getChildrenSize()||t.type==="text"&&t.offset===n.getTextContentSize())){let r=n.getParent(),a=n.getNextSibling()||(r===null?null:r.getNextSibling());if(Q(a)&&a.isShadowRoot())return!0}return!1}deleteCharacter(t){let n=this.isCollapsed();if(this.isCollapsed()){let o=this.anchor,r=o.getNode();if(this.forwardDeletion(o,r,t))return;let a=Kx(Ri(o,t?"previous":"next"));if(a.getTextSlices().every(s=>s===null||s.distance===0)){let s={type:"initial"};for(let l of a.iterNodeCarets("shadowRoot"))if(Ar(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(s.type==="merge-block")break;if(Q(a.anchor.origin)&&a.anchor.origin.isEmpty()){let d=Lr(l);$c(this,Mi(d,d)),a.anchor.origin.remove()}return}s.type!=="merge-next-block"&&s.type!=="merge-block"||(s={block:s.block,caret:l,type:"merge-block"})}}else{if(s.type==="merge-block")break;if(Ms(l)){if(Q(l.origin)){if(l.origin.isInline()){if(!l.origin.isParentOf(a.anchor.origin))break}else s={block:l.origin,type:"merge-next-block"};continue}if(Qt(l.origin)){if(!l.origin.isIsolated())if(s.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&Q(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let d=wx();d.add(l.origin.getKey()),$o(d)}else l.origin.remove();return}break}}if(s.type==="merge-block"){let{caret:l,block:d}=s;return $c(this,Mi(!l.origin.isEmpty()&&d.isEmpty()?td(Yn(d,l.direction)):a.anchor,l)),this.removeText()}}let i=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&o.offset===0&&ik(this,o.getNode()))return}else{let s=i.type==="text"?i.getNode():null;if(r=o.type==="text"?o.getNode():null,s!==null&&s.isSegmented()){let l=i.offset,d=s.getTextContentSize();if(s.is(r)||t&&l!==d||!t&&l!==0)return void sk(s,t,l)}else if(r!==null&&r.isSegmented()){let l=o.offset,d=r.getTextContentSize();if(r.is(s)||t&&l!==0||!t&&l!==d)return void sk(r,t,l)}(function(l,d){let c=l.anchor,f=l.focus,p=c.getNode(),m=f.getNode();if(p===m&&c.type==="text"&&f.type==="text"){let h=c.offset,g=f.offset,v=h<g,x=v?h:g,y=v?g:h,C=y-1;x!==C&&(function(S){return!(qL(S)||eH(S))})(p.getTextContent().slice(x,y))&&(d?f.set(f.key,C,f.type):c.set(c.key,C,c.type))}})(this,t)}}if(this.removeText(),t&&!n&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){let o=this.anchor.getNode();o.isEmpty()&&no(o.getParent())&&o.getPreviousSibling()===null&&ik(this,o)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){let n=this.anchor,o=n.getNode();if(this.forwardDeletion(n,o,t))return;this.modify("extend",t,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function Zc(e){return e instanceof qp}function ak(e){let t=e.offset;if(e.type==="text")return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function Jv(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,o]=t;return n.type==="element"&&o.type==="element"&&n.key===o.key&&n.offset===o.offset?[0,0]:[ak(n),ak(o)]}function ik(e,t){for(let n=t;n;n=n.getParent()){if(Q(n)){if(n.collapseAtStart(e))return!0;if(pr(n))break}if(n.getPreviousSibling())break}return!1}var eH=(()=>{try{let e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("\u2764\uFE0F")&&t("#\uFE0F\u20E3")&&t("\u{1F44D}"))return t}catch{}return()=>!1})();function sk(e,t,n){let o=e,r=o.getTextContent().split(/(?=\s)/g),a=r.length,i=0,s=0;for(let d=0;d<a;d++){let c=d===a-1;if(s=i,i+=r[d].length,t&&i===n||i>n||c){r.splice(d,1),c&&(s=void 0);break}}let l=r.join("").trim();l===""?o.remove():(o.setTextContent(l),o.select(s,s))}function lk(e,t,n,o){let r,a=t;if(ko(e)){let i=!1,s=e.childNodes,l=s.length,d=o._blockCursorElement;a===l&&(i=!0,a=l-1);let c=s[a],f=!1;if(c===d)c=s[a+1],f=!0;else if(d!==null){let p=d.parentNode;e===p&&t>Array.prototype.indexOf.call(p.children,d)&&a--}if(r=Bl(c),Me(r))a=Er(r,i?"next":"previous");else{let p=Bl(e);if(p===null)return null;if(Q(p)){let m=o.getElementByKey(p.getKey());m===null&&J(214),[p,a]=p.getDOMSlot(m).resolveChildIndex(p,m,e,t),Q(p)||J(215),i&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let g=p.getChildAtIndex(a);if(Q(g)&&(function(v,x,y){let C=v.getParent();return y===null||C===null||!C.canBeEmpty()||C!==y.getNode()})(g,0,n)){let v=i?g.getLastDescendant():g.getFirstDescendant();v===null?p=g:(g=v,p=Q(g)?g:g.getParentOrThrow()),a=0}Me(g)?(r=g,p=null,a=Er(g,i?"next":"previous")):g!==p&&i&&!f&&(Q(p)||J(216),a=Math.min(p.getChildrenSize(),a+1))}else{let m=p.getIndexWithinParent();a=t===0&&Qt(p)&&Bl(e)===p?m:m+1,p=p.getParentOrThrow()}if(Q(p))return Mr(p.__key,a,"element")}}else r=Bl(e);return Me(r)?Mr(r.__key,Er(r,a,"clamp"),"text"):null}function dk(e,t,n){let o=e.offset,r=e.getNode();if(o===0){let a=r.getPreviousSibling(),i=r.getParent();if(t){if((n||!t)&&a===null&&Q(i)&&i.isInline()){let s=i.getPreviousSibling();Me(s)&&e.set(s.__key,s.getTextContent().length,"text")}}else Q(a)&&!n&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):Me(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(o===r.getTextContent().length){let a=r.getNextSibling(),i=r.getParent();if(t&&Q(a)&&a.isInline())e.set(a.__key,0,"element");else if((n||t)&&a===null&&Q(i)&&i.isInline()&&!i.canInsertTextAfter()){let s=i.getNextSibling();Me(s)&&e.set(s.__key,0,"text")}}}function TL(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);dk(e,o,r),dk(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function kL(e,t,n,o,r,a){if(e===null||n===null||!eu(r,e,n))return null;let i=lk(e,t,je(a)?a.anchor:null,r);if(i===null)return null;let s=lk(n,o,je(a)?a.focus:null,r);if(s===null)return null;if(i.type==="element"&&s.type==="element"){let l=Bl(e),d=Bl(n);if(Qt(l)&&Qt(d))return null}return TL(i,s),[i,s]}function tH(e){return Q(e)&&!e.isInline()}function LL(e,t,n,o,r,a){let i=$a(),s=new As(Mr(e,t,r),Mr(n,o,a),0,"");return s.dirty=!0,i._selection=s,s}function PL(){let e=Mr("root",0,"element"),t=Mr("root",0,"element");return new As(e,t,0,"")}function wx(){return new qp(new Set)}function nH(e,t){return nm(null,e,t,null)}function nm(e,t,n,o){let r=n._window;if(r===null)return null;let a=o||r.event,i=a?a.type:void 0,s=i==="selectionchange",l=!Rv&&(s||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&a&&a.detail===3||i==="drop"||i===void 0),d,c,f,p;if(je(e)&&!l)return e.clone();if(t===null)return null;if(d=t.anchorNode,c=t.focusNode,f=t.anchorOffset,p=t.focusOffset,(s||i===void 0)&&je(e)&&!eu(n,d,c))return e.clone();let m=kL(d,f,c,p,n,e);if(m===null)return null;let[h,g]=m,v=0,x="";if(je(e)){let y=e.anchor;if(h.key===y.key)v=e.format,x=e.style;else{let C=h.getNode();Me(C)?(v=C.getFormat(),x=C.getStyle()):Q(C)&&(v=C.getTextFormat(),x=C.getTextStyle())}}return new As(h,g,v,x)}function wt(){return $a()._selection}function Rs(){return qt()._editorState._selection}function Vp(e,t,n,o=1){let r=e.anchor,a=e.focus,i=r.getNode(),s=a.getNode();if(!t.is(i)&&!t.is(s))return;let l=t.__key;if(e.isCollapsed()){let d=r.offset;if(n<=d&&o>0||n<d&&o<0){let c=Math.max(0,d+o);r.set(l,c,"element"),a.set(l,c,"element"),ck(e)}}else{let d=e.isBackward(),c=d?a:r,f=c.getNode(),p=d?r:a,m=p.getNode();if(t.is(f)){let h=c.offset;(n<=h&&o>0||n<h&&o<0)&&c.set(l,Math.max(0,h+o),"element")}if(t.is(m)){let h=p.offset;(n<=h&&o>0||n<h&&o<0)&&p.set(l,Math.max(0,h+o),"element")}}ck(e)}function ck(e){let t=e.anchor,n=t.offset,o=e.focus,r=o.offset,a=t.getNode(),i=o.getNode();if(e.isCollapsed()){if(!Q(a))return;let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Me(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text"),o.set(d.__key,c,"text")}return}if(Q(a)){let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Me(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text")}}if(Q(i)){let s=i.getChildrenSize(),l=r>=s,d=l?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(Me(d)){let c=0;l&&(c=d.getTextContentSize()),o.set(d.__key,c,"text")}}}function Wp(e,t,n,o,r){let a=null,i=0,s=null;o!==null?(a=o.__key,Me(o)?(i=o.getTextContentSize(),s="text"):Q(o)&&(i=o.getChildrenSize(),s="element")):r!==null&&(a=r.__key,Me(r)?s="text":Q(r)&&(s="element")),a!==null&&s!==null?e.set(a,i,s):(i=t.getIndexWithinParent(),i===-1&&(i=n.getChildrenSize()),e.set(n.__key,i,"element"))}function uk(e,t,n,o,r){e.type==="text"?e.set(n,e.offset+(t?0:r),"text"):e.offset>o.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function AL(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function fk(e,t,n){let o=Gl(e,t.getKey());if(Q(t)){let r=t.getDOMSlot(o);return[r.element,n+r.getFirstChildOffset()]}return[o,n]}function oH(e,t,n,o,r,a,i){let s=o.anchorNode,l=o.focusNode,d=o.anchorOffset,c=o.focusOffset,f=document.activeElement;if(r.has(xL)&&f!==a||f!==null&&Ex(f))return;if(!je(t))return void(e!==null&&eu(n,s,l)&&o.removeAllRanges());let p=t.anchor,m=t.focus,h=p.getNode(),g=m.getNode(),[v,x]=fk(n,h,p.offset),[y,C]=fk(n,g,m.offset),S=t.format,L=t.style,w=t.isCollapsed(),k=v,I=y,T=!1;var E,A,N,R,$;if(p.type==="text"?(k=Es(v),T=h.getFormat()!==S||h.getStyle()!==L):je(e)&&e.anchor.type==="text"&&(T=!0),m.type==="text"&&(I=Es(y)),k!==null&&I!==null&&(w&&(e===null||T||je(e)&&(e.format!==S||e.style!==L))&&(E=S,A=L,N=x,R=p.key,$=performance.now(),uL=[E,A,N,R,$]),d!==x||c!==C||s!==k||l!==I||o.type==="Range"&&w||(f!==null&&a.contains(f)||r.has(Xv)||a.focus({preventScroll:!0}),p.type==="element"))){if(AL(o,k,x,I,C),!Li||!t.isCollapsed()||a===null||r.has(Xv)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(yL)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let U=je(t)&&t.anchor.type==="element"?k.childNodes[x]||null:o.rangeCount>0?o.getRangeAt(0):null;if(U!==null){let H;if(U instanceof Text){let F=document.createRange();F.selectNode(U),H=F.getBoundingClientRect()}else H=U.getBoundingClientRect();(function(F,oe,ee){let W=Fx(ee),Ze=Bx(W);if(W===null||Ze===null)return;let{top:ue,bottom:pe}=oe,Fe=0,Le=0,ie=ee;for(;ie!==null;){let Ie=ie===W.body;if(Ie)Fe=0,Le=Xo(F).innerHeight;else{let re=ie.getBoundingClientRect();Fe=re.top,Le=re.bottom}let ve=0;if(ue<Fe?ve=-(Fe-ue):pe>Le&&(ve=pe-Le),ve!==0)if(Ie)Ze.scrollBy(0,ve);else{let re=ie.scrollTop;ie.scrollTop+=ve;let be=ie.scrollTop-re;ue-=be,pe-=be}if(Ie)break;ie=nu(ie)}})(n,H,a)}}Gv=!0}}function rH(e){let t=wt()||Rs();t===null&&(t=Qo().selectEnd()),t.insertNodes(e)}function aH(){let e=wt();return e===null?"":e.getTextContent()}function Tv(e){let t=e;e.isCollapsed()||t.removeText();let n=wt();je(n)&&(t=n),je(t)||J(161);let o=t.anchor,r=o.getNode(),a=o.offset;for(;!Oa(r);){let i=r;if([r,a]=iH(r,a),i.is(r))break}return a}function iH(e,t){let n=e.getParent();if(!n){let r=Fa();return Qo().append(r),r.select(),[Qo(),0]}if(Me(e)){let r=e.splitText(t);if(r.length===0)return[n,e.getIndexWithinParent()];let a=t===0?0:1;return[n,r[0].getIndexWithinParent()+a]}if(!Q(e)||t===0)return[n,e.getIndexWithinParent()];let o=e.getChildAtIndex(t);if(o){let r=new As(Mr(e.__key,t,"element"),Mr(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(o,...o.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function pk(e,t,n,o,r="decorators-and-blocks"){if(t==="move"&&o==="character"&&!e.isCollapsed()){let[c,f]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return f.set(c.key,c.offset,c.type),!0}let a=Ri(e.focus,n?"previous":"next"),i=o==="lineboundary",s=t==="move",l=a,d=r==="decorators-and-blocks";if(!lP(l)){for(let c of l){d=!1;let{origin:f}=c;if(!Qt(f)||f.isIsolated()||(l=c,!i||!f.isInline()))break}if(d)for(let c of Kx(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Ar(c))c.origin.isInline()||(l=c);else{if(Q(c.origin))continue;Qt(c.origin)&&!c.origin.isInline()&&(l=c)}break}}if(l===a)return!1;if(s&&!i&&Qt(l.origin)&&l.origin.isKeyboardSelectable()){let c=wx();return c.add(l.origin.getKey()),$o(c),!0}return l=Lr(l),s&&Jl(e.anchor,l),Jl(e.focus,l),d||!i}var Qn=null,Xn=null,zo=!1,kv=!1,Rp=0,mk={characterData:!0,childList:!0,subtree:!0};function Zl(){return zo||Qn!==null&&Qn._readOnly}function Gn(){zo&&J(13)}function EL(){Rp>99&&J(14)}function $a(){return Qn===null&&J(195,ML()),Qn}function qt(){return Xn===null&&J(196,ML()),Xn}function ML(){let e=0,t=new Set,n=Ai.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=tu(r);if(rm(a))e++;else if(a){let i=String(a.constructor.version||"<0.17.1");i===n&&(i+=" (separately built, likely a bundler configuration issue)"),t.add(i)}}let o=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(o+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),o}function sH(){return Xn}function gk(e,t,n){let o=t.__type,r=Px(e,o),a=n.get(o);a===void 0&&(a=Array.from(r.transforms),n.set(o,a));let i=a.length;for(let s=0;s<i&&(a[s](t),t.isAttached());s++);}function hk(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function RL(e,t){if(!t)return;let n=e._updateTags,o=t;Array.isArray(t)||(o=[t]);for(let r of o)n.add(r)}function lH(e){return Tx(e,qt()._nodes)}function Tx(e,t){let n=e.type,o=t.get(n);o===void 0&&J(17,n);let r=o.klass;e.type!==r.getType()&&J(18,r.name);let a=r.importJSON(e),i=e.children;if(Q(a)&&Array.isArray(i))for(let s=0;s<i.length;s++){let l=Tx(i[s],t);a.append(l)}return a}function vk(e,t,n){let o=Qn,r=zo,a=Xn;Qn=t,zo=!0,Xn=e;try{return n()}finally{Qn=o,zo=r,Xn=a}}function Da(e,t){let n=e._pendingEditorState,o=e._rootElement,r=e._headless||o===null;if(n===null)return;let a=e._editorState,i=a._selection,s=n._selection,l=e._dirtyType!==0,d=Qn,c=zo,f=Xn,p=e._updating,m=e._observer,h=null;if(e._pendingEditorState=null,e._editorState=n,!r&&l&&m!==null){Xn=e,Qn=n,zo=!1,e._updating=!0;try{let w=e._dirtyType,k=e._dirtyElements,I=e._dirtyLeaves;m.disconnect(),h=L$(a,n,e,w,k,I)}catch(w){if(w instanceof Error&&e._onError(w),kv)throw w;return OL(e,null,o,n),Fk(e),e._dirtyType=2,kv=!0,Da(e,a),void(kv=!1)}finally{m.observe(o,mk),e._updating=p,Qn=d,zo=c,Xn=f}}n._readOnly||(n._readOnly=!0);let g=e._dirtyLeaves,v=e._dirtyElements,x=e._normalizedNodes,y=e._updateTags,C=e._deferred;l&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),(function(w,k){let I=w._decorators,T=w._pendingDecorators||I,E=k._nodeMap,A;for(A in T)E.has(A)||(T===I&&(T=UL(w)),delete T[A])})(e,n);let S=r?null:Nr(Xo(e));if(e._editable&&S!==null&&(l||s===null||s.dirty||!s.is(i))&&o!==null&&!y.has(CL)){Xn=e,Qn=n;try{if(m!==null&&m.disconnect(),l||s===null||s.dirty){let w=e._blockCursorElement;w!==null&&tx(w,e,o),oH(i,s,e,S,y,o)}(function(w,k,I){let T=w._blockCursorElement;if(je(I)&&I.isCollapsed()&&I.anchor.type==="element"&&k.contains(document.activeElement)){let E=I.anchor,A=E.getNode(),N=E.offset,R=!1,$=null;if(N===A.getChildrenSize())Pv(A.getChildAtIndex(N-1))&&(R=!0);else{let U=A.getChildAtIndex(N);if(U!==null&&Pv(U)){let H=U.getPreviousSibling();(H===null||Pv(H))&&(R=!0,$=w.getElementByKey(U.__key))}}if(R){let U=w.getElementByKey(A.__key);return T===null&&(w._blockCursorElement=T=(function(H){let F=H.theme,oe=document.createElement("div");oe.contentEditable="false",oe.setAttribute("data-lexical-cursor","true");let ee=F.blockCursor;if(ee!==void 0){if(typeof ee=="string"){let W=au(ee);ee=F.blockCursor=W}ee!==void 0&&oe.classList.add(...ee)}return oe})(w._config)),k.style.caretColor="transparent",void($===null?U.appendChild(T):U.insertBefore(T,$))}}T!==null&&tx(T,w,k)})(e,o,s)}finally{m!==null&&m.observe(o,mk),Xn=f,Qn=d}}h!==null&&(function(w,k,I,T,E){let A=Array.from(w._listeners.mutation),N=A.length;for(let R=0;R<N;R++){let[$,U]=A[R];for(let H of U){let F=k.get(H);F!==void 0&&$(F,{dirtyLeaves:T,prevEditorState:E,updateTags:I})}}})(e,h,y,g,a),je(s)||s===null||i!==null&&i.is(s)||e.dispatchCommand(ux,void 0);let L=e._pendingDecorators;L!==null&&(e._decorators=L,e._pendingDecorators=null,Fc("decorator",e,!0,L)),(function(w,k,I){let T=bk(k),E=bk(I);T!==E&&Fc("textcontent",w,!0,E)})(e,t||a,n),Fc("update",e,!0,{dirtyElements:v,dirtyLeaves:g,editorState:n,mutatedNodes:h,normalizedNodes:x,prevEditorState:t||a,tags:y}),(function(w,k){if(w._deferred=[],k.length!==0){let I=w._updating;w._updating=!0;try{for(let T=0;T<k.length;T++)k[T]()}finally{w._updating=I}}})(e,C),(function(w){let k=w._updates;if(k.length!==0){let I=k.shift();if(I){let[T,E]=I;om(w,T,E)}}})(e)}function Fc(e,t,n,...o){let r=t._updating;t._updating=n;try{let a=Array.from(t._listeners[e]);for(let i=0;i<a.length;i++)a[i].apply(null,o)}finally{t._updating=r}}function xk(e,t){let n=e._updates,o=t||!1;for(;n.length!==0;){let r=n.shift();if(r){let[a,i]=r,s=e._pendingEditorState,l;i!==void 0&&(l=i.onUpdate,i.skipTransforms&&(o=!0),i.discrete&&(s===null&&J(191),s._flushSync=!0),l&&e._deferred.push(l),RL(e,i.tag)),s==null?om(e,a,i):a()}}return o}function om(e,t,n){let o=e._updateTags,r,a=!1,i=!1;n!==void 0&&(r=n.onUpdate,RL(e,n.tag),a=n.skipTransforms||!1,i=n.discrete||!1),r&&e._deferred.push(r);let s=e._editorState,l=e._pendingEditorState,d=!1;(l===null||l._readOnly)&&(l=e._pendingEditorState=NL(l||s),d=!0),l._flushSync=i;let c=Qn,f=zo,p=Xn,m=e._updating;Qn=l,zo=!1,e._updating=!0,Xn=e;let h=e._headless||e.getRootElement()===null;Lx(null);try{d&&(h?s._selection!==null&&(l._selection=s._selection.clone()):l._selection=(function(y,C){let S=y.getEditorState()._selection,L=Nr(Xo(y));return je(S)||S==null?nm(S,L,y,C):S.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=xk(e,a),(function(y,C){let S=C.getEditorState()._selection,L=y._selection;if(je(L)){let w=L.anchor,k=L.focus,I;if(w.type==="text"&&(I=w.getNode(),I.selectionTransform(S,L)),k.type==="text"){let T=k.getNode();I!==T&&T.selectionTransform(S,L)}}})(l,e),e._dirtyType!==0&&(a?(function(y,C){let S=C._dirtyLeaves,L=y._nodeMap;for(let w of S){let k=L.get(w);Me(k)&&k.isAttached()&&k.isSimpleText()&&!k.isUnmergeable()&&WT(k)}})(l,e):(function(y,C){let S=C._dirtyLeaves,L=C._dirtyElements,w=y._nodeMap,k=wi(),I=new Map,T=S,E=T.size,A=L,N=A.size;for(;E>0||N>0;){if(E>0){C._dirtyLeaves=new Set;for(let R of T){let $=w.get(R);Me($)&&$.isAttached()&&$.isSimpleText()&&!$.isUnmergeable()&&WT($),$!==void 0&&hk($,k)&&gk(C,$,I),S.add(R)}if(T=C._dirtyLeaves,E=T.size,E>0){Rp++;continue}}C._dirtyLeaves=new Set,C._dirtyElements=new Map,A.delete("root")&&A.set("root",!0);for(let R of A){let $=R[0],U=R[1];if(L.set($,U),!U)continue;let H=w.get($);H!==void 0&&hk(H,k)&&gk(C,H,I)}T=C._dirtyLeaves,E=T.size,A=C._dirtyElements,N=A.size,Rp++}C._dirtyLeaves=S,C._dirtyElements=L})(l,e),xk(e),(function(y,C,S,L){let w=y._nodeMap,k=C._nodeMap,I=[];for(let[T]of L){let E=k.get(T);E!==void 0&&(E.isAttached()||(Q(E)&&_k(E,T,w,k,I,L),w.has(T)||L.delete(T),I.push(T)))}for(let T of I)k.delete(T);for(let T of S){let E=k.get(T);E===void 0||E.isAttached()||(w.has(T)||S.delete(T),k.delete(T))}})(s,l,e._dirtyLeaves,e._dirtyElements)),v!==e._compositionKey&&(l._flushSync=!0);let x=l._selection;if(je(x)){let y=l._nodeMap,C=x.anchor.key,S=x.focus.key;y.get(C)!==void 0&&y.get(S)!==void 0||J(19)}else Zc(x)&&x._nodes.size===0&&(l._selection=null)}catch(v){return v instanceof Error&&e._onError(v),e._pendingEditorState=s,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Da(e)}finally{Qn=c,zo=f,Xn=p,e._updating=m,Rp=0}e._dirtyType!==0||e._deferred.length>0||(function(v,x){let y=x.getEditorState()._selection,C=v._selection;if(C!==null){if(C.dirty||!C.is(y))return!0}else if(y!==null)return!0;return!1})(l,e)?l._flushSync?(l._flushSync=!1,Da(e)):d&&vH(()=>{Da(e)}):(l._flushSync=!1,d&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function ia(e,t,n){Xn===e&&n===void 0?t():om(e,t,n)}var Zv=class e{element;before;after;constructor(t,n,o){this.element=t,this.before=n||null,this.after=o||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(t){let n=this.before||this.getManagedLineBreak();return n!==null&&n.parentElement!==this.element&&J(222),this.element.insertBefore(t,n),this}removeChild(t){return t.parentElement!==this.element&&J(223),this.element.removeChild(t),this}replaceChild(t,n){return n.parentElement!==this.element&&J(224),this.element.replaceChild(t,n),this}getFirstChild(){let t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(t===null)this.removeManagedLineBreak();else{let n=t==="decorator"&&(Jp||Jc||Yp);this.insertManagedLineBreak(n)}}removeManagedLineBreak(){let t=this.getManagedLineBreak();if(t){let n=this.element,o=t.nodeName==="IMG"?t.nextSibling:null;o&&n.removeChild(o),n.removeChild(t),n.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){let n=this.getManagedLineBreak();if(n){if(t===(n.nodeName==="IMG"))return;this.removeManagedLineBreak()}let o=this.element,r=this.before,a=document.createElement("br");if(o.insertBefore(a,r),t){let i=document.createElement("img");i.setAttribute("data-lexical-linebreak","true"),i.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",i.alt="",o.insertBefore(i,a),o.__lexicalLineBreak=i}else o.__lexicalLineBreak=a}getFirstChildOffset(){let t=0;for(let n=this.after;n!==null;n=n.previousSibling)t++;return t}resolveChildIndex(t,n,o,r){if(o===this.element){let l=this.getFirstChildOffset();return[t,Math.min(l+t.getChildrenSize(),Math.max(l,r))]}let a=yk(n,o);a.push(r);let i=yk(n,this.element),s=t.getIndexWithinParent();for(let l=0;l<i.length;l++){let d=a[l],c=i[l];if(d===void 0||d<c)break;if(d>c){s+=1;break}}return[t.getParentOrThrow(),s]}};function yk(e,t){let n=[],o=t;for(;o!==e&&o!==null;o=o.parentNode){let r=0;for(let a=o.previousSibling;a!==null;a=a.previousSibling)r++;n.push(r)}return o!==e&&J(225),n.reverse()}var Pi=class extends fr{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(t){super(t),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){let t=this.getFormat();return p$[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getChildrenKeys(){let t=[],n=this.getFirstChild();for(;n!==null;)t.push(n.__key),n=n.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let t=qt()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){let t=this.getLatest(),n=this.getParentOrThrow().getLastChild();return n!==null&&n.is(t)}getAllTextNodes(){let t=[],n=this.getFirstChild();for(;n!==null;){if(Me(n)&&t.push(n),Q(n)){let o=n.getAllTextNodes();t.push(...o)}n=n.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;Q(t);){let n=t.getFirstChild();if(n===null)break;t=n}return t}getLastDescendant(){let t=this.getLastChild();for(;Q(t);){let n=t.getLastChild();if(n===null)break;t=n}return t}getDescendantByIndex(t){let n=this.getChildren(),o=n.length;if(t>=o){let a=n[o-1];return Q(a)&&a.getLastDescendant()||a||null}let r=n[t];return Q(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:$n(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&J(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:$n(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&J(96,this.__key),t}getChildAtIndex(t){let n=this.getChildrenSize(),o,r;if(t<n/2){for(o=this.getFirstChild(),r=0;o!==null&&r<=t;){if(r===t)return o;o=o.getNextSibling(),r++}return null}for(o=this.getLastChild(),r=n-1;o!==null&&r>=t;){if(r===t)return o;o=o.getPreviousSibling(),r--}return null}getTextContent(){let t="",n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContent(),Q(a)&&r!==o-1&&!a.isInline()&&(t+=Zp)}return t}getTextContentSize(){let t=0,n=this.getChildren(),o=n.length;for(let r=0;r<o;r++){let a=n[r];t+=a.getTextContentSize(),Q(a)&&r!==o-1&&!a.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(t!==""){let n=Mv[t];return(this.getFormat()&n)!==0}return!1}hasTextFormat(t){let n=go[t];return(this.getTextFormat()&n)!==0}getFormatFlags(t,n){return Xc(this.getLatest().__textFormat,t,n)}getTextStyle(){return this.getLatest().__textStyle}select(t,n){Gn();let o=wt(),r=t,a=n,i=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&n===0){let l=this.getFirstChild();if(Me(l)||Q(l))return l.select(0,0)}else if(!(t!==void 0&&t!==i||n!==void 0&&n!==i)){let l=this.getLastChild();if(Me(l)||Q(l))return l.select()}}r===void 0&&(r=i),a===void 0&&(a=i);let s=this.__key;return je(o)?(o.anchor.set(s,r,"element"),o.focus.set(s,a,"element"),o.dirty=!0,o):LL(s,r,s,a,"element","element")}selectStart(){let t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){let t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){let t=this.getWritable();return this.getChildren().forEach(n=>n.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){let n=this.getWritable();return n.__dir=t,n}setFormat(t){return this.getWritable().__format=t!==""?Mv[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){let n=this.getWritable();return n.__textFormat=t,n}setTextStyle(t){let n=this.getWritable();return n.__textStyle=t,n}setIndent(t){return this.getWritable().__indent=t,this}splice(t,n,o){Kp(this)&&J(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+n<=r||J(226,String(t),String(n),String(r));let i=a.__key,s=[],l=[],d=this.getChildAtIndex(t+n),c=null,f=r-n+o.length;if(t!==0)if(t===r)c=this.getLastChild();else{let m=this.getChildAtIndex(t);m!==null&&(c=m.getPreviousSibling())}if(n>0){let m=c===null?this.getFirstChild():c.getNextSibling();for(let h=0;h<n;h++){m===null&&J(100);let g=m.getNextSibling(),v=m.__key;ki(m.getWritable()),l.push(v),m=g}}let p=c;for(let m of o){p!==null&&m.is(p)&&(c=p=p.getPreviousSibling());let h=m.getWritable();h.__parent===i&&f--,ki(h);let g=m.__key;if(p===null)a.__first=g,h.__prev=null;else{let v=p.getWritable();v.__next=g,h.__prev=v.__key}m.__key===i&&J(76),h.__parent=i,s.push(g),p=m}if(t+n===r)p!==null&&(p.getWritable().__next=null,a.__last=p.__key);else if(d!==null){let m=d.getWritable();if(p!==null){let h=p.getWritable();m.__prev=p.__key,h.__next=d.__key}else m.__prev=null}if(a.__size=f,l.length){let m=wt();if(je(m)){let h=new Set(l),g=new Set(s),{anchor:v,focus:x}=m;Ck(v,h,g)&&Wp(v,v.getNode(),this,c,d),Ck(x,h,g)&&Wp(x,x.getNode(),this,c,d),f!==0||this.canBeEmpty()||pr(this)||this.remove()}}return a}getDOMSlot(t){return new Zv(t)}exportDOM(t){let{element:n}=super.exportDOM(t);if(ko(n)){let o=this.getIndent();o>0&&(n.style.paddingInlineStart=40*o+"px");let r=this.getDirection();r&&(n.dir=r)}return{element:n}}exportJSON(){let t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},n=this.getTextFormat(),o=this.getTextStyle();return n===0&&o===""||pr(this)||this.getChildren().some(Me)||(n!==0&&(t.textFormat=n),o!==""&&(t.textStyle=o)),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,n){return null}canIndent(){return!0}collapseAtStart(t){return!1}excludeFromCopy(t){return!1}canReplaceWith(t){return!0}canInsertAfter(t){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(t){return!1}extractWithChild(t,n,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,n){let o=this.getDOMSlot(t),r=o.getFirstChild();for(let a=this.getFirstChild();a;a=a.getNextSibling()){let i=n.getElementByKey(a.getKey());i!==null&&(r==null?(o.insertChild(i),r=i):r!==i&&o.replaceChild(i,r),r=r.nextSibling)}}};function Q(e){return e instanceof Pi}function Ck(e,t,n){let o=e.getNode();for(;o;){let r=o.__key;if(t.has(r)&&!n.has(r))return!0;o=o.getParent()}return!1}var jc=class extends fr{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Qt(e){return e instanceof jc}var Vl=class e extends Pi{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){J(51)}getTextContent(){let t=this.__cachedText;return!Zl()&&qt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){J(52)}replace(t){J(53)}insertBefore(t){J(54)}insertAfter(t){J(55)}updateDOM(t,n){return!1}splice(t,n,o){for(let r of o)Q(r)||Qt(r)||J(282);return super.splice(t,n,o)}static importJSON(t){return Qo().updateFromJSON(t)}collapseAtStart(){return!0}};function no(e){return e instanceof Vl}function NL(e){return new Qc(new Map(e._nodeMap))}function kx(){return new Qc(new Map([["root",new Vl]]))}function _L(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&J(130,n.name),Q(e)){let o=t.children;Array.isArray(o)||J(59,n.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let i=_L(r[a]);o.push(i)}}return t}function dH(e){return e instanceof Qc}var Qc=class e{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,n){this._nodeMap=t,this._selection=n||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t,n){return vk(n&&n.editor||null,this,t)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t);return n._readOnly=!0,n}toJSON(){return vk(null,this,()=>({root:_L(Qo())}))}},Gp=class extends Pi{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},Wl=class e extends Pi{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let n=document.createElement("p"),o=Hl(t.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(t,n,o){return!1}static importDOM(){return{p:t=>({conversion:cH,priority:0})}}exportDOM(t){let{element:n}=super.exportDOM(t);if(ko(n)){this.isEmpty()&&n.append(document.createElement("br"));let o=this.getFormatType();o&&(n.style.textAlign=o)}return{element:n}}static importJSON(t){return Fa().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(Me);n?(t.textFormat=n.getFormat(),t.textStyle=n.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,n){let o=Fa();o.setTextFormat(t.format),o.setTextStyle(t.style);let r=this.getDirection();return o.setDirection(r),o.setFormat(this.getFormatType()),o.setStyle(this.getStyle()),this.insertAfter(o,n),o}collapseAtStart(){let t=this.getChildren();if(t.length===0||Me(t[0])&&t[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function cH(e){let t=Fa();if(e.style&&(t.setFormat(e.style.textAlign),nP(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in Mv&&t.setFormat(n)}return{node:t}}function Fa(){return ou(new Wl)}function DL(e){return e instanceof Wl}var Fl=0,uH=1,fH=2,pH=3,mH=4;function OL(e,t,n,o){let r=e._keyToDOMMap;r.clear(),e._editorState=kx(),e._pendingEditorState=o,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;let a=e._observer;a!==null&&(a.disconnect(),e._observer=null),t!==null&&(t.textContent=""),n!==null&&(n.textContent="",r.set("root",n))}function FL(e){let t=new Set,n=new Set,o=e;for(;o;){let{ownNodeConfig:r}=ru(o),a=o.transform;if(!n.has(a)){n.add(a);let i=o.transform();i&&t.add(i)}if(r){let i=r.$transform;i&&t.add(i),o=r.extends}else{let i=Object.getPrototypeOf(o);o=i.prototype instanceof fr&&i!==fr?i:void 0}}return t}function gH(e){let t=e||{},n=sH(),o=t.theme||{},r=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,i=kx(),s=t.namespace||(r!==null?r._config.namespace:VL()),l=t.editorState,d=[Vl,Ps,Ul,ql,Wl,Gp,...t.nodes||[]],{onError:c,html:f}=t,p=t.editable===void 0||t.editable,m;if(e===void 0&&n!==null)m=n._nodes;else{m=new Map;for(let g=0;g<d.length;g++){let v=d[g],x=null,y=null;if(typeof v!="function"){let L=v;v=L.replace,x=L.with,y=L.withKlass||null}ru(v);let C=v.getType(),S=FL(v);m.set(C,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:x,replaceWithKlass:y,sharedNodeState:Bk(d[g]),transforms:S})}}let h=new Ai(i,r,m,{disableEvents:a,namespace:s,theme:o},c||console.error,(function(g,v){let x=new Map,y=new Set,C=S=>{Object.keys(S).forEach(L=>{let w=x.get(L);w===void 0&&(w=[],x.set(L,w)),w.push(S[L])})};return g.forEach(S=>{let L=S.klass.importDOM;if(L==null||y.has(L))return;y.add(L);let w=L.call(S.klass);w!==null&&C(w)}),v&&C(v),x})(m,f?f.import:void 0),p,e);return l!==void 0&&(h._pendingEditorState=l,h._dirtyType=2),(function(g){g.registerCommand(fx,F$,Fl),g.registerCommand(px,B$,Fl),g.registerCommand(mx,z$,Fl),g.registerCommand(gx,$$,Fl),g.registerCommand(yx,H$,Fl)})(h),h}var Ai=class{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(t,n,o,r,a,i,s,l){this._createEditorArgs=l,this._parentEditor=n,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=o,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=VL(),this._onError=a,this._htmlConversions=i,this._editable=s,this._headless=n!==null&&n._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){let n=this._listeners.update;return n.add(t),()=>{n.delete(t)}}registerEditableListener(t){let n=this._listeners.editable;return n.add(t),()=>{n.delete(t)}}registerDecoratorListener(t){let n=this._listeners.decorator;return n.add(t),()=>{n.delete(t)}}registerTextContentListener(t){let n=this._listeners.textcontent;return n.add(t),()=>{n.delete(t)}}registerRootListener(t){let n=this._listeners.root;return t(this._rootElement,null),n.add(t),()=>{t(null,this._rootElement),n.delete(t)}}registerCommand(t,n,o){o===void 0&&J(35);let r=this._commands;r.has(t)||r.set(t,[new Set,new Set,new Set,new Set,new Set]);let a=r.get(t);a===void 0&&J(36,String(t));let i=a[o];return i.add(n),()=>{i.delete(n),a.every(s=>s.size===0)&&r.delete(t)}}registerMutationListener(t,n,o){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,a=this._listeners.mutation,i=a.get(n);i===void 0&&(i=new Set,a.set(n,i)),i.add(r);let s=o&&o.skipInitialization;return s!==void 0&&s||this.initializeMutationListener(n,r),()=>{i.delete(r),i.size===0&&a.delete(n)}}getRegisteredNode(t){let n=this._nodes.get(t.getType());return n===void 0&&J(37,t.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,n){let o=this._editorState,r=ox(o).get(n.getType());if(!r)return;let a=new Map;for(let i of r.keys())a.set(i,"created");a.size>0&&t(a,{dirtyLeaves:new Set,prevEditorState:o,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,n){let o=this.getRegisteredNode(t);return o.transforms.add(n),o}registerNodeTransform(t,n){let o=this.registerNodeTransformToKlass(t,n),r=[o],a=o.replaceWithKlass;if(a!=null){let i=this.registerNodeTransformToKlass(a,n);r.push(i)}return(function(i,s){let l=ox(i.getEditorState()),d=[];for(let c of s){let f=l.get(c);f&&d.push(f)}d.length!==0&&i.update(()=>{for(let c of d)for(let f of c.keys()){let p=$n(f);p&&p.markDirty()}},i._pendingEditorState===null?{tag:Mp}:void 0)})(this,r.map(i=>i.klass.getType())),()=>{r.forEach(i=>i.transforms.delete(n))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,n){return ye(this,t,n)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){let n=this._rootElement;if(t!==n){let o=Hl(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,OL(this,n,t,r),n!==null&&(this._config.disableEvents||U$(n),o!=null&&n.classList.remove(...o)),t!==null){let a=Bx(t),i=t.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=a,this._dirtyType=2,Fk(this),this._updateTags.add(Mp),Da(this),this._config.disableEvents||(function(s,l){let d=s.ownerDocument;Wv.set(s,d);let c=Hp.get(d)??0;c<1&&d.addEventListener("selectionchange",hL),Hp.set(d,c+1),s.__lexicalEditor=l;let f=gL(s);for(let p=0;p<Vv.length;p++){let[m,h]=Vv[p],g=typeof h=="function"?v=>{ZT(v)||(JT(v),(l.isEditable()||m==="click")&&h(v,l))}:v=>{if(ZT(v))return;JT(v);let x=l.isEditable();switch(m){case"cut":return x&&ye(l,bx,v);case"copy":return ye(l,Cx,v);case"paste":return x&&ye(l,hx,v);case"dragstart":return x&&ye(l,oL,v);case"dragover":return x&&ye(l,rL,v);case"dragend":return x&&ye(l,aL,v);case"focus":return x&&ye(l,iL,v);case"blur":return x&&ye(l,sL,v);case"drop":return x&&ye(l,nL,v)}};s.addEventListener(m,g),f.push(()=>{s.removeEventListener(m,g)})}})(t,this),o!=null&&t.classList.add(...o)}else this._window=null,this._updateTags.add(Mp),Da(this);Fc("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&J(38);let o=t;o._readOnly&&(o=NL(t),o._selection=t._selection?t._selection.clone():null),Ok(this);let r=this._pendingEditorState,a=this._updateTags,i=n!==void 0?n.tag:null;r===null||r.isEmpty()||(i!=null&&a.add(i),Da(this)),this._pendingEditorState=o,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&a.add(i),this._updating||Da(this)}parseEditorState(t,n){return(function(o,r,a){let i=kx(),s=Qn,l=zo,d=Xn,c=r._dirtyElements,f=r._dirtyLeaves,p=r._cloneNotNeeded,m=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,Qn=i,zo=!1,Xn=r,Lx(null);try{let h=r._nodes;Tx(o.root,h),a&&a(),i._readOnly=!0}catch(h){h instanceof Error&&r._onError(h)}finally{r._dirtyElements=c,r._dirtyLeaves=f,r._cloneNotNeeded=p,r._dirtyType=m,Qn=s,zo=l,Xn=d}return i})(typeof t=="string"?JSON.parse(t):t,this,n)}read(t){return Da(this),this.getEditorState().read(t,{editor:this})}update(t,n){(function(o,r,a){o._updating?o._updates.push([r,a]):om(o,r,a)})(this,t,n)}focus(t,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),ia(this,()=>{let r=wt(),a=Qo();r!==null?r.dirty||$o(r.clone()):a.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),sm("focus"),XL(()=>{o.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let n=Nr(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,Fc("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};Ai.version="0.41.0+prod.esm";var ex=null;function Lx(e){ex=e}var BL=1;function hH(){BL=1}function Px(e,t){let n=Ax(e,t);return n===void 0&&J(30,t),n}function Ax(e,t){return e._nodes.get(t)}var vH=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function zL(e){return Qt(im(e))}function Ex(e){let t=document.activeElement;if(!ko(t))return!1;let n=t.nodeName;return Qt(im(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&tu(t)==null)}function eu(e,t,n){let o=e.getRootElement();try{return o!==null&&o.contains(t)&&o.contains(n)&&t!==null&&!Ex(t)&&Mx(t)===e}catch{return!1}}function rm(e){return e instanceof Ai}function Mx(e){let t=e;for(;t!=null;){let n=tu(t);if(rm(n))return n;t=nu(t)}return null}function tu(e){return e?e.__lexicalEditor:null}function xH(e){return c$.test(e)?"rtl":u$.test(e)?"ltr":null}function Ti(e){return Sx(e)||e.isToken()}function _a(e){return Ti(e)||e.isSegmented()}function sa(e){return ed(e)&&e.nodeType===3}function $L(e){return ed(e)&&e.nodeType===9}function Es(e){let t=e;for(;t!=null;){if(sa(t))return t;t=t.firstChild}return null}function Xc(e,t,n){let o=go[t];if(n!==null&&(e&o)===(n&o))return e;let r=e^o;return t==="subscript"?r&=~go.superscript:t==="superscript"?r&=~go.subscript:t==="lowercase"?(r&=~go.uppercase,r&=~go.capitalize):t==="uppercase"?(r&=~go.lowercase,r&=~go.capitalize):t==="capitalize"&&(r&=~go.lowercase,r&=~go.uppercase),r}function yH(e){return Me(e)||Ts(e)||Qt(e)}function HL(e,t){let n=(function(){let i=ex;return ex=null,i})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);Gn(),EL();let o=qt(),r=$a(),a=""+BL++;r._nodeMap.set(a,e),Q(e)?o._dirtyElements.set(a,!0):o._dirtyLeaves.add(a),o._cloneNotNeeded.add(a),o._dirtyType=1,e.__key=a}function ki(e){let t=e.getParent();if(t!==null){let n=e.getWritable(),o=t.getWritable(),r=e.getPreviousSibling(),a=e.getNextSibling(),i=a!==null?a.__key:null,s=r!==null?r.__key:null,l=r!==null?r.getWritable():null,d=a!==null?a.getWritable():null;r===null&&(o.__first=i),a===null&&(o.__last=s),l!==null&&(l.__next=i),d!==null&&(d.__prev=s),n.__prev=null,n.__next=null,n.__parent=null,o.__size--}}function jp(e){EL(),Kp(e)&&J(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,o=$a(),r=qt(),a=o._nodeMap,i=r._dirtyElements;n!==null&&(function(l,d,c){let f=l;for(;f!==null;){if(c.has(f))return;let p=d.get(f);if(p===void 0)break;c.set(f,!1),f=p.__parent}})(n,a,i);let s=t.__key;r._dirtyType=1,Q(e)?i.set(s,!0):r._dirtyLeaves.add(s)}function jn(e){Gn();let t=qt(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let o=$n(n);o!==null&&o.getWritable()}if(e!==null){let o=$n(e);o!==null&&o.getWritable()}}}function wi(){return Zl()?null:qt()._compositionKey}function $n(e,t){let n=(t||$a())._nodeMap.get(e);return n===void 0?null:n}function Rx(e,t){let n=am(e,qt());return n!==void 0?$n(n,t):null}function am(e,t){return e[`__lexicalKey_${t._key}`]}function im(e,t){let n=e;for(;n!=null;){let o=Rx(n,t);if(o!==null)return o;n=nu(n)}return null}function UL(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function bk(e){return e.read(()=>Qo().getTextContent())}function Qo(){return KL($a())}function KL(e){return e._nodeMap.get("root")}function $o(e){Gn();let t=$a();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Bl(e){let t=qt(),n=(function(o,r){let a=o;for(;a!=null;){let i=am(a,r);if(i!==void 0)return i;a=nu(a)}return null})(e,t);return n===null?e===t.getRootElement()?$n("root"):null:$n(n)}function qL(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Nx(e){let t=[],n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function VL(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function WL(e){return sa(e)?e.nodeValue:null}function _x(e,t,n){let o=Nr(Xo(t));if(o===null)return;let r=o.anchorNode,{anchorOffset:a,focusOffset:i}=o;if(r!==null){let s=WL(r),l=im(r);if(s!==null&&Me(l)){if((s===Hc||s===lx)&&n){let d=n.length;s=n,a=d,i=d}s!==null&&Dx(l,s,a,i,e)}}}function Dx(e,t,n,o,r){let a=e;if(a.isAttached()&&(r||!a.isDirty())){let i=a.isComposing(),s=t;if((i||r)&&(t.endsWith(Hc)&&(s=t.slice(0,-Hc.length)),r)){let d=lx,c;for(;(c=s.indexOf(d))!==-1;)s=s.slice(0,c)+s.slice(c+d.length),n!==null&&n>c&&(n=Math.max(c,n-d.length)),o!==null&&o>c&&(o=Math.max(c,o-d.length))}let l=a.getTextContent();if(r||s!==l){if(s===""){if(jn(null),Yp||Jc||Jp)a.remove();else{let g=qt();setTimeout(()=>{g.update(()=>{a.isAttached()&&a.remove()})},20)}return}let d=a.getParent(),c=Rs(),f=a.getTextContentSize(),p=wi(),m=a.getKey();if(a.isToken()||p!==null&&m===p&&!i||je(c)&&(d!==null&&!d.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===e.__key&&c.anchor.offset===0&&!a.canInsertTextBefore()&&!i||c.focus.key===e.__key&&c.focus.offset===f&&!a.canInsertTextAfter()&&!i))return void a.markDirty();let h=wt();if(!je(h)||n===null||o===null)return void Ik(a,s,h);if(h.setTextNodeRange(a,n,a,o),a.isSegmented()){let g=Wn(a.getTextContent());a.replace(g),a=g}Ik(a,s,h)}}}function Ik(e,t,n){if(e.setTextContent(t),je(n)){let o=e.getKey();for(let r of["anchor","focus"]){let a=n[r];a.type==="text"&&a.key===o&&(a.offset=Er(e,a.offset,"clamp"))}}}function Tp(e,t,n){let o=t[n]||!1;return o==="any"||o===e[n]}function GL(e,t){return Tp(e,t,"altKey")&&Tp(e,t,"ctrlKey")&&Tp(e,t,"shiftKey")&&Tp(e,t,"metaKey")}function Mt(e,t,n){if(!GL(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||e.key.length===1&&e.key.charCodeAt(0)<=127)return!1;let o="Key"+t.toUpperCase();return e.code===o}var Na={ctrlKey:!kr,metaKey:kr},Sk={altKey:kr,ctrlKey:!kr};function wk(e){return e.key==="Backspace"}function Tk(e){return Mt(e,"a",Na)}function CH(e){let t=Qo();if(je(e)){let n=e.anchor,o=e.focus,r=n.getNode().getTopLevelElementOrThrow().getParentOrThrow();return n.set(r.getKey(),0,"element"),o.set(r.getKey(),r.getChildrenSize(),"element"),Dp(e),e}{let n=t.select(0,t.getChildrenSize());return $o(Dp(n)),n}}function Hl(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,o=n[t];if(o!==void 0)return o;let r=e[t];if(typeof r=="string"){let a=au(r);return n[t]=a,a}return r}function Ox(e,t,n,o,r){if(n.size===0)return;let a=o.__type,i=o.__key,s=t.get(a);s===void 0&&J(33,a);let l=s.klass,d=e.get(l);d===void 0&&(d=new Map,e.set(l,d));let c=d.get(i),f=c==="destroyed"&&r==="created";(c===void 0||f)&&d.set(i,f?"updated":r)}function bH(e){let t=e.getType(),n=$a();if(n._readOnly){let a=ox(n).get(t);return a?Array.from(a.values()):[]}let o=n._nodeMap,r=[];for(let[,a]of o)a instanceof e&&a.__type===t&&a.isAttached()&&r.push(a);return r}function kk(e,t,n){let o=e.getParent(),r=n,a=e;return o!==null&&(t&&n===0?(r=a.getIndexWithinParent(),a=o):t||n!==a.getChildrenSize()||(r=a.getIndexWithinParent()+1,a=o)),a.getChildAtIndex(t?r-1:r)}function jL(e,t){let n=e.offset;if(e.type==="element")return kk(e.getNode(),t,n);{let o=e.getNode();if(t&&n===0||!t&&n===o.getTextContentSize()){let r=t?o.getPreviousSibling():o.getNextSibling();return r===null?kk(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function QL(e){let t=Xo(e).event,n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function ye(e,t,n){return(function(o,r,a){let i=Nx(o);for(let s=4;s>=0;s--)for(let l=0;l<i.length;l++){let d=i[l],c=d._commands.get(r);if(c!==void 0){let f=c[s];if(f!==void 0){let p=Array.from(f),m=p.length,h=!1;if(ia(d,()=>{for(let g=0;g<m;g++)if(p[g](a,o))return void(h=!0)}),h)return h}}}return!1})(e,t,n)}function Gl(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&J(75,t),n}function nu(e){let t=e.assignedSlot||e.parentElement;return eP(t)?t.host:t}function Fx(e){return $L(e)?e:ko(e)?e.ownerDocument:null}function IH(e){return qt()._updateTags.has(e)}function sm(e){Gn(),qt()._updateTags.add(e)}function XL(e){Gn(),qt()._deferred.push(e)}function Qp(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function Bx(e){let t=Fx(e);return t?t.defaultView:null}function Xo(e){let t=e._window;return t===null&&J(78),t}function SH(e){return Q(e)&&e.isInline()||Qt(e)&&e.isInline()}function YL(e){let t=e.getParentOrThrow();for(;t!==null;){if(pr(t))return t;t=t.getParentOrThrow()}return t}function pr(e){return no(e)||Q(e)&&e.isShadowRoot()}function zx(e){let t=e.constructor.clone(e);return HL(t,null),t.afterCloneFrom(e),t}function ou(e){let t=qt(),n=e.getType(),o=Ax(t,n);o===void 0&&J(200,e.constructor.name,n);let{replace:r,replaceWithKlass:a}=o;if(r!==null){let i=r(e),s=i.constructor;return a!==null?i instanceof a||J(201,a.name,a.getType(),s.name,s.getType(),e.constructor.name,n):i instanceof e.constructor&&s!==e.constructor||J(202,s.name,s.getType(),e.constructor.name,n),i.__key===e.__key&&J(203,e.constructor.name,n,s.name,s.getType()),i}return e}function Lv(e,t){!no(e.getParent())||Q(t)||Qt(t)||J(99)}function JL(e){let t=$n(e);return t===null&&J(63,e),t}function Pv(e){return(Qt(e)||Q(e)&&!e.canBeEmpty())&&!e.isInline()}function tx(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;let o=e.parentElement;o!==null&&o.removeChild(e)}function Nr(e){return Rr?(e||window).getSelection():null}function ZL(e){let t=Bx(e);return t?t.getSelection():null}function wH(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),pr(e)&&J(102);let o=i=>{let s=i.getParentOrThrow(),l=pr(s),d=i!==n||l?zx(i):i;if(l)return Q(i)&&Q(d)||J(133),i.insertAfter(d),[i,d,d];{let[c,f,p]=o(s),m=i.getNextSiblings();return p.append(d,...m),[c,f,d]}},[r,a]=o(n);return[r,a]}function TH(e){return ko(e)&&e.tagName==="A"}function ko(e){return ed(e)&&e.nodeType===1}function ed(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function eP(e){return ed(e)&&e.nodeType===11}function tP(e){let t=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return e.nodeName.match(t)!==null}function nx(e){let t=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return e.nodeName.match(t)!==null}function Oa(e){if(Qt(e)&&!e.isInline())return!0;if(!Q(e)||pr(e))return!1;let t=e.getFirstChild(),n=t===null||Ts(t)||Me(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&n}function $x(){return qt()}var Lk=new WeakMap,kH=new Map;function ox(e){if(!e._readOnly&&e.isEmpty())return kH;e._readOnly||J(192);let t=Lk.get(e);return t||(t=(function(n){let o=new Map;for(let[r,a]of n._nodeMap){let i=a.__type,s=o.get(i);s||(s=new Map,o.set(i,s)),s.set(r,a)}return o})(e),Lk.set(e,t)),t}function Hx(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function LH(e){return(t=Hx(e))[vL]=!0,t;var t}function nP(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function PH(e){e.__lexicalUnmanaged=!0}function oP(e){return e.__lexicalUnmanaged===!0}function Nc(e,t){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(e,t)&&e[t]!==fr[t]}function ru(e){let t=zT in e.prototype?e.prototype[zT]():void 0,n=(function(i){if(!(i===fr||i.prototype instanceof fr)){let s="<unknown>",l="<unknown>";try{s=i.getType()}catch{}try{Ai.version&&(l=JSON.parse(Ai.version))}catch{}J(290,i.name,s,l)}return i===jc||i===Pi||i===fr})(e),o=!n&&Nc(e,"getType")?e.getType():void 0,r,a=o;if(t)if(o)r=t[o];else for(let[i,s]of Object.entries(t))a=i,r=s;if(!n&&a&&(Nc(e,"getType")||(e.getType=()=>a),Nc(e,"clone")||(e.clone=i=>(Lx(i),new e)),Nc(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(i=>new e().updateFromJSON(i))),!Nc(e,"importDOM")&&r)){let{importDOM:i}=r;i&&(e.importDOM=()=>i)}return{ownNodeConfig:r,ownNodeType:a}}function AH(e){let t=$x();return Gn(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Bc=(e,t)=>{let n=e;for(;n!=null&&!no(n);){if(t(n))return n;n=n.getParent()}return null},EH={next:"previous",previous:"next"},jl=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return qx({hasNext:Ms,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return Yn(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Yn(this.origin,this.direction)}remove(){let t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,n){let o=this.getNodeAtCaret();return t.is(this.origin)||t.is(o)||(o===null?this.insert(t):o.replace(t,n)),this}splice(t,n,o="next"){let r=o===this.direction?n:Array.from(n).reverse(),a=this,i=this.getParentAtCaret(),s=new Map;for(let l=a.getAdjacentCaret();l!==null&&s.size<t;l=l.getAdjacentCaret()){let d=l.origin.getWritable();s.set(d.getKey(),d)}for(let l of r){if(s.size>0){let d=a.getNodeAtCaret();if(d){if(s.delete(d.getKey()),s.delete(l.getKey()),!(d.is(l)||a.origin.is(l))){let c=l.getParent();c&&c.is(i)&&l.remove(),d.replace(l)}}else d===null&&J(263,Array.from(s).join(" "))}else a.insert(l);a=Yn(l,this.direction)}for(let l of s.values())l.remove();return this}},Yc=class e extends jl{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:za(t,this.direction)}getParentCaret(t="root"){return Yn(Ux(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=_i(this.direction);return Yn(this.getNodeAtCaret(),t)||za(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}},MH={root:no,shadowRoot:pr};function _i(e){return EH[e]}function Ux(e,t="root"){return MH[t](e)?null:e}var Ql=class e extends jl{type="sibling";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Yn(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Q(this.origin)?za(this.origin,this.direction):null}getParentCaret(t="root"){return Yn(Ux(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=_i(this.direction);return Yn(this.getNodeAtCaret(),t)||za(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof e||t instanceof Xl)&&this.direction===t.direction&&this.origin.is(t.origin)}},Xl=class e extends jl{type="text";offset;constructor(t,n){super(t),this.offset=n}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Ei(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return Yn(Ux(this.getParentAtCaret(),t),this.direction)}getFlipped(){return Ei(this.origin,_i(this.direction),this.offset)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof Ql||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Yn(this.origin,this.direction)}};function Ba(e){return e instanceof Xl}function RH(e){return e instanceof jl}function Ms(e){return e instanceof Ql}function Ar(e){return e instanceof Yc}var NH={next:class extends Xl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Xl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},_H={next:class extends Ql{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ql{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},DH={next:class extends Yc{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Yc{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Yn(e,t){return e?new _H[t](e):null}function Ei(e,t,n){return e?new NH[t](e,Er(e,n)):null}function Er(e,t,n="error"){let o=e.getTextContentSize(),r=t==="next"?o:t==="previous"?0:t;return(r<0||r>o)&&(n!=="clamp"&&Ek(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function rx(e,t){return new Xp(e,t)}function za(e,t){return Q(e)?new DH[t](e):null}function rP(e){return e&&e.getChildCaret()||e}function Yl(e){return e&&rP(e.getAdjacentCaret())}var ax=class e{type="node-caret-range";direction;anchor;focus;constructor(t,n,o){this.anchor=t,this.focus=n,this.direction=o}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let t=r=>{let a=this[r].getLatest();return Ba(a)?(function(i,s){let{direction:l,origin:d}=i,c=Er(d,s==="focus"?_i(l):l);return rx(i,c-i.offset)})(a,r):null},n=t("anchor"),o=t("focus");if(n&&o){let{caret:r}=n,{caret:a}=o;if(r.isSameNodeCaret(a))return[rx(r,a.offset-r.offset),null]}return[n,o]}iterNodeCarets(t="root"){let n=Ba(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=Ba(o),a=i=>i.isSameNodeCaret(o)?null:Yl(i)||i.getParentCaret(t);return qx({hasNext:i=>i!==null&&!(r&&o.isSameNodeCaret(i)),initial:n.isSameNodeCaret(o)?null:a(n),map:i=>i,step:a})}[Symbol.iterator](){return this.iterNodeCarets("root")}},Xp=class{type="slice";caret;distance;constructor(t,n){this.caret=t,this.distance=n}getSliceIndices(){let{distance:t,caret:{offset:n}}=this,o=n+t;return o<n?[o,n]:[n,o]}getTextContent(){let[t,n]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,n)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:t,direction:n}}=this,[o,r]=this.getSliceIndices(),a=t.getTextContent();return Ei(t.setTextContent(a.slice(0,o)+a.slice(r)),n,o)}};function OH(e){return e instanceof Xp}function Kx(e){return Mi(e,Yn(Qo(),e.direction))}function aP(e){return Mi(e,e)}function Mi(e,t){return e.direction!==t.direction&&J(265),new ax(e,t,e.direction)}function qx(e){let{initial:t,hasNext:n,step:o,map:r}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let i={done:!1,value:r(a)};return a=o(a),i}}}function Vx(e,t){let n=zc(e.origin,t.origin);switch(n===null&&J(275,e.origin.getKey(),t.origin.getKey()),n.type){case"same":{let o=e.type==="text",r=t.type==="text";return o&&r?(function(a,i){return Math.sign(a-i)})(e.offset,t.offset):e.type===t.type?0:o?-1:r?1:e.type==="child"?-1:1}case"ancestor":return e.type==="child"?-1:1;case"descendant":return t.type==="child"?1:-1;case"branch":return Wx(n)}}function Wx(e){let{a:t,b:n}=e,o=t.__key,r=n.__key,a=t,i=n;for(;a&&i;a=a.getNextSibling(),i=i.getNextSibling()){if(a.__key===r)return-1;if(i.__key===o)return 1}return a===null?1:-1}function kp(e,t){return t.is(e)}function Pk(e){return Q(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function zc(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[o,r]=Pk(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=Pk(t);o;r=o,o=o.getParent()){let a=n.get(o);if(a!==void 0)return a===null?(kp(e,o)||J(276),{commonAncestor:o,type:"ancestor"}):r===null?(kp(t,o)||J(277),{commonAncestor:o,type:"descendant"}):((Q(a)||kp(e,a))&&(Q(r)||kp(t,r))&&o.is(a.getParent())&&o.is(r.getParent())||J(278),{a,b:r,commonAncestor:o,type:"branch"})}return null}function Ri(e,t){let{type:n,key:o,offset:r}=e,a=JL(e.key);return n==="text"?(Me(a)||J(266,a.getType(),o),Ei(a,t,r)):(Q(a)||J(267,a.getType(),o),dP(a,e.offset,t))}function Jl(e,t){let{origin:n,direction:o}=t,r=o==="next";Ba(t)?e.set(n.getKey(),t.offset,"text"):Ms(t)?Me(n)?e.set(n.getKey(),Er(n,o),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(Ar(t)&&Q(n)||J(268),e.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function iP(e){let t=wt(),n=je(t)?t:PL();return $c(n,e),$o(n),n}function $c(e,t){Jl(e.anchor,t.anchor),Jl(e.focus,t.focus)}function ix(e){let{anchor:t,focus:n}=e,o=Ri(t,"next"),r=Ri(n,"next"),a=Vx(o,r)<=0?"next":"previous";return Mi(Ni(o,a),Ni(r,a))}function td(e){let{direction:t,origin:n}=e,o=Yn(n,_i(t)).getNodeAtCaret();return o?Yn(o,t):za(n.getParentOrThrow(),t)}function Ak(e,t="root"){let n=[e];for(let o=Ar(e)?e.getParentCaret(t):e.getSiblingCaret();o!==null;o=o.getParentCaret(t))n.push(td(o));return n}function Av(e){return!!e&&e.origin.isAttached()}function sP(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=Gx(e,o),i=Ak(a.anchor,n),s=Ak(a.focus.getFlipped(),n),l=new Set,d=[];for(let h of a.iterNodeCarets(n))if(Ar(h))l.add(h.origin.getKey());else if(Ms(h)){let{origin:g}=h;Q(g)&&!l.has(g.getKey())||d.push(g)}for(let h of d)h.remove();for(let h of a.getTextSlices()){if(!h)continue;let{origin:g}=h.caret,v=g.getTextContentSize(),x=td(Yn(g,o)),y=g.getMode();if(Math.abs(h.distance)===v&&r==="removeEmptySlices"||y==="token"&&h.distance!==0)x.remove();else if(h.distance!==0){r="removeEmptySlices";let C=h.removeTextSlice(),S=h.caret.origin;if(y==="segmented"){let L=C.origin,w=Wn(L.getTextContent()).setStyle(L.getStyle()).setFormat(L.getFormat());x.replaceOrInsert(w),C=Ei(w,o,C.offset)}S.is(i[0].origin)&&(i[0]=C),S.is(s[0].origin)&&(s[0]=C.getFlipped())}}let c,f;for(let h of i)if(Av(h)){c=Lr(h);break}for(let h of s)if(Av(h)){f=Lr(h);break}let p=(function(h,g,v){if(!h||!g)return null;let x=h.getParentAtCaret(),y=g.getParentAtCaret();if(!x||!y)return null;let C=x.getParents().reverse();C.push(x);let S=y.getParents().reverse();S.push(y);let L=Math.min(C.length,S.length),w;for(w=0;w<L&&C[w]===S[w];w++);let k=(E,A)=>{let N;for(let R=w;R<E.length;R++){let $=E[R];if(pr($))return;!N&&A($)&&(N=$)}return N},I=k(C,Oa),T=I&&k(S,E=>v.has(E.getKey())&&Oa(E));return I&&T?[I,T]:null})(c,f,l);if(p){let[h,g]=p;za(h,"previous").splice(0,g.getChildren());let v=g.getParent();for(g.remove(!0);v&&v.isEmpty();){let x=v;v=v.getParent(),x.remove(!0)}}let m=[c,f,...i,...s].find(Av);if(m)return aP(Ni(Lr(m),e.direction));J(269,JSON.stringify(i.map(h=>h.origin.__key)))}function Lr(e){let t=(function(r){let a=r;for(;Ar(a);){let i=Yl(a);if(!Ar(i))break;a=i}return a})(e.getLatest()),{direction:n}=t;if(Me(t.origin))return Ba(t)?t:Ei(t.origin,n,n);let o=t.getAdjacentCaret();return Ms(o)&&Me(o.origin)?Ei(o.origin,n,_i(n)):t}function lP(e){return Ba(e)&&e.offset!==Er(e.origin,e.direction)}function Ni(e,t){return e.direction===t?e:e.getFlipped()}function Gx(e,t){return e.direction===t?e:Mi(Ni(e.focus,t),Ni(e.anchor,t))}function dP(e,t,n){let o=za(e,"next");for(let r=0;r<t;r++){let a=o.getAdjacentCaret();if(a===null)break;o=a}return Ni(o,n)}function FH(e,t="root"){let n=0,o=e,r=Yl(o);for(;r===null;){if(n--,r=o.getParentCaret(t),!r)return null;o=r,r=Yl(o)}return r&&[r,n]}function BH(e){let{origin:t,offset:n,direction:o}=e;if(n===Er(t,o))return e.getSiblingCaret();if(n===Er(t,_i(o)))return td(e.getSiblingCaret());let[r]=t.splitText(n);return Me(r)||J(281),Ni(Yn(r,"next"),o)}function zH(e,t){return!0}function $H(e,{$copyElementNode:t=zx,$splitTextPointCaretNext:n=BH,rootMode:o="shadowRoot",$shouldSplit:r=zH}={}){if(Ba(e))return n(e);let a=e.getParentCaret(o);if(a){let{origin:i}=a;if(Ar(e)&&(!i.canBeEmpty()||!r(i,"first")))return td(a);let s=(function(l){let d=[];for(let c=l.getAdjacentCaret();c;c=c.getAdjacentCaret())d.push(c.origin);return d})(e);(s.length>0||i.canBeEmpty()&&r(i,"last"))&&a.insert(t(i).splice(0,0,s))}return a}function HH(e){return e}function UH(...e){return e}function KH(e,t){return[e,t]}function qH(e){return e}function VH(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function au(...e){let t=[];for(let n of e)if(n&&typeof n=="string")for(let[o]of n.matchAll(/\S+/g))t.push(o);return t}function WH(e,...t){let n=au(...t);n.length>0&&e.classList.add(...n)}function GH(e,...t){let n=au(...t);n.length>0&&e.classList.remove(...n)}function jH(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var M=jx,lne=M.$addUpdateTag,lm=M.$applyNodeReplacement,nd=M.$caretFromPoint,cP=M.$caretRangeFromSelection,dm=M.$cloneWithProperties,uP=M.$cloneWithPropertiesEphemeral,dne=M.$comparePointCaretNext,cne=M.$copyNode,fP=M.$create,Ns=M.$createLineBreakNode,pP=M.$createNodeSelection,mr=M.$createParagraphNode,une=M.$createPoint,_s=M.$createRangeSelection,mP=M.$createRangeSelectionFromDom,gP=M.$createTabNode,_r=M.$createTextNode,hP=M.$extendCaretToRange,Ha=M.$findMatchingParent,Qx=M.$getAdjacentChildCaret,fne=M.$getAdjacentNode,Ds=M.$getAdjacentSiblingOrParentSiblingCaret,Xx=M.$getCaretInDirection,vP=M.$getCaretRange,pne=M.$getCaretRangeInDirection,xP=M.$getCharacterOffsets,Di=M.$getChildCaret,mne=M.$getChildCaretAtIndex,Yx=M.$getChildCaretOrSelf,yP=M.$getCollapsedCaretRange,gne=M.$getCommonAncestor,hne=M.$getCommonAncestorResultBranchOrder,cm=M.$getEditor,vne=M.$getNearestNodeFromDOMNode,xne=M.$getNearestRootOrShadowRoot,um=M.$getNodeByKey,yne=M.$getNodeByKeyOrThrow,CP=M.$getNodeFromDOMNode,iu=M.$getPreviousSelection,bt=M.$getRoot,$e=M.$getSelection,Ua=M.$getSiblingCaret,fm=M.$getState,Cne=M.$getStateChange,bne=M.$getTextContent,Ine=M.$getTextNodeOffset,Sne=M.$getTextPointCaret,wne=M.$getTextPointCaretSlice,Tne=M.$getWritableNodeState,bP=M.$hasAncestor,kne=M.$hasUpdateTag,Lne=M.$insertNodes,od=M.$isBlockElementNode,su=M.$isChildCaret,pm=M.$isDecoratorNode,IP=M.$isEditorState,Qe=M.$isElementNode,SP=M.$isExtendableTextPointCaret,Pne=M.$isInlineElementOrDecoratorNode,wP=M.$isLeafNode,rd=M.$isLineBreakNode,Ane=M.$isNodeCaret,Jx=M.$isNodeSelection,TP=M.$isParagraphNode,Se=M.$isRangeSelection,lu=M.$isRootNode,Os=M.$isRootOrShadowRoot,kP=M.$isSiblingCaret,Ene=M.$isTabNode,nt=M.$isTextNode,mm=M.$isTextPointCaret,Mne=M.$isTextPointCaretSlice,Zx=M.$isTokenOrSegmented,Rne=M.$isTokenOrTab,Nne=M.$nodesOfType,LP=M.$normalizeCaret,PP=M.$normalizeSelection__EXPERIMENTAL,_ne=M.$onUpdate,AP=M.$parseSerializedNode,Dne=M.$removeTextFromCaretRange,EP=M.$rewindSiblingCaret,gm=M.$selectAll,One=M.$setCompositionKey,Fne=M.$setPointFromCaret,Dr=M.$setSelection,MP=M.$setSelectionFromCaretRange,hm=M.$setState,RP=M.$splitAtPointCaretNext,NP=M.$splitNode,Bne=M.$updateRangeSelectionFromCaretRange,ey=M.ArtificialNode__DO_NOT_USE,zne=M.BEFORE_INPUT_COMMAND,_P=M.BLUR_COMMAND,du=M.CAN_REDO_COMMAND,cu=M.CAN_UNDO_COMMAND,vm=M.CLEAR_EDITOR_COMMAND,DP=M.CLEAR_HISTORY_COMMAND,OP=M.CLICK_COMMAND,$ne=M.COLLABORATION_TAG,xm=M.COMMAND_PRIORITY_CRITICAL,Xt=M.COMMAND_PRIORITY_EDITOR,Or=M.COMMAND_PRIORITY_HIGH,ad=M.COMMAND_PRIORITY_LOW,Hne=M.COMMAND_PRIORITY_NORMAL,Une=M.COMPOSITION_END_COMMAND,FP=M.COMPOSITION_END_TAG,Kne=M.COMPOSITION_START_COMMAND,BP=M.COMPOSITION_START_TAG,zP=M.CONTROLLED_TEXT_INSERTION_COMMAND,ym=M.COPY_COMMAND,$P=M.CUT_COMMAND,Cm=M.DELETE_CHARACTER_COMMAND,HP=M.DELETE_LINE_COMMAND,UP=M.DELETE_WORD_COMMAND,qne=M.DRAGEND_COMMAND,Vne=M.DRAGOVER_COMMAND,KP=M.DRAGSTART_COMMAND,qP=M.DROP_COMMAND,Ka=M.DecoratorNode,Wne=M.ElementNode,VP=M.FOCUS_COMMAND,Gne=M.FORMAT_ELEMENT_COMMAND,WP=M.FORMAT_TEXT_COMMAND,bm=M.HISTORIC_TAG,Fr=M.HISTORY_MERGE_TAG,GP=M.HISTORY_PUSH_TAG,ty=M.INDENT_CONTENT_COMMAND,jne=M.INPUT_COMMAND,ny=M.INSERT_LINE_BREAK_COMMAND,jP=M.INSERT_PARAGRAPH_COMMAND,QP=M.INSERT_TAB_COMMAND,uu=M.INTERNAL_$isBlock,Qne=M.IS_ALL_FORMATTING,Xne=M.IS_BOLD,Yne=M.IS_CODE,Jne=M.IS_HIGHLIGHT,Zne=M.IS_ITALIC,eoe=M.IS_STRIKETHROUGH,toe=M.IS_SUBSCRIPT,noe=M.IS_SUPERSCRIPT,ooe=M.IS_UNDERLINE,XP=M.KEY_ARROW_DOWN_COMMAND,Im=M.KEY_ARROW_LEFT_COMMAND,Sm=M.KEY_ARROW_RIGHT_COMMAND,YP=M.KEY_ARROW_UP_COMMAND,wm=M.KEY_BACKSPACE_COMMAND,JP=M.KEY_DELETE_COMMAND,ZP=M.KEY_DOWN_COMMAND,Tm=M.KEY_ENTER_COMMAND,roe=M.KEY_ESCAPE_COMMAND,aoe=M.KEY_MODIFIER_COMMAND,ioe=M.KEY_SPACE_COMMAND,km=M.KEY_TAB_COMMAND,eA=M.LineBreakNode,soe=M.MOVE_TO_END,loe=M.MOVE_TO_START,doe=M.NODE_STATE_KEY,tA=M.OUTDENT_CONTENT_COMMAND,Lm=M.PASTE_COMMAND,nA=M.PASTE_TAG,oA=M.ParagraphNode,rA=M.REDO_COMMAND,aA=M.REMOVE_TEXT_COMMAND,iA=M.RootNode,coe=M.SELECTION_CHANGE_COMMAND,sA=M.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,lA=M.SELECT_ALL_COMMAND,uoe=M.SKIP_COLLAB_TAG,foe=M.SKIP_DOM_SELECTION_TAG,poe=M.SKIP_SCROLL_INTO_VIEW_TAG,moe=M.SKIP_SELECTION_FOCUS_TAG,dA=M.TEXT_TYPE_TO_FORMAT,cA=M.TabNode,Pm=M.TextNode,uA=M.UNDO_COMMAND,fu=M.addClassNamesToElement,goe=M.buildImportMap,Am=M.configExtension,fA=M.createCommand,Em=M.createEditor,hoe=M.createSharedNodeState,pA=M.createState,mA=M.declarePeerDependency,Nn=M.defineExtension,voe=M.flipDirection,xoe=M.getDOMOwnerDocument,oy=M.getDOMSelection,yoe=M.getDOMSelectionFromTarget,gA=M.getDOMTextNode,Coe=M.getEditorPropertyFromDOMNode,boe=M.getNearestEditorFromDOMNode,hA=M.getRegisteredNode,Ioe=M.getRegisteredNodeOrThrow,Soe=M.getStaticNodeConfig,woe=M.getTextDirection,Toe=M.getTransformSetFromKlass,vA=M.isBlockDomNode,koe=M.isCurrentlyReadOnlyMode,xA=M.isDOMDocumentNode,yA=M.isDOMNode,Loe=M.isDOMTextNode,Poe=M.isDOMUnmanaged,ry=M.isDocumentFragment,Aoe=M.isExactShortcutMatch,CA=M.isHTMLAnchorElement,Mm=M.isHTMLElement,pu=M.isInlineDomNode,Eoe=M.isLexicalEditor,Moe=M.isModifierMatch,Roe=M.isSelectionCapturedInDecoratorInput,bA=M.isSelectionWithinEditor,ay=M.makeStepwiseIterator,la=M.mergeRegister,Noe=M.normalizeClassNames,Rm=M.removeClassNamesFromElement,_oe=M.removeFromParent,Doe=M.resetRandomKey,Br=M.safeCast,Ooe=M.setDOMUnmanaged,Foe=M.setNodeIndentFromDOM,Nm=M.shallowMergeConfig,iy=M.toggleTextFormatType;var sy={};Mn(sy,{LexicalComposer:()=>XH});ge();var IA=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,QH=IA?xe:K,_m={tag:Fr};function XH({initialConfig:e,children:t}){let n=z(()=>{let{theme:o,namespace:r,nodes:a,onError:i,editorState:s,html:l}=e,d=BT(null,o),c=Em({editable:e.editable,html:l,namespace:r,nodes:a,onError:f=>i(f,c),theme:o});return(function(f,p){if(p!==null){if(p===void 0)f.update(()=>{let m=bt();if(m.isEmpty()){let h=mr();m.append(h);let g=IA?document.activeElement:null;($e()!==null||g!==null&&g===f.getRootElement())&&h.select()}},_m);else if(p!==null)switch(typeof p){case"string":{let m=f.parseEditorState(p);f.setEditorState(m,_m);break}case"object":f.setEditorState(p,_m);break;case"function":f.update(()=>{bt().isEmpty()&&p(f)},_m)}}})(c,s),[c,d]},[]);return QH(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),u(FT.Provider,{value:n,children:t})}var YH=sy,SA=YH.LexicalComposer;var dy={};Mn(dy,{$canShowPlaceholder:()=>TA,$canShowPlaceholderCurry:()=>ZH,$findTextIntersectionFromCharacters:()=>eU,$isRootTextContentEmpty:()=>ly,$isRootTextContentEmptyCurry:()=>JH,$rootTextContent:()=>wA,registerLexicalTextEntity:()=>nU});function wA(){return bt().getTextContent()}function ly(e,t=!0){if(e)return!1;let n=wA();return t&&(n=n.trim()),n===""}function JH(e,t){return()=>ly(e,t)}function TA(e){if(!ly(e,!1))return!1;let t=bt().getChildren(),n=t.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=t[o];if(pm(r))return!1;if(Qe(r)){if(!TP(r)||r.__indent!==0)return!1;let a=r.getChildren(),i=a.length;for(let s=0;s<i;s++){let l=a[o];if(!nt(l))return!1}}}return!0}function ZH(e){return()=>TA(e)}function eU(e,t){let n=e.getFirstChild(),o=0;e:for(;n!==null;){if(Qe(n)){let i=n.getFirstChild();if(i!==null){n=i;continue}}else if(nt(n)){let i=n.getTextContentSize();if(o+i>t)return{node:n,offset:t-o};o+=i}let r=n.getNextSibling();if(r!==null){n=r;continue}let a=n.getParent();for(;a!==null;){let i=a.getNextSibling();if(i!==null){n=i;continue e}a=a.getParent()}break}return null}function tU(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function nU(e,t,n,o){let r=i=>i instanceof n,a=i=>{let s=_r(i.getTextContent());s.setFormat(i.getFormat()),i.replace(s)};return[e.registerNodeTransform(Pm,i=>{if(!i.isSimpleText())return;let s,l=i.getPreviousSibling(),d=i.getTextContent(),c=i;if(nt(l)){let p=l.getTextContent(),m=t(p+d);if(r(l)){if(m===null||(h=>h.getLatest().__mode)(l)!==0)return void a(l);{let h=m.end-p.length;if(h>0){let g=p+d.slice(0,h);if(l.select(),l.setTextContent(g),h===d.length)i.remove();else{let v=d.slice(h);i.setTextContent(v)}return}}}else if(m===null||m.start<p.length)return}let f=0;for(;;){s=t(d);let p,m=s===null?"":d.slice(s.end);if(d=m,m===""){let g=c.getNextSibling();if(nt(g)){m=c.getTextContent()+g.getTextContent();let v=t(m);if(v===null)return void(r(g)?a(g):g.markDirty());if(v.start!==0)return}}if(s===null)return;if(s.start===0&&nt(l)&&l.isTextEntity()){f+=s.end;continue}s.start===0?[p,c]=c.splitText(s.end):[,p,c]=c.splitText(s.start+f,s.end+f),p===void 0&&tU(165,"nodeToReplace");let h=o(p);if(h.setFormat(p.getFormat()),p.replace(h),c==null)return;f=0,l=h}}),e.registerNodeTransform(n,i=>{let s=i.getTextContent(),l=t(s);if(l===null||l.start!==0)return void a(i);if(s.length>l.end)return void i.splitText(l.end);let d=i.getPreviousSibling();nt(d)&&d.isTextEntity()&&(a(d),a(i));let c=i.getNextSibling();nt(c)&&c.isTextEntity()&&(a(c),r(i)&&a(i))})]}var Fs=dy,Voe=Fs.$canShowPlaceholder,Dm=Fs.$canShowPlaceholderCurry,Woe=Fs.$findTextIntersectionFromCharacters,Goe=Fs.$isRootTextContentEmpty,joe=Fs.$isRootTextContentEmptyCurry,Qoe=Fs.$rootTextContent,Xoe=Fs.registerLexicalTextEntity;var gy={};Mn(gy,{$addNodeStyle:()=>lU,$cloneWithProperties:()=>dm,$copyBlockFormatIndent:()=>_A,$ensureForwardRangeSelection:()=>NA,$forEachSelectedTextNode:()=>RA,$getComputedStyleForElement:()=>fy,$getComputedStyleForParent:()=>py,$getSelectionStyleValueForProperty:()=>hU,$isAtNodeEnd:()=>sU,$isParentElementRTL:()=>my,$isParentRTL:()=>aU,$moveCaretSelection:()=>FA,$moveCharacter:()=>mU,$patchStyleText:()=>dU,$selectAll:()=>gm,$setBlocksType:()=>cU,$shouldOverrideDefaultCharacterSelection:()=>pU,$sliceSelectedTextNodeContent:()=>iU,$trimTextContentFromAnchor:()=>MA,$wrapNodes:()=>fU,createDOMRange:()=>oU,createRectsFromDOMRange:()=>rU,getCSSFromStyleObject:()=>EA,getStyleObjectFromCSS:()=>Bm,trimTextContentFromAnchor:()=>vU});function uy(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Fm=new Map;function kA(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function LA(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function oU(e,t,n,o,r){let a=t.getKey(),i=o.getKey(),s=document.createRange(),l=e.getElementByKey(a),d=e.getElementByKey(i),c=n,f=r;if(nt(t)&&(l=kA(l)),nt(o)&&(d=kA(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,c]=LA(l)),d.nodeName==="BR"&&([d,f]=LA(d));let p=l.firstChild;l===d&&p!=null&&p.nodeName==="BR"&&c===0&&f===0&&(f=1);try{s.setStart(l,c),s.setEnd(d,f)}catch{return null}return!s.collapsed||c===f&&a===i||(s.setStart(d,f),s.setEnd(l,c)),s}function rU(e,t){let n=e.getRootElement();if(n===null)return[];let o=n.getBoundingClientRect(),r=getComputedStyle(n),a=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),i=Array.from(t.getClientRects()),s,l=i.length;i.sort((d,c)=>{let f=d.top-c.top;return Math.abs(f)<=3?d.left-c.left:f});for(let d=0;d<l;d++){let c=i[d],f=s&&s.top<=c.top&&s.top+s.height>c.top&&s.left+s.width>c.left,p=c.width+a===o.width;f||p?(i.splice(d--,1),l--):s=c}return i}function AA(e){let t={};if(!e)return t;let n=e.split(";");for(let o of n)if(o!==""){let[r,a]=o.split(/:([^]+)/);r&&a&&(t[r.trim()]=a.trim())}return t}function Bm(e){let t=Fm.get(e);return t===void 0&&(t=AA(e),Fm.set(e,t)),t}function EA(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function fy(e){let t=cm().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function py(e){return fy(lu(e)?e:e.getParentOrThrow())}function aU(e){let t=py(e);return t!==null&&t.direction==="rtl"}function iU(e,t,n="self"){let o=e.getStartEndPoints();if(t.isSelected(e)&&!Zx(t)&&o!==null){let[r,a]=o,i=e.isBackward(),s=r.getNode(),l=a.getNode(),d=t.is(s),c=t.is(l);if(d||c){let[f,p]=xP(e),m=s.is(l),h=t.is(i?l:s),g=t.is(i?s:l),v,x=0;m?(x=f>p?p:f,v=f>p?f:p):h?(x=i?p:f,v=void 0):g&&(x=0,v=i?f:p);let y=t.__text.slice(x,v);y!==t.__text&&(n==="clone"&&(t=uP(t)),t.__text=y)}}return t}function sU(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return Qe(t)||uy(177),e.offset===t.getChildrenSize()}function MA(e,t,n){let o=t.getNode(),r=n;if(Qe(o)){let a=o.getDescendantByIndex(t.offset);a!==null&&(o=a)}for(;r>0&&o!==null;){if(Qe(o)){let d=o.getLastDescendant();d!==null&&(o=d)}let a=o.getPreviousSibling(),i=0;if(a===null){let d=o.getParentOrThrow(),c=d.getPreviousSibling();for(;c===null;){if(d=d.getParent(),d===null){a=null;break}c=d.getPreviousSibling()}d!==null&&(i=d.isInline()?0:2,a=c)}let s=o.getTextContent();s===""&&Qe(o)&&!o.isInline()&&(s=`
3708
3711
 
3709
- `);let l=s.length;if(!tt(o)||r>=l){let d=o.getParent();o.remove(),d==null||d.getChildrenSize()!==0||tu(d)||d.remove(),r-=l+i,o=a}else{let d=o.getKey(),c=e.getEditorState().read(()=>{let m=rm(d);return tt(m)&&m.isSimpleText()?m.getTextContent():null}),f=l-r,p=s.slice(0,f);if(c!==null&&c!==s){let m=Zc(),h=o;if(o.isSimpleText())o.setTextContent(c);else{let g=Mr(c);o.replace(g),h=g}if(we(m)&&m.isCollapsed()){let g=m.anchor.offset;h.select(g,g)}}else if(o.isSimpleText()){let m=t.key===d,h=t.offset;h<r&&(h=l);let g=m?h-r:0,v=m?h:f;if(m&&g===0){let[x]=o.splitText(g,v);x.remove()}else{let[,x]=o.splitText(g,v);x.remove()}}else{let m=Mr(p);o.replace(m)}r=0}}}function YH(e){let t=e.getStyle(),n=CA(t);Em.set(t,n)}function Am(e,t){(we(e)?e.isCollapsed():tt(e)||Ke(e))||iy(280);let n=Mm(we(e)?e.style:tt(e)?e.getStyle():e.getTextStyle()),o=Object.entries(t).reduce((a,[i,s])=>(typeof s=="function"?a[i]=s(n[i],e):s===null?delete a[i]:a[i]=s,a),{...n}),r=bA(o);we(e)||tt(e)?e.setStyle(r):e.setTextStyle(r),Em.set(r,o)}function JH(e,t){if(we(e)&&e.isCollapsed()){Am(e,t);let o=e.anchor.getNode();Ke(o)&&o.isEmpty()&&Am(o,t)}SA(o=>{Am(o,t)});let n=e.getNodes();if(n.length>0){let o=new Set;for(let r of n){if(!Ke(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();o.has(a)||(o.add(a),Am(r,t))}}}function SA(e){let t=Oe();if(!t)return;let n=new Map,o=a=>n.get(a.getKey())||[0,a.getTextContentSize()];if(we(t))for(let a of tP(t).getTextSlices())a&&n.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!tt(a)||!a.canHaveFormat())continue;let[i,s]=o(a);s!==i&&(jx(a)||i===0&&s===a.getTextContentSize()?e(a):e(a.splitText(i,s)[i===0?0:1]))}we(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&wA(t)}function wA(e){if(e.isBackward()){let{anchor:t,focus:n}=e,{key:o,offset:r,type:a}=t;t.set(n.key,n.offset,n.type),n.set(o,r,a)}}function TA(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function ZH(e,t,n=TA){if(e===null)return;let o=e.getStartEndPoints(),r=new Map,a=null;if(o){let[i,s]=o;a=Rs(),a.anchor.set(i.key,i.offset,i.type),a.focus.set(s.key,s.offset,s.type);let l=_a(i.getNode(),ru),d=_a(s.getNode(),ru);Ke(l)&&r.set(l.getKey(),l),Ke(d)&&r.set(d.getKey(),d)}for(let i of e.getNodes())if(Ke(i)&&ru(i))r.set(i.getKey(),i);else if(o===null){let s=_a(i,ru);Ke(s)&&r.set(s.getKey(),s)}for(let[i,s]of r){let l=t();n(s,l),s.replace(l,!0),a&&(i===a.anchor.key&&a.anchor.set(l.getKey(),a.anchor.offset,a.anchor.type),i===a.focus.key&&a.focus.set(l.getKey(),a.focus.offset,a.focus.type))}a&&e.is(Oe())&&Rr(a)}function yA(e){return e.getNode().isAttached()}function eU(e){let t=e;for(;t!==null&&!_s(t);){let n=t.getLatest(),o=t.getParent();n.getChildrenSize()===0&&t.remove(!0),t=o}}function tU(e,t,n=null){let o=e.getStartEndPoints(),r=o?o[0]:null,a=e.getNodes(),i=a.length;if(r!==null&&(i===0||i===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){let d=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),c=d.getChildren(),f=t();return f.setFormat(d.getFormatType()),f.setIndent(d.getIndent()),c.forEach(p=>f.append(p)),n&&(f=n.append(f)),void d.replace(f)}let s=null,l=[];for(let d=0;d<i;d++){let c=a[d];_s(c)?(ay(e,l,l.length,t,n),l=[],s=c):s===null||s!==null&&fP(c,s)?l.push(c):(ay(e,l,l.length,t,n),l=[c])}ay(e,l,l.length,t,n)}function ay(e,t,n,o,r=null){if(t.length===0)return;let a=t[0],i=new Map,s=[],l=Ke(a)?a:a.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let d=!1;for(;l!==null;){let h=l.getPreviousSibling();if(h!==null){l=h,d=!0;break}if(l=l.getParentOrThrow(),_s(l))break}let c=new Set;for(let h=0;h<n;h++){let g=t[h];Ke(g)&&g.getChildrenSize()===0&&c.add(g.getKey())}let f=new Set;for(let h=0;h<n;h++){let g=t[h],v=g.getParent();if(v!==null&&v.isInline()&&(v=v.getParent()),v!==null&&gP(g)&&!f.has(g.getKey())){let x=v.getKey();if(i.get(x)===void 0){let y=o();y.setFormat(v.getFormatType()),y.setIndent(v.getIndent()),s.push(y),i.set(x,y),v.getChildren().forEach(C=>{y.append(C),f.add(C.getKey()),Ke(C)&&C.getChildrenKeys().forEach(w=>f.add(w))}),eU(v)}}else if(c.has(g.getKey())){Ke(g)||iy(179);let x=o();x.setFormat(g.getFormatType()),x.setIndent(g.getIndent()),s.push(x),g.remove(!0)}}if(r!==null)for(let h=0;h<s.length;h++){let g=s[h];r.append(g)}let p=null;if(_s(l))if(d)if(r!==null)l.insertAfter(r);else for(let h=s.length-1;h>=0;h--){let g=s[h];l.insertAfter(g)}else{let h=l.getFirstChild();if(Ke(h)&&(l=h),h===null)if(r)l.append(r);else for(let g=0;g<s.length;g++){let v=s[g];l.append(v),p=v}else if(r!==null)h.insertBefore(r);else for(let g=0;g<s.length;g++){let v=s[g];h.insertBefore(v),p=v}}else if(r)l.insertAfter(r);else for(let h=s.length-1;h>=0;h--){let g=s[h];l.insertAfter(g),p=g}let m=Zc();we(m)&&yA(m.anchor)&&yA(m.focus)?Rr(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function LA(e){let t=kA(e);return t!==null&&t.writingMode==="vertical-rl"}function kA(e){let t=e.anchor.getNode();return Ke(t)?sy(t):ly(t)}function nU(e,t){let n=LA(e)?!t:t;dy(e)&&(n=!n);let o=jl(e.focus,n?"previous":"next");if(mP(o))return!1;for(let r of sP(o)){if(eu(r))return!r.origin.isInline();if(!Ke(r.origin)){if(im(r.origin))return!0;break}}return!1}function PA(e,t,n,o){e.modify(t?"extend":"move",n,o)}function dy(e){let t=kA(e);return t!==null&&t.direction==="rtl"}function oU(e,t,n){let o=dy(e),r;r=LA(e)||o?!n:n,PA(e,t,r,"character")}function rU(e,t,n){let o=Mm(e.getStyle());return o!==null&&o[t]||n}function aU(e,t,n=""){let o=null,r=e.getNodes(),a=e.anchor,i=e.focus,s=e.isBackward(),l=s?i.offset:a.offset,d=s?i.getNode():a.getNode();if(we(e)&&e.isCollapsed()&&e.style!==""){let c=Mm(e.style);if(c!==null&&t in c)return c[t]}for(let c=0;c<r.length;c++){let f=r[c];if((c===0||l!==0||!f.is(d))&&tt(f)){let p=rU(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var iU=IA;var an=cy,AA=an.$addNodeStyle,qoe=an.$cloneWithProperties,Voe=an.$copyBlockFormatIndent,Woe=an.$ensureForwardRangeSelection,Goe=an.$forEachSelectedTextNode,joe=an.$getComputedStyleForElement,Qoe=an.$getComputedStyleForParent,Xoe=an.$getSelectionStyleValueForProperty,Yoe=an.$isAtNodeEnd,Joe=an.$isParentElementRTL,Zoe=an.$isParentRTL,ere=an.$moveCaretSelection,uy=an.$moveCharacter,tre=an.$patchStyleText,nre=an.$selectAll,ore=an.$setBlocksType,fy=an.$shouldOverrideDefaultCharacterSelection,Rm=an.$sliceSelectedTextNodeContent,rre=an.$trimTextContentFromAnchor,are=an.$wrapNodes,ire=an.createDOMRange,EA=an.createRectsFromDOMRange,sre=an.getCSSFromStyleObject,lre=an.getStyleObjectFromCSS,dre=an.trimTextContentFromAnchor;var hy={};An(hy,{$descendantsMatching:()=>KU,$dfs:()=>TU,$dfsIterator:()=>$A,$filter:()=>FU,$findMatchingParent:()=>_a,$firstToLastIterator:()=>qU,$getAdjacentCaret:()=>LU,$getAdjacentSiblingOrParentSiblingCaret:()=>Ns,$getDepth:()=>UA,$getNearestBlockElementAncestorOrThrow:()=>MU,$getNearestNodeOfType:()=>EU,$getNextRightPreorderNode:()=>AU,$getNextSiblingOrParentSibling:()=>PU,$handleIndentAndOutdent:()=>BU,$insertFirst:()=>zU,$insertNodeToNearestRoot:()=>_U,$insertNodeToNearestRootAtCaret:()=>qA,$isEditorIsNestedEditor:()=>HU,$lastToFirstIterator:()=>gy,$restoreEditorState:()=>NU,$reverseDfs:()=>kU,$reverseDfsIterator:()=>KA,$splitNode:()=>wP,$unwrapAndFilterDescendants:()=>UU,$unwrapNode:()=>VU,$wrapNodeInElement:()=>DU,CAN_USE_BEFORE_INPUT:()=>hU,CAN_USE_DOM:()=>FA,IS_ANDROID:()=>vU,IS_ANDROID_CHROME:()=>xU,IS_APPLE:()=>yU,IS_APPLE_WEBKIT:()=>CU,IS_CHROME:()=>bU,IS_FIREFOX:()=>BA,IS_IOS:()=>IU,IS_SAFARI:()=>SU,addClassNamesToElement:()=>au,calculateZoomLevel:()=>$U,isBlockDomNode:()=>lA,isHTMLAnchorElement:()=>uA,isHTMLElement:()=>wm,isInlineDomNode:()=>iu,isMimeType:()=>zA,makeStateWrapper:()=>WU,markSelection:()=>OA,mediaFileReader:()=>wU,mergeRegister:()=>ra,objectKlassEquals:()=>OU,positionNodeOnRange:()=>DA,registerNestedElementResolver:()=>RU,removeClassNamesFromElement:()=>Tm,selectionAlwaysOnDisplay:()=>gU});function Nm(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Or=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,sU=Or&&"documentMode"in document?document.documentMode:null,NA=Or&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),lU=Or&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),dU=!(!Or||!("InputEvent"in window)||sU)&&"getTargetRanges"in new window.InputEvent("input"),cU=Or&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),uU=Or&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,_A=Or&&/Android/.test(navigator.userAgent),my=Or&&/^(?=.*Chrome).*/i.test(navigator.userAgent),fU=Or&&_A&&my,pU=Or&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&NA&&!my;function aa(e){return`${e}px`}var mU={attributes:!0,characterData:!0,childList:!0,subtree:!0};function DA(e,t,n){let o=null,r=null,a=null,i=[],s=document.createElement("div");function l(){o===null&&Nm(182),r===null&&Nm(183);let{left:f,top:p}=r.getBoundingClientRect(),m=EA(e,t);var h,g;s.isConnected||(g=s,(h=r).insertBefore(g,h.firstChild));let v=!1;for(let x=0;x<m.length;x++){let y=m[x],C=i[x]||document.createElement("div"),w=C.style;w.position!=="absolute"&&(w.position="absolute",v=!0);let k=aa(y.left-f);w.left!==k&&(w.left=k,v=!0);let S=aa(y.top-p);w.top!==S&&(C.style.top=S,v=!0);let L=aa(y.width);w.width!==L&&(C.style.width=L,v=!0);let I=aa(y.height);w.height!==I&&(C.style.height=I,v=!0),C.parentNode!==s&&(s.append(C),v=!0),i[x]=C}for(;i.length>m.length;)i.pop();v&&n(i)}function d(){r=null,o=null,a!==null&&a.disconnect(),a=null,s.remove();for(let f of i)f.remove();i=[]}s.style.position="relative";let c=e.registerRootListener(function f(){let p=e.getRootElement();if(p===null)return d();let m=p.parentElement;if(!wm(m))return d();d(),o=p,r=m,a=new MutationObserver(h=>{let g=e.getRootElement(),v=g&&g.parentElement;if(g!==o||v!==r)return f();for(let x of h)if(!s.contains(x.target))return l()}),a.observe(m,mU),l()});return()=>{c(),d()}}function MA(e,t,n){if(e.type!=="text"&&Ke(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[iA(n)||n,e.offset]}function OA(e,t){let n=null,o=null,r=null,a=null,i=null,s=null,l=()=>{};function d(c){c.read(()=>{let f=Oe();if(!we(f))return n=null,r=null,a=null,s=null,l(),void(l=()=>{});let[p,m]=(function(I){let T=I.getStartEndPoints();return I.isBackward()?[T[1],T[0]]:T})(f),h=p.getNode(),g=h.getKey(),v=p.offset,x=m.getNode(),y=x.getKey(),C=m.offset,w=e.getElementByKey(g),k=e.getElementByKey(y),S=n===null||w!==o||v!==r||g!==n.getKey(),L=a===null||k!==i||C!==s||y!==a.getKey();if((S||L)&&w!==null&&k!==null){let I=(function(T,E,A,N,R,$,H){let K=(T._window?T._window.document:document).createRange();return K.setStart(...MA(E,A,N)),K.setEnd(...MA(R,$,H)),K})(e,p,h,w,m,x,k);l(),l=DA(e,I,T=>{if(t===void 0)for(let E of T){let A=E.style;A.background!=="Highlight"&&(A.background="Highlight"),A.color!=="HighlightText"&&(A.color="HighlightText"),A.marginTop!==aa(-1.5)&&(A.marginTop=aa(-1.5)),A.paddingTop!==aa(4)&&(A.paddingTop=aa(4)),A.paddingBottom!==aa(0)&&(A.paddingBottom=aa(0))}else t(T)})}n=h,o=w,r=v,a=x,i=k,s=C})}return d(e.getEditorState()),ra(e.registerUpdateListener(({editorState:c})=>d(c)),()=>{l()})}function gU(e,t){let n=null,o=()=>{let r=getSelection(),a=r&&r.anchorNode,i=e.getRootElement();a!==null&&i!==null&&i.contains(a)?n!==null&&(n(),n=null):n===null&&(n=OA(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var hU=dU,FA=Or,vU=_A,xU=fU,yU=NA,CU=pU,bU=my,BA=lU,IU=uU,SU=cU;function zA(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function wU(e,t){let n=e[Symbol.iterator]();return new Promise((o,r)=>{let a=[],i=()=>{let{done:s,value:l}=n.next();if(s)return o(a);let d=new FileReader;d.addEventListener("error",r),d.addEventListener("load",()=>{let c=d.result;typeof c=="string"&&a.push({file:l,result:c}),i()}),zA(l,t)?d.readAsDataURL(l):i()};i()})}function TU(e,t){return Array.from($A(e,t))}function LU(e){return e?e.getAdjacentCaret():null}function kU(e,t){return Array.from(KA(e,t))}function $A(e,t){return HA("next",e,t)}function RA(e,t){let n=Ns(Da(e,t));return n&&n[0]}function HA(e,t,n){let o=Ct(),r=t||o,a=Ke(r)?ki(r,e):Da(r,e),i=UA(r),s=n?qx(Wx(Da(n,e)))||RA(n,e):RA(r,e),l=i;return ey({hasNext:d=>d!==null,initial:a,map:d=>({depth:l,node:d.origin}),step:d=>{if(d.isSameNodeCaret(s))return null;eu(d)&&l++;let c=Ns(d);return!c||c[0].isSameNodeCaret(s)?null:(l+=c[1],c[0])}})}function PU(e){let t=Ns(Da(e,"next"));return t&&[t[0].origin,t[1]]}function UA(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function AU(e){let t=Wx(Da(e,"previous")),n=Ns(t,"root");return n&&n[0].origin}function KA(e,t){return HA("previous",e,t)}function EU(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function MU(e){let t=_a(e,n=>Ke(n)&&!n.isInline());return Ke(t)||Nm(4,e.__key),t}function RU(e,t,n,o){let r=a=>a instanceof t;return e.registerNodeTransform(t,a=>{let i=(s=>{let l=s.getChildren();for(let f=0;f<l.length;f++){let p=l[f];if(r(p))return null}let d=s,c=s;for(;d!==null;)if(c=d,d=d.getParent(),r(d))return{child:c,parent:d};return null})(a);if(i!==null){let{child:s,parent:l}=i;if(s.is(a)){o(l,a);let d=s.getNextSiblings(),c=d.length;if(l.insertAfter(s),c!==0){let f=n(l);s.insertAfter(f);for(let p=0;p<c;p++)f.append(d[p])}l.canBeEmpty()||l.getChildrenSize()!==0||l.remove()}}})}function NU(e,t){let n=new Map,o=e._pendingEditorState;for(let[a,i]of t._nodeMap)n.set(a,nm(i));o&&(o._nodeMap=n),e._dirtyType=2;let r=t._selection;Rr(r===null?null:r.clone())}function _U(e){let t=Oe()||Zc(),n;if(we(t))n=jl(t.focus,"next");else{if(t!=null){let i=t.getNodes(),s=i[i.length-1];s&&(n=Da(s,"next"))}n=n||ki(Ct(),"previous").getFlipped().insert(ur())}let o=qA(e,n),r=qx(o),a=eu(r)?xP(r):o;return IP(cP(a)),e.getLatest()}function qA(e,t,n){let o=Vx(t,"next");for(let r=o;r;r=SP(r,n))o=r;return sm(o)&&Nm(283),o.insert(e.isInline()?ur().append(e):e),Vx(Da(e.getLatest(),"next"),t.direction)}function DU(e,t){let n=t();return e.replace(n),n.append(e),n}function OU(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function FU(e,t){let n=[];for(let o=0;o<e.length;o++){let r=t(e[o]);r!==null&&n.push(r)}return n}function BU(e){let t=Oe();if(!we(t))return!1;let n=new Set,o=t.getNodes();for(let r=0;r<o.length;r++){let a=o[r],i=a.getKey();if(n.has(i))continue;let s=_a(a,d=>Ke(d)&&!d.isInline());if(s===null)continue;let l=s.getKey();s.canIndent()&&!n.has(l)&&(n.add(l),e(s))}return n.size>0}function zU(e,t){ki(e,"next").insert(t)}var py=!(BA||!FA)&&void 0;function $U(e,t=!1){let n=1;if((function(){if(py===void 0){let o=document.createElement("div");o.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(o);let r=o.getBoundingClientRect();o.style.setProperty("zoom","2"),py=o.getBoundingClientRect().width===r.width,document.body.removeChild(o)}return py})()||t)for(;e;)n*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return n}function HU(e){return e._parentEditor!==null}function UU(e,t){return VA(e,t,null)}function VA(e,t,n){let o=!1;for(let r of gy(e))t(r)?n!==null&&n(r):(o=!0,Ke(r)&&VA(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function KU(e,t){let n=[],o=Array.from(e).reverse();for(let r=o.pop();r!==void 0;r=o.pop())if(t(r))n.push(r);else if(Ke(r))for(let a of gy(r))o.push(a);return n}function qU(e){return WA(ki(e,"next"))}function gy(e){return WA(ki(e,"previous"))}function WA(e){return ey({hasNext:vP,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function VU(e){bP(Da(e,"next")).splice(1,e.getChildren())}function WU(e){let t=o=>am(o,e),n=(o,r)=>dm(o,e,r);return{$get:t,$set:n,accessors:[t,n],makeGetterMethod:()=>function(){return t(this)},makeSetterMethod:()=>function(o){return n(this,o)},stateConfig:e}}var Ve=hy,mre=Ve.$descendantsMatching,gre=Ve.$dfs,hre=Ve.$dfsIterator,vre=Ve.$filter,xre=Ve.$findMatchingParent,yre=Ve.$firstToLastIterator,Cre=Ve.$getAdjacentCaret,bre=Ve.$getAdjacentSiblingOrParentSiblingCaret,Ire=Ve.$getDepth,GA=Ve.$getNearestBlockElementAncestorOrThrow,Sre=Ve.$getNearestNodeOfType,wre=Ve.$getNextRightPreorderNode,Tre=Ve.$getNextSiblingOrParentSibling,jA=Ve.$handleIndentAndOutdent,Lre=Ve.$insertFirst,kre=Ve.$insertNodeToNearestRoot,Pre=Ve.$insertNodeToNearestRootAtCaret,Are=Ve.$isEditorIsNestedEditor,Ere=Ve.$lastToFirstIterator,Mre=Ve.$restoreEditorState,Rre=Ve.$reverseDfs,Nre=Ve.$reverseDfsIterator,_re=Ve.$splitNode,Dre=Ve.$unwrapAndFilterDescendants,Ore=Ve.$unwrapNode,Fre=Ve.$wrapNodeInElement,Bre=Ve.CAN_USE_BEFORE_INPUT,zre=Ve.CAN_USE_DOM,$re=Ve.IS_ANDROID,Hre=Ve.IS_ANDROID_CHROME,Ure=Ve.IS_APPLE,Kre=Ve.IS_APPLE_WEBKIT,qre=Ve.IS_CHROME,Vre=Ve.IS_FIREFOX,Wre=Ve.IS_IOS,Gre=Ve.IS_SAFARI,jre=Ve.addClassNamesToElement,Qre=Ve.calculateZoomLevel,vy=Ve.isBlockDomNode,Xre=Ve.isHTMLAnchorElement,QA=Ve.isHTMLElement,Yre=Ve.isInlineDomNode,Jre=Ve.isMimeType,Zre=Ve.makeStateWrapper,eae=Ve.markSelection,tae=Ve.mediaFileReader,Fa=Ve.mergeRegister,su=Ve.objectKlassEquals,nae=Ve.positionNodeOnRange,oae=Ve.registerNestedElementResolver,rae=Ve.removeClassNamesFromElement,aae=Ve.selectionAlwaysOnDisplay;var xy={};An(xy,{ContentEditable:()=>jU,ContentEditableElement:()=>JA});me();var YA=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ye:q;function GU({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:r,ariaErrorMessage:a,ariaExpanded:i,ariaInvalid:s,ariaLabel:l,ariaLabelledBy:d,ariaMultiline:c,ariaOwns:f,ariaRequired:p,autoCapitalize:m,className:h,id:g,role:v="textbox",spellCheck:x=!0,style:y,tabIndex:C,"data-testid":w,...k},S){let[L,I]=G(e.isEditable()),T=B(A=>{A&&A.ownerDocument&&A.ownerDocument.defaultView?e.setRootElement(A):e.setRootElement(null)},[e]),E=z(()=>(function(...A){return N=>{for(let R of A)typeof R=="function"?R(N):R!=null&&(R.current=N)}})(S,T),[T,S]);return YA(()=>(I(e.isEditable()),e.registerEditableListener(A=>{I(A)})),[e]),u("div",{"aria-activedescendant":L?t:void 0,"aria-autocomplete":L?n:"none","aria-controls":L?o:void 0,"aria-describedby":r,...a!=null?{"aria-errormessage":a}:{},"aria-expanded":L&&v==="combobox"?!!i:void 0,...s!=null?{"aria-invalid":s}:{},"aria-label":l,"aria-labelledby":d,"aria-multiline":c,"aria-owns":L?f:void 0,"aria-readonly":!L||void 0,"aria-required":p,autoCapitalize:m,className:h,contentEditable:L,"data-testid":w,id:g,ref:E,role:v,spellCheck:x,style:y,tabIndex:C,...k})}var JA=Wn(GU);function XA(e){return e.getEditorState().read(Pm(e.isComposing()))}var jU=Wn(QU);function QU(e,t){let{placeholder:n,...o}=e,[r]=In();return b(be,{children:[u(JA,{editor:r,...o,ref:t}),n!=null&&u(XU,{editor:r,content:n})]})}function XU({content:e,editor:t}){let n=(function(i){let[s,l]=G(()=>XA(i));return YA(()=>{function d(){let c=XA(i);l(c)}return d(),Fa(i.registerUpdateListener(()=>{d()}),i.registerEditableListener(()=>{d()}))},[i]),s})(t),[o,r]=G(t.isEditable());if(ye(()=>(r(t.isEditable()),t.registerEditableListener(i=>{r(i)})),[t]),!n)return null;let a=null;return typeof e=="function"?a=e(o):e!==null&&(a=e),a===null?null:u("div",{"aria-hidden":!0,children:a})}var ZA=xy,eE=ZA.ContentEditable,fae=ZA.ContentEditableElement;me();var YU=Ht(null),yy={didCatch:!1,error:null},_m=class extends Ui{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=yy}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(...t){let{error:n}=this.state;n!==null&&(this.props.onReset?.({args:t,reason:"imperative-api"}),this.setState(yy))}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t,n){let{didCatch:o}=this.state,{resetKeys:r}=this.props;o&&n.error!==null&&JU(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(yy))}render(){let{children:t,fallbackRender:n,FallbackComponent:o,fallback:r}=this.props,{didCatch:a,error:i}=this.state,s=t;if(a){let l={error:i,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")s=n(l);else if(o)s=Te(o,l);else if(r!==void 0)s=r;else throw i}return Te(YU.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}};function JU(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var Cy={};An(Cy,{LexicalErrorBoundary:()=>ZU});function ZU({children:e,onError:t}){return u(_m,{fallback:u("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var e3=Cy,tE=e3.LexicalErrorBoundary;var Dy={};An(Dy,{$createHorizontalRuleNode:()=>_y,$isDecoratorTextNode:()=>gE,$isHorizontalRuleNode:()=>bE,AutoFocusExtension:()=>o3,ClearEditorExtension:()=>r3,DecoratorTextExtension:()=>c3,DecoratorTextNode:()=>cu,EditorStateExtension:()=>Bm,HorizontalRuleExtension:()=>b3,HorizontalRuleNode:()=>Fs,INSERT_HORIZONTAL_RULE_COMMAND:()=>y3,InitialStateExtension:()=>yE,LexicalBuilder:()=>td,NodeSelectionExtension:()=>Ey,TabIndentationExtension:()=>I3,applyFormatFromStyle:()=>i3,applyFormatToDom:()=>s3,batch:()=>sE,buildEditorFromExtensions:()=>m3,computed:()=>cE,configExtension:()=>Im,declarePeerDependency:()=>aA,defineExtension:()=>Mn,effect:()=>Ai,getExtensionDependencyFromEditor:()=>h3,getKnownTypesAndNodes:()=>a3,getPeerDependencyFromEditor:()=>CE,getPeerDependencyFromEditorOrThrow:()=>v3,namedSignals:()=>$m,registerClearEditor:()=>pE,registerTabIndentation:()=>SE,safeCast:()=>Dr,shallowMergeConfig:()=>Lm,signal:()=>ed,untracked:()=>Ly,watchedSignal:()=>Ry});var t3=Symbol.for("preact-signals");function zm(){if(Pi>1)return void Pi--;let e,t=!1;for(;du!==void 0;){let n=du;for(du=void 0,ky++;n!==void 0;){let o=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&lE(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(ky=0,Pi--,t)throw e}function sE(e){if(Pi>0)return e();Pi++;try{return e()}finally{zm()}}var At,du;function Ly(e){let t=At;At=void 0;try{return e()}finally{At=t}}var Pi=0,ky=0,Fm=0;function nE(e){if(At===void 0)return;let t=e.n;return t===void 0||t.t!==At?(t={i:0,S:e,p:At.s,n:void 0,t:At,e:void 0,x:void 0,r:t},At.s!==void 0&&(At.s.n=t),At.s=t,e.n=t,32&At.f&&e.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=At.s,t.n=void 0,At.s.n=t,At.s=t),t):void 0}function Po(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function ed(e,t){return new Po(e,t)}function lE(e){for(let t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function oE(e){for(let t=e.s;t!==void 0;t=t.n){let n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function dE(e){let t,n=e.s;for(;n!==void 0;){let o=n.p;n.i===-1?(n.S.U(n),o!==void 0&&(o.n=n.n),n.n!==void 0&&(n.n.p=o)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=o}e.s=t}function Os(e,t){Po.call(this,void 0),this.x=e,this.s=void 0,this.g=Fm-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function cE(e,t){return new Os(e,t)}function uE(e){let t=e.u;if(e.u=void 0,typeof t=="function"){Pi++;let n=At;At=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,My(e),o}finally{At=n,zm()}}}function My(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,uE(e)}function n3(e){if(At!==this)throw new Error("Out-of-order effect");dE(this),At=e,this.f&=-2,8&this.f&&My(this),zm()}function Zl(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=t?.name}function Ai(e,t){let n=new Zl(e,t);try{n.c()}catch(r){throw n.d(),r}let o=n.d.bind(n);return o[Symbol.dispose]=o,o}function $m(e,t={}){let n={};for(let o in e){let r=t[o],a=ed(r===void 0?e[o]:r);n[o]=a}return n}Po.prototype.brand=t3,Po.prototype.h=function(){return!0},Po.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t!==void 0?t.e=e:Ly(()=>{var n;(n=this.W)==null||n.call(this)}))},Po.prototype.U=function(e){if(this.t!==void 0){let t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&Ly(()=>{var o;(o=this.Z)==null||o.call(this)}))}},Po.prototype.subscribe=function(e){return Ai(()=>{let t=this.value,n=At;At=void 0;try{e(t)}finally{At=n}},{name:"sub"})},Po.prototype.valueOf=function(){return this.value},Po.prototype.toString=function(){return this.value+""},Po.prototype.toJSON=function(){return this.value},Po.prototype.peek=function(){let e=At;At=void 0;try{return this.value}finally{At=e}},Object.defineProperty(Po.prototype,"value",{get(){let e=nE(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(ky>100)throw new Error("Cycle detected");this.v=e,this.i++,Fm++,Pi++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{zm()}}}}),Os.prototype=new Po,Os.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Fm))return!0;if(this.g=Fm,this.f|=1,this.i>0&&!lE(this))return this.f&=-2,!0;let e=At;try{oE(this),At=this;let t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return At=e,dE(this),this.f&=-2,!0},Os.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let t=this.s;t!==void 0;t=t.n)t.S.S(t)}Po.prototype.S.call(this,e)},Os.prototype.U=function(e){if(this.t!==void 0&&(Po.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let t=this.s;t!==void 0;t=t.n)t.S.U(t)}},Os.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(Os.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=nE(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Zl.prototype.c=function(){let e=this.S();try{if(8&this.f||this.x===void 0)return;let t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}},Zl.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,uE(this),oE(this),Pi++;let e=At;return At=this,n3.bind(this,e)},Zl.prototype.N=function(){2&this.f||(this.f|=2,this.o=du,du=this)},Zl.prototype.d=function(){this.f|=8,1&this.f||My(this)},Zl.prototype.dispose=function(){this.d()};var o3=Mn({build:(e,t,n)=>$m(t),config:Dr({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){let o=n.getOutput();return Ai(()=>o.disabled.value?void 0:e.registerRootListener(r=>{e.focus(()=>{let a=document.activeElement;r===null||a!==null&&r.contains(a)||r.focus({preventScroll:!0})},{defaultSelection:o.defaultSelection.peek()})}))}});function fE(){let e=Ct(),t=Oe(),n=ur();e.clear(),e.append(n),t!==null&&n.select(),we(t)&&(t.format=0)}function pE(e,t=fE){return e.registerCommand(cm,n=>(e.update(t),!0),Xt)}var r3=Mn({build:(e,t,n)=>$m(t),config:Dr({$onClear:fE}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return Ai(()=>pE(e,o.value))}});function a3(e){let t=new Set,n=new Set;for(let o of mE(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function mE(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var by=rA("format",{parse:e=>typeof e=="number"?e:0}),cu=class extends Oa{$config(){return this.config("decorator-text",{extends:Oa,stateConfigs:[{flat:!0,stateConfig:by}]})}getFormat(){return am(this,by)}getFormatFlags(t,n){return ty(this.getFormat(),t,n)}hasFormat(t){let n=eA[t];return(this.getFormat()&n)!==0}setFormat(t){return dm(this,by,t)}toggleFormat(t){let n=this.getFormat(),o=ty(n,t,null);return this.setFormat(o)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function gE(e){return e instanceof cu}function i3(e,t,n){let o=t.fontWeight,r=t.textDecoration.split(" "),a=o==="700"||o==="bold",i=r.includes("line-through"),s=t.fontStyle==="italic",l=r.includes("underline"),d=t.verticalAlign;return a&&!e.hasFormat("bold")&&e.toggleFormat("bold"),i&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),s&&!e.hasFormat("italic")&&e.toggleFormat("italic"),l&&!e.hasFormat("underline")&&e.toggleFormat("underline"),d!=="sub"||e.hasFormat("subscript")||e.toggleFormat("subscript"),d!=="super"||e.hasFormat("superscript")||e.toggleFormat("superscript"),n&&!e.hasFormat(n)&&e.toggleFormat(n),e}function s3(e,t,n=d3){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=l3(t,o));return t}function l3(e,t){let n=document.createElement(t);return n.appendChild(e),n}var d3={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},c3=Mn({name:"@lexical/extension/DecoratorText",nodes:()=>[cu],register:(e,t,n)=>e.registerCommand(FP,o=>{let r=Oe();if(Gx(r)||we(r))for(let a of r.getNodes())gE(a)&&a.toggleFormat(o);return!1},Yl)});function Ry(e,t){let n;return ed(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var Bm=Mn({build:e=>Ry(()=>e.getEditorState(),t=>e.registerUpdateListener(n=>{t.value=n.editorState})),name:"@lexical/extension/EditorState"});function Ft(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function hE(e,t){if(e&&t&&!Array.isArray(t)&&typeof e=="object"&&typeof t=="object"){let n=e,o=t;for(let r in o)n[r]=hE(n[r],o[r]);return e}return t}var Ny=0,Py=1,vE=2,Iy=3,Dm=4,Jl=5,Sy=6,lu=7;function wy(e){return e.id===Ny}function xE(e){return e.id===vE}function u3(e){return(function(t){return t.id===Py})(e)||Ft(305,String(e.id),String(Py)),Object.assign(e,{id:vE})}var f3=new Set,Ay=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,n){this.builder=t,this.extension=n,this.configs=new Set,this.state={id:Ny}}mergeConfigs(){let t=this.extension.config||{},n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Lm;for(let o of this.configs)t=n(t,o);return t}init(t){let n=this.state;xE(n)||Ft(306,String(n.id));let o={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...o,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},a=(function(s,l,d){return Object.assign(s,{config:l,id:Iy,registerState:d})})(n,this.mergeConfigs(),o),i;this.state=a,this.extension.init&&(i=this.extension.init(t,a.config,o)),this.state=(function(s,l,d){return Object.assign(s,{id:Dm,initResult:l,registerState:d})})(a,i,r)}build(t){let n=this.state,o;n.id!==Dm&&Ft(307,String(n.id),String(Jl)),this.extension.build&&(o=this.extension.build(t,n.config,n.registerState));let r={...n.registerState,getOutput:()=>o,getSignal:this.getSignal.bind(this)};this.state=(function(a,i,s){return Object.assign(a,{id:Jl,output:i,registerState:s})})(n,o,r)}register(t,n){this._signal=n;let o=this.state;o.id!==Jl&&Ft(308,String(o.id),String(Jl));let r=this.extension.register&&this.extension.register(t,o.config,o.registerState);return this.state=(function(a){return Object.assign(a,{id:Sy})})(o),()=>{let a=this.state;a.id!==lu&&Ft(309,String(o.id),String(lu)),this.state=(function(i){return Object.assign(i,{id:Jl})})(a),r&&r()}}afterRegistration(t){let n=this.state,o;return n.id!==Sy&&Ft(310,String(n.id),String(Sy)),this.extension.afterRegistration&&(o=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(r){return Object.assign(r,{id:lu})})(n),o}getSignal(){return this._signal===void 0&&Ft(311),this._signal}getInitResult(){this.extension.init===void 0&&Ft(312,this.extension.name);let t=this.state;return(function(n){return n.id>=Dm})(t)||Ft(313,String(t.id),String(Dm)),t.initResult}getInitPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionInitDependency():void 0}getExtensionInitDependency(){let t=this.state;return(function(n){return n.id>=Iy})(t)||Ft(314,String(t.id),String(Iy)),{config:t.config}}getPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}getInitDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Ft(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Ft(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){let t=this.state;return(function(n){return n.id>=lu})(t)||Ft(316,String(t.id),String(lu)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||f3}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([n])=>n)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){let t=this.state;(function(n){return n.id>=Jl})(t)||Ft(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},rE={tag:_r};function p3(){let e=Ct();e.isEmpty()&&e.append(ur())}var yE=Mn({config:Dr({setOptions:rE,updateOptions:rE}),init:({$initialEditorState:e=p3})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},o){let r=o.getInitResult();if(!r.initialized){r.initialized=!0;let{$initialEditorState:a}=r;if(pP(a))e.setEditorState(a,n);else if(typeof a=="function")e.update(()=>{a(e)},t);else if(a&&(typeof a=="string"||typeof a=="object")){let i=e.parseEditorState(a);e.setEditorState(i,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[YP,bm,VP,tA,jP]}),aE=Symbol.for("@lexical/extension/LexicalBuilder");function m3(...e){return td.fromExtensions(e).buildEditor()}function iE(){}function g3(e){throw e}function Om(e){return Array.isArray(e)?e:[e]}var Ty="0.41.0+prod.esm",td=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(t){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=Ty,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[Om(yE)];for(let o of t)n.push(Om(o));return new e(n)}static maybeFromEditor(t){let n=t[aE];return n&&(n.PACKAGE_VERSION!==Ty&&Ft(292,n.PACKAGE_VERSION,Ty),n instanceof e||Ft(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Ft(294),n}constructEditor(){let{$initialEditorState:t,onError:n,...o}=this.buildCreateEditorArgs(),r=Object.assign(Sm({...o,...n?{onError:a=>{n(a,r)}}:{}}),{[aE]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=iE;function n(){try{t()}finally{t=iE}}let o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=ra(this.registerEditor(o),()=>o.setRootElement(null)),o}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){let n=this.extensionNameMap.get(t.name);if(n)return n.extension!==t&&Ft(295,t.name),n}addEdge(t,n,o){let r=this.outgoingConfigEdges.get(t);r?r.set(n,o):this.outgoingConfigEdges.set(t,new Map([[n,o]]));let a=this.incomingEdges.get(n);a?a.add(t):this.incomingEdges.set(n,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&Ft(296);let n=Om(t),[o]=n;typeof o.name!="string"&&Ft(297,typeof o.name);let r=this.extensionNameMap.get(o.name);if(r!==void 0&&r.extension!==o&&Ft(298,o.name),!r){r=new Ay(this,o),this.extensionNameMap.set(o.name,r);let a=this.conflicts.get(o.name);typeof a=="string"&&Ft(299,o.name,a);for(let i of o.conflictsWith||[])this.extensionNameMap.has(i)&&Ft(299,o.name,i),this.conflicts.set(i,o.name);for(let i of o.dependencies||[]){let s=Om(i);this.addEdge(o.name,s[0].name,s.slice(1)),this.addExtension(s)}for(let[i,s]of o.peerDependencies||[])this.addEdge(o.name,i,s?[s]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let t=[],n=(o,r)=>{let a=o.state;if(xE(a))return;let i=o.extension.name;var s;wy(a)||Ft(300,i,r||"[unknown]"),wy(s=a)||Ft(304,String(s.id),String(Ny)),a=Object.assign(s,{id:Py}),o.state=a;let l=this.outgoingConfigEdges.get(i);if(l)for(let d of l.keys()){let c=this.extensionNameMap.get(d);c&&n(c,i)}a=u3(a),o.state=a,t.push(o)};for(let o of this.extensionNameMap.values())wy(o.state)&&n(o);for(let o of t)for(let[r,a]of this.outgoingConfigEdges.get(o.extension.name)||[])if(a.length>0){let i=this.extensionNameMap.get(r);if(i)for(let s of a)i.configs.add(s)}for(let[o,...r]of this.roots)if(r.length>0){let a=this.extensionNameMap.get(o.name);a===void 0&&Ft(301,o.name);for(let i of r)a.configs.add(i)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){let n=this.sortedExtensionReps(),o=new AbortController,r=[()=>o.abort()],a=o.signal;for(let i of n){let s=i.register(t,a);s&&r.push(s)}for(let i of n){let s=i.afterRegistration(t);s&&r.push(s)}return ra(...r)}buildCreateEditorArgs(){let t={},n=new Set,o=new Map,r=new Map,a={},i={},s=this.sortedExtensionReps();for(let c of s){let{extension:f}=c;if(f.onError!==void 0&&(t.onError=f.onError),f.disableEvents!==void 0&&(t.disableEvents=f.disableEvents),f.parentEditor!==void 0&&(t.parentEditor=f.parentEditor),f.editable!==void 0&&(t.editable=f.editable),f.namespace!==void 0&&(t.namespace=f.namespace),f.$initialEditorState!==void 0&&(t.$initialEditorState=f.$initialEditorState),f.nodes)for(let p of mE(f)){if(typeof p!="function"){let m=o.get(p.replace);m&&Ft(302,f.name,p.replace.name,m.extension.name),o.set(p.replace,c)}n.add(p)}if(f.html){if(f.html.export)for(let[p,m]of f.html.export.entries())r.set(p,m);f.html.import&&Object.assign(a,f.html.import)}f.theme&&hE(i,f.theme)}Object.keys(i).length>0&&(t.theme=i),n.size&&(t.nodes=[...n]);let l=Object.keys(a).length>0,d=r.size>0;(l||d)&&(t.html={},l&&(t.html.import=a),d&&(t.html.export=r));for(let c of s)c.init(t);return t.onError||(t.onError=g3),t}};function h3(e,t){let n=td.fromEditor(e).getExtensionRep(t);return n===void 0&&Ft(303,t.name),n.getExtensionDependency()}function CE(e,t){let n=td.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function v3(e,t){let n=CE(e,t);return n===void 0&&Ft(291,t),n}var x3=new Set,Ey=Mn({build(e,t,n){let o=n.getDependency(Bm).output,r=ed({watchedNodeKeys:new Map}),a=Ry(()=>{},()=>Ai(()=>{let i=a.peek(),{watchedNodeKeys:s}=r.value,l,d=!1;o.value.read(()=>{if(Oe())for(let[c,f]of s.entries()){if(f.size===0){s.delete(c);continue}let p=rm(c),m=p&&p.isSelected()||!1;d=d||m!==(!!i&&i.has(c)),m&&(l=l||new Set,l.add(c))}}),!d&&l&&i&&l.size===i.size||(a.value=l)}));return{watchNodeKey:function(i){let s=cE(()=>(a.value||x3).has(i)),{watchedNodeKeys:l}=r.peek(),d=l.get(i),c=d!==void 0;return d=d||new Set,d.add(s),c||(l.set(i,d),r.value={watchedNodeKeys:l}),s}}},dependencies:[Bm],name:"@lexical/extension/NodeSelection"}),y3=oA("INSERT_HORIZONTAL_RULE_COMMAND"),Fs=class e extends Oa{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return _y().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:C3,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return au(n,t.theme.hr),n}getTextContent(){return`
3710
- `}isInline(){return!1}updateDOM(){return!1}};function C3(){return{node:_y()}}function _y(){return oP(Fs)}function bE(e){return e instanceof Fs}var b3=Mn({dependencies:[Bm,Ey],name:"@lexical/extension/HorizontalRule",nodes:()=>[Fs],register(e,t,n){let{watchNodeKey:o}=n.getDependency(Ey).output,r=ed({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return ra(e.registerCommand(kP,i=>{if(cA(i.target)){let s=uP(i.target);if(bE(s))return(function(l,d=!1){let c=Oe(),f=l.isSelected(),p=l.getKey(),m;d&&Gx(c)?m=c:(m=rP(),Rr(m)),f?m.delete(p):m.add(p)})(s,i.shiftKey),!0}return!1},Yl),e.registerMutationListener(Fs,(i,s)=>{sE(()=>{let l=!1,{nodeSelections:d}=r.peek();for(let[c,f]of i.entries())if(f==="destroyed")d.delete(c),l=!0;else{let p=d.get(c),m=e.getElementByKey(c);p?p.domNode.value=m:(l=!0,d.set(c,{domNode:ed(m),selectedSignal:o(c)}))}l&&(r.value={nodeSelections:d})})}),Ai(()=>{let i=[];for(let{domNode:s,selectedSignal:l}of r.value.nodeSelections.values())i.push(Ai(()=>{let d=s.value;d&&(l.value?au(d,a):Tm(d,a))}));return ra(...i)}))}});function IE(e){return e.canBeEmpty()}function SE(e,t,n=IE){return ra(e.registerCommand(ym,o=>{let r=Oe();if(!we(r))return!1;o.preventDefault();let a=(function(i){if(i.getNodes().filter(p=>Ql(p)&&p.canIndent()).length>0)return!0;let s=i.anchor,l=i.focus,d=l.isBefore(s)?l:s,c=d.getNode(),f=GA(c);if(f.canIndent()){let p=f.getKey(),m=Rs();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=yP(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?WP:Xx:$P;return e.dispatchCommand(a,void 0)},Xt),e.registerCommand(Xx,()=>{let o=typeof t=="number"?t:t?t.peek():null,r=Oe();if(!we(r))return!1;let a=typeof n=="function"?n:n.peek();return jA(i=>{if(a(i)){let s=i.getIndent()+1;(!o||s<o)&&i.setIndent(s)}})},um))}var I3=Mn({build:(e,t,n)=>$m(t),config:Dr({$canIndent:IE,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){let{disabled:o,maxIndent:r,$canIndent:a}=n.getOutput();return Ai(()=>{if(!o.value)return SE(e,r,a)})}});var gt=Dy,Iae=gt.$createHorizontalRuleNode,Sae=gt.$isDecoratorTextNode,wae=gt.$isHorizontalRuleNode,Tae=gt.AutoFocusExtension,Lae=gt.ClearEditorExtension,kae=gt.DecoratorTextExtension,Pae=gt.DecoratorTextNode,Aae=gt.EditorStateExtension,Eae=gt.HorizontalRuleExtension,Mae=gt.HorizontalRuleNode,Rae=gt.INSERT_HORIZONTAL_RULE_COMMAND,Nae=gt.InitialStateExtension,wE=gt.LexicalBuilder,_ae=gt.NodeSelectionExtension,Dae=gt.TabIndentationExtension,Oae=gt.applyFormatFromStyle,Fae=gt.applyFormatToDom,TE=gt.batch,Bae=gt.buildEditorFromExtensions,zae=gt.computed,$ae=gt.configExtension,Hae=gt.declarePeerDependency,Uae=gt.defineExtension,uu=gt.effect,Kae=gt.getExtensionDependencyFromEditor,qae=gt.getKnownTypesAndNodes,LE=gt.getPeerDependencyFromEditor,Vae=gt.getPeerDependencyFromEditorOrThrow,Hm=gt.namedSignals,Wae=gt.registerClearEditor,Gae=gt.registerTabIndentation,jae=gt.safeCast,Qae=gt.shallowMergeConfig,Xae=gt.signal,Yae=gt.untracked,Jae=gt.watchedSignal;var Oy={};An(Oy,{HistoryExtension:()=>Um,SharedHistoryExtension:()=>T3,createEmptyHistoryState:()=>AE,registerHistory:()=>PE});function S3(e,t,n,o,r){if(e===null||n.size===0&&o.size===0&&!r)return 0;let a=t._selection,i=e._selection;if(r)return 1;if(!(we(a)&&we(i)&&i.isCollapsed()&&a.isCollapsed()))return 0;let s=(function(x,y,C){let w=x._nodeMap,k=[];for(let S of y){let L=w.get(S);L!==void 0&&k.push(L)}for(let[S,L]of C){if(!L)continue;let I=w.get(S);I===void 0||tu(I)||k.push(I)}return k})(t,n,o);if(s.length===0)return 0;if(s.length>1){let x=t._nodeMap,y=x.get(a.anchor.key),C=x.get(i.anchor.key);return y&&C&&!e._nodeMap.has(y.__key)&&tt(y)&&y.__text.length===1&&a.anchor.offset===1?2:0}let l=s[0],d=e._nodeMap.get(l.__key);if(!tt(d)||!tt(l)||d.__mode!==l.__mode)return 0;let c=d.__text,f=l.__text;if(c===f)return 0;let p=a.anchor,m=i.anchor;if(p.key!==m.key||p.type!=="text")return 0;let h=p.offset,g=m.offset,v=f.length-c.length;return v===1&&g===h-1?2:v===-1&&g===h+1?3:v===-1&&g===h?4:0}function w3(e,t){let n=Date.now(),o=0,r=Date.now(),a=0,i=null;return(s,l,d,c,f,p)=>{let m=Date.now();if(p.has(AP)&&(r=n,a=o,i=s),p.has(mm))return o=0,n=m,2;p.has(PP)&&i&&(n=r,o=a,s=i);let h=S3(s,l,c,f,e.isComposing()),g=(()=>{let v=d===null||d.editor===e,x=p.has(BP);if(!x&&v&&p.has(_r))return 0;if(h===1)return 2;if(s===null)return 1;let y=l._selection;if(!(c.size>0||f.size>0))return y!==null?0:2;let C=typeof t=="number"?t:t.peek();return x===!1&&h!==0&&h===o&&m<n+C&&v||c.size===1&&(function(w,k,S){let L=k._nodeMap.get(w),I=S._nodeMap.get(w),T=k._selection,E=S._selection;return!(we(T)&&we(E)&&T.anchor.type==="element"&&T.focus.type==="element"&&E.anchor.type==="text"&&E.focus.type==="text"||!tt(L)||!tt(I)||L.__parent!==I.__parent)&&JSON.stringify(k.read(()=>L.exportJSON()))===JSON.stringify(S.read(()=>I.exportJSON()))})(Array.from(c)[0],s,l)?0:1})();return n=m,o=h,g}}function kE(e){e.undoStack=[],e.redoStack=[],e.current=null}function PE(e,t,n){let o=w3(e,n);return Fa(e.registerCommand(nA,()=>((function(a,i){let s=i.redoStack,l=i.undoStack;if(l.length!==0){let d=i.current,c=l.pop();d!==null&&(s.push(d),a.dispatchCommand(nu,!0)),l.length===0&&a.dispatchCommand(ou,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:mm})}})(e,t),!0),Xt),e.registerCommand(QP,()=>((function(a,i){let s=i.redoStack,l=i.undoStack;if(s.length!==0){let d=i.current;d!==null&&(l.push(d),a.dispatchCommand(ou,!0));let c=s.pop();s.length===0&&a.dispatchCommand(nu,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:mm})}})(e,t),!0),Xt),e.registerCommand(cm,()=>(kE(t),!1),Xt),e.registerCommand(LP,()=>(kE(t),e.dispatchCommand(nu,!1),e.dispatchCommand(ou,!1),!0),Xt),e.registerUpdateListener(({editorState:a,prevEditorState:i,dirtyLeaves:s,dirtyElements:l,tags:d})=>{let c=t.current,f=t.redoStack,p=t.undoStack,m=c===null?null:c.editorState;if(c!==null&&a===m)return;let h=o(i,a,c,s,l,d);if(h===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand(nu,!1)),c!==null&&(p.push({...c}),e.dispatchCommand(ou,!0));else if(h===2)return;t.current={editor:e,editorState:a}}))}function AE(){return{current:null,redoStack:[],undoStack:[]}}var Um=Mn({build:(e,{delay:t,createInitialHistoryState:n,disabled:o})=>Hm({delay:t,disabled:o,historyState:n(e)}),config:Dr({createInitialHistoryState:AE,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,n)=>{let o=n.getOutput();return uu(()=>o.disabled.value?void 0:PE(e,o.historyState.value,o.delay))}}),T3=Mn({dependencies:[Im(Um,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:!0})],name:"@lexical/history/SharedHistory",register(e,t,n){let{output:o}=n.getDependency(Um),r=(function(i){return i?LE(i,Um.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return uu(()=>TE(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var Km=Oy,oie=Km.HistoryExtension,rie=Km.SharedHistoryExtension,qm=Km.createEmptyHistoryState,EE=Km.registerHistory;var Fy={};An(Fy,{HistoryPlugin:()=>L3,createEmptyHistoryState:()=>qm});me();function L3({delay:e,externalHistoryState:t}){let[n]=In();return(function(o,r,a=1e3){let i=z(()=>r||qm(),[r]);q(()=>EE(o,i,a),[a,o,i])})(n,t,e),null}var ME=Fy,RE=ME.HistoryPlugin,NE=ME.createEmptyHistoryState;var By={};An(By,{OnChangePlugin:()=>P3});me();var k3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ye:q;function P3({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=In();return k3(()=>{if(n)return o.registerUpdateListener(({editorState:r,dirtyElements:a,dirtyLeaves:i,prevEditorState:s,tags:l})=>{t&&a.size===0&&i.size===0||e&&l.has(_r)||s.isEmpty()||n(r,o,l)})},[o,e,t,n]),null}var A3=By,_E=A3.OnChangePlugin;var zy={};An(zy,{useLexicalEditable:()=>R3});me();var E3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ye:q;function M3(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function R3(){return(function(e){let[t]=In(),n=z(()=>e(t),[t,e]),[o,r]=G(()=>n.initialValueFn()),a=_(o);return E3(()=>{let{initialValueFn:i,subscribe:s}=n,l=i();return a.current!==l&&(a.current=l,r(l)),s(d=>{a.current=d,r(d)})},[n,e]),o})(M3)}var N3=zy,DE=N3.useLexicalEditable;var $y={};An($y,{ReactProviderExtension:()=>_3});var _3=Mn({name:"@lexical/react/ReactProvider"});var D3=$y,OE=D3.ReactProviderExtension;var Hy={};An(Hy,{DragonExtension:()=>O3,registerDragonSupport:()=>FE});function FE(e){let t=window.location.origin,n=o=>{if(o.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let a=o.data;if(typeof a=="string"){let i;try{i=JSON.parse(a)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){let s=i.payload;if(s&&s.functionId==="makeChanges"){let l=s.args;if(l){let[d,c,f,p,m]=l;e.update(()=>{let h=Oe();if(we(h)){let g=h.anchor,v=g.getNode(),x=0,y=0;if(tt(v)&&d>=0&&c>=0&&(x=d,y=d+c,h.setTextNodeRange(v,x,v,y)),x===y&&f===""||(h.insertRawText(f),v=g.getNode()),tt(v)){x=p,y=p+m;let C=v.getTextContentSize();x=x>C?C:x,y=y>C?C:y,h.setTextNodeRange(v,x,v,y)}o.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}var O3=Mn({build:(e,t,n)=>Hm(t),config:Dr({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>uu(()=>n.getOutput().disabled.value?void 0:FE(e))});var BE=Hy,zE=BE.DragonExtension,$E=BE.registerDragonSupport;var Uy={};An(Uy,{$generateHtmlFromNodes:()=>B3,$generateNodesFromDOM:()=>F3});function F3(e,t){let n=dA(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!UE.has(a.nodeName)){let i=KE(a,e,r,!1);i!==null&&(o=o.concat(i))}return(function(a){for(let i of a)i.getNextSibling()instanceof Qx&&i.insertAfter(Ms());for(let i of a){let s=i.getChildren();for(let l of s)i.insertBefore(l);i.remove()}})(r),o}function B3(e,t){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),o=Ct().getChildren();for(let r=0;r<o.length;r++)HE(e,o[r],n,t);return n.innerHTML}function HE(e,t,n,o=null){let r=o===null||t.isSelected(o),a=Ke(t)&&t.excludeFromCopy("html"),i=t;o!==null&&tt(t)&&(i=Rm(o,t,"clone"));let s=Ke(i)?i.getChildren():[],l=sA(e,i.getType()),d;d=l&&l.exportDOM!==void 0?l.exportDOM(e,i):i.exportDOM(e);let{element:c,after:f}=d;if(!c)return!1;let p=document.createDocumentFragment();for(let m=0;m<s.length;m++){let h=s[m],g=HE(e,h,p,o);!r&&Ke(t)&&g&&t.extractWithChild(h,o,"html")&&(r=!0)}if(r&&!a){if((QA(c)||Zx(c))&&c.append(p),n.append(c),f){let m=f.call(i,c);m&&(Zx(c)?c.replaceChildren(m):c.replaceWith(m))}}else n.append(p);return r}var UE=new Set(["STYLE","SCRIPT"]);function KE(e,t,n,o,r=new Map,a){let i=[];if(UE.has(e.nodeName))return i;let s=null,l=(function(h,g){let{nodeName:v}=h,x=g._htmlConversions.get(v.toLowerCase()),y=null;if(x!==void 0)for(let C of x){let w=C(h);w!==null&&(y===null||(y.priority||0)<=(w.priority||0))&&(y=w)}return y!==null?y.conversion:null})(e,t),d=l?l(e):null,c=null;if(d!==null){c=d.after;let h=d.node;if(s=Array.isArray(h)?h[h.length-1]:h,s!==null){for(let[,g]of r)if(s=g(s,a),!s)break;s&&i.push(...Array.isArray(h)?h:[s])}d.forChild!=null&&r.set(e.nodeName,d.forChild)}let f=e.childNodes,p=[],m=(s==null||!_s(s))&&(s!=null&&Ql(s)||o);for(let h=0;h<f.length;h++)p.push(...KE(f[h],t,n,m,new Map(r),s));return c!=null&&(p=c(p)),vy(e)&&(p=z3(e,p,m?()=>{let h=new Qx;return n.push(h),h}:ur)),s==null?p.length>0?i=i.concat(p):vy(e)&&(function(h){return h.nextSibling==null||h.previousSibling==null?!1:iu(h.nextSibling)&&iu(h.previousSibling)})(e)&&(i=i.concat(Ms())):Ke(s)&&s.append(...p),i}function z3(e,t,n){let o=e.style.textAlign,r=[],a=[];for(let i=0;i<t.length;i++){let s=t[i];if(Ql(s))o&&!s.getFormat()&&s.setFormat(o),r.push(s);else if(a.push(s),i===t.length-1||i<t.length-1&&Ql(t[i+1])){let l=n();l.setFormat(o),l.append(...a),r.push(l),a=[]}}return r}var qE=Uy,VE=qE.$generateHtmlFromNodes,WE=qE.$generateNodesFromDOM;var qy={};An(qy,{$generateJSONFromSelectedNodes:()=>YE,$generateNodesFromSerializedNodes:()=>JE,$getClipboardDataFromSelection:()=>eM,$getHtmlContent:()=>jE,$getLexicalContent:()=>QE,$insertDataTransferForPlainText:()=>$3,$insertDataTransferForRichText:()=>H3,$insertGeneratedNodes:()=>Ky,copyToClipboard:()=>U3,setLexicalClipboardDataTransfer:()=>tM});function Vm(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function jE(e,t=Oe()){return t==null&&Vm(166),we(t)&&t.isCollapsed()||t.getNodes().length===0?"":VE(e,t)}function QE(e,t=Oe()){return t==null&&Vm(166),we(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(YE(e,t))}function $3(e,t){let n=e.getData("text/plain")||e.getData("text/uri-list");n!=null&&t.insertRawText(n)}function H3(e,t,n){let o=e.getData("application/x-lexical-editor");if(o)try{let s=JSON.parse(o);if(s.namespace===n._config.namespace&&Array.isArray(s.nodes))return Ky(n,JE(s.nodes),t)}catch(s){console.error(s)}let r=e.getData("text/html"),a=e.getData("text/plain");if(r&&a!==r)try{let s=new DOMParser().parseFromString((function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:d=>d}).createHTML(l):l})(r),"text/html");return Ky(n,WE(n,s),t)}catch(s){console.error(s)}let i=a||e.getData("text/uri-list");if(i!=null)if(we(t)){let s=i.split(/(\r?\n|\t)/);s[s.length-1]===""&&s.pop();for(let l=0;l<s.length;l++){let d=Oe();if(we(d)){let c=s[l];c===`
3712
+ `);let l=s.length;if(!nt(o)||r>=l){let d=o.getParent();o.remove(),d==null||d.getChildrenSize()!==0||lu(d)||d.remove(),r-=l+i,o=a}else{let d=o.getKey(),c=e.getEditorState().read(()=>{let m=um(d);return nt(m)&&m.isSimpleText()?m.getTextContent():null}),f=l-r,p=s.slice(0,f);if(c!==null&&c!==s){let m=iu(),h=o;if(o.isSimpleText())o.setTextContent(c);else{let g=_r(c);o.replace(g),h=g}if(Se(m)&&m.isCollapsed()){let g=m.anchor.offset;h.select(g,g)}}else if(o.isSimpleText()){let m=t.key===d,h=t.offset;h<r&&(h=l);let g=m?h-r:0,v=m?h:f;if(m&&g===0){let[x]=o.splitText(g,v);x.remove()}else{let[,x]=o.splitText(g,v);x.remove()}}else{let m=_r(p);o.replace(m)}r=0}}}function lU(e){let t=e.getStyle(),n=AA(t);Fm.set(t,n)}function Om(e,t){(Se(e)?e.isCollapsed():nt(e)||Qe(e))||uy(280);let n=Bm(Se(e)?e.style:nt(e)?e.getStyle():e.getTextStyle()),o=Object.entries(t).reduce((a,[i,s])=>(typeof s=="function"?a[i]=s(n[i],e):s===null?delete a[i]:a[i]=s,a),{...n}),r=EA(o);Se(e)||nt(e)?e.setStyle(r):e.setTextStyle(r),Fm.set(r,o)}function dU(e,t){if(Se(e)&&e.isCollapsed()){Om(e,t);let o=e.anchor.getNode();Qe(o)&&o.isEmpty()&&Om(o,t)}RA(o=>{Om(o,t)});let n=e.getNodes();if(n.length>0){let o=new Set;for(let r of n){if(!Qe(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();o.has(a)||(o.add(a),Om(r,t))}}}function RA(e){let t=$e();if(!t)return;let n=new Map,o=a=>n.get(a.getKey())||[0,a.getTextContentSize()];if(Se(t))for(let a of cP(t).getTextSlices())a&&n.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!nt(a)||!a.canHaveFormat())continue;let[i,s]=o(a);s!==i&&(Zx(a)||i===0&&s===a.getTextContentSize()?e(a):e(a.splitText(i,s)[i===0?0:1]))}Se(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&NA(t)}function NA(e){if(e.isBackward()){let{anchor:t,focus:n}=e,{key:o,offset:r,type:a}=t;t.set(n.key,n.offset,n.type),n.set(o,r,a)}}function _A(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function cU(e,t,n=_A){if(e===null)return;let o=e.getStartEndPoints(),r=new Map,a=null;if(o){let[i,s]=o;a=_s(),a.anchor.set(i.key,i.offset,i.type),a.focus.set(s.key,s.offset,s.type);let l=Ha(i.getNode(),uu),d=Ha(s.getNode(),uu);Qe(l)&&r.set(l.getKey(),l),Qe(d)&&r.set(d.getKey(),d)}for(let i of e.getNodes())if(Qe(i)&&uu(i))r.set(i.getKey(),i);else if(o===null){let s=Ha(i,uu);Qe(s)&&r.set(s.getKey(),s)}for(let[i,s]of r){let l=t();n(s,l),s.replace(l,!0),a&&(i===a.anchor.key&&a.anchor.set(l.getKey(),a.anchor.offset,a.anchor.type),i===a.focus.key&&a.focus.set(l.getKey(),a.focus.offset,a.focus.type))}a&&e.is($e())&&Dr(a)}function PA(e){return e.getNode().isAttached()}function uU(e){let t=e;for(;t!==null&&!Os(t);){let n=t.getLatest(),o=t.getParent();n.getChildrenSize()===0&&t.remove(!0),t=o}}function fU(e,t,n=null){let o=e.getStartEndPoints(),r=o?o[0]:null,a=e.getNodes(),i=a.length;if(r!==null&&(i===0||i===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){let d=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),c=d.getChildren(),f=t();return f.setFormat(d.getFormatType()),f.setIndent(d.getIndent()),c.forEach(p=>f.append(p)),n&&(f=n.append(f)),void d.replace(f)}let s=null,l=[];for(let d=0;d<i;d++){let c=a[d];Os(c)?(cy(e,l,l.length,t,n),l=[],s=c):s===null||s!==null&&bP(c,s)?l.push(c):(cy(e,l,l.length,t,n),l=[c])}cy(e,l,l.length,t,n)}function cy(e,t,n,o,r=null){if(t.length===0)return;let a=t[0],i=new Map,s=[],l=Qe(a)?a:a.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let d=!1;for(;l!==null;){let h=l.getPreviousSibling();if(h!==null){l=h,d=!0;break}if(l=l.getParentOrThrow(),Os(l))break}let c=new Set;for(let h=0;h<n;h++){let g=t[h];Qe(g)&&g.getChildrenSize()===0&&c.add(g.getKey())}let f=new Set;for(let h=0;h<n;h++){let g=t[h],v=g.getParent();if(v!==null&&v.isInline()&&(v=v.getParent()),v!==null&&wP(g)&&!f.has(g.getKey())){let x=v.getKey();if(i.get(x)===void 0){let y=o();y.setFormat(v.getFormatType()),y.setIndent(v.getIndent()),s.push(y),i.set(x,y),v.getChildren().forEach(C=>{y.append(C),f.add(C.getKey()),Qe(C)&&C.getChildrenKeys().forEach(S=>f.add(S))}),uU(v)}}else if(c.has(g.getKey())){Qe(g)||uy(179);let x=o();x.setFormat(g.getFormatType()),x.setIndent(g.getIndent()),s.push(x),g.remove(!0)}}if(r!==null)for(let h=0;h<s.length;h++){let g=s[h];r.append(g)}let p=null;if(Os(l))if(d)if(r!==null)l.insertAfter(r);else for(let h=s.length-1;h>=0;h--){let g=s[h];l.insertAfter(g)}else{let h=l.getFirstChild();if(Qe(h)&&(l=h),h===null)if(r)l.append(r);else for(let g=0;g<s.length;g++){let v=s[g];l.append(v),p=v}else if(r!==null)h.insertBefore(r);else for(let g=0;g<s.length;g++){let v=s[g];h.insertBefore(v),p=v}}else if(r)l.insertAfter(r);else for(let h=s.length-1;h>=0;h--){let g=s[h];l.insertAfter(g),p=g}let m=iu();Se(m)&&PA(m.anchor)&&PA(m.focus)?Dr(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function DA(e){let t=OA(e);return t!==null&&t.writingMode==="vertical-rl"}function OA(e){let t=e.anchor.getNode();return Qe(t)?fy(t):py(t)}function pU(e,t){let n=DA(e)?!t:t;my(e)&&(n=!n);let o=nd(e.focus,n?"previous":"next");if(SP(o))return!1;for(let r of hP(o)){if(su(r))return!r.origin.isInline();if(!Qe(r.origin)){if(pm(r.origin))return!0;break}}return!1}function FA(e,t,n,o){e.modify(t?"extend":"move",n,o)}function my(e){let t=OA(e);return t!==null&&t.direction==="rtl"}function mU(e,t,n){let o=my(e),r;r=DA(e)||o?!n:n,FA(e,t,r,"character")}function gU(e,t,n){let o=Bm(e.getStyle());return o!==null&&o[t]||n}function hU(e,t,n=""){let o=null,r=e.getNodes(),a=e.anchor,i=e.focus,s=e.isBackward(),l=s?i.offset:a.offset,d=s?i.getNode():a.getNode();if(Se(e)&&e.isCollapsed()&&e.style!==""){let c=Bm(e.style);if(c!==null&&t in c)return c[t]}for(let c=0;c<r.length;c++){let f=r[c];if((c===0||l!==0||!f.is(d))&&nt(f)){let p=gU(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var vU=MA;var an=gy,BA=an.$addNodeStyle,ere=an.$cloneWithProperties,tre=an.$copyBlockFormatIndent,nre=an.$ensureForwardRangeSelection,ore=an.$forEachSelectedTextNode,rre=an.$getComputedStyleForElement,are=an.$getComputedStyleForParent,ire=an.$getSelectionStyleValueForProperty,sre=an.$isAtNodeEnd,lre=an.$isParentElementRTL,dre=an.$isParentRTL,cre=an.$moveCaretSelection,hy=an.$moveCharacter,ure=an.$patchStyleText,fre=an.$selectAll,pre=an.$setBlocksType,vy=an.$shouldOverrideDefaultCharacterSelection,zm=an.$sliceSelectedTextNodeContent,mre=an.$trimTextContentFromAnchor,gre=an.$wrapNodes,hre=an.createDOMRange,zA=an.createRectsFromDOMRange,vre=an.getCSSFromStyleObject,xre=an.getStyleObjectFromCSS,yre=an.trimTextContentFromAnchor;var by={};Mn(by,{$descendantsMatching:()=>e3,$dfs:()=>OU,$dfsIterator:()=>QA,$filter:()=>jU,$findMatchingParent:()=>Ha,$firstToLastIterator:()=>t3,$getAdjacentCaret:()=>FU,$getAdjacentSiblingOrParentSiblingCaret:()=>Ds,$getDepth:()=>YA,$getNearestBlockElementAncestorOrThrow:()=>UU,$getNearestNodeOfType:()=>HU,$getNextRightPreorderNode:()=>$U,$getNextSiblingOrParentSibling:()=>zU,$handleIndentAndOutdent:()=>QU,$insertFirst:()=>XU,$insertNodeToNearestRoot:()=>VU,$insertNodeToNearestRootAtCaret:()=>ZA,$isEditorIsNestedEditor:()=>JU,$lastToFirstIterator:()=>Cy,$restoreEditorState:()=>qU,$reverseDfs:()=>BU,$reverseDfsIterator:()=>JA,$splitNode:()=>NP,$unwrapAndFilterDescendants:()=>ZU,$unwrapNode:()=>n3,$wrapNodeInElement:()=>WU,CAN_USE_BEFORE_INPUT:()=>LU,CAN_USE_DOM:()=>WA,IS_ANDROID:()=>PU,IS_ANDROID_CHROME:()=>AU,IS_APPLE:()=>EU,IS_APPLE_WEBKIT:()=>MU,IS_CHROME:()=>RU,IS_FIREFOX:()=>GA,IS_IOS:()=>NU,IS_SAFARI:()=>_U,addClassNamesToElement:()=>fu,calculateZoomLevel:()=>YU,isBlockDomNode:()=>vA,isHTMLAnchorElement:()=>CA,isHTMLElement:()=>Mm,isInlineDomNode:()=>pu,isMimeType:()=>jA,makeStateWrapper:()=>o3,markSelection:()=>VA,mediaFileReader:()=>DU,mergeRegister:()=>la,objectKlassEquals:()=>GU,positionNodeOnRange:()=>qA,registerNestedElementResolver:()=>KU,removeClassNamesFromElement:()=>Rm,selectionAlwaysOnDisplay:()=>kU});function $m(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var zr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,xU=zr&&"documentMode"in document?document.documentMode:null,UA=zr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),yU=zr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),CU=!(!zr||!("InputEvent"in window)||xU)&&"getTargetRanges"in new window.InputEvent("input"),bU=zr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),IU=zr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,KA=zr&&/Android/.test(navigator.userAgent),yy=zr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),SU=zr&&KA&&yy,wU=zr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&UA&&!yy;function da(e){return`${e}px`}var TU={attributes:!0,characterData:!0,childList:!0,subtree:!0};function qA(e,t,n){let o=null,r=null,a=null,i=[],s=document.createElement("div");function l(){o===null&&$m(182),r===null&&$m(183);let{left:f,top:p}=r.getBoundingClientRect(),m=zA(e,t);var h,g;s.isConnected||(g=s,(h=r).insertBefore(g,h.firstChild));let v=!1;for(let x=0;x<m.length;x++){let y=m[x],C=i[x]||document.createElement("div"),S=C.style;S.position!=="absolute"&&(S.position="absolute",v=!0);let L=da(y.left-f);S.left!==L&&(S.left=L,v=!0);let w=da(y.top-p);S.top!==w&&(C.style.top=w,v=!0);let k=da(y.width);S.width!==k&&(C.style.width=k,v=!0);let I=da(y.height);S.height!==I&&(C.style.height=I,v=!0),C.parentNode!==s&&(s.append(C),v=!0),i[x]=C}for(;i.length>m.length;)i.pop();v&&n(i)}function d(){r=null,o=null,a!==null&&a.disconnect(),a=null,s.remove();for(let f of i)f.remove();i=[]}s.style.position="relative";let c=e.registerRootListener(function f(){let p=e.getRootElement();if(p===null)return d();let m=p.parentElement;if(!Mm(m))return d();d(),o=p,r=m,a=new MutationObserver(h=>{let g=e.getRootElement(),v=g&&g.parentElement;if(g!==o||v!==r)return f();for(let x of h)if(!s.contains(x.target))return l()}),a.observe(m,TU),l()});return()=>{c(),d()}}function $A(e,t,n){if(e.type!=="text"&&Qe(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[gA(n)||n,e.offset]}function VA(e,t){let n=null,o=null,r=null,a=null,i=null,s=null,l=()=>{};function d(c){c.read(()=>{let f=$e();if(!Se(f))return n=null,r=null,a=null,s=null,l(),void(l=()=>{});let[p,m]=(function(I){let T=I.getStartEndPoints();return I.isBackward()?[T[1],T[0]]:T})(f),h=p.getNode(),g=h.getKey(),v=p.offset,x=m.getNode(),y=x.getKey(),C=m.offset,S=e.getElementByKey(g),L=e.getElementByKey(y),w=n===null||S!==o||v!==r||g!==n.getKey(),k=a===null||L!==i||C!==s||y!==a.getKey();if((w||k)&&S!==null&&L!==null){let I=(function(T,E,A,N,R,$,U){let H=(T._window?T._window.document:document).createRange();return H.setStart(...$A(E,A,N)),H.setEnd(...$A(R,$,U)),H})(e,p,h,S,m,x,L);l(),l=qA(e,I,T=>{if(t===void 0)for(let E of T){let A=E.style;A.background!=="Highlight"&&(A.background="Highlight"),A.color!=="HighlightText"&&(A.color="HighlightText"),A.marginTop!==da(-1.5)&&(A.marginTop=da(-1.5)),A.paddingTop!==da(4)&&(A.paddingTop=da(4)),A.paddingBottom!==da(0)&&(A.paddingBottom=da(0))}else t(T)})}n=h,o=S,r=v,a=x,i=L,s=C})}return d(e.getEditorState()),la(e.registerUpdateListener(({editorState:c})=>d(c)),()=>{l()})}function kU(e,t){let n=null,o=()=>{let r=getSelection(),a=r&&r.anchorNode,i=e.getRootElement();a!==null&&i!==null&&i.contains(a)?n!==null&&(n(),n=null):n===null&&(n=VA(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var LU=CU,WA=zr,PU=KA,AU=SU,EU=UA,MU=wU,RU=yy,GA=yU,NU=IU,_U=bU;function jA(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function DU(e,t){let n=e[Symbol.iterator]();return new Promise((o,r)=>{let a=[],i=()=>{let{done:s,value:l}=n.next();if(s)return o(a);let d=new FileReader;d.addEventListener("error",r),d.addEventListener("load",()=>{let c=d.result;typeof c=="string"&&a.push({file:l,result:c}),i()}),jA(l,t)?d.readAsDataURL(l):i()};i()})}function OU(e,t){return Array.from(QA(e,t))}function FU(e){return e?e.getAdjacentCaret():null}function BU(e,t){return Array.from(JA(e,t))}function QA(e,t){return XA("next",e,t)}function HA(e,t){let n=Ds(Ua(e,t));return n&&n[0]}function XA(e,t,n){let o=bt(),r=t||o,a=Qe(r)?Di(r,e):Ua(r,e),i=YA(r),s=n?Qx(Yx(Ua(n,e)))||HA(n,e):HA(r,e),l=i;return ay({hasNext:d=>d!==null,initial:a,map:d=>({depth:l,node:d.origin}),step:d=>{if(d.isSameNodeCaret(s))return null;su(d)&&l++;let c=Ds(d);return!c||c[0].isSameNodeCaret(s)?null:(l+=c[1],c[0])}})}function zU(e){let t=Ds(Ua(e,"next"));return t&&[t[0].origin,t[1]]}function YA(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function $U(e){let t=Yx(Ua(e,"previous")),n=Ds(t,"root");return n&&n[0].origin}function JA(e,t){return XA("previous",e,t)}function HU(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function UU(e){let t=Ha(e,n=>Qe(n)&&!n.isInline());return Qe(t)||$m(4,e.__key),t}function KU(e,t,n,o){let r=a=>a instanceof t;return e.registerNodeTransform(t,a=>{let i=(s=>{let l=s.getChildren();for(let f=0;f<l.length;f++){let p=l[f];if(r(p))return null}let d=s,c=s;for(;d!==null;)if(c=d,d=d.getParent(),r(d))return{child:c,parent:d};return null})(a);if(i!==null){let{child:s,parent:l}=i;if(s.is(a)){o(l,a);let d=s.getNextSiblings(),c=d.length;if(l.insertAfter(s),c!==0){let f=n(l);s.insertAfter(f);for(let p=0;p<c;p++)f.append(d[p])}l.canBeEmpty()||l.getChildrenSize()!==0||l.remove()}}})}function qU(e,t){let n=new Map,o=e._pendingEditorState;for(let[a,i]of t._nodeMap)n.set(a,dm(i));o&&(o._nodeMap=n),e._dirtyType=2;let r=t._selection;Dr(r===null?null:r.clone())}function VU(e){let t=$e()||iu(),n;if(Se(t))n=nd(t.focus,"next");else{if(t!=null){let i=t.getNodes(),s=i[i.length-1];s&&(n=Ua(s,"next"))}n=n||Di(bt(),"previous").getFlipped().insert(mr())}let o=ZA(e,n),r=Qx(o),a=su(r)?LP(r):o;return MP(yP(a)),e.getLatest()}function ZA(e,t,n){let o=Xx(t,"next");for(let r=o;r;r=RP(r,n))o=r;return mm(o)&&$m(283),o.insert(e.isInline()?mr().append(e):e),Xx(Ua(e.getLatest(),"next"),t.direction)}function WU(e,t){let n=t();return e.replace(n),n.append(e),n}function GU(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function jU(e,t){let n=[];for(let o=0;o<e.length;o++){let r=t(e[o]);r!==null&&n.push(r)}return n}function QU(e){let t=$e();if(!Se(t))return!1;let n=new Set,o=t.getNodes();for(let r=0;r<o.length;r++){let a=o[r],i=a.getKey();if(n.has(i))continue;let s=Ha(a,d=>Qe(d)&&!d.isInline());if(s===null)continue;let l=s.getKey();s.canIndent()&&!n.has(l)&&(n.add(l),e(s))}return n.size>0}function XU(e,t){Di(e,"next").insert(t)}var xy=!(GA||!WA)&&void 0;function YU(e,t=!1){let n=1;if((function(){if(xy===void 0){let o=document.createElement("div");o.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(o);let r=o.getBoundingClientRect();o.style.setProperty("zoom","2"),xy=o.getBoundingClientRect().width===r.width,document.body.removeChild(o)}return xy})()||t)for(;e;)n*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return n}function JU(e){return e._parentEditor!==null}function ZU(e,t){return eE(e,t,null)}function eE(e,t,n){let o=!1;for(let r of Cy(e))t(r)?n!==null&&n(r):(o=!0,Qe(r)&&eE(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function e3(e,t){let n=[],o=Array.from(e).reverse();for(let r=o.pop();r!==void 0;r=o.pop())if(t(r))n.push(r);else if(Qe(r))for(let a of Cy(r))o.push(a);return n}function t3(e){return tE(Di(e,"next"))}function Cy(e){return tE(Di(e,"previous"))}function tE(e){return ay({hasNext:kP,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function n3(e){EP(Ua(e,"next")).splice(1,e.getChildren())}function o3(e){let t=o=>fm(o,e),n=(o,r)=>hm(o,e,r);return{$get:t,$set:n,accessors:[t,n],makeGetterMethod:()=>function(){return t(this)},makeSetterMethod:()=>function(o){return n(this,o)},stateConfig:e}}var Xe=by,wre=Xe.$descendantsMatching,Tre=Xe.$dfs,kre=Xe.$dfsIterator,Lre=Xe.$filter,Pre=Xe.$findMatchingParent,Are=Xe.$firstToLastIterator,Ere=Xe.$getAdjacentCaret,Mre=Xe.$getAdjacentSiblingOrParentSiblingCaret,Rre=Xe.$getDepth,nE=Xe.$getNearestBlockElementAncestorOrThrow,Nre=Xe.$getNearestNodeOfType,_re=Xe.$getNextRightPreorderNode,Dre=Xe.$getNextSiblingOrParentSibling,oE=Xe.$handleIndentAndOutdent,Ore=Xe.$insertFirst,Fre=Xe.$insertNodeToNearestRoot,Bre=Xe.$insertNodeToNearestRootAtCaret,zre=Xe.$isEditorIsNestedEditor,$re=Xe.$lastToFirstIterator,Hre=Xe.$restoreEditorState,Ure=Xe.$reverseDfs,Kre=Xe.$reverseDfsIterator,qre=Xe.$splitNode,Vre=Xe.$unwrapAndFilterDescendants,Wre=Xe.$unwrapNode,Gre=Xe.$wrapNodeInElement,jre=Xe.CAN_USE_BEFORE_INPUT,Qre=Xe.CAN_USE_DOM,Xre=Xe.IS_ANDROID,Yre=Xe.IS_ANDROID_CHROME,Jre=Xe.IS_APPLE,Zre=Xe.IS_APPLE_WEBKIT,eae=Xe.IS_CHROME,tae=Xe.IS_FIREFOX,nae=Xe.IS_IOS,oae=Xe.IS_SAFARI,rae=Xe.addClassNamesToElement,aae=Xe.calculateZoomLevel,Iy=Xe.isBlockDomNode,iae=Xe.isHTMLAnchorElement,rE=Xe.isHTMLElement,sae=Xe.isInlineDomNode,lae=Xe.isMimeType,dae=Xe.makeStateWrapper,cae=Xe.markSelection,uae=Xe.mediaFileReader,qa=Xe.mergeRegister,mu=Xe.objectKlassEquals,fae=Xe.positionNodeOnRange,pae=Xe.registerNestedElementResolver,mae=Xe.removeClassNamesFromElement,gae=Xe.selectionAlwaysOnDisplay;var Sy={};Mn(Sy,{ContentEditable:()=>a3,ContentEditableElement:()=>sE});ge();var iE=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?xe:K;function r3({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:r,ariaErrorMessage:a,ariaExpanded:i,ariaInvalid:s,ariaLabel:l,ariaLabelledBy:d,ariaMultiline:c,ariaOwns:f,ariaRequired:p,autoCapitalize:m,className:h,id:g,role:v="textbox",spellCheck:x=!0,style:y,tabIndex:C,"data-testid":S,...L},w){let[k,I]=G(e.isEditable()),T=B(A=>{A&&A.ownerDocument&&A.ownerDocument.defaultView?e.setRootElement(A):e.setRootElement(null)},[e]),E=z(()=>(function(...A){return N=>{for(let R of A)typeof R=="function"?R(N):R!=null&&(R.current=N)}})(w,T),[T,w]);return iE(()=>(I(e.isEditable()),e.registerEditableListener(A=>{I(A)})),[e]),u("div",{"aria-activedescendant":k?t:void 0,"aria-autocomplete":k?n:"none","aria-controls":k?o:void 0,"aria-describedby":r,...a!=null?{"aria-errormessage":a}:{},"aria-expanded":k&&v==="combobox"?!!i:void 0,...s!=null?{"aria-invalid":s}:{},"aria-label":l,"aria-labelledby":d,"aria-multiline":c,"aria-owns":k?f:void 0,"aria-readonly":!k||void 0,"aria-required":p,autoCapitalize:m,className:h,contentEditable:k,"data-testid":S,id:g,ref:E,role:v,spellCheck:x,style:y,tabIndex:C,...L})}var sE=qn(r3);function aE(e){return e.getEditorState().read(Dm(e.isComposing()))}var a3=qn(i3);function i3(e,t){let{placeholder:n,...o}=e,[r]=wn();return b(Ce,{children:[u(sE,{editor:r,...o,ref:t}),n!=null&&u(s3,{editor:r,content:n})]})}function s3({content:e,editor:t}){let n=(function(i){let[s,l]=G(()=>aE(i));return iE(()=>{function d(){let c=aE(i);l(c)}return d(),qa(i.registerUpdateListener(()=>{d()}),i.registerEditableListener(()=>{d()}))},[i]),s})(t),[o,r]=G(t.isEditable());if(xe(()=>(r(t.isEditable()),t.registerEditableListener(i=>{r(i)})),[t]),!n)return null;let a=null;return typeof e=="function"?a=e(o):e!==null&&(a=e),a===null?null:u("div",{"aria-hidden":!0,children:a})}var lE=Sy,dE=lE.ContentEditable,Iae=lE.ContentEditableElement;ge();var l3=Ut(null),wy={didCatch:!1,error:null},Hm=class extends qi{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=wy}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(...t){let{error:n}=this.state;n!==null&&(this.props.onReset?.({args:t,reason:"imperative-api"}),this.setState(wy))}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t,n){let{didCatch:o}=this.state,{resetKeys:r}=this.props;o&&n.error!==null&&d3(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(wy))}render(){let{children:t,fallbackRender:n,FallbackComponent:o,fallback:r}=this.props,{didCatch:a,error:i}=this.state,s=t;if(a){let l={error:i,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")s=n(l);else if(o)s=we(o,l);else if(r!==void 0)s=r;else throw i}return we(l3.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}};function d3(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var Ty={};Mn(Ty,{LexicalErrorBoundary:()=>c3});function c3({children:e,onError:t}){return u(Hm,{fallback:u("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var u3=Ty,cE=u3.LexicalErrorBoundary;var $y={};Mn($y,{$createHorizontalRuleNode:()=>zy,$isDecoratorTextNode:()=>wE,$isHorizontalRuleNode:()=>EE,AutoFocusExtension:()=>m3,ClearEditorExtension:()=>g3,DecoratorTextExtension:()=>b3,DecoratorTextNode:()=>vu,EditorStateExtension:()=>Vm,HorizontalRuleExtension:()=>R3,HorizontalRuleNode:()=>zs,INSERT_HORIZONTAL_RULE_COMMAND:()=>E3,InitialStateExtension:()=>PE,LexicalBuilder:()=>dd,NodeSelectionExtension:()=>Dy,TabIndentationExtension:()=>N3,applyFormatFromStyle:()=>v3,applyFormatToDom:()=>x3,batch:()=>hE,buildEditorFromExtensions:()=>T3,computed:()=>yE,configExtension:()=>Am,declarePeerDependency:()=>mA,defineExtension:()=>Nn,effect:()=>Fi,getExtensionDependencyFromEditor:()=>L3,getKnownTypesAndNodes:()=>h3,getPeerDependencyFromEditor:()=>AE,getPeerDependencyFromEditorOrThrow:()=>P3,namedSignals:()=>Gm,registerClearEditor:()=>IE,registerTabIndentation:()=>RE,safeCast:()=>Br,shallowMergeConfig:()=>Nm,signal:()=>ld,untracked:()=>My,watchedSignal:()=>Fy});var f3=Symbol.for("preact-signals");function Wm(){if(Oi>1)return void Oi--;let e,t=!1;for(;hu!==void 0;){let n=hu;for(hu=void 0,Ry++;n!==void 0;){let o=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&vE(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(Ry=0,Oi--,t)throw e}function hE(e){if(Oi>0)return e();Oi++;try{return e()}finally{Wm()}}var Rt,hu;function My(e){let t=Rt;Rt=void 0;try{return e()}finally{Rt=t}}var Oi=0,Ry=0,qm=0;function uE(e){if(Rt===void 0)return;let t=e.n;return t===void 0||t.t!==Rt?(t={i:0,S:e,p:Rt.s,n:void 0,t:Rt,e:void 0,x:void 0,r:t},Rt.s!==void 0&&(Rt.s.n=t),Rt.s=t,e.n=t,32&Rt.f&&e.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Rt.s,t.n=void 0,Rt.s.n=t,Rt.s=t),t):void 0}function Lo(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function ld(e,t){return new Lo(e,t)}function vE(e){for(let t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function fE(e){for(let t=e.s;t!==void 0;t=t.n){let n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function xE(e){let t,n=e.s;for(;n!==void 0;){let o=n.p;n.i===-1?(n.S.U(n),o!==void 0&&(o.n=n.n),n.n!==void 0&&(n.n.p=o)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=o}e.s=t}function Bs(e,t){Lo.call(this,void 0),this.x=e,this.s=void 0,this.g=qm-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function yE(e,t){return new Bs(e,t)}function CE(e){let t=e.u;if(e.u=void 0,typeof t=="function"){Oi++;let n=Rt;Rt=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Oy(e),o}finally{Rt=n,Wm()}}}function Oy(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,CE(e)}function p3(e){if(Rt!==this)throw new Error("Out-of-order effect");xE(this),Rt=e,this.f&=-2,8&this.f&&Oy(this),Wm()}function sd(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=t?.name}function Fi(e,t){let n=new sd(e,t);try{n.c()}catch(r){throw n.d(),r}let o=n.d.bind(n);return o[Symbol.dispose]=o,o}function Gm(e,t={}){let n={};for(let o in e){let r=t[o],a=ld(r===void 0?e[o]:r);n[o]=a}return n}Lo.prototype.brand=f3,Lo.prototype.h=function(){return!0},Lo.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t!==void 0?t.e=e:My(()=>{var n;(n=this.W)==null||n.call(this)}))},Lo.prototype.U=function(e){if(this.t!==void 0){let t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&My(()=>{var o;(o=this.Z)==null||o.call(this)}))}},Lo.prototype.subscribe=function(e){return Fi(()=>{let t=this.value,n=Rt;Rt=void 0;try{e(t)}finally{Rt=n}},{name:"sub"})},Lo.prototype.valueOf=function(){return this.value},Lo.prototype.toString=function(){return this.value+""},Lo.prototype.toJSON=function(){return this.value},Lo.prototype.peek=function(){let e=Rt;Rt=void 0;try{return this.value}finally{Rt=e}},Object.defineProperty(Lo.prototype,"value",{get(){let e=uE(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Ry>100)throw new Error("Cycle detected");this.v=e,this.i++,qm++,Oi++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Wm()}}}}),Bs.prototype=new Lo,Bs.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===qm))return!0;if(this.g=qm,this.f|=1,this.i>0&&!vE(this))return this.f&=-2,!0;let e=Rt;try{fE(this),Rt=this;let t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return Rt=e,xE(this),this.f&=-2,!0},Bs.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let t=this.s;t!==void 0;t=t.n)t.S.S(t)}Lo.prototype.S.call(this,e)},Bs.prototype.U=function(e){if(this.t!==void 0&&(Lo.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let t=this.s;t!==void 0;t=t.n)t.S.U(t)}},Bs.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(Bs.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=uE(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),sd.prototype.c=function(){let e=this.S();try{if(8&this.f||this.x===void 0)return;let t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}},sd.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,CE(this),fE(this),Oi++;let e=Rt;return Rt=this,p3.bind(this,e)},sd.prototype.N=function(){2&this.f||(this.f|=2,this.o=hu,hu=this)},sd.prototype.d=function(){this.f|=8,1&this.f||Oy(this)},sd.prototype.dispose=function(){this.d()};var m3=Nn({build:(e,t,n)=>Gm(t),config:Br({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){let o=n.getOutput();return Fi(()=>o.disabled.value?void 0:e.registerRootListener(r=>{e.focus(()=>{let a=document.activeElement;r===null||a!==null&&r.contains(a)||r.focus({preventScroll:!0})},{defaultSelection:o.defaultSelection.peek()})}))}});function bE(){let e=bt(),t=$e(),n=mr();e.clear(),e.append(n),t!==null&&n.select(),Se(t)&&(t.format=0)}function IE(e,t=bE){return e.registerCommand(vm,n=>(e.update(t),!0),Xt)}var g3=Nn({build:(e,t,n)=>Gm(t),config:Br({$onClear:bE}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return Fi(()=>IE(e,o.value))}});function h3(e){let t=new Set,n=new Set;for(let o of SE(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function SE(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var ky=pA("format",{parse:e=>typeof e=="number"?e:0}),vu=class extends Ka{$config(){return this.config("decorator-text",{extends:Ka,stateConfigs:[{flat:!0,stateConfig:ky}]})}getFormat(){return fm(this,ky)}getFormatFlags(t,n){return iy(this.getFormat(),t,n)}hasFormat(t){let n=dA[t];return(this.getFormat()&n)!==0}setFormat(t){return hm(this,ky,t)}toggleFormat(t){let n=this.getFormat(),o=iy(n,t,null);return this.setFormat(o)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function wE(e){return e instanceof vu}function v3(e,t,n){let o=t.fontWeight,r=t.textDecoration.split(" "),a=o==="700"||o==="bold",i=r.includes("line-through"),s=t.fontStyle==="italic",l=r.includes("underline"),d=t.verticalAlign;return a&&!e.hasFormat("bold")&&e.toggleFormat("bold"),i&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),s&&!e.hasFormat("italic")&&e.toggleFormat("italic"),l&&!e.hasFormat("underline")&&e.toggleFormat("underline"),d!=="sub"||e.hasFormat("subscript")||e.toggleFormat("subscript"),d!=="super"||e.hasFormat("superscript")||e.toggleFormat("superscript"),n&&!e.hasFormat(n)&&e.toggleFormat(n),e}function x3(e,t,n=C3){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=y3(t,o));return t}function y3(e,t){let n=document.createElement(t);return n.appendChild(e),n}var C3={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},b3=Nn({name:"@lexical/extension/DecoratorText",nodes:()=>[vu],register:(e,t,n)=>e.registerCommand(WP,o=>{let r=$e();if(Jx(r)||Se(r))for(let a of r.getNodes())wE(a)&&a.toggleFormat(o);return!1},ad)});function Fy(e,t){let n;return ld(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var Vm=Nn({build:e=>Fy(()=>e.getEditorState(),t=>e.registerUpdateListener(n=>{t.value=n.editorState})),name:"@lexical/extension/EditorState"});function Ft(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function TE(e,t){if(e&&t&&!Array.isArray(t)&&typeof e=="object"&&typeof t=="object"){let n=e,o=t;for(let r in o)n[r]=TE(n[r],o[r]);return e}return t}var By=0,Ny=1,kE=2,Ly=3,Um=4,id=5,Py=6,gu=7;function Ay(e){return e.id===By}function LE(e){return e.id===kE}function I3(e){return(function(t){return t.id===Ny})(e)||Ft(305,String(e.id),String(Ny)),Object.assign(e,{id:kE})}var S3=new Set,_y=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,n){this.builder=t,this.extension=n,this.configs=new Set,this.state={id:By}}mergeConfigs(){let t=this.extension.config||{},n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Nm;for(let o of this.configs)t=n(t,o);return t}init(t){let n=this.state;LE(n)||Ft(306,String(n.id));let o={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...o,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},a=(function(s,l,d){return Object.assign(s,{config:l,id:Ly,registerState:d})})(n,this.mergeConfigs(),o),i;this.state=a,this.extension.init&&(i=this.extension.init(t,a.config,o)),this.state=(function(s,l,d){return Object.assign(s,{id:Um,initResult:l,registerState:d})})(a,i,r)}build(t){let n=this.state,o;n.id!==Um&&Ft(307,String(n.id),String(id)),this.extension.build&&(o=this.extension.build(t,n.config,n.registerState));let r={...n.registerState,getOutput:()=>o,getSignal:this.getSignal.bind(this)};this.state=(function(a,i,s){return Object.assign(a,{id,output:i,registerState:s})})(n,o,r)}register(t,n){this._signal=n;let o=this.state;o.id!==id&&Ft(308,String(o.id),String(id));let r=this.extension.register&&this.extension.register(t,o.config,o.registerState);return this.state=(function(a){return Object.assign(a,{id:Py})})(o),()=>{let a=this.state;a.id!==gu&&Ft(309,String(o.id),String(gu)),this.state=(function(i){return Object.assign(i,{id})})(a),r&&r()}}afterRegistration(t){let n=this.state,o;return n.id!==Py&&Ft(310,String(n.id),String(Py)),this.extension.afterRegistration&&(o=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(r){return Object.assign(r,{id:gu})})(n),o}getSignal(){return this._signal===void 0&&Ft(311),this._signal}getInitResult(){this.extension.init===void 0&&Ft(312,this.extension.name);let t=this.state;return(function(n){return n.id>=Um})(t)||Ft(313,String(t.id),String(Um)),t.initResult}getInitPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionInitDependency():void 0}getExtensionInitDependency(){let t=this.state;return(function(n){return n.id>=Ly})(t)||Ft(314,String(t.id),String(Ly)),{config:t.config}}getPeer(t){let n=this.builder.extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}getInitDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Ft(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Ft(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){let t=this.state;return(function(n){return n.id>=gu})(t)||Ft(316,String(t.id),String(gu)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||S3}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([n])=>n)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){let t=this.state;(function(n){return n.id>=id})(t)||Ft(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},pE={tag:Fr};function w3(){let e=bt();e.isEmpty()&&e.append(mr())}var PE=Nn({config:Br({setOptions:pE,updateOptions:pE}),init:({$initialEditorState:e=w3})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},o){let r=o.getInitResult();if(!r.initialized){r.initialized=!0;let{$initialEditorState:a}=r;if(IP(a))e.setEditorState(a,n);else if(typeof a=="function")e.update(()=>{a(e)},t);else if(a&&(typeof a=="string"||typeof a=="object")){let i=e.parseEditorState(a);e.setEditorState(i,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[iA,Pm,eA,cA,oA]}),mE=Symbol.for("@lexical/extension/LexicalBuilder");function T3(...e){return dd.fromExtensions(e).buildEditor()}function gE(){}function k3(e){throw e}function Km(e){return Array.isArray(e)?e:[e]}var Ey="0.41.0+prod.esm",dd=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(t){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=Ey,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[Km(PE)];for(let o of t)n.push(Km(o));return new e(n)}static maybeFromEditor(t){let n=t[mE];return n&&(n.PACKAGE_VERSION!==Ey&&Ft(292,n.PACKAGE_VERSION,Ey),n instanceof e||Ft(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Ft(294),n}constructEditor(){let{$initialEditorState:t,onError:n,...o}=this.buildCreateEditorArgs(),r=Object.assign(Em({...o,...n?{onError:a=>{n(a,r)}}:{}}),{[mE]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=gE;function n(){try{t()}finally{t=gE}}let o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=la(this.registerEditor(o),()=>o.setRootElement(null)),o}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){let n=this.extensionNameMap.get(t.name);if(n)return n.extension!==t&&Ft(295,t.name),n}addEdge(t,n,o){let r=this.outgoingConfigEdges.get(t);r?r.set(n,o):this.outgoingConfigEdges.set(t,new Map([[n,o]]));let a=this.incomingEdges.get(n);a?a.add(t):this.incomingEdges.set(n,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&Ft(296);let n=Km(t),[o]=n;typeof o.name!="string"&&Ft(297,typeof o.name);let r=this.extensionNameMap.get(o.name);if(r!==void 0&&r.extension!==o&&Ft(298,o.name),!r){r=new _y(this,o),this.extensionNameMap.set(o.name,r);let a=this.conflicts.get(o.name);typeof a=="string"&&Ft(299,o.name,a);for(let i of o.conflictsWith||[])this.extensionNameMap.has(i)&&Ft(299,o.name,i),this.conflicts.set(i,o.name);for(let i of o.dependencies||[]){let s=Km(i);this.addEdge(o.name,s[0].name,s.slice(1)),this.addExtension(s)}for(let[i,s]of o.peerDependencies||[])this.addEdge(o.name,i,s?[s]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let t=[],n=(o,r)=>{let a=o.state;if(LE(a))return;let i=o.extension.name;var s;Ay(a)||Ft(300,i,r||"[unknown]"),Ay(s=a)||Ft(304,String(s.id),String(By)),a=Object.assign(s,{id:Ny}),o.state=a;let l=this.outgoingConfigEdges.get(i);if(l)for(let d of l.keys()){let c=this.extensionNameMap.get(d);c&&n(c,i)}a=I3(a),o.state=a,t.push(o)};for(let o of this.extensionNameMap.values())Ay(o.state)&&n(o);for(let o of t)for(let[r,a]of this.outgoingConfigEdges.get(o.extension.name)||[])if(a.length>0){let i=this.extensionNameMap.get(r);if(i)for(let s of a)i.configs.add(s)}for(let[o,...r]of this.roots)if(r.length>0){let a=this.extensionNameMap.get(o.name);a===void 0&&Ft(301,o.name);for(let i of r)a.configs.add(i)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){let n=this.sortedExtensionReps(),o=new AbortController,r=[()=>o.abort()],a=o.signal;for(let i of n){let s=i.register(t,a);s&&r.push(s)}for(let i of n){let s=i.afterRegistration(t);s&&r.push(s)}return la(...r)}buildCreateEditorArgs(){let t={},n=new Set,o=new Map,r=new Map,a={},i={},s=this.sortedExtensionReps();for(let c of s){let{extension:f}=c;if(f.onError!==void 0&&(t.onError=f.onError),f.disableEvents!==void 0&&(t.disableEvents=f.disableEvents),f.parentEditor!==void 0&&(t.parentEditor=f.parentEditor),f.editable!==void 0&&(t.editable=f.editable),f.namespace!==void 0&&(t.namespace=f.namespace),f.$initialEditorState!==void 0&&(t.$initialEditorState=f.$initialEditorState),f.nodes)for(let p of SE(f)){if(typeof p!="function"){let m=o.get(p.replace);m&&Ft(302,f.name,p.replace.name,m.extension.name),o.set(p.replace,c)}n.add(p)}if(f.html){if(f.html.export)for(let[p,m]of f.html.export.entries())r.set(p,m);f.html.import&&Object.assign(a,f.html.import)}f.theme&&TE(i,f.theme)}Object.keys(i).length>0&&(t.theme=i),n.size&&(t.nodes=[...n]);let l=Object.keys(a).length>0,d=r.size>0;(l||d)&&(t.html={},l&&(t.html.import=a),d&&(t.html.export=r));for(let c of s)c.init(t);return t.onError||(t.onError=k3),t}};function L3(e,t){let n=dd.fromEditor(e).getExtensionRep(t);return n===void 0&&Ft(303,t.name),n.getExtensionDependency()}function AE(e,t){let n=dd.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function P3(e,t){let n=AE(e,t);return n===void 0&&Ft(291,t),n}var A3=new Set,Dy=Nn({build(e,t,n){let o=n.getDependency(Vm).output,r=ld({watchedNodeKeys:new Map}),a=Fy(()=>{},()=>Fi(()=>{let i=a.peek(),{watchedNodeKeys:s}=r.value,l,d=!1;o.value.read(()=>{if($e())for(let[c,f]of s.entries()){if(f.size===0){s.delete(c);continue}let p=um(c),m=p&&p.isSelected()||!1;d=d||m!==(!!i&&i.has(c)),m&&(l=l||new Set,l.add(c))}}),!d&&l&&i&&l.size===i.size||(a.value=l)}));return{watchNodeKey:function(i){let s=yE(()=>(a.value||A3).has(i)),{watchedNodeKeys:l}=r.peek(),d=l.get(i),c=d!==void 0;return d=d||new Set,d.add(s),c||(l.set(i,d),r.value={watchedNodeKeys:l}),s}}},dependencies:[Vm],name:"@lexical/extension/NodeSelection"}),E3=fA("INSERT_HORIZONTAL_RULE_COMMAND"),zs=class e extends Ka{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return zy().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:M3,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return fu(n,t.theme.hr),n}getTextContent(){return`
3713
+ `}isInline(){return!1}updateDOM(){return!1}};function M3(){return{node:zy()}}function zy(){return fP(zs)}function EE(e){return e instanceof zs}var R3=Nn({dependencies:[Vm,Dy],name:"@lexical/extension/HorizontalRule",nodes:()=>[zs],register(e,t,n){let{watchNodeKey:o}=n.getDependency(Dy).output,r=ld({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return la(e.registerCommand(OP,i=>{if(yA(i.target)){let s=CP(i.target);if(EE(s))return(function(l,d=!1){let c=$e(),f=l.isSelected(),p=l.getKey(),m;d&&Jx(c)?m=c:(m=pP(),Dr(m)),f?m.delete(p):m.add(p)})(s,i.shiftKey),!0}return!1},ad),e.registerMutationListener(zs,(i,s)=>{hE(()=>{let l=!1,{nodeSelections:d}=r.peek();for(let[c,f]of i.entries())if(f==="destroyed")d.delete(c),l=!0;else{let p=d.get(c),m=e.getElementByKey(c);p?p.domNode.value=m:(l=!0,d.set(c,{domNode:ld(m),selectedSignal:o(c)}))}l&&(r.value={nodeSelections:d})})}),Fi(()=>{let i=[];for(let{domNode:s,selectedSignal:l}of r.value.nodeSelections.values())i.push(Fi(()=>{let d=s.value;d&&(l.value?fu(d,a):Rm(d,a))}));return la(...i)}))}});function ME(e){return e.canBeEmpty()}function RE(e,t,n=ME){return la(e.registerCommand(km,o=>{let r=$e();if(!Se(r))return!1;o.preventDefault();let a=(function(i){if(i.getNodes().filter(p=>od(p)&&p.canIndent()).length>0)return!0;let s=i.anchor,l=i.focus,d=l.isBefore(s)?l:s,c=d.getNode(),f=nE(c);if(f.canIndent()){let p=f.getKey(),m=_s();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=PP(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?tA:ty:QP;return e.dispatchCommand(a,void 0)},Xt),e.registerCommand(ty,()=>{let o=typeof t=="number"?t:t?t.peek():null,r=$e();if(!Se(r))return!1;let a=typeof n=="function"?n:n.peek();return oE(i=>{if(a(i)){let s=i.getIndent()+1;(!o||s<o)&&i.setIndent(s)}})},xm))}var N3=Nn({build:(e,t,n)=>Gm(t),config:Br({$canIndent:ME,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){let{disabled:o,maxIndent:r,$canIndent:a}=n.getOutput();return Fi(()=>{if(!o.value)return RE(e,r,a)})}});var mt=$y,Rae=mt.$createHorizontalRuleNode,Nae=mt.$isDecoratorTextNode,_ae=mt.$isHorizontalRuleNode,Dae=mt.AutoFocusExtension,Oae=mt.ClearEditorExtension,Fae=mt.DecoratorTextExtension,Bae=mt.DecoratorTextNode,zae=mt.EditorStateExtension,$ae=mt.HorizontalRuleExtension,Hae=mt.HorizontalRuleNode,Uae=mt.INSERT_HORIZONTAL_RULE_COMMAND,Kae=mt.InitialStateExtension,NE=mt.LexicalBuilder,qae=mt.NodeSelectionExtension,Vae=mt.TabIndentationExtension,Wae=mt.applyFormatFromStyle,Gae=mt.applyFormatToDom,_E=mt.batch,jae=mt.buildEditorFromExtensions,Qae=mt.computed,Xae=mt.configExtension,Yae=mt.declarePeerDependency,Jae=mt.defineExtension,xu=mt.effect,Zae=mt.getExtensionDependencyFromEditor,eie=mt.getKnownTypesAndNodes,DE=mt.getPeerDependencyFromEditor,tie=mt.getPeerDependencyFromEditorOrThrow,jm=mt.namedSignals,nie=mt.registerClearEditor,oie=mt.registerTabIndentation,rie=mt.safeCast,aie=mt.shallowMergeConfig,iie=mt.signal,sie=mt.untracked,lie=mt.watchedSignal;var Hy={};Mn(Hy,{HistoryExtension:()=>Qm,SharedHistoryExtension:()=>O3,createEmptyHistoryState:()=>BE,registerHistory:()=>FE});function _3(e,t,n,o,r){if(e===null||n.size===0&&o.size===0&&!r)return 0;let a=t._selection,i=e._selection;if(r)return 1;if(!(Se(a)&&Se(i)&&i.isCollapsed()&&a.isCollapsed()))return 0;let s=(function(x,y,C){let S=x._nodeMap,L=[];for(let w of y){let k=S.get(w);k!==void 0&&L.push(k)}for(let[w,k]of C){if(!k)continue;let I=S.get(w);I===void 0||lu(I)||L.push(I)}return L})(t,n,o);if(s.length===0)return 0;if(s.length>1){let x=t._nodeMap,y=x.get(a.anchor.key),C=x.get(i.anchor.key);return y&&C&&!e._nodeMap.has(y.__key)&&nt(y)&&y.__text.length===1&&a.anchor.offset===1?2:0}let l=s[0],d=e._nodeMap.get(l.__key);if(!nt(d)||!nt(l)||d.__mode!==l.__mode)return 0;let c=d.__text,f=l.__text;if(c===f)return 0;let p=a.anchor,m=i.anchor;if(p.key!==m.key||p.type!=="text")return 0;let h=p.offset,g=m.offset,v=f.length-c.length;return v===1&&g===h-1?2:v===-1&&g===h+1?3:v===-1&&g===h?4:0}function D3(e,t){let n=Date.now(),o=0,r=Date.now(),a=0,i=null;return(s,l,d,c,f,p)=>{let m=Date.now();if(p.has(BP)&&(r=n,a=o,i=s),p.has(bm))return o=0,n=m,2;p.has(FP)&&i&&(n=r,o=a,s=i);let h=_3(s,l,c,f,e.isComposing()),g=(()=>{let v=d===null||d.editor===e,x=p.has(GP);if(!x&&v&&p.has(Fr))return 0;if(h===1)return 2;if(s===null)return 1;let y=l._selection;if(!(c.size>0||f.size>0))return y!==null?0:2;let C=typeof t=="number"?t:t.peek();return x===!1&&h!==0&&h===o&&m<n+C&&v||c.size===1&&(function(S,L,w){let k=L._nodeMap.get(S),I=w._nodeMap.get(S),T=L._selection,E=w._selection;return!(Se(T)&&Se(E)&&T.anchor.type==="element"&&T.focus.type==="element"&&E.anchor.type==="text"&&E.focus.type==="text"||!nt(k)||!nt(I)||k.__parent!==I.__parent)&&JSON.stringify(L.read(()=>k.exportJSON()))===JSON.stringify(w.read(()=>I.exportJSON()))})(Array.from(c)[0],s,l)?0:1})();return n=m,o=h,g}}function OE(e){e.undoStack=[],e.redoStack=[],e.current=null}function FE(e,t,n){let o=D3(e,n);return qa(e.registerCommand(uA,()=>((function(a,i){let s=i.redoStack,l=i.undoStack;if(l.length!==0){let d=i.current,c=l.pop();d!==null&&(s.push(d),a.dispatchCommand(du,!0)),l.length===0&&a.dispatchCommand(cu,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:bm})}})(e,t),!0),Xt),e.registerCommand(rA,()=>((function(a,i){let s=i.redoStack,l=i.undoStack;if(s.length!==0){let d=i.current;d!==null&&(l.push(d),a.dispatchCommand(cu,!0));let c=s.pop();s.length===0&&a.dispatchCommand(du,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:bm})}})(e,t),!0),Xt),e.registerCommand(vm,()=>(OE(t),!1),Xt),e.registerCommand(DP,()=>(OE(t),e.dispatchCommand(du,!1),e.dispatchCommand(cu,!1),!0),Xt),e.registerUpdateListener(({editorState:a,prevEditorState:i,dirtyLeaves:s,dirtyElements:l,tags:d})=>{let c=t.current,f=t.redoStack,p=t.undoStack,m=c===null?null:c.editorState;if(c!==null&&a===m)return;let h=o(i,a,c,s,l,d);if(h===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand(du,!1)),c!==null&&(p.push({...c}),e.dispatchCommand(cu,!0));else if(h===2)return;t.current={editor:e,editorState:a}}))}function BE(){return{current:null,redoStack:[],undoStack:[]}}var Qm=Nn({build:(e,{delay:t,createInitialHistoryState:n,disabled:o})=>jm({delay:t,disabled:o,historyState:n(e)}),config:Br({createInitialHistoryState:BE,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,n)=>{let o=n.getOutput();return xu(()=>o.disabled.value?void 0:FE(e,o.historyState.value,o.delay))}}),O3=Nn({dependencies:[Am(Qm,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:!0})],name:"@lexical/history/SharedHistory",register(e,t,n){let{output:o}=n.getDependency(Qm),r=(function(i){return i?DE(i,Qm.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return xu(()=>_E(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var Xm=Hy,pie=Xm.HistoryExtension,mie=Xm.SharedHistoryExtension,Ym=Xm.createEmptyHistoryState,zE=Xm.registerHistory;var Uy={};Mn(Uy,{HistoryPlugin:()=>F3,createEmptyHistoryState:()=>Ym});ge();function F3({delay:e,externalHistoryState:t}){let[n]=wn();return(function(o,r,a=1e3){let i=z(()=>r||Ym(),[r]);K(()=>zE(o,i,a),[a,o,i])})(n,t,e),null}var $E=Uy,HE=$E.HistoryPlugin,UE=$E.createEmptyHistoryState;var Ky={};Mn(Ky,{OnChangePlugin:()=>z3});ge();var B3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?xe:K;function z3({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=wn();return B3(()=>{if(n)return o.registerUpdateListener(({editorState:r,dirtyElements:a,dirtyLeaves:i,prevEditorState:s,tags:l})=>{t&&a.size===0&&i.size===0||e&&l.has(Fr)||s.isEmpty()||n(r,o,l)})},[o,e,t,n]),null}var $3=Ky,KE=$3.OnChangePlugin;var qy={};Mn(qy,{useLexicalEditable:()=>K3});ge();var H3=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?xe:K;function U3(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function K3(){return(function(e){let[t]=wn(),n=z(()=>e(t),[t,e]),[o,r]=G(()=>n.initialValueFn()),a=D(o);return H3(()=>{let{initialValueFn:i,subscribe:s}=n,l=i();return a.current!==l&&(a.current=l,r(l)),s(d=>{a.current=d,r(d)})},[n,e]),o})(U3)}var q3=qy,qE=q3.useLexicalEditable;var Vy={};Mn(Vy,{ReactProviderExtension:()=>V3});var V3=Nn({name:"@lexical/react/ReactProvider"});var W3=Vy,VE=W3.ReactProviderExtension;var Wy={};Mn(Wy,{DragonExtension:()=>G3,registerDragonSupport:()=>WE});function WE(e){let t=window.location.origin,n=o=>{if(o.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let a=o.data;if(typeof a=="string"){let i;try{i=JSON.parse(a)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){let s=i.payload;if(s&&s.functionId==="makeChanges"){let l=s.args;if(l){let[d,c,f,p,m]=l;e.update(()=>{let h=$e();if(Se(h)){let g=h.anchor,v=g.getNode(),x=0,y=0;if(nt(v)&&d>=0&&c>=0&&(x=d,y=d+c,h.setTextNodeRange(v,x,v,y)),x===y&&f===""||(h.insertRawText(f),v=g.getNode()),nt(v)){x=p,y=p+m;let C=v.getTextContentSize();x=x>C?C:x,y=y>C?C:y,h.setTextNodeRange(v,x,v,y)}o.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}var G3=Nn({build:(e,t,n)=>jm(t),config:Br({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>xu(()=>n.getOutput().disabled.value?void 0:WE(e))});var GE=Wy,jE=GE.DragonExtension,QE=GE.registerDragonSupport;var Gy={};Mn(Gy,{$generateHtmlFromNodes:()=>Q3,$generateNodesFromDOM:()=>j3});function j3(e,t){let n=xA(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!YE.has(a.nodeName)){let i=JE(a,e,r,!1);i!==null&&(o=o.concat(i))}return(function(a){for(let i of a)i.getNextSibling()instanceof ey&&i.insertAfter(Ns());for(let i of a){let s=i.getChildren();for(let l of s)i.insertBefore(l);i.remove()}})(r),o}function Q3(e,t){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");let n=document.createElement("div"),o=bt().getChildren();for(let r=0;r<o.length;r++)XE(e,o[r],n,t);return n.innerHTML}function XE(e,t,n,o=null){let r=o===null||t.isSelected(o),a=Qe(t)&&t.excludeFromCopy("html"),i=t;o!==null&&nt(t)&&(i=zm(o,t,"clone"));let s=Qe(i)?i.getChildren():[],l=hA(e,i.getType()),d;d=l&&l.exportDOM!==void 0?l.exportDOM(e,i):i.exportDOM(e);let{element:c,after:f}=d;if(!c)return!1;let p=document.createDocumentFragment();for(let m=0;m<s.length;m++){let h=s[m],g=XE(e,h,p,o);!r&&Qe(t)&&g&&t.extractWithChild(h,o,"html")&&(r=!0)}if(r&&!a){if((rE(c)||ry(c))&&c.append(p),n.append(c),f){let m=f.call(i,c);m&&(ry(c)?c.replaceChildren(m):c.replaceWith(m))}}else n.append(p);return r}var YE=new Set(["STYLE","SCRIPT"]);function JE(e,t,n,o,r=new Map,a){let i=[];if(YE.has(e.nodeName))return i;let s=null,l=(function(h,g){let{nodeName:v}=h,x=g._htmlConversions.get(v.toLowerCase()),y=null;if(x!==void 0)for(let C of x){let S=C(h);S!==null&&(y===null||(y.priority||0)<=(S.priority||0))&&(y=S)}return y!==null?y.conversion:null})(e,t),d=l?l(e):null,c=null;if(d!==null){c=d.after;let h=d.node;if(s=Array.isArray(h)?h[h.length-1]:h,s!==null){for(let[,g]of r)if(s=g(s,a),!s)break;s&&i.push(...Array.isArray(h)?h:[s])}d.forChild!=null&&r.set(e.nodeName,d.forChild)}let f=e.childNodes,p=[],m=(s==null||!Os(s))&&(s!=null&&od(s)||o);for(let h=0;h<f.length;h++)p.push(...JE(f[h],t,n,m,new Map(r),s));return c!=null&&(p=c(p)),Iy(e)&&(p=X3(e,p,m?()=>{let h=new ey;return n.push(h),h}:mr)),s==null?p.length>0?i=i.concat(p):Iy(e)&&(function(h){return h.nextSibling==null||h.previousSibling==null?!1:pu(h.nextSibling)&&pu(h.previousSibling)})(e)&&(i=i.concat(Ns())):Qe(s)&&s.append(...p),i}function X3(e,t,n){let o=e.style.textAlign,r=[],a=[];for(let i=0;i<t.length;i++){let s=t[i];if(od(s))o&&!s.getFormat()&&s.setFormat(o),r.push(s);else if(a.push(s),i===t.length-1||i<t.length-1&&od(t[i+1])){let l=n();l.setFormat(o),l.append(...a),r.push(l),a=[]}}return r}var ZE=Gy,eM=ZE.$generateHtmlFromNodes,tM=ZE.$generateNodesFromDOM;var Qy={};Mn(Qy,{$generateJSONFromSelectedNodes:()=>iM,$generateNodesFromSerializedNodes:()=>sM,$getClipboardDataFromSelection:()=>dM,$getHtmlContent:()=>oM,$getLexicalContent:()=>rM,$insertDataTransferForPlainText:()=>Y3,$insertDataTransferForRichText:()=>J3,$insertGeneratedNodes:()=>jy,copyToClipboard:()=>Z3,setLexicalClipboardDataTransfer:()=>cM});function Jm(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function oM(e,t=$e()){return t==null&&Jm(166),Se(t)&&t.isCollapsed()||t.getNodes().length===0?"":eM(e,t)}function rM(e,t=$e()){return t==null&&Jm(166),Se(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(iM(e,t))}function Y3(e,t){let n=e.getData("text/plain")||e.getData("text/uri-list");n!=null&&t.insertRawText(n)}function J3(e,t,n){let o=e.getData("application/x-lexical-editor");if(o)try{let s=JSON.parse(o);if(s.namespace===n._config.namespace&&Array.isArray(s.nodes))return jy(n,sM(s.nodes),t)}catch(s){console.error(s)}let r=e.getData("text/html"),a=e.getData("text/plain");if(r&&a!==r)try{let s=new DOMParser().parseFromString((function(l){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:d=>d}).createHTML(l):l})(r),"text/html");return jy(n,tM(n,s),t)}catch(s){console.error(s)}let i=a||e.getData("text/uri-list");if(i!=null)if(Se(t)){let s=i.split(/(\r?\n|\t)/);s[s.length-1]===""&&s.pop();for(let l=0;l<s.length;l++){let d=$e();if(Se(d)){let c=s[l];c===`
3711
3714
  `||c===`\r
3712
- `?d.insertParagraph():c===" "?d.insertNodes([iP()]):d.insertText(c)}}}else t.insertRawText(i)}function Ky(e,t,n){e.dispatchCommand(JP,{nodes:t,selection:n})||(n.insertNodes(t),(function(o){if(we(o)&&o.isCollapsed()){let r=o.anchor,a=null,i=jl(r,"previous");if(i)if(sm(i))a=i.origin;else{let s=lP(i,ki(Ct(),"next").getFlipped());for(let l of s){if(tt(l.origin)){a=l.origin;break}if(Ke(l.origin)&&!l.origin.isInline())break}}if(a&&tt(a)){let s=a.getFormat(),l=a.getStyle();o.format===s&&o.style===l||(o.format=s,o.style=l,o.dirty=!0)}}})(n))}function XE(e,t,n,o=[]){let r=t===null||n.isSelected(t),a=Ke(n)&&n.excludeFromCopy("html"),i=n;t!==null&&tt(i)&&(i=Rm(t,i,"clone"));let s=Ke(i)?i.getChildren():[],l=(function(d){let c=d.exportJSON(),f=d.constructor;if(c.type!==f.getType()&&Vm(58,f.name),Ke(d)){let p=c.children;Array.isArray(p)||Vm(59,f.name)}return c})(i);tt(i)&&i.getTextContentSize()===0&&(r=!1);for(let d=0;d<s.length;d++){let c=s[d],f=XE(e,t,c,l.children);!r&&Ke(n)&&f&&n.extractWithChild(c,t,"clone")&&(r=!0)}if(r&&!a)o.push(l);else if(Array.isArray(l.children))for(let d=0;d<l.children.length;d++){let c=l.children[d];o.push(c)}return r}function YE(e,t){let n=[],o=Ct().getChildren();for(let r=0;r<o.length;r++)XE(e,t,o[r],n);return{namespace:e._config.namespace,nodes:n}}function JE(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n],r=CP(o);tt(r)&&AA(r),t.push(r)}return t}var nd=null;async function U3(e,t,n){if(nd!==null)return!1;if(t!==null)return new Promise((d,c)=>{e.update(()=>{d(GE(e,t,n))})});let o=e.getRootElement(),r=e._window||window,a=r.document,i=Jx(r);if(o===null||i===null)return!1;let s=a.createElement("span");s.style.cssText="position: fixed; top: -1000px;",s.append(a.createTextNode("#")),o.append(s);let l=new Range;return l.setStart(s,0),l.setEnd(s,1),i.removeAllRanges(),i.addRange(l),new Promise((d,c)=>{let f=e.registerCommand(fm,p=>(su(p,ClipboardEvent)&&(f(),nd!==null&&(r.clearTimeout(nd),nd=null),d(GE(e,p,n))),!0),um);nd=r.setTimeout(()=>{f(),nd=null,d(!1)},50),a.execCommand("copy"),s.remove()})}function GE(e,t,n){if(n===void 0){let r=Jx(e._window),a=Oe();if(!a||a.isCollapsed()||!r)return!1;let i=r.anchorNode,s=r.focusNode;if(i!==null&&s!==null&&!fA(e,i,s))return!1;n=eM(a)}t.preventDefault();let o=t.clipboardData;return o!==null&&(tM(o,n),!0)}var ZE=[["text/html",jE],["application/x-lexical-editor",QE]];function eM(e=Oe()){let t={"text/plain":e?e.getTextContent():""};if(e){let n=om();for(let[o,r]of ZE){let a=r(n,e);a!==null&&(t[o]=a)}}return t}function tM(e,t){for(let[n]of ZE)t[n]===void 0&&e.setData(n,"");for(let n in t){let o=t[n];o!==void 0&&e.setData(n,o)}}var ia=qy,Mie=ia.$generateJSONFromSelectedNodes,Rie=ia.$generateNodesFromSerializedNodes,Nie=ia.$getClipboardDataFromSelection,nM=ia.$getHtmlContent,_ie=ia.$getLexicalContent,Vy=ia.$insertDataTransferForPlainText,Die=ia.$insertDataTransferForRichText,Oie=ia.$insertGeneratedNodes,Fie=ia.copyToClipboard,Bie=ia.setLexicalClipboardDataTransfer;var Wy={};An(Wy,{PlainTextExtension:()=>Q3,registerPlainText:()=>aM});var Bs=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,K3=Bs&&"documentMode"in document?document.documentMode:null,q3=Bs&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),V3=!(!Bs||!("InputEvent"in window)||K3)&&"getTargetRanges"in new window.InputEvent("input"),W3=Bs&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),oM=Bs&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,G3=Bs&&/^(?=.*Chrome).*/i.test(navigator.userAgent),j3=Bs&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&q3&&!G3;function rM(e,t){t.update(()=>{if(e!==null){let n=su(e,KeyboardEvent)?null:e.clipboardData,o=Oe();if(o!==null&&!o.isCollapsed()&&n!=null){e.preventDefault();let r=nM(t);r!==null&&n.setData("text/html",r),n.setData("text/plain",o.getTextContent())}}})}function aM(e){return Fa(e.registerCommand(pm,t=>{let n=Oe();return!!we(n)&&(n.deleteCharacter(t),!0)},Xt),e.registerCommand(NP,t=>{let n=Oe();return!!we(n)&&(n.deleteWord(t),!0)},Xt),e.registerCommand(RP,t=>{let n=Oe();return!!we(n)&&(n.deleteLine(t),!0)},Xt),e.registerCommand(EP,t=>{let n=Oe();if(!we(n))return!1;if(typeof t=="string")n.insertText(t);else{let o=t.dataTransfer;if(o!=null)Vy(o,n);else{let r=t.data;r&&n.insertText(r)}}return!0},Xt),e.registerCommand(XP,()=>{let t=Oe();return!!we(t)&&(t.removeText(),!0)},Xt),e.registerCommand(Yx,t=>{let n=Oe();return!!we(n)&&(n.insertLineBreak(t),!0)},Xt),e.registerCommand(zP,()=>{let t=Oe();return!!we(t)&&(t.insertLineBreak(),!0)},Xt),e.registerCommand(gm,t=>{let n=Oe();if(!we(n))return!1;let o=t,r=o.shiftKey;return!!fy(n,!0)&&(o.preventDefault(),uy(n,r,!0),!0)},Xt),e.registerCommand(hm,t=>{let n=Oe();if(!we(n))return!1;let o=t,r=o.shiftKey;return!!fy(n,!1)&&(o.preventDefault(),uy(n,r,!1),!0)},Xt),e.registerCommand(vm,t=>{let n=Oe();return!!we(n)&&(!oM||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(pm,!0))},Xt),e.registerCommand(KP,t=>{let n=Oe();return!!we(n)&&(t.preventDefault(),e.dispatchCommand(pm,!1))},Xt),e.registerCommand(xm,t=>{let n=Oe();if(!we(n))return!1;if(t!==null){if((oM||W3||j3)&&V3)return!1;t.preventDefault()}return e.dispatchCommand(Yx,!1)},Xt),e.registerCommand(ZP,()=>(lm(),!0),Xt),e.registerCommand(fm,t=>{let n=Oe();return!!we(n)&&(rM(t,e),!0)},Xt),e.registerCommand(MP,t=>{let n=Oe();return!!we(n)&&((function(o,r){rM(o,r),r.update(()=>{let a=Oe();we(a)&&a.removeText()})})(t,e),!0)},Xt),e.registerCommand(Cm,t=>{let n=Oe();return!!we(n)&&((function(o,r){o.preventDefault(),r.update(()=>{let a=Oe(),i=su(o,ClipboardEvent)?o.clipboardData:null;i!=null&&we(a)&&Vy(i,a)},{tag:GP})})(t,e),!0)},Xt),e.registerCommand(DP,t=>{let n=Oe();return!!we(n)&&(t.preventDefault(),!0)},Xt),e.registerCommand(_P,t=>{let n=Oe();return!!we(n)&&(t.preventDefault(),!0)},Xt))}var Q3=Mn({conflictsWith:["@lexical/rich-text"],dependencies:[zE],name:"@lexical/plain-text",register:aM});var iM=Wy,Vie=iM.PlainTextExtension,sM=iM.registerPlainText;var jy={};An(jy,{PlainTextPlugin:()=>Z3});me();var Wm=Sd(pc(),1);function X3(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Gy=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?ye:q;function Y3({editor:e,ErrorBoundary:t}){return(function(n,o){let[r,a]=G(()=>n.getDecorators());return Gy(()=>n.registerDecoratorListener(i=>{(0,Wm.flushSync)(()=>{a(i)})}),[n]),q(()=>{a(n.getDecorators())},[n]),z(()=>{let i=[],s=Object.keys(r);for(let l=0;l<s.length;l++){let d=s[l],c=u(o,{onError:p=>n._onError(p),children:u(ih,{fallback:null,children:r[d]})}),f=n.getElementByKey(d);f!==null&&i.push((0,Wm.createPortal)(c,f,d))}return i},[o,r,n])})(e,t)}function J3({editor:e,ErrorBoundary:t}){return(function(n){let o=wE.maybeFromEditor(n);if(o&&o.hasExtensionByName(OE.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])o.hasExtensionByName(r)&&X3(320,r);return!0}return!1})(e)?null:u(Y3,{editor:e,ErrorBoundary:t})}function lM(e){return e.getEditorState().read(Pm(e.isComposing()))}function Z3({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[o]=In();return(function(r){Gy(()=>Fa(sM(r),$E(r)),[r])})(o),b(be,{children:[e,u(eK,{content:t}),u(J3,{editor:o,ErrorBoundary:n})]})}function eK({content:e}){let[t]=In(),n=(function(r){let[a,i]=G(()=>lM(r));return Gy(()=>{function s(){let l=lM(r);i(l)}return s(),Fa(r.registerUpdateListener(()=>{s()}),r.registerEditableListener(()=>{s()}))},[r]),a})(t),o=DE();return n?typeof e=="function"?e(o):e:null}var tK=jy,dM=tK.PlainTextPlugin;me();function cM(e){return/mac|iphone|ipad|ipod/i.test(e)}function fu(){let e=globalThis.crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function pu(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function uM(e){let t=pu(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}me();var Gm=ue(function(t){let n=Ot().pierreIcons,o=n.useSpriteReady();wd(n.ensureSprite,[n]);let r=z(()=>n.resolveForEntry(t.pathValue,t.kind),[n,t.kind,t.pathValue]);return o?u("svg",{"aria-hidden":"true","data-file-icon":r.symbolId,className:F("size-4 shrink-0",t.className),children:u("use",{href:`#${r.symbolId}`})}):t.kind==="directory"?u(oi,{className:F("size-4 shrink-0 text-icon-muted",t.className)}):u(_d,{className:F("size-4 shrink-0 text-icon-muted",t.className)})});var fM=mi;function pM(e){return b(be,{children:[u(Gm,{pathValue:e.path,kind:uM(e.path),theme:e.theme,className:Zr}),u("span",{className:e.selectable?xT:ea,children:e.label})]})}function mM(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Qe,{children:[u(Ye,{render:b("span",{className:F(mi,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0,children:[u(ba,{className:F(Zr,"size-icon-1",o&&"opacity-100")}),u("span",{className:ea,children:t})]})}),u(Xe,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}function gM({context:e}){let{t}=De(),n=Gw(e),o=Ww(e),r=o?t("pendingContext.terminalExpired",{label:n}):e.text;return u(mM,{label:n,tooltipText:r,expired:o})}function nK(e){let t=[];for(let n of e.split(/[\s:_-]+/))n.length!==0&&t.push(n.charAt(0).toUpperCase()+n.slice(1));return t.join(" ")}function oK(e){return e.replaceAll("\\","/")}function sa(e){let t=e.displayName?.trim();return t||nK(e.name)}function hM(e,t){return t?e.filter(n=>n.enabled):[]}function vM(e,t){let n=new Set(t.map(o=>o.name.trim().toLowerCase()));return e.filter(o=>!n.has(o.name.trim().toLowerCase()))}function xM(e){let t=oK(e.path);if(t.includes("/.codex/plugins/")||t.includes("/.agents/plugins/"))return"app";switch(e.scope?.trim().toLowerCase()){case"repo":case"repository":return"repo";case"project":case"workspace":case"local":return"project";case"user":case"personal":return"personal";case"system":return"system";case void 0:case"":return"other";default:return"other"}}function yM(e,t){return e.registerCommand(Cm,n=>{if(!(n instanceof ClipboardEvent)||n.clipboardData===null||n.clipboardData.files.length>0)return!1;let o=n.clipboardData.getData("text/plain");if(o.length===0)return!1;let r=wc(`${o}
3713
- `).filter(c=>c.type==="mention"&&c.end<=o.length);if(r.length===0)return!1;let a=Oe();if(!we(a))return!1;let i=[],s=c=>{let f=c.split(`
3714
- `);for(let p=0;p<f.length;p+=1){let m=f[p]??"";m.length>0&&i.push(Mr(m)),p<f.length-1&&i.push(Ms())}},l=r[0];if(l&&l.start===0){let c=a.isBackward()?a.focus:a.anchor,f=t.getExpandedAbsoluteOffsetForPoint(c.getNode(),c.offset),p=Ct().getTextContent().slice(f-1,f);p.length>0&&!/\s/.test(p)&&i.push(Mr(" "))}let d=0;for(let c of r)c.start<d||(c.start>d&&s(o.slice(d,c.start)),i.push(t.createMentionNode(c.value)),d=c.end);return d<o.length?s(o.slice(d)):i.push(Mr(" ")),a.insertNodes(i),n.preventDefault(),!0},Nr)}var od=new Map,rK=32;function CM(e,t){for(od.delete(e),od.set(e,t);od.size>rK;){let n=od.keys().next().value;if(n===void 0)break;od.delete(n)}}function aK(e){return{anchor:e.length,focus:e.length}}function Ba(e,t,n){let o=od.get(e);if(o)return CM(e,o),o;let r={cursor:n?.cursor??t.length,expandedCursor:n?.expandedCursor??t.length,selection:n?{anchor:n.cursor,focus:n.cursor}:aK(t),history:NE()};return CM(e,r),r}function rd(e,t,n){let o=Ba(e,t);o.cursor=n.cursor,o.expandedCursor=n.expandedCursor,o.selection=n.selection}function bM(e,t,n,o){let r=Ba(e,t);r.cursor=n,r.expandedCursor=o}function IM(e,t){let n=e.current,o=[...e.undoStack],r=[...e.redoStack];t(),e.current=n,e.undoStack.splice(0,e.undoStack.length,...o),e.redoStack.splice(0,e.redoStack.length,...r)}var iK=`composer-editor-${Math.random().toString(36).slice(2)}`,sK=[["(",")"],["[","]"],["{","}"],["'","'"],['"','"'],["\u201C","\u201D"],["`","`"],["<",">"],["\xAB","\xBB"],["*","*"],["_","_"]],kM=new Map(sK),SM=kM.get("`")??null,PM=Ht({onRemoveTerminalContext:()=>{}});function lK(e){let t=fK(),n=u("span",{className:fM,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:u(pM,{path:e.path,label:pu(e.path),theme:t})});return b(Qe,{children:[u(Ye,{render:n}),u(Xe,{side:"top",className:"max-w-120 whitespace-normal leading-tight wrap-anywhere",children:e.path})]})}var mu=class e extends Oa{__path;static getType(){return"composer-mention"}static clone(t){return new e(t.__path,t.__key)}static importJSON(t){return Jy(t.path).updateFromJSON(t)}constructor(t,n){super(n),this.__path=t}exportJSON(){return{...super.exportJSON(),path:this.__path,type:"composer-mention",version:1}}createDOM(){let t=document.createElement("span");return t.className=pp,t}updateDOM(){return!1}getTextContent(){return Sc(this.__path)}isInline(){return!0}decorate(){return u(lK,{path:this.__path})}};function Jy(e){return tm(new mu(e))}function dK(e){let t=e.shortDescription?.trim();return t||e.description?.trim()||null}function gu(e){return new Map(e.map(t=>[t.name,{label:sa(t),description:dK(t)}]))}function cK(e){let t=b("span",{className:yT,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[u("span",{"aria-hidden":"true",className:Zr,dangerouslySetInnerHTML:{__html:CT}}),u("span",{className:ea,children:e.skillLabel})]});return e.skillDescription?b(Qe,{children:[u(Ye,{render:t}),u(Xe,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:e.skillDescription})]}):t}var hu=class e extends Oa{__skillName;__skillLabel;__skillDescription;static getType(){return"composer-skill"}static clone(t){return new e(t.__skillName,t.__skillLabel,t.__skillDescription,t.__key)}static importJSON(t){return AM(t.skillName,t.skillLabel??t.skillName,t.skillDescription??null).updateFromJSON(t)}constructor(t,n,o,r){super(r);let a=t.startsWith("$")?t.slice(1):t;this.__skillName=a,this.__skillLabel=n,this.__skillDescription=o}exportJSON(){return{...super.exportJSON(),skillName:this.__skillName,skillLabel:this.__skillLabel,...this.__skillDescription?{skillDescription:this.__skillDescription}:{},type:"composer-skill",version:1}}createDOM(){let t=document.createElement("span");return t.className=pp,t}updateDOM(){return!1}getTextContent(){return`$${this.__skillName}`}isInline(){return!0}decorate(){return u(cK,{skillLabel:this.__skillLabel,skillDescription:this.__skillDescription})}};function AM(e,t,n){return tm(new hu(e,t,n))}function uK(e){return u(gM,{context:e.context})}var zs=class e extends Oa{__context;static getType(){return"composer-terminal-context"}static clone(t){return new e(t.__context,t.__key)}static importJSON(t){return EM(t.context)}constructor(t,n){super(n),this.__context=t}exportJSON(){return{...super.exportJSON(),context:this.__context,type:"composer-terminal-context",version:1}}createDOM(){let t=document.createElement("span");return t.className=pp,t}updateDOM(){return!1}getTextContent(){return"\uFFFC"}isInline(){return!0}decorate(){return u(uK,{context:this.__context})}};function EM(e){return tm(new zs(e))}function Ei(e){return e instanceof mu||e instanceof hu||e instanceof zs}function fK(){return document.documentElement.classList.contains("dark")?"dark":"light"}function pK(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function mK(e){return e.map(t=>[t.name,t.displayName??"",t.shortDescription??"",t.description??"",t.path,t.scope??"",t.enabled?"1":"0"].join("")).join("")}function jm(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function Xm(e){return 1}function MM(e){return e.getTextContentSize()}function gK(e,t,n){return t+(n>0?Xm(e):0)}function hK(e,t,n){return t+(n>0?MM(e):0)}function vK(e,t){let n=e.getParent();if(!n||!Ke(n))return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===Xm(e)?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=Xm(e),null)}function Ym(e){return Ei(e)?Xm(e):tt(e)?e.getTextContentSize():Xl(e)?1:Ke(e)?e.getChildren().reduce((t,n)=>t+Ym(n),0):0}function Xy(e){return Ei(e)?MM(e):tt(e)?e.getTextContentSize():Xl(e)?1:Ke(e)?e.getChildren().reduce((t,n)=>t+Xy(n),0):0}function vu(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!Ke(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=Ym(l))}o=r}if(tt(e))return n+Math.min(t,e.getTextContentSize());if(Ei(e))return gK(e,n,t);if(Xl(e))return n+Math.min(t,1);if(Ke(e)){let r=e.getChildren(),a=Math.max(0,Math.min(t,r.length));for(let i=0;i<a;i+=1){let s=r[i];s&&(n+=Ym(s))}return n}return n}function Jm(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!Ke(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=Xy(l))}o=r}if(tt(e))return n+Math.min(t,e.getTextContentSize());if(Ei(e))return hK(e,n,t);if(Xl(e))return n+Math.min(t,1);if(Ke(e)){let r=e.getChildren(),a=Math.max(0,Math.min(t,r.length));for(let i=0;i<a;i+=1){let s=r[i];s&&(n+=Xy(s))}return n}return n}function Zm(e,t){if(Ei(e))return vK(e,t);if(tt(e)){let n=e.getTextContentSize();return t.value<=n?{key:e.getKey(),offset:t.value,type:"text"}:(t.value-=n,null)}if(Xl(e)){let n=e.getParent();if(!n)return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===1?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=1,null)}if(Ke(e)){let n=e.getChildren();for(let o of n){let r=Zm(o,t);if(r)return r}if(t.value===0)return{key:e.getKey(),offset:n.length,type:"element"}}return null}function eg(){return Ct().getChildren().reduce((n,o)=>n+Ym(o),0)}function $s(e){let t=Ct(),n=eg(),r={value:Math.max(0,Math.min(e,n))},a=Zm(t,r)??{key:t.getKey(),offset:t.getChildren().length,type:"element"},i=Rs();i.anchor.set(a.key,a.offset,a.type),i.focus.set(a.key,a.offset,a.type),Rr(i)}function Qm(e,t){let n=Ct(),o=eg(),r=Math.max(0,Math.min(e,o)),a=Math.max(0,Math.min(t,o)),i={value:r},s={value:a},l=Zm(n,i)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},d=Zm(n,s)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},c=Rs();c.anchor.set(l.key,l.offset,l.type),c.focus.set(d.key,d.offset,d.type),Rr(c)}function wM(e){if(!we(e))return null;let t=e.anchor.getNode(),n=e.focus.getNode(),o=Jm(t,e.anchor.offset),r=Jm(n,e.focus.offset);return{start:Math.min(o,r),end:Math.max(o,r)}}function TM(e){return we(e)?e.getNodes().some(t=>Ei(t)):!1}function xu(e){let t=Oe();if(!we(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=vu(n,t.anchor.offset),r=eg();return Math.max(0,Math.min(o,r))}function LM(e){let t=Oe();if(!we(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=Jm(n,t.anchor.offset),r=Ct().getTextContent().length;return Math.max(0,Math.min(o,r))}function Qy(e){let t=Oe();return we(t)?{anchor:vu(t.anchor.getNode(),t.anchor.offset),focus:vu(t.focus.getNode(),t.focus.offset)}:e}function xK(e,t){let n=t.split(`
3715
- `);for(let o=0;o<n.length;o+=1){let r=n[o]??"";r.length>0&&e.append(Mr(r)),o<n.length-1&&e.append(Ms())}}function Zy(e,t,n){let o=Ct();o.clear();let r=ur();o.append(r);let a=ys(e,t);for(let i of a){if(i.type==="mention"){r.append(Jy(i.path));continue}if(i.type==="skill"){let s=n.get(i.name);r.append(AM(i.name,s?.label??sa({name:i.name}),s?.description??null));continue}if(i.type==="terminal-context"){i.context&&r.append(EM(i.context));continue}xK(r,i.text)}}function Yy(e){return e instanceof zs?[e.__context.id]:Ke(e)?e.getChildren().flatMap(t=>Yy(t)):[]}function yK(e){let[t]=In();return q(()=>{let n=(s,l)=>{if(!e.onCommandKeyDown||!l)return!1;if(s==="Enter"&&(l.isComposing||l.keyCode===229))return l.stopPropagation(),!0;let d=e.onCommandKeyDown(s,l);return d&&(l.preventDefault(),l.stopPropagation()),d},o=t.registerCommand(HP,s=>n("ArrowDown",s),Nr),r=t.registerCommand(UP,s=>n("ArrowUp",s),Nr),a=t.registerCommand(xm,s=>n("Enter",s),Nr),i=t.registerCommand(ym,s=>n("Tab",s),Nr);return()=>{o(),r(),a(),i()}},[t,e]),null}function CK(){let[e]=In();return q(()=>{let t=e.registerCommand(gm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=Oe();if(!we(i)||!i.isCollapsed())return;let s=xu(0);if(s<=0)return;let l=Ct().getTextContent();Tc(l,s,"left")&&(r=s-1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{$s(a)}),!0},Nr),n=e.registerCommand(hm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=Oe();if(!we(i)||!i.isCollapsed())return;let s=xu(0),l=eg();if(s>=l)return;let d=Ct().getTextContent();Tc(d,s,"right")&&(r=s+1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{$s(a)}),!0},Nr);return()=>{t(),n()}},[e]),null}function bK(){let[e]=In();return q(()=>e.registerCommand(qP,t=>{if(!cM(navigator.platform)||t.key!=="Home"&&t.key!=="End"||t.altKey||t.metaKey||t.ctrlKey||t.isComposing)return!1;let n=e.getRootElement(),o=window.getSelection(),r=o?.anchorNode;return!n||!o||!r||!n.contains(r)||o.rangeCount===0||typeof o.modify!="function"?!1:(t.preventDefault(),t.stopPropagation(),o.modify(t.shiftKey?"extend":"move",t.key==="Home"?"backward":"forward","lineboundary"),e.update(()=>{Rr(aP(o,e))}),!0)},Nr),[e]),null}function IK(){let[e]=In();return q(()=>e.registerUpdateListener(({editorState:t})=>{let n=null;t.read(()=>{let o=Oe();if(!we(o)||!o.isCollapsed())return;let r=o.anchor.getNode();if(!Ei(r)||o.anchor.offset===0)return;n=vu(r,0)+1}),n!==null&&queueMicrotask(()=>{e.update(()=>{$s(n)})})}),[e]),null}function SK(){let[e]=In(),{onRemoveTerminalContext:t}=Ut(PM);return q(()=>e.registerCommand(vm,n=>{let o=Oe();if(!we(o)||!o.isCollapsed())return!1;let r=o.anchor.getNode(),a=xu(0),i=s=>{if(!Ei(s))return!1;let l=vu(s,0);return s.remove(),s instanceof zs?(t(s.__context.id),$s(a)):$s(l),n?.preventDefault(),!0};if(i(r))return!0;if(tt(r)){if(o.anchor.offset>0)return!1;if(i(r.getPreviousSibling()))return!0;let s=r.getParent();if(Ke(s)){let l=r.getIndexWithinParent();if(l>0&&i(s.getChildAtIndex(l-1)))return!0}return!1}if(Ke(r)){let s=o.anchor.offset-1;if(s>=0&&i(r.getChildAtIndex(s)))return!0}return!1},Nr),[e,t]),null}function wK(){let[e]=In();return q(()=>{let t=new Set,n=e.getRootElement()===document.activeElement,o=l=>{for(let d of t)l.has(d)||e.getElementByKey(d)?.removeAttribute("data-composer-chip-selected");for(let d of l)e.getElementByKey(d)?.setAttribute("data-composer-chip-selected","true");t=l},r=()=>{let l=new Set;return e.getEditorState().read(()=>{let d=Oe();if(we(d)&&!d.isCollapsed())for(let c of d.getNodes())c instanceof Oa&&l.add(c.getKey())}),l},a=e.registerUpdateListener(()=>{o(n?r():new Set)}),i=e.registerCommand(OP,()=>(n=!0,o(r()),!1),Yl),s=e.registerCommand(TP,()=>(n=!1,o(new Set),!1),Yl);return()=>{a(),i(),s()}},[e]),null}function TK(){let[e]=In();return q(()=>yM(e,{createMentionNode:Jy,getExpandedAbsoluteOffsetForPoint:Jm}),[e]),null}function LK(e){let[t]=In(),n=_(e.terminalContexts),o=_(gu(e.skills)),r=_(null),a=_(null);q(()=>{n.current=e.terminalContexts},[e.terminalContexts]),q(()=>{o.current=gu(e.skills)},[e.skills]);let i=lh(s=>{let l=kM.get(s),d=r.current;if(!l)return r.current=null,!1;let c=!1;return t.update(()=>{let f=d??(()=>{let g=Oe();if(!we(g)||g.isCollapsed()||TM(g))return null;let v=wM(g);if(!v||v.start===v.end)return null;let x=Ct().getTextContent();return lv(x,v.start,v.end)?null:{value:x,expandedStart:v.start,expandedEnd:v.end}})();if(!f||!l)return;let p=f.value.slice(f.expandedStart,f.expandedEnd),m=`${f.value.slice(0,f.expandedStart)}${s}${p}${l}${f.value.slice(f.expandedEnd)}`;Zy(m,n.current,o.current);let h=sr(m,f.expandedStart);Qm(h+s.length,h+s.length+p.length),c=!0,r.current=null}),c});return q(()=>{let s=h=>{if(a.current){if(h.key==="Dead"||h.key===" "||h.code==="Space")return;a.current=null}if(h.defaultPrevented||h.isComposing||h.metaKey||h.ctrlKey){r.current=null,a.current=null;return}t.getEditorState().read(()=>{let g=Oe();if(!we(g)||g.isCollapsed()){r.current=null,a.current=null;return}if(TM(g)){r.current=null,a.current=null;return}let v=wM(g);if(!v||v.start===v.end){r.current=null,a.current=null;return}let x=Ct().getTextContent();if(lv(x,v.start,v.end)){r.current=null,a.current=null;return}let y={value:x,expandedStart:v.start,expandedEnd:v.end};r.current=y,a.current=null})},l=h=>{if(h.inputType==="insertCompositionText"&&h.data==="`"&&SM!==null&&r.current){a.current=r.current;return}if(a.current||h.inputType==="insertCompositionText")return;if(typeof h.data!="string"){r.current=null;return}let g=h.inputType==="insertText"?h.data:null;if(!g||g.length!==1){r.current=null;return}i(g)&&(h.preventDefault(),h.stopPropagation(),h.stopImmediatePropagation())},d=h=>{queueMicrotask(()=>{t.update(()=>{let g=a.current;if(!g)return;let v=Ct().getTextContent(),x=SM;if(x===null){a.current=null;return}let y=`${g.value.slice(0,g.expandedStart)}\`${g.value.slice(g.expandedEnd)}`;if(v!==y){h?.finalAttempt&&(r.current=null,a.current=null);return}let C=g.value.slice(g.expandedStart,g.expandedEnd),w=sr(v,g.expandedStart);Qm(w,w+1);let k=Oe();if(!we(k)){r.current=null,a.current=null;return}k.insertText(`\`${C}${x}`),Qm(w+1,w+1+C.length),r.current=null,a.current=null},{tag:_r})})},c=h=>{let g=h;(g.inputType==="insertText"||g.inputType==="insertCompositionText")&&d()},f=()=>{d({finalAttempt:!0})},p=null,m=t.registerRootListener((h,g)=>{g?.removeEventListener("keydown",s),g?.removeEventListener("beforeinput",l,!0),g?.removeEventListener("input",c),g?.removeEventListener("compositionend",f),h?.addEventListener("keydown",s),h?.addEventListener("beforeinput",l,!0),h?.addEventListener("input",c),h?.addEventListener("compositionend",f),p=h});return()=>{p&&(p.removeEventListener("keydown",s),p.removeEventListener("beforeinput",l,!0),p.removeEventListener("input",c),p.removeEventListener("compositionend",f)),m()}},[t]),null}function kK({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,onRemoveTerminalContext:l,onChange:d,onCommandKeyDown:c,onPaste:f,editorRef:p}){let[m]=In(),h=_(d);h.current=d;let g=ir(t,n),v=Ba(e,t,{cursor:g,expandedCursor:Ir(t,g)}),x=ir(t,v.cursor),y=pK(o),C=_(y),w=mK(r),k=_(w),S=_(gu(r)),L=_({value:t,cursor:x,expandedCursor:v.expandedCursor,selection:v.selection,terminalContextIds:o.map(H=>H.id)}),I=_(e),T=v.history,E=_(!1),A=z(()=>({onRemoveTerminalContext:l}),[l]);ye(()=>{S.current=gu(r)},[r]),q(()=>{m.setEditable(!a)},[a,m]),ye(()=>{let H=ir(t,n),K=L.current,O=I.current,oe=O!==e,ee=C.current!==y,W=k.current!==w;if(!oe&&K.value===t&&K.cursor===H&&!ee&&!W)return;if(oe){let Ee=K.selection;m.getEditorState().read(()=>{Ee=Qy(Ee)}),rd(O,K.value,{cursor:K.cursor,expandedCursor:K.expandedCursor,selection:Ee})}let qe=Ba(e,t),ve=oe?qe.selection:{anchor:H,focus:H};L.current={value:t,cursor:oe?qe.cursor:H,expandedCursor:oe?qe.expandedCursor:Ir(t,H),selection:ve,terminalContextIds:o.map(Ee=>Ee.id)},I.current=e,C.current=y,k.current=w;let fe=m.getRootElement(),Ne=!!(fe&&document.activeElement===fe);if(!oe&&K.value===t&&!ee&&!W&&!Ne)return;let Ae=oe?Ba(O,K.value).history:null;E.current=!0;let ae=()=>m.update(()=>{let Ee=oe||K.value!==t||ee||W;Ee&&Zy(t,o,S.current),oe?Qm(ve.anchor,ve.focus):(Ee||Ne)&&$s(H)},{discrete:!0,tag:_r});Ae?IM(Ae,ae):ae(),rd(e,t,L.current),queueMicrotask(()=>{E.current=!1})},[n,e,m,w,o,y,t]);let N=B(H=>{let K=m.getRootElement();if(!K)return;let O=ir(L.current.value,H);K.focus({preventScroll:!0}),m.update(()=>{$s(O)}),L.current={value:L.current.value,cursor:O,expandedCursor:Ir(L.current.value,O),selection:{anchor:O,focus:O},terminalContextIds:L.current.terminalContextIds},rd(I.current,L.current.value,{cursor:L.current.cursor,expandedCursor:L.current.expandedCursor,selection:L.current.selection}),h.current(L.current.value,O,L.current.expandedCursor,!1,L.current.terminalContextIds)},[m]),R=B(()=>{let H=L.current;return m.getEditorState().read(()=>{let K=Ct().getTextContent(),O=ir(K,L.current.cursor),oe=ir(K,xu(O)),ee=jm(K,L.current.expandedCursor),W=jm(K,LM(ee)),qe=Yy(Ct()),ve=Qy(L.current.selection);H={value:K,cursor:oe,expandedCursor:W,selection:ve,terminalContextIds:qe}}),L.current=H,rd(I.current,H.value,H),H},[m]);Gr(p,()=>({focus:()=>{N(L.current.cursor)},focusAt:N,focusAtEnd:()=>{N(sr(L.current.value,L.current.value.length))},readSnapshot:R}),[N,R]);let $=B(H=>{H.read(()=>{let K=Ct().getTextContent(),O=ir(K,L.current.cursor),oe=ir(K,xu(O)),ee=jm(K,L.current.expandedCursor),W=jm(K,LM(ee)),qe=Yy(Ct()),ve=Qy(L.current.selection),fe=L.current;if(fe.value===K&&fe.cursor===oe&&fe.expandedCursor===W&&fe.selection.anchor===ve.anchor&&fe.selection.focus===ve.focus&&fe.terminalContextIds.length===qe.length&&fe.terminalContextIds.every((Ae,ae)=>Ae===qe[ae])||E.current)return;L.current={value:K,cursor:oe,expandedCursor:W,selection:ve,terminalContextIds:qe},rd(I.current,K,{cursor:oe,expandedCursor:W,selection:ve});let Ne=Tc(K,oe,"left")||Tc(K,oe,"right");h.current(K,oe,W,Ne,qe)})},[]);return u(PM,{value:A,children:b("div",{className:"relative [font-family:var(--font-composer,var(--font-sans))] [font-size:var(--font-size-prompt,0.875rem)] [@media(max-width:39.999rem)_and_(pointer:coarse)]:[font-size:max(var(--font-size-prompt,1rem),16px)]",children:[u(dM,{contentEditable:u(eE,{className:F("block max-h-50 min-h-17.5 w-full overflow-y-auto whitespace-pre-wrap wrap-break-word bg-transparent leading-relaxed text-foreground focus:outline-none",s),"data-testid":"composer-editor","data-composer-prompt":"true",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off","aria-placeholder":i,placeholder:u("span",{}),onPaste:f}),placeholder:o.length>0?null:u("div",{className:"pointer-events-none absolute inset-0 leading-relaxed text-placeholder",children:i}),ErrorBoundary:tE}),u(_E,{onChange:$}),u(yK,{...c?{onCommandKeyDown:c}:{}}),u(LK,{terminalContexts:o,skills:r}),u(bK,{}),u(CK,{}),u(IK,{}),u(SK,{}),u(TK,{}),u(wK,{}),u(RE,{externalHistoryState:T},e)]})})}function PK(e){let[t]=In(),n=_(e),o=_(e),[r,a]=G(e.documentKey);r===e.documentKey&&(n.current=e),o.current=e,ye(()=>{r===e.documentKey||t.isComposing()||a(e.documentKey)},[r,t,e.documentKey]),q(()=>{let s=null,l=()=>{let c=o.current.documentKey;a(f=>f===c?f:c)},d=t.registerRootListener((c,f)=>{f?.removeEventListener("compositionend",l),c?.addEventListener("compositionend",l),s=c});return()=>{s?.removeEventListener("compositionend",l),d()}},[t]);let i=r===e.documentKey?e:n.current;return u(kK,{...i})}function RM({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,onRemoveTerminalContext:l,onChange:d,onCommandKeyDown:c,onPaste:f,editorRef:p}){let m=_(t),h=_(o),g=_(gu(r)),v=z(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[mu,hu,zs],editorState:()=>{Zy(m.current,h.current,g.current)},onError:x=>{throw x}}),[]);return u(mA,{initialConfig:v,children:u(PK,{documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,onRemoveTerminalContext:l,onChange:d,onPaste:f,editorRef:p,...c?{onCommandKeyDown:c}:{},...s?{className:s}:{}})},iK)}me();me();me();var xC=Sd(OM(),1),xR=Sd(pc(),1),yR=Sd(pc(),1);Wn(function(t,n){return Te("div",{ref:n,...t})});var cg=Wn(function(t,n){return Te("div",{ref:n,...t})}),fr=cg,Ua={OS:"web"};function Hs(e,t){return t===void 0?e:Math.max(0,Math.min(t,e))}function yC(e,t){return t===void 0||!Number.isFinite(t)||!Number.isFinite(e.scrollLength)||t<=e.scrollLength?t!==void 0&&Number.isFinite(t)&&Number.isFinite(e.scrollLength)?0:void 0:Math.max(0,t-e.scrollLength)}function CR(){return"normal"}function BK(e){var t;return(t=e?.horizontalRTLScrollType)!=null?t:CR()}function zK(e){var t;return(t=e?.rtl)!=null?t:!1}function qa(e){return CC(e?.props)}function CC(e){return!!e?.horizontal&&zK(e)}function bC(e){return e?.horizontal?(CC(e)?e.stylePaddingLeft:e.stylePaddingRight)||0:e?.stylePaddingBottom||0}function $K(e,t){var n;return(n=yC(e,t))!=null?n:0}function FM(e,t){return t&&(qa(e)?t.left:t.right)||0}function HK(e,t,n,o){return!qa(e)||o===void 0||!Number.isFinite(o)?t:Math.max(0,o-t-n)}function IC(e,t,n){if(!e||!qa(e))return t;let o=yC(e,n),r=Hs(t,o),a=BK(e);return a==="negative"?r===0?0:-r:a==="inverted"?o===void 0?r:Hs(o-r,o):r}function UK(e,t,n){if(!qa(e))return e.horizontalRTLScrollType=void 0,t;let o=yC(e,n);if(t<0)return e.horizontalRTLScrollType="negative",Hs(-t,o);if(o===void 0)return t;let r=t,a=o-t;if(!Number.isFinite(a))return e.horizontalRTLScrollType="normal",r;let i=e.horizontalRTLScrollType;if(i==="inverted")return Hs(a,o);if(i==="normal")return Hs(r,o);if(!e.hasScrolled){let f=CR();return e.horizontalRTLScrollType=f,Hs(r,o)}let s=e.scroll,l=Math.abs(r-s),c=Math.abs(a-s)+.5<l;return e.horizontalRTLScrollType=c?"inverted":"normal",Hs(c?a:r,o)}var KK=e=>e,ug=Ht(null),bR="\0",qK=0;function VK({children:e}){let[t]=G(()=>({animatedScrollY:KK(0),columnWrapperStyle:void 0,containerLayoutTriggers:new Map,contextNum:qK++,listeners:new Map,mapViewabilityAmountCallbacks:new Map,mapViewabilityAmountValues:new Map,mapViewabilityCallbacks:new Map,mapViewabilityConfigStates:new Map,mapViewabilityValues:new Map,pendingContainerIds:void 0,positionListeners:new Map,scrollAxisGap:0,state:void 0,values:new Map([["alignItemsAtEndPadding",0],["containerLayoutEpoch",0],["stylePaddingTop",0],["headerSize",0],["numContainers",0],["activeStickyIndex",-1],["isAtEnd",!1],["isAtStart",!1],["isNearEnd",!1],["isNearStart",!1],["isWithinMaintainScrollAtEndThreshold",!1],["adaptiveRender","normal"],["totalSize",0],["scrollAdjustPending",0]]),viewRefs:new Map}));return Te(ug.Provider,{value:t},e)}function Br(){return fn(ug)}function IR(e,t){if(!e){let r=[];return{get:()=>r,subscribe:()=>()=>{}}}let n=[],o=[];return{get:()=>{let r=[],a=!1;for(let i=0;i<t.length;i++){let s=de(e,t[i]);r.push(s),s!==o[i]&&(a=!0)}return o=r,a&&(n=r),n},subscribe:r=>{let a=[];for(let i of t)a.push($a(e,i,r));return()=>{for(let i of a)i()}}}}function WK(e){return e.length===1?e[0]:e.join(bR)}function GK(e){return e.split(bR)}function $a(e,t,n){let{listeners:o}=e,r=o.get(t);return r||(r=new Set,o.set(t,r)),r.add(n),()=>r.delete(n)}function de(e,t){let{values:n}=e;return n.get(t)}function Pe(e,t,n){let{listeners:o,values:r}=e;if(r.get(t)!==n){r.set(t,n);let a=o.get(t);if(a)for(let i of a)i(n)}}function jK(e,t,n){let{positionListeners:o}=e,r=o.get(t);return r||(r=new Set,o.set(t,r)),r.add(n),()=>r.delete(n)}function QK(e,t,n){let{positionListeners:o}=e,r=o.get(t);if(r)for(let a of r)a(n)}function Wo(e){let t=fn(ug),n=WK(e),{subscribe:o,get:r}=z(()=>IR(t,GK(n)),[t,n]);return(0,xC.useSyncExternalStore)(o,r,r)}function XK(e,t){let n=fn(ug),{subscribe:o,get:r}=z(()=>IR(n,[e]),[n,e]),a=B(()=>t(r()[0]),[r,t]);return(0,xC.useSyncExternalStore)(o,a,a)}function YK(e){return Math.max(0,e??0)}function Ks(e,t){var n;let o=e.state,{props:r}=o,a=r.horizontal,i=r.contentInset,s=i??o.nativeContentInset,l=(a?FM(o,s):s?.bottom)||0,d=YK(t??r.contentInsetEndAdjustment),c=de(e,"anchoredEndSpaceSize"),f=r.anchoredEndSpace&&c?c:0,p=(n=o.contentInsetOverride)!=null?n:void 0,m=l+d;if(p){let h={bottom:0,left:0,right:0,...s,...p};return Math.max(((a?FM(o,h):h.bottom)||0)+d,f)}return Math.max(m,f)}function po(e){var t,n;let{values:o,state:r}=e,a=r.props.horizontal?r.props.stylePaddingLeft||0:o.get("stylePaddingTop")||0,i=r.props.horizontal?r.props.stylePaddingRight||0:r.props.stylePaddingBottom||0,s=o.get("alignItemsAtEndPadding")||0,l=o.get("headerSize")||0,d=o.get("footerSize")||0,c=Ks(e),f=(n=(t=r.pendingTotalSize)!=null?t:r.totalSize)!=null?n:o.get("totalSize"),p=Math.max(0,f-(r.props.data.length>0?e.scrollAxisGap:0));return l+d+p+a+s+i+(c||0)}var id=({children:e})=>Te(cg,{style:{alignItems:"center",flexDirection:"row",justifyContent:"space-between"}},e);ue(function(){let t=Br(),[n=0,o=0,r=0,a=0,i=0,s=0,l=!1]=Wo(["totalSize","scrollAdjust","debugRawScroll","debugComputedScroll","numContainers","numContainersPooled","isAtEnd"]),d=po(t),[,c]=Za(f=>f+1,0);return JK(()=>{c()},100),Te(cg,{pointerEvents:"none",style:{backgroundColor:"#FFFFFFCC",borderRadius:4,padding:4,paddingBottom:4,paddingLeft:4,position:"absolute",right:0,top:0}},Te(id,null,Te(fr,null,"TotalSize:"),Te(fr,null,n.toFixed(2))),Te(id,null,Te(fr,null,"ContentSize:"),Te(fr,null,d.toFixed(2))),Te(id,null,Te(fr,null,"At end:"),Te(fr,null,String(l))),Te(id,null,Te(fr,null,"ScrollAdjust:"),Te(fr,null,o.toFixed(2))),Te(id,null,Te(fr,null,"RawScroll: "),Te(fr,null,r.toFixed(2))),Te(id,null,Te(fr,null,"ComputedScroll: "),Te(fr,null,a.toFixed(2))))});function JK(e,t){q(()=>{let n=setInterval(e,t);return()=>clearInterval(n)},[t])}var SC=!0,SR=new WeakMap;function ZK(e){return SR.get(e)}function eq(e,t){SR.set(e,t)}var tq=typeof __DEV__<"u"?__DEV__:void 0,BM,zM=typeof process<"u"&&typeof process.env=="object"&&process.env?(BM="production")!=null?BM:process.env.MODE:void 0,$M=typeof zM=="string"?zM.toLowerCase()!=="production":void 0,HM,Vo=(HM=$M??tq)!=null?HM:!1,sd=-1e7,wR=1,nq=Vo&&!1,oq=Vo&&!1;function fg({scheduledWork:e}){e.cancel("checkFinishedScrollFrame"),e.cancel("checkFinishedScrollRetryFrame"),e.cancel("checkFinishedScrollFallback"),e.cancel("platformScrollCompletion")}function TR(e){var t,n;let o=(n=e.pendingScrollResolve)!=null?n:(t=e.pendingScrollToEnd)==null?void 0:t.resolve;e.pendingScrollResolve=void 0,e.pendingScrollToEnd=void 0,o?.()}function rq(e){fg(e),e.scheduledWork.cancel("imperativeScrollReady"),e.scrollingTo=void 0,e.scrollTargetPinnedRange=void 0,TR(e)}function aq(e,t,n){return{...t,nativeEvent:{...t.nativeEvent,contentOffset:e.props.horizontal?{x:n,y:0}:{x:0,y:n}}}}function iq(e,t){var n,o,r,a;let i=e.state,s=i.deferredPublicOnScrollEvent;i.deferredPublicOnScrollEvent=void 0,s&&((a=(r=i.props).onScroll)==null||a.call(r,aq(i,s,(o=(n=t??i.scrollPending)!=null?n:i.scroll)!=null?o:0)))}var tC=1;function sq(e){return!!(e?.didDispatchNativeScroll||e?.didRetrySilentInitialScroll||e?.watchdog)}function UM(e){e.initialScrollSession=void 0}function sC(e){let{bootstrap:t,completion:n,kind:o,previousDataLength:r}=e;return o==="offset"?{completion:n,kind:o,previousDataLength:r}:{bootstrap:t,completion:n,kind:o,previousDataLength:r}}function tg(e,t=(n=>(n=(o=>(o=e.initialScrollSession)==null?void 0:o.kind)())!=null?n:"bootstrap")()){var n,o;return e.initialScrollSession?e.initialScrollSession.kind!==t&&(e.initialScrollSession=sC({bootstrap:e.initialScrollSession.kind==="bootstrap"?e.initialScrollSession.bootstrap:void 0,completion:e.initialScrollSession.completion,kind:t,previousDataLength:e.initialScrollSession.previousDataLength})):e.initialScrollSession=sC({completion:{},kind:t,previousDataLength:0}),(o=(n=e.initialScrollSession).completion)!=null||(n.completion={}),e.initialScrollSession.completion}var pg={didDispatchNativeScroll(e){var t,n;return!!((n=(t=e.initialScrollSession)==null?void 0:t.completion)!=null&&n.didDispatchNativeScroll)},didRetrySilentInitialScroll(e){var t,n;return!!((n=(t=e.initialScrollSession)==null?void 0:t.completion)!=null&&n.didRetrySilentInitialScroll)},markInitialScrollNativeDispatch(e){tg(e).didDispatchNativeScroll=!0},markSilentInitialScrollRetry(e){tg(e).didRetrySilentInitialScroll=!0},resetFlags(e){if(!e.initialScrollSession)return;let t=tg(e,e.initialScrollSession.kind);t.didDispatchNativeScroll=void 0,t.didRetrySilentInitialScroll=void 0}},oo={clear(e){oo.set(e,void 0)},didReachTarget(e,t){return Math.abs(e-t.targetOffset)<=tC},get(e){var t,n;return(n=(t=e.initialScrollSession)==null?void 0:t.completion)==null?void 0:n.watchdog},hasNonZeroTargetOffset(e){return e!==void 0&&e>tC},isAtZeroTargetOffset(e){return e<=tC},set(e,t){var n,o;if(!t&&!((o=(n=e.initialScrollSession)==null?void 0:n.completion)!=null&&o.watchdog))return;let r=tg(e);r.watchdog=t?{startScroll:t.startScroll,targetOffset:t.targetOffset}:void 0}};function Ka(e,t={}){var n,o,r,a;let i=e.initialScrollSession,s=(n=t.kind)!=null?n:i?.kind,l=i?.completion,d=i?.kind==="bootstrap"?i.bootstrap:void 0,c=s==="bootstrap"?t.bootstrap===null?void 0:(o=t.bootstrap)!=null?o:d:void 0;if(!s||!e.initialScroll&&!c&&!sq(l))return UM(e);let f=(a=(r=t.previousDataLength)!=null?r:i?.previousDataLength)!=null?a:0;return e.initialScrollSession=sC({bootstrap:c,completion:l,kind:s,previousDataLength:f}),e.initialScrollSession}var lq=1.3;function lC(e,t,n){let o=Math.abs(e);return!t&&n>0&&o>=n*lq||!t&&n<=0&&o>0}var LR=(e,t,n,o,r,a,i,s)=>{let l=Math.abs(e),d=t||n>0&&l<=n,c=()=>{s({atThreshold:t,contentSize:a.contentSize,dataLength:a.dataLength,scrollPosition:a.scrollPosition})};return o?lC(e,t,n)?(s(void 0),!1):(d&&(!r||r.atThreshold!==t||r.contentSize!==a.contentSize||r.dataLength!==a.dataLength)&&c(),!0):d?(i(e),c(),!0):!1};function dq(e,t){let n=e.state;t==="start"?(n.isStartReached=!1,n.startReachedSnapshot=void 0):(n.isEndReached=!1,n.endReachedSnapshot=void 0)}function kR(e){let t=e.state;if(!t.edgeReachedGate)return;let n=po(e),o=n-t.scroll-t.scrollLength-Ks(e),r=n<t.scrollLength,a=t.props.onStartReachedThreshold*t.scrollLength,i=t.props.onEndReachedThreshold*t.scrollLength,s=lC(t.scroll,!1,a),l=lC(o,r,i);s&&l&&(t.edgeReachedGate=void 0)}function PR(e,t,n,o){return!e.state.edgeReachedGate||n===t||!!o}function AR(e){e.state.edgeReachedGate="closed"}function KM(e){e.state.edgeReachedGate&&(e.state.edgeReachedGate="prepared")}function cq(e,t){let n=e.state;if(n.edgeReachedGate!=="prepared")return;let o=t<0?"start":"end";return n.edgeReachedGate="closed",dq(e,o),o}function bu(e){return!!e?.initialScroll&&!e.didFinishInitialScroll}function ER(e,t,n){var o;let r=e.state;if(!r)return;let{queuedInitialLayout:a,scrollLength:i,scroll:s,maintainingScrollAtEnd:l,props:{maintainScrollAtEndThreshold:d,onEndReachedThreshold:c}}=r,f=po(e);if(kR(e),f>0&&a){let p=Ks(e),m=f-s-i-p,h=f<i;Pe(e,"isAtEnd",h||m<=wR),Pe(e,"isNearEnd",h||m<=c*i),Pe(e,"isWithinMaintainScrollAtEndThreshold",h||m<=d*i),bu(r)||l||(r.isEndReached=LR(m,h,c*i,r.isEndReached,r.endReachedSnapshot,{contentSize:f,dataLength:(o=r.props.data)==null?void 0:o.length,scrollPosition:s},v=>{var x,y;PR(e,"end",t,n)&&(AR(e),(y=(x=r.props).onEndReached)==null||y.call(x,{distanceFromEnd:v}))},v=>{r.endReachedSnapshot=v}))}}function uq(e,t,n){let o=e?.state;if(!o)return;let{isStartReached:r,props:{data:a,onStartReachedThreshold:i},scroll:s,scrollLength:l,startReachedSnapshot:d,totalSize:c}=o,f=a.length,p=i*l;kR(e),r&&p>0&&s>p&&d&&(d.contentSize!==c||d.dataLength!==f)&&(o.isStartReached=!1,o.startReachedSnapshot=void 0),Pe(e,"isAtStart",s<=wR),Pe(e,"isNearStart",s<=p),bu(o)||o.scrollingTo||(o.isStartReached=LR(s,!1,p,o.isStartReached,d,{contentSize:c,dataLength:f,scrollPosition:s},h=>{var g,v;PR(e,"start",t,n)&&(AR(e),(v=(g=o.props).onStartReached)==null||v.call(g,{distanceFromStart:h}))},h=>{o.startReachedSnapshot=h}))}function mg(e,t){let n=!e.state.edgeReachedGate;ER(e,t,n),uq(e,t,n)}function MR(e){var t,n;let o=e.state;(t=o.props)!=null&&t.data&&((n=o.triggerCalculateItemsInView)==null||n.call(o,{forceFullItemPositions:!0})),mg(e)}var fq=6,pq=3,mq=250;function RR(e){e.state.scheduledWork.cancel("adaptiveRender")}function qM(e,t){let n=e.state;RR(e),t<=0?Tu(e,"normal","scroll"):n.scheduledWork.timeout(()=>Tu(e,"normal","scroll"),t,"adaptiveRender")}function Tu(e,t,n){var o,r;de(e,"adaptiveRender")!==t&&(Pe(e,"adaptiveRender",t),(r=(o=e.state.props.adaptiveRender)==null?void 0:o.onChange)==null||r.call(o,t,n))}function wC(e){var t,n;RR(e);let o=(n=(t=e.state.props.adaptiveRender)==null?void 0:t.initialMode)!=null?n:"normal";de(e,"adaptiveRender")!==o&&Tu(e,o,"initial")}function gq(e,t,n){var o,r,a;let i=e.state,s=i.props.adaptiveRender,l=de(e,"adaptiveRender");if(de(e,"readyToRender"))if(s){let d=(o=s.enterVelocity)!=null?o:fq,c=(r=s.exitVelocity)!=null?r:pq,f=(a=s.exitDelay)!=null?a:mq,p=l==="light"?c:d,m=n?.forceLight||Math.abs(t)>p?"light":"normal",h=i.scheduledWork.has("adaptiveRender")?"normal":l;m!==h&&(m==="light"?(Tu(e,"light","scroll"),qM(e,f)):l==="light"&&qM(e,f))}else wC(e)}var TC=50;function NR(e,t){var n;let o=e.state.props.drawDistance,r=e.state.initialScroll,a=r!==void 0&&((n=r.viewPosition)!=null?n:0)>0;return t==="visible-first"||t!=="full"&&!de(e,"readyToRender")&&!a?Math.min(o,TC):o}function _R(e){let{state:t}=e;t.props.drawDistance<=TC||t.scheduledWork.has("fullDrawDistancePrewarm")||t.scheduledWork.frame(()=>{var n;return(n=t.triggerCalculateItemsInView)==null?void 0:n.call(t)},"fullDrawDistancePrewarm")}function LC(e,{resetLayout:t,resetInitialScroll:n}){let{state:o}=e;t&&(o.didContainersLayout=!1,o.queuedInitialLayout=!1),n&&(o.didFinishInitialScroll=!1),Pe(e,"readyToRender",!1),wC(e)}function kC(e,{didLayout:t,didInitialScroll:n}){let{state:o}=e,{loadStartTime:r,props:{onLoad:a}}=o;t&&(o.didContainersLayout=!0),n&&(o.didFinishInitialScroll=!0),o.didContainersLayout&&o.didFinishInitialScroll&&!de(e,"readyToRender")&&(Pe(e,"readyToRender",!0),Tu(e,"normal","ready"),o.props.drawDistance>TC&&_R(e),o.didLoad||(o.didLoad=!0,a&&a({elapsedTimeInMs:Date.now()-r})))}var hq=2e3;function VM(e,t){e.scroll=t,e.scrollPending=t,e.scrollPrev=t}function DR(e){e.scheduledWork.cancel("preservedInitialScroll")}function ld(e){DR(e),e.clearPreservedInitialScrollOnNextFinish=void 0,e.initialScroll=void 0,Ka(e)}function WM(e){var t,n,o;let r=e.state,a=((t=r.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?r.initialScrollSession.bootstrap:void 0;(r.initialScroll||a||(n=r.scrollingTo)!=null&&n.isInitialScroll)&&(a?.frameHandle!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a.frameHandle),(o=r.scrollingTo)!=null&&o.isInitialScroll&&(fg(r),r.scrollingTo=void 0,r.scrollTargetPinnedRange=void 0),pg.resetFlags(r),Ka(r,{bootstrap:null}),dd(e))}function dd(e,t){var n,o,r;let a=e.state;if(t?.resolvedOffset!==void 0)VM(a,t.resolvedOffset);else if(t?.syncObservedOffset&&((n=a.initialScrollSession)==null?void 0:n.kind)==="offset"){let s=(r=(o=a.refScroller.current)==null?void 0:o.getCurrentScrollOffset)==null?void 0:r.call(o);typeof s=="number"&&Number.isFinite(s)&&VM(a,s)}let i=()=>{var s,l,d,c,f;let p=((s=a.initialScrollSession)==null?void 0:s.kind)==="bootstrap",m=(c=(d=(l=t?.resolvedOffset)!=null?l:a.scrollPending)!=null?d:a.scroll)!=null?c:0;oo.clear(a),t?.preserveTarget&&a.initialScroll?(a.clearPreservedInitialScrollOnNextFinish=void 0,Ka(a),DR(a),t?.schedulePreservedTargetClear&&a.scheduledWork.timeout(()=>{var h;!a.didFinishInitialScroll||(h=a.scrollingTo)!=null&&h.isInitialScroll||!a.initialScroll||ld(a)},hq,"preservedInitialScroll")):ld(a),t?.recalculateItems&&MR(e),kC(e,{didInitialScroll:!0}),p&&iq(e,m),(f=t?.onFinished)==null||f.call(t)};if(t?.waitForCompletionFrame){requestAnimationFrame(i);return}i()}function gg(e,t){let n=e.state;return t!==void 0&&n.positions[t]||0}function vq(e){let{state:t}=e;return(t.props.horizontal?(qa(t)?t.props.stylePaddingRight:t.props.stylePaddingLeft)||0:de(e,"stylePaddingTop")||0)+(de(e,"alignItemsAtEndPadding")||0)+(de(e,"headerSize")||0)}function Bt(e,t){let{data:n,keyExtractor:o}=e.props;if(!n)return"";let a=t<n.length?o?o(n[t],t):t:null;return e.idCache[t]=a,a}function xq(e){var t,n,o;let{state:r,values:a}=e;return(a.get("headerSize")||0)+(a.get("footerSize")||0)+((o=(n=(t=r.pendingTotalSize)!=null?t:r.totalSize)!=null?n:a.get("totalSize"))!=null?o:0)+(r.props.stylePaddingTop||0)+(r.props.stylePaddingBottom||0)}function yq(e){let{state:t}=e;return!!t.props.alignItemsAtEndPaddingEnabled&&!t.props.horizontal&&t.props.data.length>0&&t.scrollLength>0?Math.max(0,t.scrollLength-xq(e)-Ks(e)):0}function Gs(e){let t=de(e,"alignItemsAtEndPadding")||0,n=yq(e);t!==n&&Pe(e,"alignItemsAtEndPadding",n)}function Iu(e,t,n,o=!0){let r=e.state,a=r.totalSize,i=r.totalSize;t===null?(i=n,r.timeoutSetPaddingTop&&(clearTimeout(r.timeoutSetPaddingTop),r.timeoutSetPaddingTop=void 0)):i+=n,a!==i?(r.pendingTotalSize=void 0,r.totalSize=i,o&&Pe(e,"totalSize",i),Gs(e)):o&&e.values.get("totalSize")!==i&&Pe(e,"totalSize",i)}function dC(e,t,n,o=!0){let r=e.state,{sizes:a}=r,i=a.get(t),s=i!==void 0?n-i:n;s!==0&&Iu(e,t,s,o),a.set(t,n)}function OR(e){return typeof e=="function"}function hg(e){return Array.isArray(e)}var GM=new Set;function Us(e,t){Vo&&!GM.has(e)&&(GM.add(e),console.warn(`[legend-list] ${t}`))}function Lu(e){return Math.floor(e*8)/8}function Su(e){return e==null}function jM(e,t){var n,o,r;let a=t==="Left"||t==="Right"?e.paddingHorizontal:e.paddingVertical;return(r=(o=(n=e[`padding${t}`])!=null?n:a)!=null?o:e.padding)!=null?r:0}function Cu(e,t,n){return jM(e,n)+jM(t,n)}function cC(e,t){var n,o;let r=(o=(n=e.state)==null?void 0:n.containerItemKeys)==null?void 0:o.get(t);if(r!==void 0)return r;let a=de(e,"numContainers");for(let i=0;i<a;i++)if(de(e,`containerItemKey${i}`)===t)return i;return-1}function FR(e,t,n,o,r){var a,i;let s=e.state,{getFixedItemSize:l,getItemType:d}=s.props,c=t?s.sizesKnown.get(t):void 0;if(c===void 0&&t&&l){let f=(i=r?.itemType)!=null?i:d&&(a=d(o,n))!=null?a:"",p=r?.didResolveFixedItemSize?r.fixedItemSize:l(o,n,f);p!==void 0&&(c=p+e.scrollAxisGap,s.sizesKnown.set(t,c))}return c}function BR(e,t){let n=Bt(e.state,t);return FR(e,n,t,e.state.props.data[t])}function Cq(e,t,n){for(let o=t;o<=n;o++)if(BR(e,o)===void 0)return!1;return!0}function mo(e,t,n,o,r,a,i,s){var l,d,c,f;let p=e.state,{sizes:m,averageSizes:h,props:{estimatedItemSize:g,getItemType:v},scrollingTo:x}=p,y=p.sizesKnown.get(t);if(y!==void 0)return y;let C,w=m.get(t);if(a&&w!==void 0)return w;if(C=FR(e,t,n,o,s),C!==void 0)return dC(e,t,C,i),C;let k=(d=s?.itemType)!=null?d:v&&(l=v(o,n))!=null?l:"";if(r&&!x){let S=(c=h[k])==null?void 0:c.avg;S!==void 0&&(C=Lu(S))}if(C===void 0&&w!==void 0)return w;if(C===void 0&&r&&x){let S=(f=x.averageSizeSnapshot)==null?void 0:f[k];S!==void 0&&(C=Lu(S))}return C===void 0&&(C=g+e.scrollAxisGap),dC(e,t,C,i),C}function PC(e,t){if(t===void 0||t<0)return;let n=Bt(e.state,t);return mo(e,n,t,e.state.props.data[t])}function vg(e,t,n){var o;let r=e.state,{index:a,viewOffset:i,viewPosition:s}=n,l=t;if(i&&(l-=i),a!==void 0){let d=vq(e);d&&(l+=d)}if(s!==void 0&&a!==void 0){let d=r.props.data.length;if(d===0)return l;let c=a<0||a>=d,f=(o=r.props.estimatedItemSize)!=null?o:0,p=c?f:mo(e,Bt(r,a),a,r.props.data[a]),m=Math.max(0,p-(c?0:e.scrollAxisGap)),h=Ks(e);if(l-=s*(r.scrollLength-h-m),!c&&a===r.props.data.length-1){let g=de(e,"footerSize")||0;l+=g}}return l}function Mi(e,t,n){let o=e.state,r=po(e),a=t;if(Number.isFinite(r)&&Number.isFinite(o.scrollLength)&&Ua.OS!=="android"){let i=Math.max(0,r-o.scrollLength),s=n?.viewOffset,l=typeof s=="number"&&s<0?-s:0,d=i+l;a=Math.min(t,d)}return a=Math.max(0,a),a}function ku(e){var t,n;let o=e.state;if(o?.scrollingTo){fg(o);let r=o.pendingScrollResolve;o.pendingScrollResolve=void 0;let a=o.scrollingTo;if(o.scrollHistory.length=0,o.scrollingTo=void 0,o.scrollTargetPinnedRange=void 0,o.pendingTotalSize!==void 0&&Iu(e,null,o.pendingTotalSize),o.scrollAdjustHandler.commitPendingAdjust(a),a.isInitialScroll||o.initialScroll){let i=((t=o.initialScrollSession)==null?void 0:t.kind)==="offset",s=!!a.isInitialScroll&&!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;dd(e,{onFinished:()=>{r?.()},preserveTarget:i&&o.props.data.length===0||s,recalculateItems:!0,schedulePreservedTargetClear:s,syncObservedOffset:i,waitForCompletionFrame:!!a.waitForInitialScrollCompletionFrame});return}MR(e),r?.()}}var bq=80,Iq=1500,Sq=320,wq=1;function Tq(e,t){var n,o;let r=e.state,{animated:a,horizontal:i,offset:s}=t;r.scheduledWork.cancel("platformScrollCompletion");let l=r.refScroller.current,d=l?.getScrollableNode();if(!l||!d)return;let c=!!a,f=!!i,p=f?po(e):void 0,m=f?IC(r,s,p):0,h=f?0:s;if(l.scrollTo({animated:c,x:m,y:h}),c){let g=(o=(n=l.getScrollEventTarget)==null?void 0:n.call(l))!=null?o:null;Lq(e,{readOffset:()=>l.getCurrentScrollOffset(),target:g,targetOffset:s})}else{r.scroll=s;let g=r.scrollingTo;r.scheduledWork.timeout(()=>{g===r.scrollingTo&&ku(e)},100,"platformScrollCompletion")}}function Lq(e,t){let{readOffset:n,target:o,targetOffset:r}=t;if(!o){ku(e);return}let a="onscrollend"in o,i,s=!1,{scheduledWork:l,scrollingTo:d}=e.state,c=setTimeout(()=>m("max"),Iq),f=()=>{o.removeEventListener("scroll",h),a&&o.removeEventListener("scrollend",g),i!==void 0&&clearTimeout(i),clearTimeout(c)},p=()=>{s||(s=!0,f())},m=v=>{if(s)return;if(d!==e.state.scrollingTo){l.cancel("platformScrollCompletion");return}let x=n(),y=Math.abs(x-r)<=wq;v==="scrollend"&&!y||(l.cancel("platformScrollCompletion"),ku(e))},h=()=>{i!==void 0&&clearTimeout(i),i=setTimeout(()=>m("idle"),bq)},g=()=>m("scrollend");o.addEventListener("scroll",h),a?o.addEventListener("scrollend",g):i=setTimeout(()=>m("idle"),Sq),l.register("platformScrollCompletion",p)}function cd(e){let t=e.state,{didContainersLayout:n,pendingNativeMVCPAdjust:o,refScroller:r,props:{maintainScrollAtEnd:a}}=t,s=!!(de(e,"isWithinMaintainScrollAtEndThreshold")&&a&&n);if(o)return t.pendingMaintainScrollAtEnd=s,!1;if(s){if(t.pendingMaintainScrollAtEnd=!1,po(e)<t.scrollLength&&(t.scroll=0),t.maintainingScrollAtEnd)t.pendingMaintainScrollAtEnd=!0;else{let d=a.animated?"pending-animated":"pending-instant",c=a.animated?"animated":"instant",f=t.scroll;t.maintainingScrollAtEnd=d,requestAnimationFrame(()=>{let p=de(e,"isWithinMaintainScrollAtEndThreshold"),m=t.scroll!==f;if(p||!m){t.maintainingScrollAtEnd=c;let h=r.current;if(t.props.horizontal&&qa(t)){let g=po(e),v=$K(t,g),x=IC(t,v,g);h?.scrollTo({animated:a.animated,x,y:0})}else h?.scrollToEnd({animated:a.animated});setTimeout(()=>{t.maintainingScrollAtEnd===c&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd&&cd(e))},a.animated?500:0)}else t.maintainingScrollAtEnd===d&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd=!1)})}return!0}return t.pendingMaintainScrollAtEnd=!1,!1}function js(e,t,n){let o=e.state;if(Math.abs(t)>.1){let r=()=>{o.scrollAdjustHandler.requestAdjust(t),o.adjustingFromInitialMount&&o.adjustingFromInitialMount--};o.scroll+=t,o.scrollForNextCalculateItemsInView=void 0,de(e,"readyToRender")?r():(o.adjustingFromInitialMount=(o.adjustingFromInitialMount||0)+1,requestAnimationFrame(r))}}var Ao=.1,kq=300,Pq=2,Aq=1;function Eq(e,t,n,o){if(!t){e.mvcpAnchorLock=void 0;return}let r=e.mvcpAnchorLock;if(!r)return;let a=o>r.expiresAt,i=e.indexByKey.get(r.id)===void 0;if(a||i||!n){e.mvcpAnchorLock=void 0;return}return r}function Mq(e,t){{let{anchorId:n,anchorPosition:o,dataChanged:r,now:a,positionDiff:i}=t,s=!!r||!!e.mvcpAnchorLock,l=e.props.maintainVisibleContentPosition.data;if(!s||!l||e.scrollingTo||!n||o===void 0)return;let d=e.mvcpAnchorLock,c=!r&&Math.abs(i)<=Ao&&d?.id===n?d.quietPasses+1:0;if(!r&&c>=Pq){e.mvcpAnchorLock=void 0;return}e.mvcpAnchorLock={expiresAt:a+kq,id:n,position:o,quietPasses:c}}}function Rq(e,t,n,o,r,a){return!1}function Nq(e,t,n){if(Math.abs(t)<=Ao)return 0;let r=Math.max(0,n-e.scrollLength)-e.scroll;return t<0?Math.max(t,Math.min(0,r)):t>0?Math.min(t,Math.max(0,r)):0}function _q(e,t){return e<0?-t:t}function nC(e,t,n){let o=e.state;o.pendingNativeMVCPAdjust=void 0;let r=t-n;Math.abs(r)>Ao&&js(e,r)}function Dq(e){let t=e.state,n=t.pendingNativeMVCPAdjust;if(!n||Math.abs(n.manualApplied)>Ao)return;let o=po(e),r=Nq(t,n.amount,o);if(Math.abs(r)<=Ao)return;let a=n.amount-r;Math.abs(a)<=Ao||(n.manualApplied=a,js(e,a),n.furthestProgressTowardAmount=0)}function Oq(e,t){let n=e.state,o=n.pendingNativeMVCPAdjust;if(!o)return!1;let r=o.amount-o.manualApplied,a=t-(o.startScroll+o.manualApplied),i=r<0&&a>Ao||r>0&&a<-Ao,s=_q(r,a);if(Math.abs(r)<=Ao)return n.pendingNativeMVCPAdjust=void 0,!0;if(i)return n.pendingNativeMVCPAdjust=void 0,!1;if(s+Ao>=Math.abs(r))return nC(e,r,a),!0;let l=Math.max(0,po(e)-n.scrollLength);return Math.abs(t-l)<=Aq||n.pendingMaintainScrollAtEnd&&de(e,"isWithinMaintainScrollAtEndThreshold")&&s>Ao?(nC(e,r,a),!0):s>o.furthestProgressTowardAmount+Ao?(o.furthestProgressTowardAmount=s,!1):(o.furthestProgressTowardAmount>Ao&&s<o.furthestProgressTowardAmount-Ao&&(n.pendingNativeMVCPAdjust=void 0),!1)}function Fq(e,t){let n=e.state,{idsInView:o,positions:r,props:a}=n,{maintainVisibleContentPosition:{data:i,size:s,shouldRestorePosition:l}}=a,d=Date.now(),c=!!t||!!n.mvcpAnchorLock,f=n.scrollingTo;if(t&&n.pendingScrollToEnd&&f===void 0){n.mvcpAnchorLock=void 0;return}let p=Eq(n,c,i,d),m,h,g=[],v=f?.index,x=f?.viewPosition,y=v!==void 0&&n.props.data.length>0&&v>=n.props.data.length-1&&(x??0)>0,C=t?i:s,w=n.indexByKey,k=n.scroll;if(po(e),C){if(p&&v===void 0?(h=p.id,m=p.position):v!==void 0?h=Bt(n,v):o.length>0&&n.didContainersLayout&&!t&&(h=o.find(S=>w.get(S)!==void 0)),t&&o.length>0&&n.didContainersLayout)for(let S=0;S<o.length;S++){let L=o[S],I=w.get(L);if(I!==void 0){let T=r[I];T!==void 0&&g.push({id:L,position:T})}}if(h!==void 0&&m===void 0){let S=w.get(h);S!==void 0&&(m=r[S])}return()=>{let S=0,L=p?.id,I,T=!1,E=n.props.data;if(t&&i&&v===void 0&&h!==void 0&&p?.id===h&&l!==void 0&&h!==void 0){let R=w.get(h);if(R!==void 0){let $=E[R];T=$===void 0||!l($,R,E),T&&p?.id===h&&(n.mvcpAnchorLock=void 0)}}if(t&&i&&v===void 0&&(()=>{if(h===void 0||T)return!0;let R=w.get(h);return R===void 0||r[R]===void 0})())for(let R=0;R<g.length;R++){let{id:$,position:H}=g[R],K=w.get($);if(K!==void 0&&l){let oe=E[K];if(oe===void 0||!l(oe,K,E))continue}let O=K!==void 0?r[K]:void 0;if(O!==void 0){S=O-H,L=$,I=O;break}}if(!T&&h!==void 0&&m!==void 0){let R=w.get(h),$=R!==void 0?r[R]:void 0;if($!==void 0){let H=po(e),K=$-m;if(K!==0&&y&&n.scroll+n.scrollLength>H)if(K>0)K=Math.max(0,H-n.scroll-n.scrollLength);else{let O=Math.max(0,H-n.scrollLength);n.scroll=O,n.scrollPending=O,K=0}S=K,L=h,I=$}}if(x&&x>0){let R=mo(e,h,v,n.props.data[v]),$=f?.itemSize;if(R!==void 0&&$!==void 0&&R!==$){let H=R-$;H!==0&&(S+=H*x,f.itemSize=R)}}if(Mq(n,{anchorId:L,anchorPosition:I,dataChanged:t,now:d,positionDiff:S}),Rq()){n.pendingNativeMVCPAdjust={amount:S,furthestProgressTowardAmount:0,manualApplied:0,startScroll:k},Dq(e);return}Math.abs(S)>Ao&&((n.maintainingScrollAtEnd==="pending-animated"||n.maintainingScrollAtEnd==="animated")&&de(e,"isWithinMaintainScrollAtEndThreshold")||js(e,S))}}}var QM=1e3,Bq=200,xg=e=>{let{scrollHistory:t}=e,n=t.length-1;if(n<1)return 0;let o=t[n];if(Date.now()-o.time>QM)return 0;let r=0,a=0,i=0;for(let s=n;s>0;s--){let l=t[s],d=t[s-1],c=l.scroll-d.scroll,f=l.time-d.time,p=Math.sign(c);if(p!==0){if(r===0)r=p;else if(p!==r)break}if(o.time-d.time>QM)break;if(c===0||f<=0)continue;let m=o.time-l.time,h=Math.exp(-m/Bq);a+=c/f*h,i+=h}return i>0?a/i:0};function zq(e){let t=e.mvcpAnchorLock;return t?Date.now()>t.expiresAt?(e.mvcpAnchorLock=void 0,!1):!0:!1}function Ru(e){return e.dataChangeNeedsScrollUpdate||zq(e)}function qs(e,t,n,o){var r;let a=e.state,{ignoreScrollFromMVCP:i,lastScrollAdjustForHistory:s,scrollAdjustHandler:l,scrollHistory:d,scrollingTo:c}=a,f=a.scroll;o?.markHasScrolled!==!1&&(a.hasScrolled=!0);let p=Date.now();a.lastBatchingAction=p;let m=l.getAdjust(),h=s!==void 0&&Math.abs(m-s)>.1;if(h&&(d.length=0),a.lastScrollAdjustForHistory=m,c===void 0&&!(d.length===0&&t===a.scroll)&&(h||d.push({scroll:t,time:p})),d.length>5&&d.shift(),i&&!c){let{lt:T,gt:E}=i;if(T&&t<T||E&&t>E){a.ignoreScrollFromMVCPIgnored=!0;return}}a.scrollPrev=f,a.scrollPrevTime=a.scrollTime,a.scroll=t,a.scrollTime=p;let g=Math.abs(t-f),x=!!o?.fromNativeScrollEvent&&g>.1&&!h&&c===void 0&&!a.pendingNativeMVCPAdjust?cq(e,t-f):void 0,y=Oq(e,t),C=a.scrollLength,w=C>0&&c===void 0&&g>C&&!a.pendingNativeMVCPAdjust,k=xg(a);gq(e,k,{forceLight:w});let S=a.scrollLastCalculate;if(Ru(a)||y||x!==void 0||n||S===void 0||Math.abs(a.scroll-S)>2){a.scrollLastCalculate=a.scroll,a.ignoreScrollFromMVCPIgnored=!1,a.lastScrollDelta=g;let T=()=>{var A;let N={doMVCP:c!==void 0,scrollVelocity:k};w&&(N.drawDistanceMode="visible-first"),(A=a.triggerCalculateItemsInView)==null||A.call(a,N),mg(e,x)};w?(a.mvcpAnchorLock=void 0,a.pendingNativeMVCPAdjust=void 0,a.userScrollAnchorReset={keys:new Set},a.scheduledWork.cancel("mvcpRecalculate"),(0,yR.flushSync)(T),_R(e)):T();let E=!!a.pendingMaintainScrollAtEnd||!!((r=a.props.maintainScrollAtEnd)!=null&&r.onDataChange);y&&E&&(a.pendingMaintainScrollAtEnd=!1,cd(e)),a.dataChangeNeedsScrollUpdate=!1,a.lastScrollDelta=0}}function $q(e){if(Object.keys(e.averageSizes).length===0)return;let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];t[n]=o.avg}return t}function Hq(e,t){var n;let{isInitialScroll:o,requestedOffset:r,targetOffset:a}=t,i=oo.get(e),s=!e.didFinishInitialScroll&&(o||!!i)&&oo.hasNonZeroTargetOffset(a),l=!e.didFinishInitialScroll&&!!i&&oo.isAtZeroTargetOffset(r);if(s){e.hasScrolled=!1,oo.set(e,{startScroll:(n=i?.startScroll)!=null?n:e.scroll,targetOffset:a});return}l&&oo.clear(e)}function Uq(e,t){let n=e.state,o=n.props.data.length,r=0,a=o-1,i;for(;r<=a;){let s=Math.floor((r+a)/2),l=n.positions[s];l===void 0?a=s-1:l<=t?(i=s,r=s+1):a=s-1}return i}function XM(e,t){var n;let o=e.state.positions[t];if(o===void 0)return;let r=(n=PC(e,t))!=null?n:0;return o+(Number.isFinite(r)?r:0)}function Kq(e,t,n){let o=e.state,r=o.props.data.length;if(r===0)return;let a=Math.max(0,t),i=Math.max(a,t+o.scrollLength),s=n!==void 0?Math.max(0,Math.min(r-1,n)):Uq(e,a);if(s===void 0)return;if(n!==void 0&&o.positions[s]===void 0)return{end:s,start:s};if(n===void 0){let d=XM(e,s);if(d===void 0||d<=a)return}for(;s>0;){let d=o.positions[s];if(d===void 0||d<=a||o.positions[s-1]===void 0)break;s--}for(;s>0;){let d=XM(e,s-1);if(d===void 0||d<=a)break;s--}let l=s;for(;l+1<r;){let d=o.positions[l+1];if(d===void 0||d>i)break;l++}return{end:l,start:s}}function qq(e,t,n){let o=Kq(e,t,n);o?(e.state.scrollTargetPinnedRange=o,e.state.scrollForNextCalculateItemsInView=void 0):e.state.scrollTargetPinnedRange=void 0}function yg(e,t){var n,o;let r=e.state,{noScrollingTo:a,forceScroll:i,...s}=t,{animated:l,isInitialScroll:d,offset:c,precomputedWithViewOffset:f,waitForInitialScrollCompletionFrame:p}=s,{props:{horizontal:m}}=r;fg(r);let h=f?c:vg(e,c,s),g=!!d&&((n=r.initialScrollSession)==null?void 0:n.kind)==="offset",v=Mi(e,h,s),x=g?h:v;if(r.scrollHistory.length=0,!a){d&&pg.resetFlags(r);let y=$q(r);r.scrollingTo={...s,...y?{averageSizeSnapshot:y}:{},targetOffset:v,waitForInitialScrollCompletionFrame:p},d||qq(e,v,s.index)}r.scrollPending=v,Hq(r,{isInitialScroll:d,requestedOffset:x,targetOffset:v}),!d&&!a&&Math.abs(r.scroll-v)>1&&(l?r.scrollTargetPinnedRange&&((o=r.triggerCalculateItemsInView)==null||o.call(r)):qs(e,v,!0,{markHasScrolled:!1})),i||!d||Ua.OS==="android"?Tq(e,{animated:l,horizontal:m,offset:x}):r.scroll=x}function zR(e,t){return t<=0?-1:e>=t?t-1:e<0?0:e}function ng(e,{index:t,viewOffset:n=0,animated:o=!0,forceScroll:r,isInitialScroll:a,viewPosition:i}){let s=e.state,{data:l}=s.props;t=zR(t,l.length);let d=PC(e,t),c=gg(e,t);t===l.length-1&&i===void 0&&(i=1),s.scrollForNextCalculateItemsInView=void 0,yg(e,{animated:o,forceScroll:r,index:t,isInitialScroll:a,itemSize:d,offset:c,viewOffset:n,viewPosition:i??0})}function Cg(e,t){let{forceScroll:n,resolvedOffset:o,target:r,waitForCompletionFrame:a}=t,i=r.index,s=i!==void 0?zR(i,e.state.props.data.length):void 0,l=PC(e,s);yg(e,{animated:!1,forceScroll:n,index:s!==void 0&&s>=0?s:void 0,isInitialScroll:!0,itemSize:l,offset:o,precomputedWithViewOffset:!0,viewOffset:r.viewOffset,viewPosition:r.viewPosition,waitForInitialScrollCompletionFrame:a})}function Vs(e,t,n){var o;let{state:r}=e;r.clearPreservedInitialScrollOnNextFinish=void 0,r.scheduledWork.cancel("preservedInitialScroll"),r.initialScroll=t,n?.resetDidFinish&&LC(e,{resetInitialScroll:!0}),Ka(r,{kind:((o=r.initialScrollSession)==null?void 0:o.kind)==="offset"?"offset":"bootstrap"})}function Fr(e,t){var n,o;if(((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset")return(o=t.contentOffset)!=null?o:0;let a=t.index!==void 0?gg(e,t.index):0,i=vg(e,a,t);return Mi(e,i,t)}function $R(e,t){let{didFinishInitialScroll:n,queuedInitialLayout:o,scrollingTo:r}=e,a=e.initialScroll,i=!!r?.isInitialScroll,s=!!t?.requiresMeasuredLayout&&!o&&!i;if(!(!a||s||n||r&&!i))return{initialScroll:a,isInitialScrollInProgress:i,queuedInitialLayout:o,scrollingTo:r}}function Vq(e,t){var n,o,r;let a=e.state,i=$R(a,{requiresMeasuredLayout:!0});if(!i)return!1;let{initialScroll:s,isInitialScrollInProgress:l,queuedInitialLayout:d}=i,c=l?i.scrollingTo:void 0,f=Fr(e,s),p=c?(n=c.targetOffset)!=null?n:c.offset:void 0,m=s.contentOffset===void 0||Math.abs(s.contentOffset-f)>1,h=p!==void 0&&Math.abs(p-f)>1,g=p!==void 0&&Math.abs(a.scroll-f)<=1&&Math.abs(a.scrollPending-f)<=1;if(!t?.forceScroll&&!m&&l&&!h||t?.forceScroll&&g)return!1;m&&((o=a.initialScrollSession)==null?void 0:o.kind)!=="offset"&&Vs(e,{...s,contentOffset:f});let v=(r=t?.forceScroll)!=null?r:!!d||l&&m;return Cg(e,{forceScroll:v,resolvedOffset:f,target:s}),!0}function Wq(e,t){var n,o;let r=e.state,a=$R(r);if(!a)return!1;let{initialScroll:i,queuedInitialLayout:s}=a,l=(n=i.contentOffset)!=null?n:0,d=Math.abs(r.scroll-l)<=1&&Math.abs(r.scrollPending-l)<=1;if(t?.forceScroll&&d)return!1;let c=!!r.lastLayout&&r.scrollLength>0,f=(o=t?.forceScroll)!=null?o:c||!!s;return Cg(e,{forceScroll:f,resolvedOffset:l,target:i}),!0}function Pu(e,t){var n;return((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset"?Wq(e,{forceScroll:t?.forceScroll}):Vq(e,{forceScroll:t?.forceScroll})}function wu(e,t,n){if(t==null||n==null||t<0||n<t)return!1;let o=!1;for(let r of e.containerItemKeys.keys()){let a=e.indexByKey.get(r);if(a!==void 0&&a>=t&&a<=n){o=!0;let i=Bt(e,a);if(i===void 0||!e.sizesKnown.has(i))return!1}}return o}var bg=1,Gq=8,jq=24,Qq="LegendList bootstrap initial scroll aborted after exceeding convergence bounds.";function pr(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?e.initialScrollSession.bootstrap:void 0}function Qs(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="offset"}function Xq(e,t){if(!e||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Yq(e){let{dataLength:t,getSize:n,offset:o,positions:r,scrollLength:a,startIndex:i}=e,s=o+a,l=[],d=i!==void 0?Math.max(0,Math.min(t-1,i)):0;for(;d>0;){let c=d-1,f=r[c];if(f===void 0){d=c;continue}let p=n(c);if(p===void 0){d=c;continue}if(f+p<=o)break;d=c}for(;d<t;d++){let c=r[d];if(c===void 0)continue;let f=n(d);if(f!==void 0){if(c<s&&c+f>o)l.push(d);else if(l.length>0&&c>=s)break}}return l}function Jq(e){let{mountFrameCount:t,maxFrames:n=Gq,maxPasses:o=jq,passCount:r}=e;return t>=n||r>=o}function HR(e,t){return Jq(t)?(Vo&&console.warn(Qq),uV(e),!0):!1}function Au(e){var t;let n=pr(e),o=n?.frameHandle;o!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o),n&&(n.frameHandle=void 0),Ka(e,{bootstrap:null,kind:(t=e.initialScrollSession)==null?void 0:t.kind})}function UR(e,t){var n,o,r;let a=pr(e);Ka(e,{bootstrap:{frameHandle:a?.frameHandle,mountFrameCount:(n=a?.mountFrameCount)!=null?n:0,passCount:0,previousResolvedOffset:void 0,scroll:t.scroll,seedContentOffset:(r=(o=t.seedContentOffset)!=null?o:a?.seedContentOffset)!=null?r:t.scroll,targetIndexSeed:t.targetIndexSeed,visibleIndices:void 0},kind:"bootstrap"})}function Zq(e,t){var n,o,r;let a=pr(e);a?(a.passCount=0,a.previousResolvedOffset=void 0,a.scroll=(n=t?.scroll)!=null?n:a.scroll,a.seedContentOffset=(o=t?.seedContentOffset)!=null?o:a.seedContentOffset,a.targetIndexSeed=(r=t?.targetIndexSeed)!=null?r:a.targetIndexSeed,a.visibleIndices=void 0,Ka(e,{bootstrap:a,kind:"bootstrap"})):t?.scroll!==void 0&&UR(e,{scroll:t.scroll,seedContentOffset:t.seedContentOffset,targetIndexSeed:t.targetIndexSeed})}function uC(e){requestAnimationFrame(()=>{var t;pr(e)&&((t=e.triggerCalculateItemsInView)==null||t.call(e,{forceFullItemPositions:!0}))})}function AC(e){let t=e.state,n=pr(t);if(!n||n.frameHandle!==void 0)return;let o=()=>{let r=pr(t);r&&(r.frameHandle=void 0,r.mountFrameCount+=1,!HR(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})&&AC(e))};n.frameHandle=requestAnimationFrame(o)}function ig(e,t){Zq(e.state,t),AC(e),uC(e.state)}function EC(e){let{dataLength:t,footerSize:n,preserveForFooterLayout:o,stylePaddingEnd:r}=e;return{contentOffset:void 0,index:Math.max(0,t-1),preserveForBottomPadding:!0,preserveForFooterLayout:o,viewOffset:-r-n,viewPosition:1}}function eV(e){return!!e?.preserveForBottomPadding}function Ws(e){return!!e?.preserveForFooterLayout}function KR(e){return!!(e&&e.viewPosition===1&&(eV(e)||Ws(e)))}function tV(e){let{dataLength:t,footerSize:n,initialScrollAtEnd:o,stylePaddingEnd:r,target:a}=e,i=Ws(a);return{...a,contentOffset:void 0,index:o?Math.max(0,t-1):a.index,preserveForBottomPadding:!0,preserveForFooterLayout:i,viewOffset:-r-(i?n:0),viewPosition:1}}function nV(e,t){return e.index===t.index&&e.preserveForBottomPadding===t.preserveForBottomPadding&&e.preserveForFooterLayout===t.preserveForFooterLayout&&e.viewOffset===t.viewOffset&&e.viewPosition===t.viewPosition}function sg(e,t){let{dataLength:n,stylePaddingEnd:o,target:r}=t;if(!Ws(r))return;let a=EC({dataLength:n,footerSize:0,preserveForFooterLayout:void 0,stylePaddingEnd:o});Vs(e,a)}function oV(e){ld(e)}function MC(e,t,n=bg){let o=e.state;if(!o.didFinishInitialScroll)return!1;let r=Eu(o);return Math.abs(r-Fr(e,t))>n}function Eu(e){var t,n,o,r;let a=(n=(t=e.refScroller.current)==null?void 0:t.getCurrentScrollOffset)==null?void 0:n.call(t);return typeof a=="number"&&Number.isFinite(a)?a:(r=(o=e.scrollPending)!=null?o:e.scroll)!=null?r:0}function qR(e){var t;let n=e.state,o=n.initialScroll;if(!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||!o||o.viewPosition!==1||n.props.data.length===0||Qs(n))return;let r=typeof n.lastNativeScroll=="number"&&Number.isFinite(n.lastNativeScroll)?n.lastNativeScroll:Eu(n);return Fr(e,o)-r}function VR(e){return qR(e)===void 0?!1:(WR(e,{}),!0)}function WR(e,t){let n=e.state;n.preservedEndAnchorCorrection=t,requestAnimationFrame(()=>{var o;let r=n.preservedEndAnchorCorrection;if(r!==t)return;let a=qR(e);if(a===void 0||Math.abs(a)<=bg){n.preservedEndAnchorCorrection=void 0;return}(!r.lastRequestTime||((o=n.lastNativeScrollTime)!=null?o:0)>r.lastRequestTime)&&(r.lastRequestTime=Date.now(),js(e,a)),WR(e,t)})}function rV(e){var t;let n=e.state,o=n.initialScroll;!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||o?.viewPosition!==1||n.preservedEndAnchorCorrection||MC(e,o)&&(KR(o)&&de(e,"isAtEnd")||(Ws(o)?sg(e,{dataLength:n.props.data.length,stylePaddingEnd:bC(n.props),target:o}):oV(n)))}function aV(e,t){var n,o,r;let{initialScrollAtEnd:a,target:i}=t,s=e.state,l=Fr(e,i),d=l===0&&!a&&(Qs(s)?Math.abs((n=i.contentOffset)!=null?n:0)<=1:i.index===0&&((o=i.viewPosition)!=null?o:0)===0&&Math.abs((r=i.viewOffset)!=null?r:0)<=1),c=s.props.data.length===0&&i.index!==void 0;d?(Au(s),dd(e,{resolvedOffset:l})):c?(Au(s),dd(e,{preserveTarget:!0,resolvedOffset:l})):(UR(s,{scroll:l,seedContentOffset:0,targetIndexSeed:i.index}),AC(e))}function iV(e,t){let{dataLength:n,didDataChange:o,initialScrollAtEnd:r,previousDataLength:a,stylePaddingEnd:i}=t,s=e.state,l=s.initialScroll;if(Qs(s)||!l)return;let d=!!(s.didFinishInitialScroll&&a===0&&n>0&&l.index!==void 0),c=pr(s);if(!r&&o&&n>0&&s.didFinishInitialScroll&&!c&&!d){ld(s);return}let p=n>0&&(r||KR(l));if(!(!o&&!d&&!p)){if(p){let m=r?EC({dataLength:n,footerSize:de(e,"footerSize")||0,preserveForFooterLayout:Ws(l),stylePaddingEnd:i}):tV({dataLength:n,footerSize:de(e,"footerSize")||0,initialScrollAtEnd:r,stylePaddingEnd:i,target:l});if(!d&&MC(e,l)){sg(e,{dataLength:n,stylePaddingEnd:i,target:l});return}if(!nV(l,m)||c||d||o){Vs(e,m,{resetDidFinish:d}),ig(e,{scroll:Fr(e,m),seedContentOffset:d&&!c?Eu(s):void 0,targetIndexSeed:m.index});return}}o&&(c||d)&&(Vs(e,l,{resetDidFinish:d}),ig(e,{scroll:Fr(e,l),seedContentOffset:d&&!c?Eu(s):void 0,targetIndexSeed:l.index}))}}function sV(e,t){let{dataLength:n,footerSize:o,initialScrollAtEnd:r,stylePaddingEnd:a}=t,i=e.state;if(!r)return;let s=i.initialScroll;if(!(Qs(i)||n===0||!s||!(pr(i)||Ws(s))))if(MC(e,s))sg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let d=EC({dataLength:n,footerSize:o,preserveForFooterLayout:Ws(s),stylePaddingEnd:a});if(!(s.index!==d.index||s.viewPosition!==d.viewPosition||s.viewOffset!==d.viewOffset))sg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let f=!!i.didFinishInitialScroll;Vs(e,d,{resetDidFinish:f}),ig(e,{scroll:Fr(e,d),targetIndexSeed:d.index})}}}function lV(e){var t,n,o;let r=e.state,a=r.initialScroll,i=pr(r);if(a&&r.props.data.length>0&&!Qs(r)&&(i||a.viewPosition===1)){let s=Fr(e,a),l=(t=r.scrollingTo)!=null&&t.isInitialScroll?r.scrollingTo:void 0;if(!i&&(l||r.didFinishInitialScroll)){let d=l?(n=l.targetOffset)!=null?n:l.offset:Eu(r),c=s-d;if(Math.abs(c)>bg){if(r.didFinishInitialScroll)VR(e);else if(l){let f=oo.get(r);l.offset=s,l.targetOffset=s,r.initialScroll={...a,contentOffset:s},r.hasScrolled=!1,oo.set(r,{startScroll:(o=f?.startScroll)!=null?o:r.scroll,targetOffset:s}),js(e,c)}}}else ig(e,{scroll:s,targetIndexSeed:a.index})}}function dV(e){var t,n;let o=e.state,r=pr(o),a=o.initialScroll;if(!r||!a||Qs(o)||(t=o.scrollingTo)!=null&&t.isInitialScroll||(r.passCount+=1,HR(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})))return;a.index!==void 0&&o.startBuffered>=0&&o.endBuffered>=0&&a.index>=o.startBuffered&&a.index<=o.endBuffered&&(r.targetIndexSeed=void 0);let i=Fr(e,a),s=wu(o,o.startBuffered,o.endBuffered),l=Math.abs(r.scroll-i)>1,{data:d}=o.props,c=Yq({dataLength:d.length,getSize:g=>{var v,x;let y=(v=o.idCache[g])!=null?v:Bt(o,g);return(x=o.sizes.get(y))!=null?x:mo(e,y,g,d[g])},offset:i,positions:o.positions,scrollLength:o.scrollLength,startIndex:(n=r.targetIndexSeed)!=null?n:o.startBuffered>=0?o.startBuffered:void 0}),f=c.length>0&&c.every(g=>{var v;let x=(v=o.idCache[g])!=null?v:Bt(o,g);return o.sizesKnown.has(x)}),p=r.previousResolvedOffset,m=r.visibleIndices;if(r.previousResolvedOffset=i,r.visibleIndices=c,l){r.scroll=i,uC(o);return}if(!s||!f)return;if(!(p!==void 0&&Math.abs(p-i)<=bg&&Xq(m,c))){uC(o);return}Au(o),Cg(e,{forceScroll:!0,resolvedOffset:i,target:a,waitForCompletionFrame:Ua.OS==="web"})}function cV(e,t){var n;let o=e.state;Au(o);let r=!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;dd(e,{preserveTarget:r,recalculateItems:!0,resolvedOffset:t,schedulePreservedTargetClear:r})}function uV(e){var t,n,o,r;let a=e.state,i=pr(a),s=a.initialScroll;i&&s&&!Qs(a)&&a.refScroller.current?(Au(a),Cg(e,{forceScroll:!0,resolvedOffset:i.scroll,target:s,waitForCompletionFrame:Ua.OS==="web"})):cV(e,(r=(o=(n=(t=pr(a))==null?void 0:t.scroll)!=null?n:a.scrollPending)!=null?o:a.scroll)!=null?r:0)}function GR(e,t,n,o){return{dataChangeEpoch:e.dataChangeEpoch,getFixedItemSize:e.props.getFixedItemSize,getItemType:e.props.getItemType,itemData:n,itemIndex:t,itemType:o}}function fV(e,t,n,o){var r,a;let{getFixedItemSize:i,getItemType:s}=e.props,l=e.containerItemMetadata.get(t),d;if(l?.dataChangeEpoch===e.dataChangeEpoch&&l.getItemType===s&&l.itemData===o&&l.itemIndex===n)d=l;else{let c=s?(r=s(o,n))!=null?r:"":void 0;d=GR(e,n,o,c),e.containerItemMetadata.set(t,d)}return d.getFixedItemSize!==i&&(d.didResolveFixedItemSize=!1,d.fixedItemSize=void 0,d.getFixedItemSize=i),i&&!d.didResolveFixedItemSize&&(d.fixedItemSize=i(o,n,(a=d.itemType)!=null?a:""),d.didResolveFixedItemSize=!0),d}function jR(e){for(let t of e.containerItemMetadata.values())t.didResolveFixedItemSize=!1,t.fixedItemSize=void 0}var pV=20,mV=1,gV=1,oC=16;function RC(e,t){let n=e.state.scrollingTo;t?.onlyIfAligned&&(!n?.isInitialScroll||n.animated||!NC(e,n).isAtResolvedTarget)||e.state.scheduledWork.frame(()=>CV(e),"checkFinishedScrollFrame")}function hV(e,t){let{clampedTargetOffset:n,scrollingTo:o}=t;return!o.isInitialScroll||e.hasScrolled||n<=mV}function vV(e,t){return!!t?.isInitialScroll&&pg.didDispatchNativeScroll(e)&&!e.hasScrolled}function QR(e){var t;return(t=oo.get(e))==null?void 0:t.targetOffset}function XR(e){let t=QR(e);return!e.didFinishInitialScroll&&oo.hasNonZeroTargetOffset(t)}function YM(e,t){var n,o;if(!t.isInitialScroll||t.animated||!e.didContainersLayout||((n=e.initialScrollSession)==null?void 0:n.kind)==="bootstrap")return!1;let r=(o=t.targetOffset)!=null?o:t.offset;return oo.hasNonZeroTargetOffset(r)&&pg.didDispatchNativeScroll(e)&&!e.hasScrolled||oo.isAtZeroTargetOffset(r)||Math.abs(e.scroll-r)>1||Math.abs(e.scrollPending-r)>1?!1:!!t.waitForInitialScrollCompletionFrame||XR(e)}function JM(e){var t;let{state:n}=e;return!!((t=n.scrollingTo)!=null&&t.isInitialScroll)&&n.props.data.length>0&&po(e)<=n.scrollLength&&n.scrollPending<=gV}function xV(e,t){return t.index===e.state.props.data.length-1&&t.viewPosition===1}function yV(e,t){var n;let o=t.index,a=xV(e,t)&&o!==void 0?vg(e,gg(e,o),t):(n=t.targetOffset)!=null?n:Mi(e,t.offset-(t.viewOffset||0),t);return Mi(e,a,t)}function NC(e,t){let{state:n}=e,o=n.scrollPending,r=n.scrollAdjustHandler.getAdjust(),a=yV(e,t),i=Mi(e,o,t),s=Math.abs(o-a),l=a+r,d=Math.abs(o-l),c=!t.animated||Ua.OS==="ios";return{clampedTargetOffset:a,isAtResolvedTarget:Math.abs(o-i)<1&&(s<1||c&&d<1)}}function CV(e){let t=e.state.scrollingTo;if(!t)return;let{state:n}=e,o=NC(e,t);o.isAtResolvedTarget&&hV(n,{clampedTargetOffset:o.clampedTargetOffset,scrollingTo:t})&&ku(e)}function bV(e,t){var n;(n=e.state.refScroller.current)==null||n.scrollTo({animated:!1,x:e.state.props.horizontal?t:0,y:e.state.props.horizontal?0:t})}function IV(e){let t=e.state;if(t.scheduledWork.has("checkFinishedScrollFallback"))return;let n=t.scrollingTo,o=JM(e),r=vV(t,n),a=n!==void 0?YM(t,n):!1,i=n?.isInitialScroll&&!o&&!a||!t.didContainersLayout,s=o||a?0:r?oC:i?500:100,l=0,d=f=>{t.scheduledWork.timeout(c,f,"checkFinishedScrollFallback")},c=()=>{var f,p;let m=t.scrollingTo;if(m){l++;let h=XR(t)&&!t.hasScrolled,g=r?5:h?pV:5,v=JM(e),x=YM(t,m),y=NC(e,m),C=Ua.OS==="android",w=t.hasScrolled&&(!m.isInitialScroll||y.isAtResolvedTarget),k=m.isInitialScroll&&!y.isAtResolvedTarget&&l<=g;if(v||w||x||C||l>g)ku(e);else if((h||k)&&l<=g){let S=(p=(f=QR(t))!=null?f:m.targetOffset)!=null?p:t.scrollPending;bV(e,S),d(r?oC:100)}else d(r?oC:100)}};d(s)}function YR(e){var t;let n=e.state,o=n.initialScroll;return n.didFinishInitialScroll?VR(e):!o||((t=n.initialScrollSession)==null?void 0:t.kind)==="offset"||o.viewPosition!==1||n.props.data.length===0?!1:Pu(e,{forceScroll:!0})}function SV(e){var t;if(!e.state.initialScroll)return;let n=()=>Pu(e,{forceScroll:!0});n(),((t=e.state.initialScrollSession)==null?void 0:t.kind)!=="offset"&&requestAnimationFrame(n),RC(e,{onlyIfAligned:!0})}function wV(e,t){var n,o;let{alwaysDispatchInitialScroll:r,dataLength:a,hasFooterComponent:i,initialContentOffset:s,initialScrollAtEnd:l,useBootstrapInitialScroll:d}=t,c=e.state,f=c.initialScroll,p=s??0,m=d&&l&&i;if(f&&(f.contentOffset===void 0||!!f.preserveForFooterLayout!==m&&((n=c.initialScrollSession)==null?void 0:n.kind)!=="offset")&&Vs(e,{...f,contentOffset:p,preserveForFooterLayout:m}),d&&f&&((o=c.initialScrollSession)==null?void 0:o.kind)!=="offset"){aV(e,{initialScrollAtEnd:l,target:c.initialScroll});return}!r&&!p&&!(f&&a===0&&!(p===0&&!l))&&(f&&!l?dd(e,{resolvedOffset:p}):kC(e,{didInitialScroll:!0}))}function TV(e,t){var n,o,r;let{dataLength:a,didDataChange:i,didStartFreshData:s,initialScrollAtEnd:l,latestInitialScroll:d,latestInitialScrollSessionKind:c,stylePaddingEnd:f,useBootstrapInitialScroll:p}=t,m=e.state,h=(o=(n=m.initialScrollSession)==null?void 0:n.previousDataLength)!=null?o:0,g=a>0&&(!m.hasHadNonEmptyData||s);if(a>0&&(m.hasHadNonEmptyData=!0),g&&(d?(Vs(e,d),Ka(m,{kind:c,previousDataLength:h})):ld(m)),m.initialScrollSession&&(m.initialScrollSession.previousDataLength=a),Ka(m),p){iV(e,{dataLength:a,didDataChange:i,initialScrollAtEnd:l,previousDataLength:h,stylePaddingEnd:f});return}let v=h===0&&a>0&&!!m.initialScroll&&((r=e.state.initialScrollSession)==null?void 0:r.kind)==="offset"&&!!m.didFinishInitialScroll;h!==0||a===0||!m.initialScroll||!m.queuedInitialLayout||m.didFinishInitialScroll&&!v||(v&&LC(e,{resetInitialScroll:!0}),Pu(e))}function JR(e){e.indexByKey.clear(),e.idCache.length=0,e.positions.length=0,e.columns.length=0,e.columnSpans.length=0}function LV(e){var t;let n=e.pendingContainerIds;if(e.pendingContainerIds=void 0,n===void 0)return;let o=e.state,r=n;if(r&&((t=o.userScrollAnchorReset)!=null&&t.keys.size)){r=new Set(r);for(let a of o.userScrollAnchorReset.keys){let i=o.containerItemKeys.get(a);i!==void 0&&r.add(i)}}return r}function lg(e,t){var n;let o=e.pendingContainerIds!==void 0,r=e.pendingContainerIds;if(t===void 0)e.pendingContainerIds=null;else if(r!==null){let a=r;if(!a)a=typeof t=="number"?new Set([t]):new Set(t);else if(typeof t=="number")a.add(t);else for(let i of t)a.add(i);e.pendingContainerIds=a}if(!o){let a=((n=de(e,"containerLayoutEpoch"))!=null?n:0)+1;Pe(e,"containerLayoutEpoch",a)}}function kV(e,t,n,o){var r,a,i,s,l,d,c,f,p;let m=e.state,{columns:h,columnSpans:g,positions:v,props:{data:x,itemsAreEqual:y,keyExtractor:C}}=m,w=x[n];if(w===void 0)return{didChangePosition:!1,didRefreshData:!1};let k=(r=m.idCache[n])!=null?r:Bt(m,n),S=(a=o?.updateLayout)!=null?a:!0,L=!1,I=!1;if(S){let N=v[n];if(N===void 0)return Pe(e,`containerPosition${t}`,sd),{didChangePosition:!1,didRefreshData:!1};let R=(N||0)-((i=o?.scrollAdjustPending)!=null?i:0),$=(s=m.sizes.get(k))!=null?s:mo(e,k,n,w),H=HK(m,R,$,de(e,"totalSize")),K=h[n]||1,O=g[n]||1,oe=de(e,`containerPosition${t}`),ee=de(e,`containerColumn${t}`),W=de(e,`containerSpan${t}`);H>sd&&H!==oe&&(Pe(e,`containerPosition${t}`,H),L=!0),K>=0&&K!==ee&&Pe(e,`containerColumn${t}`,K),O!==W&&Pe(e,`containerSpan${t}`,O)}de(e,`containerItemIndex${t}`)!==n&&Pe(e,`containerItemIndex${t}`,n);let E=de(e,`containerItemData${t}`),A=()=>{Pe(e,`containerItemData${t}`,w),I=!0};if(E!==w){let N=((l=m.pendingDataComparison)==null?void 0:l.previousData)===m.previousData&&((d=m.pendingDataComparison)==null?void 0:d.nextData)===x?m.pendingDataComparison:void 0,R=(c=N?.byIndex[n])!=null?c:0;if(R===2)A();else if(R!==1){let $=(f=de(e,`containerItemKey${t}`))!=null?f:k,H=C?.(E,n);if(E===void 0||!C||H!==$)A();else if(!y)A();else{let K=y(E,w,n,x);(!m.pendingDataComparison||m.pendingDataComparison.previousData!==m.previousData||m.pendingDataComparison.nextData!==x)&&m.previousData&&(m.pendingDataComparison={byIndex:[],nextData:x,previousData:m.previousData}),(p=m.pendingDataComparison)!=null&&p.byIndex&&(m.pendingDataComparison.byIndex[n]=K?1:2),K||A()}}}return{didChangePosition:L,didRefreshData:I}}function PV(e,t,n){var o;let r=e.state,a=de(e,"numColumns"),i=t;r.columns[t]!==1&&(i=ZM(r,a,t));let l=0,d=r.columns[i];if(i>0){let c=i-1,f=(o=r.positions[c])!=null?o:0,p=ZM(r,a,c),m=AV(e,p,c,n);l=f+m}return{column:d,currentRowTop:l,startIndex:i}}function ZM(e,t,n){if(t<=1)return Math.max(0,n);let o=Math.max(0,n);for(;o>0&&e.columns[o]!==1;)o--;return o}function AV(e,t,n,o){let r=e.state;if(n<t)return 0;let{data:a}=r.props;if(!a)return 0;let i=0;for(let s=t;s<=n;s++){if(s<0||s>=a.length)continue;let l=r.idCache[s],d=mo(e,l,s,a[s],o);d>i&&(i=d)}return i}function EV(e){var t,n;let o=e.state,{positions:r,props:{data:a}}=o,i=(t=de(e,"numColumns"))!=null?t:1;if(a.length===0)Iu(e,null,0);else{let s=a.length-1,l=Bt(o,s),d=r[s];if(l!==void 0&&d!==void 0)if(i>1){let c=s;for(;c>0;){let p=o.columns[c];if(p===1||p===void 0)break;c-=1}let f=0;for(let p=c;p<=s;p++){let m=(n=o.idCache[p])!=null?n:Bt(o,p),h=mo(e,m,p,a[p]);h>f&&(f=h)}Iu(e,null,d+f)}else{let c=mo(e,l,s,a[s]);if(c!==void 0){let f=d+c;Iu(e,null,f)}}}}function ZR(e){let t=e.state,{props:{snapToIndices:n}}=t,o=t.props.horizontal?po(e):void 0,r=Array(n.length);for(let a=0;a<n.length;a++){let i=n[a];Bt(t,i);let s=t.positions[i];r[a]=IC(t,s,o)}Pe(e,"snapToOffsets",r)}function eN(e,t,{doMVCP:n,forceFullUpdate:o=!1,optimizeForVisibleWindow:r=!1,scrollBottomBuffered:a,scrollVelocity:i,startIndex:s}={doMVCP:!1,forceFullUpdate:!1,optimizeForVisibleWindow:!1,scrollBottomBuffered:-1,startIndex:0}){var l,d,c,f,p;let m=e.state,h=e.positionListeners.size>0,{columns:g,columnSpans:v,indexByKey:x,positions:y,idCache:C,sizesKnown:w,props:{data:k,overrideItemLayout:S,snapToIndices:L},scrollingTo:I}=m,T=k.length,E=(l=de(e,"numColumns"))!=null?l:1,A=E>1,N=Vo?new Map:void 0,R=de(e,"extraData"),$=S?{span:1}:void 0,H=m.lastScrollDelta,K=i??xg(m),O=!o&&!t&&(r||Math.abs(K)>0||m.scrollLength>0&&H>m.scrollLength),oe=a+1e3,ee=!0,W=!n||t||m.scrollAdjustHandler.getAdjust()!==0||((d=de(e,"scrollAdjustPending"))!=null?d:0)!==0,qe=!1,ve=0,fe=1,Ne=0;if(t&&(v.length=0),A||(g.length&&(g.length=0),v.length&&(v.length=0)),s>0){if(A){let{startIndex:re,currentRowTop:Ie}=PV(e,s,ee);s=re,ve=Ie}else if(s<T){let re=s-1,Ie=Bt(m,re),st=(c=y[re])!=null?c:0,dt=(f=w.get(Ie))!=null?f:mo(e,Ie,re,k[re],ee,W,qe);ve=st+dt}}let Ae=t||x.size===0,ae=A&&!!S&&!!$,Ee=!1,xe;for(let re=s;re<T;re++){if(O&&xe!==void 0&&re>xe){Ee=!0;break}O&&xe===void 0&&!I&&!t&&ve>oe&&(xe=re+(A?E:1)+10);let Ie=(p=C[re])!=null?p:Bt(m,re),st=1;if(ae){$.span=1,S($,k[re],re,E,R);let ct=$.span;ct!==void 0&&Number.isFinite(ct)&&(st=Math.max(1,Math.min(E,Math.round(ct))))}A&&fe+st-1>E&&(ve+=Ne,fe=1,Ne=0);let dt=w.get(Ie),lt=dt!==void 0?dt:mo(e,Ie,re,k[re],ee,W,qe);Vo&&Ae&&(N.has(Ie)&&console.error(`[legend-list] Error: Detected overlapping key (${Ie}) which causes missing items and gaps and other terrrible things. Check that keyExtractor returns unique values.`),N.set(Ie,re)),ve!==y[re]&&(y[re]=ve,h&&QK(e,Ie,ve)),Ae&&x.set(Ie,re),A?(g[re]=fe,v[re]=st,lt>Ne&&(Ne=lt),fe+=st,fe>E&&(ve+=Ne,fe=1,Ne=0)):ve+=lt}Ee||EV(e),L&&ZR(e)}function tN(e,t){let n=e.mapViewabilityConfigStates;n||(n=new Map,e.mapViewabilityConfigStates=n);let o=n.get(t);return o||(o={end:-1,endBuffered:-1,previousEnd:-1,previousStart:-1,start:-1,startBuffered:-1,viewableItems:[]},n.set(t,o)),o}function MV(e){let{viewabilityConfig:t,viewabilityConfigCallbackPairs:n,onViewableItemsChanged:o}=e;return(t||o)&&(n=[...n||[],{onViewableItemsChanged:o,viewabilityConfig:t||{viewAreaCoveragePercentThreshold:0}}]),n}function nN(e,t,n,o,r,a,i=r,s=a){let{props:{data:l}}=e;for(let d of n){let c=tN(t,d.viewabilityConfig.id);c.start=r,c.end=a,c.startBuffered=i,c.endBuffered=s,d.viewabilityConfig.minimumViewTime?e.scheduledWork.timeout(()=>eR(l,d,e,t,o),d.viewabilityConfig.minimumViewTime):eR(l,d,e,t,o)}}function eR(e,t,n,o,r){let{viewabilityConfig:a,onViewableItemsChanged:i}=t,s=a.id,l=tN(o,s),{viewableItems:d,start:c,end:f,startBuffered:p,endBuffered:m}=l,h;for(let[y,C]of o.mapViewabilityAmountValues)oN(n,o,a,y,C.key,r,C.item,C.index).sizeVisible<0&&(h??(h=[]),h.push(y));let g=[],v=new Set;if(d)for(let y of d){v.add(y.key);let C=n.indexByKey.get(y.key),w=C!==void 0?e[C]:void 0,k=cC(o,y.key),S=!1;C!==void 0&&w!==void 0&&(S=nR(n,o,a,k,y.key,r,w,C)),S||g.push({...y,index:C??y.index,isViewable:!1,item:w??y.item})}let x=[];for(let y=c;y<=f;y++){let C=e[y];if(C){let w=Bt(n,y),k=cC(o,w);if(nR(n,o,a,k,w,r,C,y)){let S={containerId:k,index:y,isViewable:!0,item:C,key:w};x.push(S),v.has(S.key)||g.push(S)}}}if(Object.assign(l,{previousEnd:f,previousStart:c,viewableItems:x}),g.length>0){l.viewableItems=x;for(let y=0;y<g.length;y++){let C=g[y];RV(o,s,C.containerId,C)}i&&i({changed:g,end:f,endBuffered:m,start:c,startBuffered:p,viewableItems:x})}if(h)for(let y of h){let C=o.mapViewabilityAmountValues.get(y);C&&C.sizeVisible<0&&o.mapViewabilityAmountValues.delete(y)}}function tR(e,t){return!!e&&e.containerId===t.containerId&&e.index===t.index&&e.isViewable===t.isViewable&&e.item===t.item&&e.key===t.key&&e.percentOfScroller===t.percentOfScroller&&e.percentVisible===t.percentVisible&&e.scrollSize===t.scrollSize&&e.size===t.size&&e.sizeVisible===t.sizeVisible}function oN(e,t,n,o,r,a,i,s){let{sizes:l,scroll:d}=e,c=(de(t,"stylePaddingTop")||0)+(de(t,"alignItemsAtEndPadding")||0)+(de(t,"headerSize")||0),{itemVisiblePercentThreshold:f,viewAreaCoveragePercentThreshold:p}=n,m=p!=null,h=m?p:f,g=d-c,v=e.positions[s],x=l.get(r)||0;if(v===void 0){let N={containerId:o,index:s,isViewable:!1,item:i,key:r,percentOfScroller:0,percentVisible:0,scrollSize:a,size:x,sizeVisible:-1},R=t.mapViewabilityAmountValues.get(o);if(!tR(R,N)){t.mapViewabilityAmountValues.set(o,N);let $=t.mapViewabilityAmountCallbacks.get(o);$&&$(N)}return N}let y=v-g,C=y+x,w=y>=0&&C<=a&&C>y,k=w?x:Math.min(C,a)-Math.max(y,0),S=x?w?100:100*(k/x):0,L=x?100*(k/a):0,T=(w?100:m?L:S)>=h,E={containerId:o,index:s,isViewable:T,item:i,key:r,percentOfScroller:L,percentVisible:S,scrollSize:a,size:x,sizeVisible:k},A=t.mapViewabilityAmountValues.get(o);if(!tR(A,E)){t.mapViewabilityAmountValues.set(o,E);let N=t.mapViewabilityAmountCallbacks.get(o);N&&N(E)}return E}function nR(e,t,n,o,r,a,i,s){let l=t.mapViewabilityAmountValues.get(o);return(!l||l.key!==r||l.index!==s)&&(l=oN(e,t,n,o,r,a,i,s)),l.isViewable}function RV(e,t,n,o){let r=n+t;e.mapViewabilityValues.set(r,o);let a=e.mapViewabilityCallbacks.get(r);a?.(o)}var oR=xR.unstable_batchedUpdates,NV=typeof oR=="function"?oR:e=>e(),_V=32,DV=64,OV=3;function FV(e,t){if(e<=0||t<=0)return 0;let n=Math.ceil(t*OV),o=t+DV,r=Math.max(t,Math.min(n,o),Math.min(e,_V)),a=Math.max(e,t);return Math.min(a,r)}function BV(e,t){return e<=0||t<=0?0:Math.min(Math.max(e,t),Math.max(t,Math.ceil(t*1.5)))}function zV(e,t,n,o,r,a,i){var s;let l=t.length;if(l===0)return[];let d=de(e,"numContainers"),c=e.state,{containerItemMetadata:f,stickyContainerPool:p}=c,m=c.props.recycleItems&&!!c.props.positionComponentInternal,h=r.length>0?new Set(r):void 0,g=t.map((E,A)=>({isSticky:c.props.stickyHeaderIndicesSet.has(E),itemIndex:E,itemType:a?.(E),order:A})),v=g.filter(E=>!E.isSticky),x=g.filter(E=>E.isSticky),y=[],C=[];for(let E=0;E<d;E++){let A=de(e,`containerItemKey${E}`),N=!!h?.has(E);if(!(A&&i?.has(A)&&c.indexByKey.has(A))){if(p.has(E))(A===void 0||N)&&C.push({containerIndex:E,distance:Number.POSITIVE_INFINITY});else if(A===void 0||N)y.push({containerIndex:E,distance:Number.POSITIVE_INFINITY});else if(!m){let $=c.indexByKey.get(A);if($!==void 0&&($<n||$>o)){let H=$<n?n-$:$-o;y.push({containerIndex:E,distance:H})}}}}y.sort($V);let w=new Array(l),k=d,S=!1,L=(E,A)=>{w[E.order]={containerIndex:A,itemIndex:E.itemIndex,itemType:E.itemType},h?.delete(A)&&(S=!0)},I=(E,A,N)=>{for(let R of E){if(w[R.order])continue;let $=A.findIndex(H=>{var K;return N((K=f.get(H.containerIndex))==null?void 0:K.itemType,R.itemType)});if($!==-1){let[H]=A.splice($,1);L(R,H.containerIndex)}}},T=(E,A,N)=>{a&&I(E,A,(R,$)=>$!==void 0&&R===$),I(E,A,R=>R===void 0),N&&I(E,A,()=>!0)};T(v,y,!0),T(x,C,!1);for(let E of g){if(w[E.order])continue;let A=k++;E.isSticky&&p.add(A),L(E,A)}if(S&&(r.length=0,h))for(let E of h)r.push(E);if(Vo){let E=(s=de(e,"numContainersPooled"))!=null?s:Number.POSITIVE_INFINITY;k>E&&console.warn("[legend-list] No unused container available, so creating one on demand. This can be a minor performance issue and is likely caused by the estimatedItemSize being too large. Consider decreasing estimatedItemSize.",{debugInfo:{numContainers:d,numContainersPooled:E,numNeeded:l,stillNeeded:k-d}})}return w}function $V(e,t){return t.distance-e.distance}function HV(e){let t=e.state;t.queuedInitialLayout=!0,ER(e),kC(e,{didLayout:!0})}var UV=4,KV=100;function qV(e,t){if(t<=0)return 0;let n=Math.min(1,Math.abs(e)/UV);return Math.sign(e)*t*n}function VV(e){let t=e.state;t.scheduledWork.timeout(()=>{var n;t.scrollHistory.length=0,(n=t.triggerCalculateItemsInView)==null||n.call(t)},KV,"renderRangeProjection")}function WV(e,t,n){let o=n.positions;for(let r=e.length-1;r>=0;r--){let a=e[r],i=o[a];if(i!==void 0&&t>=i)return r}return-1}function GV(e,t){let n=e.state,o=!1;for(let r of n.stickyContainerPool){let a=de(e,`containerItemKey${r}`);if((a?n.indexByKey.get(a):void 0)===t){o=!0;break}}return o}function jV(e,t,n,o,r,a,i){var s;let l=e.state;Pe(e,"activeStickyIndex",n>=0?t[n]:-1);for(let d=0;d<=1;d++){let c=n-d;if(c<0)continue;let f=t[c];if(GV(e,f))continue;let p=(s=l.idCache[f])!=null?s:Bt(l,f);p&&!l.containerItemKeys.has(p)&&(f<a||f>i)&&!r.has(f)&&(r.add(f),o.push(f))}}function QV(e,t,n,o,r,a,i){var s,l;let d=e.state;for(let c of d.stickyContainerPool){let f=de(e,`containerItemKey${c}`),p=f?d.indexByKey.get(f):void 0;if(p===void 0||i(p))continue;let m=t.indexOf(p);if(m===-1){d.stickyContainerPool.delete(c),Pe(e,`containerSticky${c}`,!1);continue}if(m>=r-1&&m<=r+1)continue;let g=t[m+1],v=!1;if(g){let x=d.positions[g];v=x!==void 0&&n>x+o*2}else{let x=(s=d.idCache[p])!=null?s:Bt(d,p);if(x){let y=d.positions[p],C=(l=d.sizes.get(x))!=null?l:mo(e,x,p,d.props.data[p]);v=y!==void 0&&n>y+C+o*3}}v&&a.push(c)}}function rN(e,t,n,o,r,a){let i=!1;return e.startNoBuffer===null&&n+o>r&&(e.startNoBuffer=t),e.firstFullyOnScreenIndex===void 0&&n>=r-10&&n<=a&&(e.firstFullyOnScreenIndex=t),e.startNoBuffer!==null&&(n<=a?e.endNoBuffer=t:i=!0),i}function aN(e,t){var n,o;let r=[],a=(n=t.firstFullyOnScreenIndex)!=null?n:t.startNoBuffer;if(a!=null&&t.endNoBuffer!==null)for(let i=a;i<=t.endNoBuffer;i++){let s=(o=e.idCache[i])!=null?o:Bt(e,i);r.push(s)}return r}function fC(e,t){var n;let o=e.props.onFirstVisibleItemChanged;if(!o||t===null||t<0||t>=e.props.data.length)return;let r=(n=e.idCache[t])!=null?n:Bt(e,t),a=e.lastFirstVisibleItemCallback;a?.index===t&&a.key===r||(e.lastFirstVisibleItemCallback={index:t,key:r},o({index:t,item:e.props.data[t],key:r}))}function XV(e,t){var n,o;let r=e.state,{endBuffered:a,idCache:i,positions:s,props:{data:l},sizes:d,startBuffered:c}=r;if(c===null||a===null||c<0||a<c)return null;for(let f=c;f<=a&&f<l.length;f++){let p=(n=i[f])!=null?n:Bt(r,f),m=(o=d.get(p))!=null?o:mo(e,p,f,l[f]);if(s[f]+m>t)return f}return null}function YV(e,t,n,o,r){var a,i;let s=e.state,{endBuffered:l,idCache:d,positions:c,props:{data:f},sizes:p,startBuffered:m}=s;if(m===null||l===null||m<0||l<m)return;let h={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null};for(let g=m;g<=l&&g<f.length;g++){let v=(a=d[g])!=null?a:Bt(s,g),x=(i=p.get(v))!=null?i:mo(e,v,g,f[g]),y=c[g];if(rN(h,g,y,x,o,r))break}Object.assign(s,{endNoBuffer:h.endNoBuffer,firstFullyOnScreenIndex:h.firstFullyOnScreenIndex,idsInView:aN(s,h),startNoBuffer:h.startNoBuffer}),fC(s,h.startNoBuffer),h.startNoBuffer!==null&&h.endNoBuffer!==null&&nN(s,e,t,n,h.startNoBuffer,h.endNoBuffer,m,l)}function Ha(e,t={}){let n=e.state;NV(()=>{var o,r,a,i,s,l,d,c,f,p,m,h,g,v,x,y,C,w,k,S,L;let{columns:I,containerItemKeys:T,enableScrollForNextCalculateItemsInView:E,idCache:A,indexByKey:N,minIndexSizeChanged:R,positions:$,props:{alwaysRenderIndicesArr:H,alwaysRenderIndicesSet:K,getItemType:O,keyExtractor:oe,onStickyHeaderChange:ee},scrollForNextCalculateItemsInView:W,scrollLength:qe,sizes:ve,startBufferedId:fe,viewabilityConfigCallbackPairs:Ne}=n,{data:Ae}=n.props,ae=n.props.stickyHeaderIndicesArr||[],Ee=n.props.stickyHeaderIndicesSet||new Set,xe=NR(e,t.drawDistanceMode),{dataChanged:re,doMVCP:Ie,forceFullItemPositions:st}=t,dt=((o=n.initialScrollSession)==null?void 0:o.kind)==="bootstrap"?n.initialScrollSession.bootstrap:void 0,lt=!!dt,ct=de(e,"numContainers");if(!Ae||qe===0||!ct)return;let Et=po(e),ot,He=de(e,"stylePaddingTop")+de(e,"alignItemsAtEndPadding")+de(e,"headerSize"),Se=de(e,"numColumns"),ze=(r=t.scrollVelocity)!=null?r:xg(n),Je=0,{initialScroll:qt,queuedInitialLayout:X}=n,nn=lt?(a=dt?.scroll)!=null?a:n.scroll:!X&&bu(n)&&qt?Fr(e,qt):n.scroll,xt=0,mn=0,Tt=0,Yt=0,Jt=0,Mt=0,zn=nn,kn=ne=>{var Fe;zn=ne,xt=(Fe=de(e,"scrollAdjustPending"))!=null?Fe:0,mn=xt-He,Tt=Math.round(ne+Je+mn),Tt+qe>Et&&(Tt=Math.max(0,Et-qe))};kn(nn);let vn=de(e,"activeStickyIndex"),$n=()=>{let ne=ae.length>0?WV(ae,Tt,n):-1,Fe=ne>=0?ae[ne]:-1,at=vn!==Fe;(ne>=0||vn>=0)&&Pe(e,"activeStickyIndex",Fe);let je=!!ee&&ae.length>0&&at;return{currentStickyIdx:ne,finishCalculateItemsInView:je?()=>{let wn=Ae[Fe];wn!==void 0&&ee?.({index:Fe,item:wn})}:void 0}},Vt=re?void 0:$n(),Zt=xe,Sn=xe;ze>0||ze===0&&Tt<Math.max(50,xe)?(Zt=xe*.5,Sn=xe*1.5):(Zt=xe*1.5,Sn=xe*.5);let zt=!re&&!st&&!lt&&!bu(n)&&!n.scrollingTo&&!n.pendingNativeMVCPAdjust&&!!de(e,"readyToRender")?qV(ze,Math.min(Zt,Sn)):0,D=()=>{let ne=Math.max(0,Tt),Fe=Math.max(0,-zn);Jt=Math.max(ne,Tt+qe+Fe),Yt=ne-Zt+zt,Mt=Jt+Sn+zt};if(D(),zt!==0&&VV(e),E&&!lt&&!re&&!st&&W){let{top:ne,bottom:Fe}=W;if(ne===null&&Fe===null)n.scrollForNextCalculateItemsInView=void 0;else if((ne===null||Yt>ne)&&(Fe===null||Mt<Fe)&&!Ru(n)){Ne?YV(e,Ne,qe,Tt,Jt):n.props.onFirstVisibleItemChanged&&fC(n,XV(e,Tt)),(i=Vt?.finishCalculateItemsInView)==null||i.call(Vt);return}}let Y=Ie&&!lt?Fq(e,re):void 0;re&&JR(n);let ce=st||re?0:(s=R??n.startBuffered)!=null?s:0,ie=!st&&!re&&Se>1&&R!==void 0;eN(e,re,{doMVCP:Ie,forceFullUpdate:!!st,optimizeForVisibleWindow:ie,scrollBottomBuffered:Mt,scrollVelocity:ze,startIndex:ce}),Et=po(e),R!==void 0&&(n.minIndexSizeChanged=void 0);let pe;if(re&&Ie&&n.props.maintainVisibleContentPosition.data&&n.didContainersLayout&&n.idsInView.length>0){let ne=n.props.maintainVisibleContentPosition.shouldRestorePosition;pe=new Set;for(let Fe of n.idsInView){let at=N.get(Fe);at!==void 0&&(ne&&!ne(Ae[at],at,Ae)||pe.add(Fe))}}let Ze=n.scroll,pt=(l=de(e,"scrollAdjustPending"))!=null?l:0;Y?.(),Y&&(n.scroll!==Ze||((d=de(e,"scrollAdjustPending"))!=null?d:0)!==pt)&&(kn(n.scroll),D()),re&&(Vt=$n());let ht=null,en=null,tn=null,bt=(c=lt?dt?.targetIndexSeed:void 0)!=null?c:!re&&fe&&N.get(fe)||0;for(let ne=bt;ne>=0;ne--){let Fe=(f=A[ne])!=null?f:Bt(n,ne),at=$[ne],je=(p=ve.get(Fe))!=null?p:mo(e,Fe,ne,Ae[ne]);if(at+je>Yt)bt=ne;else break}if(Se>1)for(;bt>0;){let ne=I[bt];if(ne===1||ne===void 0)break;bt-=1}let yn=!1,sn,ge,Rt=0;for(let ne=0;ne<ct;ne++){let Fe=de(e,`containerItemKey${ne}`);if(Fe!==void 0){let at=N.get(Fe);Rt=Math.max(Rt,at)}}let rt={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null},Lt=Ae.length;for(let ne=Math.max(0,bt);ne<Lt&&(!yn||ne<=Rt);ne++){let Fe=(m=A[ne])!=null?m:Bt(n,ne),at=(h=ve.get(Fe))!=null?h:mo(e,Fe,ne,Ae[ne]),je=$[ne];yn||(rN(rt,ne,je,at,Tt,Jt),ht===null&&je+at>Yt&&(ht=ne,en=Fe,Yt<0?sn=null:sn=je),rt.startNoBuffer!==null&&(je<=Mt?(tn=ne,Mt>Et?ge=null:ge=je+at):yn=!0))}Object.assign(n,{endBuffered:tn,endNoBuffer:rt.endNoBuffer,firstFullyOnScreenIndex:rt.firstFullyOnScreenIndex,idsInView:aN(n,rt),startBuffered:ht,startBufferedId:en,startNoBuffer:rt.startNoBuffer}),E&&sn!==void 0&&ge!==void 0&&(n.scrollForNextCalculateItemsInView=Su(sn)&&Su(ge)?void 0:{bottom:ge,top:sn});let et=ct,Nt=[];if(re)for(let ne=0;ne<et;ne++){let Fe=de(e,`containerItemKey${ne}`);(!oe||Fe&&N.get(Fe)===void 0)&&Nt.push(ne)}let ut=n.scrollTargetPinnedRange,ft=0,eo=-1;ut&&(ft=Math.max(0,Math.min(ut.start,ut.end)),eo=Math.min(Lt-1,Math.max(ut.start,ut.end)));let ln=ft<=eo,Nn=ne=>K.has(ne)||ln&&ne>=ft&&ne<=eo;if(ht!==null&&tn!==null){let ne=[],Fe=new Set,at=je=>{var wn;if(je>=0&&je<Lt){let dn=(wn=A[je])!=null?wn:Bt(n,je),Cn=T.get(dn);Cn!==void 0?n.stickyContainerPool.add(Cn):!Su(dn)&&!Fe.has(je)&&(Fe.add(je),ne.push(je))}};for(let je=ht;je<=tn;je++){let wn=(g=A[je])!=null?g:Bt(n,je);T.has(wn)||(Fe.add(je),ne.push(je))}for(let je of H)at(je);if(ln)for(let je=ft;je<=eo;je++)at(je);if(ae.length>0?jV(e,ae,(v=Vt?.currentStickyIdx)!=null?v:-1,ne,Fe,ht,tn):vn!==-1&&Pe(e,"activeStickyIndex",-1),ne.length>0){let wn=zV(e,ne,ht,tn,Nt,O?dn=>{let Cn=O(Ae[dn],dn);return Cn!==void 0?String(Cn):""}:void 0,pe);for(let dn of wn){let Cn=dn.itemIndex,$t=dn.containerIndex,Kn=(x=A[Cn])!=null?x:Bt(n,Cn),Wt=de(e,`containerItemKey${$t}`);Wt&&Wt!==Kn&&T.delete(Wt),Wt!==Kn&&(ot??(ot=new Set),ot.add($t),n.containerItemGenerations[$t]=((y=n.containerItemGenerations[$t])!=null?y:0)+1),Pe(e,`containerItemKey${$t}`,Kn),Pe(e,`containerItemIndex${$t}`,Cn),Pe(e,`containerItemData${$t}`,Ae[Cn]),n.containerItemMetadata.set($t,GR(n,Cn,Ae[Cn],dn.itemType)),T.set(Kn,$t),(C=n.userScrollAnchorReset)==null||C.keys.add(Kn);let vo=`containerSticky${$t}`,Wa=Ee.has(Cn),Ga=Nn(Cn);Wa?(Pe(e,vo,!0),n.stickyContainerPool.add($t)):(de(e,vo)&&Pe(e,vo,!1),Ga?n.stickyContainerPool.add($t):n.stickyContainerPool.delete($t)),$t>=et&&(et=$t+1)}et!==ct&&(Pe(e,"numContainers",et),et>de(e,"numContainersPooled")&&Pe(e,"numContainersPooled",BV(Lt,et)))}((w=n.userScrollAnchorReset)==null?void 0:w.keys.size)===0&&(n.userScrollAnchorReset=void 0)}n.stickyContainerPool.size>0&&QV(e,ae,Tt,xe,(k=Vt?.currentStickyIdx)!=null?k:-1,Nt,Nn);let Hn=Nt.length>0?new Set(Nt):void 0,Un=!1;for(let ne=0;ne<et;ne++){let Fe=de(e,`containerItemKey${ne}`);if(Hn?.has(ne))Fe!==void 0&&(T.delete(Fe),ot??(ot=new Set),ot.add(ne),n.containerItemGenerations[ne]=((S=n.containerItemGenerations[ne])!=null?S:0)+1),n.containerItemMetadata.delete(ne),n.stickyContainerPool.has(ne)&&(Pe(e,`containerSticky${ne}`,!1),n.stickyContainerPool.delete(ne)),Pe(e,`containerItemKey${ne}`,void 0),Pe(e,`containerItemIndex${ne}`,void 0),Pe(e,`containerItemData${ne}`,void 0),Pe(e,`containerPosition${ne}`,sd),Pe(e,`containerColumn${ne}`,-1),Pe(e,`containerSpan${ne}`,1);else{let at=N.get(Fe);at!==void 0&&(Un=kV(e,ne,at,{scrollAdjustPending:xt,updateLayout:!0}).didChangePosition||Un)}}if(ot&&SC&&lg(e,ot),Un&&Pe(e,"lastPositionUpdate",Date.now()),lt){dV(e);return}fC(n,rt.startNoBuffer),!X&&!n.didContainersLayout&&(bu(n)?wu(n,n.startBuffered,n.endBuffered):wu(n,n.startNoBuffer,n.endNoBuffer)||wu(n,n.startBuffered,n.endBuffered))&&(HV(e),SV(e)),Ne&&rt.startNoBuffer!==null&&rt.endNoBuffer!==null&&nN(e.state,e,Ne,qe,rt.startNoBuffer,rt.endNoBuffer,ht??rt.startNoBuffer,tn??rt.endNoBuffer),(L=Vt?.finishCalculateItemsInView)==null||L.call(Vt)})}function dg(e){var t,n;let o=e.state,r=o.props.anchoredEndSpace,a=de(e,"anchoredEndSpaceSize"),i=o.anchoredEndSpaceReadyAnchorIndex,s=o.anchoredEndSpaceReadyAnchorKey,l=r?.anchorIndex,d,c=!0,f=0;if(r){let{anchorIndex:g,anchorMaxSize:v,anchorOffset:x=0}=r,{data:y}=o.props;if(g>=0&&g<y.length&&o.scrollLength>0){d=Bt(o,g);let C=0,w=!1;for(let S=g;S<y.length;S++){let L=BR(e,S),I=S===g&&v!==void 0?Math.min(L||0,Math.max(0,v)):L;L===void 0&&(w=!0),I!=null&&I>0&&(C+=I)}C=Math.max(0,C-e.scrollAxisGap),C+=(e.values.get("footerSize")||0)+bC(o.props),c=!w;let k=Math.max(0,o.scrollLength-C-x);f=w?Math.min(a||0,k):k}else g>=0&&(c=!1)}let p=a!==f&&(a!==void 0||r!==void 0),m=(a||0)!==f;return c&&(p||(i!==l||s!==d))?(o.anchoredEndSpaceReadyAnchorIndex=l,o.anchoredEndSpaceReadyAnchorKey=d,p&&(Pe(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f)),m&&(Gs(e),qs(e,o.scroll,!0,{markHasScrolled:!1})),(n=r?.onReady)==null||n.call(r,{anchorIndex:l,anchorKey:d,size:f})):!c&&p&&f<(a||0)&&(Pe(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f),r?.includeInEndInset&&qs(e,o.scroll,!0,{markHasScrolled:!1})),f}function JV(e){var t;let n=e.state;n.userScrollAnchorReset!==void 0?(Ha(e),((t=n.userScrollAnchorReset)==null?void 0:t.keys.size)===0&&(n.userScrollAnchorReset=void 0)):n.mvcpAnchorLock?n.scheduledWork.has("mvcpRecalculate")||n.scheduledWork.frame(()=>Ha(e,{doMVCP:!0}),"mvcpRecalculate"):(n.scheduledWork.cancel("mvcpRecalculate"),Ha(e,{doMVCP:!0}))}function rR(e,t,n){if(e.state.needsOtherAxisSize){let r=n?t.height:t.width,a=de(e,"otherAxisSize");(!a||r>a)&&Pe(e,"otherAxisSize",r)}}var za;function iN(e){let t=za===void 0;za??(za=new Map);try{e()}finally{if(t){let n=za;za=void 0;for(let[o,r]of n)_C(o,r)}}}function ZV(e,t){e.didChange||(e.didChange=t.didChange),e.didMeasureUserScrollAnchorResetItem||(e.didMeasureUserScrollAnchorResetItem=t.didMeasureUserScrollAnchorResetItem),e.needsRecalculate||(e.needsRecalculate=t.needsRecalculate),e.shouldMaintainScrollAtEnd||(e.shouldMaintainScrollAtEnd=t.shouldMaintainScrollAtEnd)}function e4(e,t){var n;let o=e.state;t.needsRecalculate?(o.scrollForNextCalculateItemsInView=void 0,JV(e)):t.didMeasureUserScrollAnchorResetItem&&((n=o.userScrollAnchorReset)==null?void 0:n.keys.size)===0&&(o.userScrollAnchorReset=void 0),t.didChange&&dg(e),t.didChange&&t.shouldMaintainScrollAtEnd&&cd(e)}function sN(e,t){if(za){let n=za.get(e);n?n.push(t):za.set(e,[t])}else _C(e,[t])}function _C(e,t){var n;let o=e.state,r={};for(let a of t)if(a.containerId===void 0||de(e,`containerItemKey${a.containerId}`)===a.itemKey){let s=o.indexByKey.get(a.itemKey),l=s===void 0||(n=o.props.data)==null?void 0:n[s],d=a.containerId!==void 0&&s!==void 0&&l!==void 0?fV(o,a.containerId,s,l):void 0,c=t4(e,a.itemKey,a.size,d);ZV(r,c)}e4(e,r)}function t4(e,t,n,o){var r,a;let i=e.state,s=i.userScrollAnchorReset,l=!!s?.keys.delete(t),{didContainersLayout:d,sizesKnown:c,props:{getFixedItemSize:f,getItemType:p,horizontal:m,onItemSizeChanged:h,data:g,maintainScrollAtEnd:v}}=i;if(!g)return{didMeasureUserScrollAnchorResetItem:l};let x=i.indexByKey.get(t);if(f){if(x===void 0)return{didMeasureUserScrollAnchorResetItem:l};let I=i.props.data[x];if(I===void 0)return{didMeasureUserScrollAnchorResetItem:l};if(!o?.didResolveFixedItemSize){let E=(a=o?.itemType)!=null?a:p&&(r=p(I,x))!=null?r:"";o={didResolveFixedItemSize:!0,fixedItemSize:f(I,x,E),itemType:E}}let T=o.fixedItemSize;if(T!==void 0&&T===c.get(t))return rR(e,n,m),{didMeasureUserScrollAnchorResetItem:l}}let y=!d,C=!1,w,k=i.sizesKnown.get(t),S=n4(e,t,n,o),L=Lu(m?n.width:n.height);if(S!==0){w=w!==void 0?Math.min(w,x):x;let{startBuffered:I,endBuffered:T}=i;y||(y=x>=I&&x<=T),!y&&i.containerItemKeys.has(t)&&(y=!0),(k===void 0||Math.abs(k-L)>5)&&(C=!0),h?.({index:x,itemData:i.props.data[x],itemKey:t,previous:L-S,size:L})}if(w!==void 0&&(i.minIndexSizeChanged=i.minIndexSizeChanged!==void 0?Math.min(i.minIndexSizeChanged,w):w),rR(e,n,m),d||wu(i,i.startBuffered,i.endBuffered)){let I=C&&!!v?.onItemLayout;return{didChange:S!==0,didMeasureUserScrollAnchorResetItem:l,needsRecalculate:y,shouldMaintainScrollAtEnd:I}}return{didChange:S!==0,didMeasureUserScrollAnchorResetItem:l}}function n4(e,t,n,o){var r,a;let i=e.state,{indexByKey:s,sizesKnown:l,averageSizes:d,props:{data:c,horizontal:f,getItemType:p,getFixedItemSize:m}}=i;if(!c)return 0;let h=s.get(t),g=c[h],v=o?.itemType,x=o?.fixedItemSize;m&&!o?.didResolveFixedItemSize&&(v=p&&(r=p(g,h))!=null?r:"",x=m(g,h,v));let y=o?.didResolveFixedItemSize||v!==void 0||x!==void 0?{didResolveFixedItemSize:o?.didResolveFixedItemSize,fixedItemSize:x,itemType:v}:void 0,C=mo(e,t,h,g,void 0,void 0,void 0,y),w=f?n.width:n.height,k=l.get(t),S=Math.round(w);if(l.set(t,S),x===void 0&&S>0){v??(v=p&&(a=p(g,h))!=null?a:"");let L=d[v];L||(L=d[v]={avg:0,num:0}),L.num===0?(L.avg=S,L.num++):k!==void 0&&k>0?L.avg+=(S-k)/L.num:(L.avg=(L.avg*L.num+S)/(L.num+1),L.num++)}return!C||Math.abs(C-S)>.1?(dC(e,t,S),S-C):0}function o4(e,t=null){let n=[],o=t??e.viewRefs.keys();for(let r of o){let a=e.viewRefs.get(r),i=de(e,`containerItemKey${r}`),s=a?.current;if(i!==void 0&&s){let l=s.getBoundingClientRect();eq(s,l),n.push({containerId:r,itemKey:i,size:{height:l.height,width:l.width}})}}n.length>0&&_C(e,n)}var lN=Wn,la=ue,r4=la(function({children:t}){let n=Br(),[o]=Wo(["containerLayoutEpoch"]);return ye(()=>{{let r=LV(n);r!==void 0&&o4(n,r)}},[n,o]),t}),og=e=>sh(e)?e:e?Te(e,null):null,a4=typeof document<"u"&&!!document.getElementById("react-native-stylesheet"),pC={contain:"paint layout style",...a4?{display:"flex",flexDirection:"column"}:{}},i4=la(function({id:t,horizontal:n,style:o,refView:r,...a}){let[i=sd]=Wo([`containerPosition${t}`]),s=hg(o)?Object.assign({},...o):o,l=n?{...pC,...s,left:i}:{...pC,...s,top:i},{animatedScrollY:d,onLayout:c,onLayoutChange:f,stickyHeaderConfig:p,...m}=a;return Te("div",{ref:r,...m,style:l})}),s4=la(function({id:t,horizontal:n,style:o,refView:r,animatedScrollY:a,stickyHeaderConfig:i,onLayout:s,onLayoutChange:l,children:d,...c}){let[f=sd,p,m]=Wo([`containerPosition${t}`,"activeStickyIndex",`containerItemIndex${t}`]),h=z(()=>{var x;return(x=hg(o)?Object.assign({},...o):o)!=null?x:{}},[o]),g=z(()=>{var x;let y={...pC,...h};delete y.transform;let C=(x=i?.offset)!=null?x:0,w=p===m;return y.position=w?"sticky":"absolute",y.zIndex=m+1e3,n?y.left=w?C:f:y.top=w?C:f,y},[h,n,f,m,p,i?.offset]),v=z(()=>i?.backdropComponent?Te("div",{style:{inset:0,pointerEvents:"none",position:"absolute"}},og(i.backdropComponent)):null,[i?.backdropComponent]);return Te("div",{ref:r,style:g,...c},v,d)}),l4=i4;function d4(e){G(()=>e())}var dN=Ht(null),c4=-1;function u4(){return fn(dN)}function f4(){var e;let t=u4(),n=(e=t?.containerId)!=null?e:c4,[o]=Wo([`containerItemKey${n}`]);return XK("lastItemKeys",a=>t&&!Su(o)&&a?.includes(o)||!1)}function p4({ItemSeparatorComponent:e,leadingItem:t}){return f4()?null:Te(e,{leadingItem:t})}var rC=null;function m4(){return rC||(rC=new ResizeObserver(e=>{iN(()=>{for(let t of e){let n=rg.get(t.target);if(n)for(let o of n)o(t)}})})),rC}var rg=new WeakMap;function g4(e,t){var n;if(typeof ResizeObserver>"u"||!e)return()=>{};let o=m4(),r=(n=rg.get(e))!=null?n:new Set;return r.size===0&&(rg.set(e,r),o.observe(e,{box:"border-box"})),r.add(t),()=>{r.delete(t),r.size===0&&(rg.delete(e),o.unobserve(e))}}function DC({ref:e,measureInLayoutEffect:t=!0,onLayoutProp:n,onLayoutChange:o,webLayoutResync:r},a){return ye(()=>{var i,s;let l=e.current,c=((s=(i=l?.getScrollableNode)==null?void 0:i.call(l))!=null?s:null)||l;if(!c)return;let f=(m,h)=>{m.height===0&&m.width===0||(o(m,h),n?.({nativeEvent:{layout:m}}))},p;if(t){let m=c.getBoundingClientRect();f(aR(m),!0),p=m}return g4(c,m=>{var h;let g=m.target instanceof HTMLElement?m.target:void 0,v=Array.isArray(m.borderBoxSize)?m.borderBoxSize[0]:m.borderBoxSize,x=v?{height:v.blockSize,left:m.contentRect.left,top:m.contentRect.top,width:v.inlineSize}:(h=g?.getBoundingClientRect())!=null?h:m.contentRect,y=p??ZK(c),C=y===void 0||x.width!==y.width||x.height!==y.height;p=x;let w=!!r?.();(C||w)&&f(aR(x),!1)})},[t,...a||[]]),{}}function aR(e){return e?{height:e.height,width:e.width,x:e.left,y:e.top}:{height:0,width:0,x:0,y:0}}var ag=new Map,aC;function cN(e){ag.delete(e)}function h4(e,t){ag.set(e,t),aC===void 0&&(aC=requestAnimationFrame(()=>{let n=Array.from(ag.values());ag.clear(),aC=void 0,iN(()=>{for(let o of n)o()})}))}function v4({containerId:e,ctx:t,rectangle:n,ref:o,state:r}){let a=t.state,i=r.itemKey;r.didLayout=!0;let s=n,l=r.horizontal?"width":"height",d=Lu(n[l]);r.lastSize&&Lu(r.lastSize[l]);let f=a.sizesKnown.get(i),p=()=>{r.lastSize=s,sN(t,{containerId:e,itemKey:i,size:s})};!Ru(a)&&f!==void 0&&d+1<f?h4(r,()=>{var h;if(r.itemKey===i){let g=o.current,v=(h=g?.getBoundingClientRect)==null?void 0:h.call(g);v&&(s={height:v.height,width:v.width}),p()}}):(cN(r),p())}function x4({containerId:e,ctx:t,horizontal:n,itemKey:o,ref:r}){let a=_({didLayout:!1,horizontal:n,itemKey:o});a.current.horizontal=n,a.current.itemKey=o;let[i,s]=G(0),l=B(f=>{v4({containerId:e,ctx:t,rectangle:f,ref:r,state:a.current})},[e,t,r]),d=B(()=>{lg(t,e)},[e,t]);ye(()=>(t.containerLayoutTriggers.set(e,d),()=>{cN(a.current),t.containerLayoutTriggers.get(e)===d&&t.containerLayoutTriggers.delete(e)}),[e,t,d]),ye(()=>{lg(t,e)});let{onLayout:c}=DC({measureInLayoutEffect:!SC,onLayoutChange:l,ref:r,webLayoutResync:()=>Ru(t.state)},[o,i]);return q(()=>{},[e,t,o]),{onLayout:c,triggerLayout:d}}function y4({columnWrapperStyle:e,contentContainerAlignItems:t,horizontal:n,hasItemSeparator:o,isHorizontalRTLList:r,numColumns:a,otherAxisPos:i,otherAxisSize:s}){let l;if(e){let{columnGap:d,rowGap:c,gap:f}=e;n?l={paddingBottom:a>1?(c||f||0)/2:void 0,paddingRight:d||f||void 0,paddingTop:a>1?(c||f||0)/2:void 0}:l={paddingBottom:c||f||void 0,paddingLeft:a>1?(d||f||0)/2:void 0,paddingRight:a>1?(d||f||0)/2:void 0}}return n?{bottom:t==="flex-end"&&a===1?0:void 0,boxSizing:l?"border-box":void 0,direction:r&&Ua.OS==="web"?"ltr":void 0,flexDirection:o?"row":void 0,height:s,left:0,position:"absolute",top:t==="flex-end"&&a===1?void 0:i,...l||{}}:{boxSizing:l?"border-box":void 0,left:i,position:"absolute",right:a>1?null:0,top:0,width:s,...l||{}}}var C4=la(function({id:t,itemKey:n,recycleItems:o,horizontal:r,getRenderedItem:a,ItemSeparatorComponent:i,stickyHeaderConfig:s}){let l=Br(),{columnWrapperStyle:d,animatedScrollY:c}=l,f=qa(l.state),p=l.state.props.positionComponentInternal,m=l.state.props.stickyPositionComponentInternal,[h=0,g=1,v,x=1,y,C]=Wo([`containerColumn${t}`,`containerSpan${t}`,`containerItemData${t}`,"numColumns","extraData",`containerSticky${t}`]),w=_(null),{onLayout:k,triggerLayout:S}=x4({containerId:t,ctx:l,horizontal:r,itemKey:n,ref:w}),L=h>0?h:1,I=Math.min(Math.max(g||1,1),x),T=x>1?`${(L-1)/x*100}%`:0,E=x>1?`${I/x*100}%`:void 0,A=z(()=>y4({columnWrapperStyle:d,contentContainerAlignItems:l.state.props.contentContainerAlignItems,hasItemSeparator:!!i,horizontal:r,isHorizontalRTLList:f,numColumns:x,otherAxisPos:T,otherAxisSize:E}),[r,f,T,E,d,l.state.props.contentContainerAlignItems,x,i]),N=z(()=>n!==void 0?a(n):null,[n,v,y]),{renderedItem:R}=N||{},$=z(()=>(l.viewRefs.set(t,w),{containerId:t,triggerLayout:S}),[t,S]);return Te(C?m||s4:p||l4,{animatedScrollY:C?c:void 0,horizontal:r,id:t,key:o?void 0:n,onLayout:k,refView:w,stickyHeaderConfig:s,style:A},Te(dN.Provider,{value:$},R,N&&i&&Te(p4,{ItemSeparatorComponent:i,leadingItem:N.item})))});function b4({id:e,horizontal:t,recycleItems:n,ItemSeparatorComponent:o,getRenderedItem:r,stickyHeaderConfig:a,ContainerComponent:i=C4}){let[s]=Wo([`containerItemKey${e}`]);return s===void 0?null:Te(i,{getRenderedItem:r,horizontal:t,ItemSeparatorComponent:o,id:e,itemKey:s,recycleItems:n,stickyHeaderConfig:a})}var I4=la(function(t){return Te(b4,{...t})});function S4(e,t){let n=Array.from(e.children);if(n.length<=1)return n;let o=n.map(l=>{var d;return[l,(d=t.get(l))!=null?d:null]});o.sort((l,d)=>{let c=l[1],f=d[1];return c===null?1:f===null?-1:c-f});let r=new Map;o.forEach((l,d)=>{r.set(l[0],d)});let a=n.map(l=>r.get(l)),i=w4(a),s=new Set(i);for(let l=0;l<o.length;l++){let d=o[l][0],c=n.indexOf(d);if(!s.has(c)){let f=null;for(let p=l+1;p<o.length;p++){let m=o[p][0],h=n.indexOf(m);if(s.has(h)){f=m;break}}f?e.insertBefore(d,f):e.appendChild(d)}}}function w4(e){let t=e.length,n=[],o=new Array(t).fill(-1),r=[];for(let s=0;s<t;s++){let l=e[s],d=0,c=n.length;for(;d<c;){let f=Math.floor((d+c)/2);e[r[f]]<l?d=f+1:c=f}d===n.length?(n.push(l),r.push(s)):(n[d]=l,r[d]=s),d>0&&(o[s]=r[d-1])}let a=[],i=r[r.length-1];for(;i!==-1;)a.unshift(i),i=o[i];return a}function T4(e){let t=Br(),n=_(void 0);q(()=>{let o=$a(t,"lastPositionUpdate",()=>{n.current!==void 0&&clearTimeout(n.current),n.current=setTimeout(()=>{let r=e.current;if(r){let a=new Map;for(let[i,s]of t.viewRefs){let l=s.current,d=de(t,`containerItemIndex${i}`);l&&d!==void 0&&a.set(l,d)}S4(r,a)}n.current=void 0},500)});return()=>{o(),n.current!==void 0&&clearTimeout(n.current)}},[t])}function L4(e,t){let[n,o]=G(t),r=n!==t;return ye(()=>{o(t)},[t]),e&&!r}var k4=la(function({freshDataTransitionEpoch:t,horizontal:n,numColumns:o,children:r}){let a=_(null),i=Br(),s=i.columnWrapperStyle,l=qa(i.state),[d,c,f]=Wo(["otherAxisSize","readyToRender","totalSize"]),p=L4(!!c,t);T4(a);let m=n?{direction:l?"ltr":void 0,flexShrink:0,minHeight:d,opacity:p?1:0,position:"relative",width:f}:{height:f,minWidth:d,opacity:p?1:0,position:"relative"};if(p||(m.pointerEvents="none"),s&&o>1){let{columnGap:h,rowGap:g,gap:v}=s,x=h||v||0,y=g||v||0;n?(y&&(m.marginTop=m.marginBottom=-y/2),x&&(m.marginRight=-x)):y&&(m.marginBottom=-y)}return Te("div",{ref:a,style:m},Te(r4,null,r))}),P4=la(function({freshDataTransitionEpoch:t,horizontal:n,recycleItems:o,ItemSeparatorComponent:r,getRenderedItem:a,stickyHeaderConfig:i}){let[s,l]=Wo(["numContainersPooled","numColumns"]),d=[];for(let c=0;c<s;c++)d.push(Te(I4,{getRenderedItem:a,horizontal:n,ItemSeparatorComponent:r,id:c,key:c,recycleItems:o,stickyHeaderConfig:i}));return Te(k4,{freshDataTransitionEpoch:t,horizontal:n,numColumns:l},d)});function A4(e){return hg(e)?Object.assign({},...e.filter(Boolean)):e}var Mu={create:e=>e,flatten:e=>A4(e)};function mC(e){let t=_(e);return t.current=e,t}function E4(e){let t=mC(e),n=_(void 0),o=z(()=>({cancel(){n.current!==void 0&&(cancelAnimationFrame(n.current),n.current=void 0)},flush(){o.cancel(),t.current()},schedule(){if(n.current!==void 0)return!1;let r=requestAnimationFrame(()=>{n.current===r&&(n.current=void 0,t.current())});return n.current=r,!0}}),[]);return q(()=>()=>{o.cancel()},[o]),o}var gC="legend-list-content-container",uN="legend-list-scrollbar-x-hidden",fN="legend-list-scrollbar-y-hidden";function M4(){return typeof document>"u"?null:document.scrollingElement||document.documentElement||document.body}function hC(){var e,t,n,o;return typeof window>"u"?{x:0,y:0}:{x:(t=(e=window.scrollX)!=null?e:window.pageXOffset)!=null?t:0,y:(o=(n=window.scrollY)!=null?n:window.pageYOffset)!=null?o:0}}function iR(e,t){var n,o;let r=e?.getBoundingClientRect();return{left:((n=r?.left)!=null?n:0)+t.x,top:((o=r?.top)!=null?o:0)+t.y}}function pN(e){var t,n;return{height:(t=e?.scrollHeight)!=null?t:0,width:(n=e?.scrollWidth)!=null?n:0}}function R4(e,t,n){return pN(n?t:e)}function sR(e,t,n){var o,r,a,i,s,l;if(t&&typeof window<"u"){let d=e?.getBoundingClientRect();return{height:n&&(r=(o=d?.height)!=null?o:e?.clientHeight)!=null?r:window.innerHeight,width:n?window.innerWidth:(i=(a=d?.width)!=null?a:e?.clientWidth)!=null?i:window.innerWidth}}return{height:(s=e?.clientHeight)!=null?s:0,width:(l=e?.clientWidth)!=null?l:0}}function lR(e,t){return Math.max(0,Math.min(e,t))}function dR(e,t){return t?e.width:e.height}function N4(e,t,n){return Math.max(0,dR(e,n)-dR(t,n))}function cR(e,t){return t&&M4()||e}function _4(e,t){return t&&typeof window<"u"?window:e}function D4(e,t,n){let o=e.getBoundingClientRect(),r=hC();return{height:t&&typeof window<"u"&&!n?window.innerHeight:o.height,width:t&&typeof window<"u"&&n?window.innerWidth:o.width,x:t?o.left+r.x:o.left,y:t?o.top+r.y:o.top}}function O4({clampedOffset:e,horizontal:t,listPos:n,scroll:o}){return{left:t?n.left+e:o.x,top:t?o.y:n.top+e}}var uR="legend-list-scrollbar-axis-hidden-style",F4=200,B4=`.${fN}::-webkit-scrollbar:vertical{width:0;display:none;}.${uN}::-webkit-scrollbar:horizontal{height:0;display:none;}`;function z4(){if(typeof document>"u"||document.getElementById(uR))return;let e=document.createElement("style");e.id=uR,e.textContent=B4,document.head.appendChild(e)}function $4(e){var t,n;let o=(n=(t=e.state)==null?void 0:t.props)==null?void 0:n.contentInsetEndAdjustment;return Math.max(0,o??0)}function H4(e){if(!e?.length)return[];let t=[],n=new Set;for(let o of e)Number.isFinite(o)&&!n.has(o)&&(n.add(o),t.push(o));return t}function U4(e,t){return{height:t?"100%":1,left:t?e:0,pointerEvents:"none",position:"absolute",scrollSnapAlign:"start",top:t?0:e,width:t?1:"100%"}}var fR=Wn(function({children:t,style:n,contentContainerClassName:o,contentContainerStyle:r,horizontal:a=!1,contentOffset:i,maintainVisibleContentPosition:s,onScroll:l,onInternalScrollEnd:d,onMomentumScrollEnd:c,showsHorizontalScrollIndicator:f=!0,showsVerticalScrollIndicator:p=!0,refreshControl:m,useWindowScroll:h=!1,onLayout:g,...v},x){var y,C,w;let k=Br(),[S]=Wo(["anchoredEndSpaceSize"]),L=_(null),I=_(null),T=h,E=B(()=>_4(L.current,T),[T]),A=B(()=>{let He=L.current,Se=R4(He,I.current,T),ze=sR(He,T,a);return N4(Se,ze,a)},[a,T]),N=B(()=>{let He=L.current;if(T){let Se=A(),ze=hC(),Je=iR(He,ze),qt=a?ze.x-Je.left:ze.y-Je.top;return lR(qt,Se)}return He?a?He.scrollLeft:He.scrollTop:0},[A,a,T]),R=B((He,Se)=>{let ze=L.current,Je=E();if(!Je||typeof Je.scrollTo!="function")return;let qt=A(),X=lR(He,qt),xt={behavior:Se?"smooth":"auto"};if(T){let mn=hC(),Tt=iR(ze,mn),{left:Yt,top:Jt}=O4({clampedOffset:X,horizontal:a,listPos:Tt,scroll:mn});xt.left=Yt,xt.top=Jt}else a?xt.left=X:xt.top=X;Je.scrollTo(xt)},[A,E,a,T]);Gr(x,()=>({getBoundingClientRect:()=>{var Se;return(Se=L.current)==null?void 0:Se.getBoundingClientRect()},getCurrentScrollOffset:N,getScrollableNode:()=>cR(L.current,T),getScrollEventTarget:()=>E(),getScrollResponder:()=>cR(L.current,T),isWindowScroll:()=>T,scrollBy:(Se,ze)=>{let Je=E();!Je||typeof Je.scrollBy!="function"||Je.scrollBy({behavior:"auto",left:Se,top:ze})},scrollTo:Se=>{let{x:ze=0,y:Je=0,animated:qt=!0}=Se;R(a?ze:Je,qt)},scrollToEnd:(Se={})=>{let{animated:ze=!0}=Se,Je=A();R(Je,ze)},scrollToOffset:Se=>{let{offset:ze,animated:Je=!0}=Se;R(ze,Je)}}),[N,A,E,a,T,R]);let $=B(()=>{if(!l||!L.current)return;let He=pN(I.current),Se=sR(L.current,T,a),ze=N(),Je={nativeEvent:{contentOffset:{x:a?ze:0,y:a?0:ze},contentSize:{height:He.height,width:He.width},layoutMeasurement:{height:Se.height,width:Se.width}}};l(Je)},[N,a,T,l]),H=E4($),K=_(void 0),O=B(()=>{let He=K.current;He!==void 0&&(clearTimeout(He),K.current=void 0),H.flush(),d?.()},[d,H]),oe=B(He=>{if(!l)return;let Se=k.state;if(!!Se?.scrollingTo||!!Se?.initialScrollSession&&!Se.didFinishInitialScroll||!!Se?.initialScroll&&!Se.didFinishInitialScroll||!!Se&&Ru(Se)?H.flush():H.schedule(),d){let Je=K.current;Je!==void 0&&clearTimeout(Je),K.current=setTimeout(O,F4)}},[k.state,O,d,l,H]);ye(()=>{let He=E();if(He)return He.addEventListener("scroll",oe,{passive:!0}),"onscrollend"in He&&He.addEventListener("scrollend",O),()=>{He.removeEventListener("scroll",oe),"onscrollend"in He&&He.removeEventListener("scrollend",O);let Se=K.current;Se!==void 0&&(clearTimeout(Se),K.current=void 0),H.cancel()}},[O,E,oe,H]),q(()=>{let He=()=>{i&&R(a?i.x||0:i.y||0,!1)};He(),requestAnimationFrame(He)},[i?.x,i?.y,a,R]),ye(()=>{if(!g||!L.current)return;let He=L.current,Se=()=>{g({nativeEvent:{layout:D4(He,T,a)}})};Se();let ze=new ResizeObserver(()=>{Se()});ze.observe(He);let Je=()=>{Se()};return T&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("resize",Je),()=>{ze.disconnect(),T&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",Je)}},[T,g]);let ee=!T&&(a?!f&&uN:!p&&fN);ye(()=>{ee&&z4()},[ee]);let W={...T?{}:{overflow:"auto",overflowX:a||f?"auto":"hidden",overflowY:a?p?"auto":"hidden":"auto",WebkitOverflowScrolling:"touch"},...Mu.flatten(n),...s?{overflowAnchor:"none"}:{}},qe=$4(k),ve=(C=(y=k.state)==null?void 0:y.props)!=null&&C.anchoredEndSpace&&S?S:0,fe=Math.max(0,qe-ve),Ne=fe?a?{flexShrink:0,width:fe}:{height:fe}:void 0,Ae={display:a?"flex":"block",flexDirection:a?"row":void 0,minHeight:a?void 0:"100%",minWidth:a?"100%":void 0,...Mu.flatten(r),...s?{overflowAnchor:"none"}:{}},ae=o?`${gC} ${o}`:gC,{contentContainerClassName:Ee,contentInset:xe,scrollEventThrottle:re,ScrollComponent:Ie,snapToOffsets:st,useWindowScroll:dt,className:lt,...ct}=v,Et=T?[]:H4(st);Et.length>0&&(W.scrollSnapType=a?"x mandatory":"y mandatory",Ae.position=(w=Ae.position)!=null?w:"relative");let ot=ee?lt?`${lt} ${ee}`:ee:lt;return Vo&&/(?:^|\s)(?:[a-z0-9_-]+:)*gap(?:-[xy])?-(?:\[[^\]]+\]|[^\s]+)/.test(`${o??""} ${lt??""}`)&&Us("className-gap","className/contentContainerClassName gap classes are not supported in LegendList because it needs to use exact values internally. Use contentContainerStyle={{ gap: ... }} or columnWrapperStyle instead."),Te("div",{className:ot,ref:L,...ct,style:W},m,Te("div",{className:ae,ref:I,style:Ae},Et.map(He=>Te("div",{"aria-hidden":!0,"data-legend-list-snap-anchor":He,key:`snap-${He}`,style:U4(He,a)})),t,Ne?Te("div",{"aria-hidden":!0,style:Ne}):null))});function K4({horizontal:e,needsOtherAxisSize:t,otherAxisSize:n}){if(!(!t||!n||n<=0))return e?{height:n}:{width:n}}function pR(e,t){let n=Br();ye(()=>$a(n,e,r=>{t(r)}),[t,n,e])}function q4(e){return e?{contentSizeKey:"scrollWidth",paddingEndProp:"paddingRight",viewportSizeKey:"clientWidth",x:1,y:0}:{contentSizeKey:"scrollHeight",paddingEndProp:"paddingBottom",viewportSizeKey:"clientHeight",x:0,y:1}}function V4(e,t){var n,o,r;let a=(n=e.state)==null?void 0:n.refScroller.current,i=(r=(o=a?.getScrollableNode)==null?void 0:o.call(a))!=null?r:null,s=null;return i&&(s=t?.isConnected&&t.parentElement===i?t:i.querySelector(`:scope > .${gC}`)),i?{contentNode:s,scrollElement:i}:null}function W4(e,t,n){e.scrollBy({behavior:"auto",left:t,top:n})}function G4(){let e=Br(),t=_(0),n=_(0),o=_(void 0),r=_(void 0),a=_(null),i=B(()=>{let s=de(e,"scrollAdjust"),l=de(e,"scrollAdjustUserOffset"),d=(s||0)+(l||0);if(d-t.current!==0){let f=V4(e,a.current);if(f){let p=!!e.state.props.horizontal,m=q4(p),{contentNode:h,scrollElement:g}=f,v=p?g.scrollLeft:g.scrollTop,x=(l||0)-n.current,C=(x!==0?v+x:e.state.scroll)-v,w=Math.abs(C)>.01,k=()=>W4(g,m.x*C,m.y*C);if(a.current=h,w&&h){let S=h[m.contentSizeKey],L=g[m.viewportSizeKey],I=v+C;if(C>0&&!e.state.adjustingFromInitialMount&&S<I+L){let E=h.style[m.paddingEndProp],A=r.current,N=A?.value===E?A.baseline:E,R=(I+L-S)*2,H=`${(Number.parseFloat(window.getComputedStyle(h)[m.paddingEndProp])||0)+R}px`;h.style[m.paddingEndProp]=H,r.current={baseline:N,value:h.style[m.paddingEndProp]},h.offsetHeight,k(),o.current!==void 0&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{let K=r.current;o.current=void 0,r.current=void 0,h.style[m.paddingEndProp]===K?.value&&(h.style[m.paddingEndProp]=K.baseline)})}else k()}else w&&k()}t.current=d,n.current=l||0}},[e]);return pR("scrollAdjust",i),pR("scrollAdjustUserOffset",i),null}var j4=Wn(function({ScrollComponent:t,...n},o){let[r]=Wo(["snapToOffsets"]);return Te(t,{...n,ref:o,snapToOffsets:r})}),vC=.1;function Q4(e,t,n){let o=de(e,t)!==n;return o&&(Pe(e,t,n),Gs(e)),o}function X4(e,t,n){let{didContainersLayout:o,didFinishInitialScroll:r,props:a,scroll:i,scrollingTo:s}=e.state,l=n-t,c=((a.horizontal?a.stylePaddingLeft:a.stylePaddingTop)||0)+t;return a.maintainVisibleContentPosition.size&&o&&r&&!s&&i>=c-vC&&Math.abs(l)>vC}function mR(e,t){let{state:n}=e,o=de(e,"headerSize")||0,r=o!==t,a=n.didMeasureHeader||o>vC;r&&(Pe(e,"headerSize",t),Gs(e),a&&X4(e,o,t)&&js(e,t-o)),n.didMeasureHeader=!0}function Y4(e,t){let n=Q4(e,"footerSize",t);return n&&dg(e),n}function J4(e,t){var n,o,r,a,i,s,l,d;return((n=e?.top)!=null?n:0)===((o=t?.top)!=null?o:0)&&((r=e?.bottom)!=null?r:0)===((a=t?.bottom)!=null?a:0)&&((i=e?.left)!=null?i:0)===((s=t?.left)!=null?s:0)&&((l=e?.right)!=null?l:0)===((d=t?.right)!=null?d:0)}function Z4(e,t){let{state:n}=e,o=n.contentInsetOverride,r=t??void 0,a=!J4(o,r);return n.contentInsetOverride=r,a&&Gs(e),a}function eW(e,t){let n=mC(e),o=mC(t);return z(()=>Wn((r,a)=>{var i,s;return(s=(i=n.current)==null?void 0:i.call(n,o.current(r,a)))!=null?s:null}),[o,n])}var gR=({onLayoutChange:e,refView:t,children:n,...o})=>{let r=_(null),a=t??r;return DC({onLayoutChange:e,ref:a}),Te("div",{...o,ref:a},n)},tW=la(function({horizontal:t}){let[n=0]=Wo(["alignItemsAtEndPadding"]);return n<=0?null:Te(cg,{style:t?{flexShrink:0,width:n}:{flexShrink:0,height:n}},null)}),nW=la(function({canRender:t,freshDataTransitionEpoch:n,style:o,contentContainerStyle:r,horizontal:a,initialContentOffset:i,recycleItems:s,ItemSeparatorComponent:l,alignItemsAtEnd:d,onScroll:c,onLayout:f,ListHeaderComponent:p,ListHeaderComponentStyle:m,ListFooterComponent:h,ListFooterComponentStyle:g,ListEmptyComponent:v,getRenderedItem:x,refScrollView:y,renderScrollComponent:C,onLayoutFooter:w,onInternalScrollBeginDrag:k,onInternalScrollEnd:S,scrollAdjustHandler:L,snapToIndices:I,stickyHeaderConfig:T,stickyHeaderIndices:E,useWindowScroll:A=!1,...N}){let R=Br(),$=R.state.props.maintainVisibleContentPosition,[H=0,K=0]=Wo(["anchoredEndSpaceSize","otherAxisSize"]),O=R.state.props.alignItemsAtEndPaddingEnabled,oe=!!R.state.props.anchoredEndSpace&&R.state.props.anchoredEndSpaceOwner==="list"&&H>0,ee;if(oe){let Ee=a?qa(R.state)?"Left":"Right":"Bottom",xe=Mu.flatten(r);ee={[`padding${Ee}`]:Cu({},xe||{},Ee)+H}}let W=K4({horizontal:a,needsOtherAxisSize:R.state.needsOtherAxisSize,otherAxisSize:K}),qe=eW(C,(Ee,xe)=>({...Ee,ref:xe})),ve=C?qe:fR,fe=I?j4:ve,Ne=B((Ee,xe)=>{var re;let Ie=Y4(R,Ee);xe?.(),Ie&&((re=R.state.props.maintainScrollAtEnd)!=null&&re.onFooterLayout)&&cd(R)},[R]);ye(()=>{p||mR(R,0),h||Ne(0)},[p,h,R,Ne]);let Ae=B(Ee=>{let xe=Ee[a?"width":"height"];mR(R,xe)},[R,a]),ae=B((Ee,xe)=>{let re=Ee[a?"width":"height"];Ne(re,()=>{w?.(Ee,xe)})},[a,w,Ne]);return Te(fe,{...N,...ve===fR?{onInternalScrollEnd:S,useWindowScroll:A}:{},contentContainerStyle:[a?{height:"100%"}:{},r,ee,{boxSizing:"border-box"}],contentOffset:i!==void 0?a?{x:i,y:0}:{x:0,y:i}:void 0,horizontal:a,maintainVisibleContentPosition:$.size||$.data?{minIndexForVisible:0}:void 0,onLayout:f,onScroll:c,ref:y,ScrollComponent:I?ve:void 0,style:W?[W,o]:o},Te(G4,null),p&&Te(gR,{onLayoutChange:Ae,style:m},og(p)),v&&og(v),O&&Te(tW,{horizontal:a}),t&&!v&&Te(P4,{freshDataTransitionEpoch:n,getRenderedItem:x,horizontal:a,ItemSeparatorComponent:l,recycleItems:s,stickyHeaderConfig:T}),h&&Te(gR,{onLayoutChange:ae,style:g},og(h)),Vo&&nq)}),oW=100,rW=.9,aW=.9;function iW(e){let t=Br(),{anchoredEndSpace:n,childrenMode:o,keyExtractor:r,numColumns:a,renderScrollComponent:i,useWindowScroll:s}=e,l=!!n;q(()=>{l&&(a??1)>1&&Us("anchoredEndSpaceNumColumns","anchoredEndSpace is only supported when numColumns is 1. Using it with multiple columns may produce incorrect anchored spacing.")},[l,a]),q(()=>{s&&i&&Us("useWindowScrollRenderScrollComponent","useWindowScroll is not supported when renderScrollComponent is provided.")},[i,s]),q(()=>{!r&&!t.state.isFirst&&t.state.didDataChange&&!o&&Us("keyExtractor","Changing data without a keyExtractor can cause slow performance and resetting scroll. If your list data can change you should use a keyExtractor with a unique id for best performance and behavior.")},[o,t,r]),q(()=>{let d=t.state,c=d.props.data.length;if(d.props.useWindowScroll||c<oW)return;let p=()=>{let h=de(t,"readyToRender"),g=de(t,"numContainers")||0,v=de(t,"totalSize")||0,x=t.state.scrollLength||0;if(!h||v<=0||x<=0)return;let y=g>=Math.ceil(c*rW),C=x>=v*aW;y&&C&&Us("webUnboundedOuterSize","LegendList appears to have an unbounded outer height on web, so virtualization is effectively disabled. Set a bounded height or flex: 1 on the list container, or use useWindowScroll.")};p();let m=[$a(t,"numContainers",p),$a(t,"readyToRender",p),$a(t,"totalSize",p)];return()=>{for(let h of m)h()}},[t])}function sW(e){}var lW=Vo?iW:sW;function dW(e,t,{didColumnsChange:n=!1}={}){let o=e.state,{previousData:r}=o,{maintainScrollAtEnd:a}=o.props;if(n){o.sizes.clear(),o.sizesKnown.clear(),jR(o);for(let l in o.averageSizes)delete o.averageSizes[l];o.minIndexSizeChanged=0,o.scrollForNextCalculateItemsInView=void 0}Ha(e,{dataChanged:!0,doMVCP:!0});let s=!n&&a?.onDataChange&&cd(e);!s&&r&&t.length>r.length&&(o.isEndReached=!1),s||mg(e),delete o.previousData}function cW(e,t,n){var o;if(e.pendingDataComparison=void 0,!n||!t||t.length!==n.length)return!0;let{idCache:r,props:{itemsAreEqual:a,keyExtractor:i}}=e,s;for(let l=0;l<t.length;l++){if(t[l]===n[l])continue;if(!i)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;let d=(o=r[l])!=null?o:i(n[l],l),c=i(t[l],l);if(d!==c)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;if(!a)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;let f=a(n[l],t[l],l,t);if(s??(s=[]),s[l]=f?1:2,!f)return e.pendingDataComparison={byIndex:s,nextData:t,previousData:n},!0}return!1}function mN(e){var t,n;let o=e.state,{scrollLength:r,props:{data:a,getFixedItemSize:i,getItemType:s,numColumns:l,estimatedItemSize:d}}=o,c=NR(e),f=de(e,"numContainers");if(r>0&&a.length>0&&!f){let p;if(i){let h=0,g=Math.min(20,a.length);for(let v=0;v<g;v++){let x=a[v];if(x!==void 0){let y=(t=s?.(x,v))!=null?t:"";h+=((n=i(x,v,y))!=null?n:d)+e.scrollAxisGap}}p=h/g}else p=d+e.scrollAxisGap;let m=Math.max(1,Math.ceil((r+c*2)/p*l));for(let h=0;h<m;h++)Pe(e,`containerPosition${h}`,sd),Pe(e,`containerColumn${h}`,-1),Pe(e,`containerSpan${h}`,1);return Pe(e,"numContainers",m),Pe(e,"numContainersPooled",FV(a.length,m)),o.lastLayout&&(o.initialScroll?requestAnimationFrame(()=>{Ha(e,{dataChanged:!0,doMVCP:!0})}):Ha(e,{dataChanged:!0,doMVCP:!0})),!0}}function uW(){return typeof window>"u"?{height:0,width:0}:{height:window.innerHeight,width:window.innerWidth}}function fW(e,t,n){let o=e.state,{maintainScrollAtEnd:r,useWindowScroll:a}=o.props,i=o.props.horizontal?"width":"height",s=o.props.horizontal?"height":"width",l=t;if(a){let v=uW()[i];l=v>0?{...t,[i]:v}:t}let d=l[i],c=o.scrollLength,f=d>0?d:c,p=l[s],m=!o.lastLayout||f>o.scrollLength||o.lastLayout.x!==l.x||o.lastLayout.y!==l.y;o.lastLayout=l;let h=o.otherAxisSize,g=f!==o.scrollLength||p!==h;if(g){if(o.scrollLength=f,o.otherAxisSize=p,Gs(e),o.lastBatchingAction=Date.now(),o.scrollForNextCalculateItemsInView=void 0,f>0&&mN(e),m&&Ha(e,{doMVCP:!0}),(g||p!==h)&&Pe(e,"scrollSize",{height:l.height,width:l.width}),r?.onLayout&&cd(e),mg(e),o){let v=o.props.horizontal?(o.props.stylePaddingTop||0)+(o.props.stylePaddingBottom||0):(o.props.stylePaddingLeft||0)+(o.props.stylePaddingRight||0);o.needsOtherAxisSize=p-v<10}Vo&&d===0&&Us("height0",`List ${o.props.horizontal?"width":"height"} is 0. You may need to set a style or \`flex: \` for the list, because children are absolutely positioned.`)}n(!0)}function pW(e,t){let n=oo.get(e);if(!!n&&oo.didReachTarget(t,n)){oo.clear(e);return}n&&(e.hasScrolled=!1,oo.set(e,{startScroll:n.startScroll,targetOffset:n.targetOffset}))}function mW(e){var t;return!!e.initialScroll&&((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"&&!e.didFinishInitialScroll}function gW(e){return{...e,nativeEvent:{...e.nativeEvent}}}function hW(e,t){var n,o,r,a,i,s;let l=e.state,{scrollProcessingEnabled:d}=l;if(d===!1||((o=(n=t.nativeEvent)==null?void 0:n.contentSize)==null?void 0:o.height)===0&&((r=t.nativeEvent.contentSize)==null?void 0:r.width)===0)return;let c=!1;if((a=t.nativeEvent)!=null&&a.contentInset){let{contentInset:p}=t.nativeEvent,m=l.nativeContentInset;(!m||m.top!==p.top||m.bottom!==p.bottom||m.left!==p.left||m.right!==p.right)&&(l.nativeContentInset=p,c=!0)}let f=t.nativeEvent.contentOffset[l.props.horizontal?"x":"y"];if(l.props.horizontal&&(f=UK(l,f,(i=t.nativeEvent.contentSize)==null?void 0:i.width)),l.didFinishInitialScroll&&((s=l.initialScroll)==null?void 0:s.viewPosition)===1&&l.scroll>l.scrollLength,l.lastNativeScroll=f,l.lastNativeScrollTime=Date.now(),l.scrollingTo&&l.scrollingTo.offset>=f){let p=Mi(e,f,l.scrollingTo);if(f!==p&&Math.abs(f-p)>1){f=p,yg(e,{forceScroll:!0,isInitialScroll:!0,noScrollingTo:!0,offset:f});return}}l.scrollPending=f,qs(e,f,c,{fromNativeScrollEvent:!0}),pW(l,f),rV(e),l.scrollingTo&&RC(e),l.props.onScroll&&(mW(l)?l.deferredPublicOnScrollEvent=gW(t):l.props.onScroll(t))}var vW=class{constructor(){this.work=new Map}timeout(e,t,n){n&&this.cancel(n);let o=[void 0,clearTimeout],r=setTimeout(()=>{let a=n??r;this.work.get(a)===o&&(this.work.delete(a),e())},t);o[0]=r,this.work.set(n??r,o)}frame(e,t){this.cancel(t);let n=[void 0,cancelAnimationFrame];this.work.set(t,n),n[0]=requestAnimationFrame(()=>{this.work.get(t)===n&&(this.work.delete(t),e())})}register(e,t){this.cancel(e),this.work.set(e,[void 0,t])}cancel(e){let t=this.work.get(e);if(t){this.work.delete(e);let[n,o]=t;o(n)}}has(e){return this.work.has(e)}dispose(){for(let[e,t]of this.work.values())t(e);this.work.clear()}},xW=class{constructor(e){this.appliedAdjust=0,this.pendingAdjust=0,this.ctx=e}requestAdjust(e){let t=this.ctx.state.scrollingTo;t?.animated&&!t.isInitialScroll?(this.pendingAdjust+=e,Pe(this.ctx,"scrollAdjustPending",this.pendingAdjust)):(this.appliedAdjust+=e,Pe(this.ctx,"scrollAdjust",this.appliedAdjust)),this.ctx.state.scrollingTo&&RC(this.ctx)}getAdjust(){return this.appliedAdjust}commitPendingAdjust(e){{let t=this.ctx.state,n=this.pendingAdjust;if(this.pendingAdjust=0,n!==0){let o;if(e?.index!==void 0){let a=gg(this.ctx,e.index);o=vg(this.ctx,a,e),o=Mi(this.ctx,o,e)}else o=Mi(this.ctx,t.scroll+n);let r=o-t.scroll;(Math.abs(r)>.1||Math.abs(n)>.1)&&(this.appliedAdjust+=r,t.scroll=o,t.scrollForNextCalculateItemsInView=void 0,Pe(this.ctx,"scrollAdjust",this.appliedAdjust)),Pe(this.ctx,"scrollAdjustPending",0),Ha(this.ctx)}}}};function yW(e,t){let n=e.state,o=Ks(e,t),a=Ks(e)-o;if(a!==0){let i=!!de(e,"isWithinMaintainScrollAtEndThreshold");qs(e,n.scroll,!0,{markHasScrolled:!1}),!YR(e)&&i&&a>0&&js(e,a)}}function iC(e){return z(()=>e?(t,n,o)=>t!==void 0&&n!==void 0?e(t,n,o):void 0:void 0,[e])}var CW=(...e)=>B(n=>{for(let o of e)o&&(OR(o)?o(n):o.current=n)},e);function bW(e){return null}function IW(e,t,n,o){return o}function SW(e){let{gap:t,columnGap:n,rowGap:o}=e;if(t||n||o)return e.gap=void 0,e.columnGap=void 0,e.rowGap=void 0,{columnGap:n,gap:t,rowGap:o}}function wW(e,t){let n=e.state,r=n.props.data.length-1;if(r===-1)return!1;let a=n.props.stylePaddingBottom||0,i=de(e,"footerSize")||0;return ng(e,{...t,index:r,viewOffset:-a-i+(t?.viewOffset||0),viewPosition:1}),!0}var TW="default";function LW(e){let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];o&&(t[n||TW]={average:o.avg,count:o.num})}return t}function kW(e){lg(e)}function PW(e,t){let n=e.state,o=800,r=2,a=0,i=()=>!!n.didDataChange||!!n.didColumnsChange||n.scheduledWork.has("mvcpRecalculate")||n.ignoreScrollFromMVCP!==void 0,s=(g,v=!1)=>{var x;let y=n.props,C=y.data.length,w=(x=y.anchoredEndSpace)==null?void 0:x.anchorIndex;return g<0?v:g>=C?!1:w===void 0||w<0||w>=C||g<w?!0:Cq(e,w,C-1)},l=(g,v,x)=>{let y=Date.now(),C=0,w=()=>{if(g!==a)return;i()||!x()?C=0:C+=1;let k=Date.now()-y>=o;if(C>=r||k){v();return}n.scheduledWork.frame(w,"imperativeScrollReady")};n.scheduledWork.frame(w,"imperativeScrollReady")},d=(g,v,x,y=()=>!0)=>{let C=()=>{if(g!==a)return;(!x()||!n.scrollingTo)&&(n.pendingScrollResolve===v&&(n.pendingScrollResolve=void 0),v())};i()||!y()?l(g,C,y):C()},c=g=>{n.scheduledWork.cancel("imperativeScrollReady");let v=++a;return TR(n),n.pendingScrollResolve=g,v},f=(g,v=()=>!0)=>new Promise(x=>{let y=c(x);WM(e),d(y,x,g,v)});n.runPendingScrollToEnd=()=>{let g=n.pendingScrollToEnd;g&&(n.pendingScrollToEnd=void 0,g.token===a&&d(g.token,g.resolve,()=>wW(e,g.options),()=>s(n.props.data.length-1,!0)))};let p=g=>{if(n){let{index:v,...x}=g,{startNoBuffer:y,endNoBuffer:C}=n;if(v<y||v>C){let w=v<y?0:1;return ng(e,{...x,index:v,viewPosition:w}),!0}}return!1},m=n.refScroller;return{clearCaches:g=>{var v,x;let y=(v=g?.mode)!=null?v:"sizes";n.sizes.clear(),n.sizesKnown.clear(),jR(n);for(let C in n.averageSizes)delete n.averageSizes[C];n.minIndexSizeChanged=0,n.scrollForNextCalculateItemsInView=void 0,n.pendingTotalSize=void 0,n.totalSize=0,Pe(e,"totalSize",0),y==="full"&&(n.indexByKey.clear(),n.idCache.length=0,n.positions.length=0,n.columns.length=0,n.columnSpans.length=0),kW(e),(x=n.triggerCalculateItemsInView)==null||x.call(n,{forceFullItemPositions:!0})},flashScrollIndicators:()=>m.current.flashScrollIndicators(),getAnimatableRef:()=>{var g,v,x;return(x=(v=(g=m.current).getNativeScrollRef)==null?void 0:v.call(g))!=null?x:m.current},getNativeScrollRef:()=>m.current,getScrollableNode:()=>m.current.getScrollableNode(),getScrollResponder:()=>m.current.getScrollResponder(),getState:()=>({activeStickyIndex:de(e,"activeStickyIndex"),contentLength:po(e),data:n.props.data,elementAtIndex:g=>{var v;return(v=e.viewRefs.get(cC(e,Bt(n,g))))==null?void 0:v.current},end:n.endNoBuffer,endBuffered:n.endBuffered,getAverageItemSizes:()=>LW(n),indexByKey:g=>n.indexByKey.get(g),isAtEnd:de(e,"isAtEnd"),isAtStart:de(e,"isAtStart"),isEndReached:n.isEndReached,isNearEnd:de(e,"isNearEnd"),isNearStart:de(e,"isNearStart"),isStartReached:n.isStartReached,isWithinMaintainScrollAtEndThreshold:de(e,"isWithinMaintainScrollAtEndThreshold"),listen:(g,v)=>$a(e,g,v),listenToPosition:(g,v)=>jK(e,g,v),positionAtIndex:g=>n.positions[g],positionByKey:g=>{let v=n.indexByKey.get(g);return v===void 0?void 0:n.positions[v]},scroll:n.scroll,scrollLength:n.scrollLength,scrollVelocity:xg(n),sizeAtIndex:g=>n.sizesKnown.get(Bt(n,g)),sizes:n.sizesKnown,start:n.startNoBuffer,startBuffered:n.startBuffered}),reportContentInset:g=>{let v=Z4(e,g);qs(e,n.scroll,!0,{markHasScrolled:!1}),v&&YR(e)},scrollIndexIntoView:g=>f(()=>p(g)),scrollItemIntoView:({item:g,...v})=>f(()=>{let y=n.props.data.indexOf(g);return y!==-1?(p({index:y,...v}),!0):!1}),scrollToEnd:g=>new Promise(v=>{var x;let y=c(v);n.pendingScrollToEnd={options:g,resolve:v,token:y},t?.(),WM(e),t||(x=n.runPendingScrollToEnd)==null||x.call(n)}),scrollToIndex:g=>f(()=>(ng(e,g),!0),g.index>=0?()=>s(g.index):void 0),scrollToItem:({item:g,...v})=>f(()=>{let y=n.props.data.indexOf(g);return y!==-1?(ng(e,{index:y,...v}),!0):!1}),scrollToOffset:g=>f(()=>(yg(e,g),!0)),setItemSize:(g,v)=>{sN(e,{itemKey:g,size:v})},setScrollProcessingEnabled:g=>{n.scrollProcessingEnabled=g},setVisibleContentAnchorOffset:g=>{let v=OR(g)?g(de(e,"scrollAdjustUserOffset")||0):g;Pe(e,"scrollAdjustUserOffset",v)}}}var AW=(e,t)=>e-t,hR=e=>typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):0,yu=(e,t,n)=>{n>=0&&n<t&&e.add(n)};function EW(e,t,n,o){var r,a;if(t.length===0)return[];let i=new Set,s=t.length,l=hR(e?.top);if(l>0)for(let f=0;f<Math.min(l,s);f++)yu(i,s,f);let d=hR(e?.bottom);if(d>0)for(let f=Math.max(0,s-d);f<s;f++)yu(i,s,f);if((r=e?.indices)!=null&&r.length)for(let f of e.indices)Number.isFinite(f)&&yu(i,s,Math.floor(f));if((a=e?.keys)!=null&&a.length){let f=new Set(e.keys);for(let p=0;p<s&&f.size>0;p++){let m=n(t[p],p);f.has(m)&&(yu(i,s,p),f.delete(m))}}if(o!==void 0&&Number.isFinite(o)){let f=Math.floor(o);for(let p=f>=0?f:s;p<s;p++)yu(i,s,p)}let c=Array.from(i);return c.sort(AW),c}function MW(e,t){var n;let o=e.state;if(!o)return null;let{indexByKey:r,props:{data:a,getItemType:i,renderItem:s}}=o,l=r.get(t);if(l===void 0)return null;let d=null,c=de(e,"extraData"),f=a[l];if(s&&!Su(f)){let p={data:a,extraData:c,index:l,item:f,type:i&&(n=i(f,l))!=null?n:""};d=s(p)}return{index:l,item:a[l],renderedItem:d}}function vR(e,t){var n,o,r,a;return{animated:!1,onDataChange:t?(n=e?.dataChange)!=null?n:!1:!0,onFooterLayout:t?(o=e?.footerLayout)!=null?o:!1:!0,onItemLayout:t?(r=e?.itemLayout)!=null?r:!1:!0,onLayout:t?(a=e?.layout)!=null?a:!1:!0}}function RW(e){var t;return e?e===!0?{...vR(void 0,!1),animated:!1}:{...vR(e.on,"on"in e),animated:(t=e.animated)!=null?t:!1}:void 0}function NW(e){var t,n;return e===!0?{data:!0,size:!0}:e&&typeof e=="object"?{data:(t=e.data)!=null?t:!1,shouldRestorePosition:e.shouldRestorePosition,size:(n=e.size)!=null?n:!0}:e===!1?{data:!1,size:!1}:{data:!1,size:!0}}function _W(e,{stylePaddingTop:t}){let n=e.state;if(t!==void 0){let o=de(e,"stylePaddingTop")||0;if(t<o){let r=de(e,"totalSize")||0;Pe(e,"totalSize",r+o),n.timeoutSetPaddingTop=setTimeout(()=>{r=de(e,"totalSize")||0,Pe(e,"totalSize",r-o)},16)}Pe(e,"stylePaddingTop",t)}}function DW(e){let t=_(null),n=_(0),o=_(null),r=()=>{t.current&&(clearTimeout(t.current),t.current=null)};return B((i,s,...l)=>{{let d=Date.now();o.current=l,d-n.current>=s?(n.current=d,i(...l),r()):(r(),t.current=setTimeout(()=>{o.current&&(n.current=Date.now(),i(...o.current),t.current=null,o.current=null)},s-(d-n.current)))}},[e])}function OW(e,t){let n=DW("throttle");return o=>n(e,t,{nativeEvent:o.nativeEvent})}var FW=la(lN(function(t,n){let{children:o,data:r,renderItem:a,...i}=t,l=o!==void 0&&r===void 0?{...i,childrenMode:!0,data:(hg(o)?o:ah.toArray(o)).flat(1),renderItem:({item:d})=>d}:{...i,data:r||[],renderItem:a};return Te(VK,null,Te(BW,{...l,ref:n}))})),BW=lN(function(t,n){var o,r,a,i,s,l,d,c,f,p,m,h,g,v,x,y,C,w,k;let S=B($e=>{},[]);t.recycleItems===void 0&&Us("recycleItems-omitted","recycleItems was not provided, so it defaults to false. Set recycleItems explicitly to true for better performance with recycling-aware rows, or false to preserve remount-on-reuse behavior.");let{alignItemsAtEnd:L=!1,anchoredEndSpace:I,alwaysRender:T,columnWrapperStyle:E,contentContainerStyle:A,contentInset:N,data:R=[],dataKey:$,dataVersion:H,drawDistance:K=250,contentInsetEndAdjustment:O,estimatedItemSize:oe=100,estimatedListSize:ee,extraData:W,getFixedItemSize:qe,getItemType:ve,horizontal:fe,rtl:Ne,estimatedHeaderSize:Ae,initialScrollAtEnd:ae=!1,initialScrollIndex:Ee,initialScrollOffset:xe,experimental_adaptiveRender:re,itemsAreEqual:Ie,keyExtractor:st,ListEmptyComponent:dt,ListFooterComponent:lt,ListFooterComponentStyle:ct,ListHeaderComponent:Et,maintainScrollAtEnd:ot=!1,maintainScrollAtEndThreshold:He=.1,maintainVisibleContentPosition:Se,numColumns:ze=1,overrideItemLayout:Je,onEndReached:qt,onEndReachedThreshold:X=.5,onItemSizeChanged:nn,onMetricsChange:xt,onLayout:mn,onLoad:Tt,onMomentumScrollEnd:Yt,onRefresh:Jt,onScroll:Mt,onScrollBeginDrag:zn,onStartReached:kn,onStartReachedThreshold:vn=.5,onStickyHeaderChange:$n,onFirstVisibleItemChanged:Vt,onViewableItemsChanged:Zt,progressViewOffset:Sn,recycleItems:ho=!1,refreshControl:zt,refreshing:D,refScrollView:Y,renderScrollComponent:ce,renderItem:ie,scrollEventThrottle:pe,snapToIndices:Ze,stickyHeaderIndices:pt,style:xn,useWindowScroll:ht=!1,viewabilityConfig:en,viewabilityConfigCallbackPairs:tn,...bt}=t,yn=t.animatedPropsInternal,sn=(o=t.anchoredEndSpaceOwnerInternal)!=null?o:"list",ge=t.positionComponentInternal,Rt=t.stickyPositionComponentInternal,{anchoredEndSpaceOwnerInternal:rt,positionComponentInternal:Lt,stickyPositionComponentInternal:et,...Nt}=bt,ut=Mu.flatten(A),ft=L&&!fe&&ut?.minHeight==null&&R.length>0,eo=L&&!ft&&(fe?ut?.minWidth==null:ut?.minHeight==null),ln={...ut,...L&&!ft?{display:"flex",flexDirection:fe?"row":"column",...eo?{flexGrow:1}:{},justifyContent:"flex-end"}:{}},Nn={...Mu.flatten(xn)},Hn=Cu(Nn,ln,"Top"),Un=Cu(Nn,ln,"Bottom"),ne=Cu(Nn,ln,"Left"),Fe=Cu(Nn,ln,"Right"),at=bC({horizontal:fe,rtl:Ne,stylePaddingBottom:Un,stylePaddingLeft:ne,stylePaddingRight:Fe}),je=RW(ot),wn=NW(Se),dn=Ee!=null,Cn=xe!=null,$t=!ae&&!dn&&!Cn&&CC({horizontal:fe,rtl:Ne}),Kn=!ae&&!dn&&(Cn||$t),Wt=ae||dn,vo=ae?{index:Math.max(0,R.length-1),preserveForBottomPadding:!0,viewOffset:-at,viewPosition:1}:dn?typeof Ee=="object"?{index:(r=Ee.index)!=null?r:0,preserveForBottomPadding:Ee.viewOffset===void 0&&Ee.viewPosition===1?!0:void 0,viewOffset:(a=Ee.viewOffset)!=null?a:Ee.viewPosition===1?-at:0,viewPosition:(i=Ee.viewPosition)!=null?i:0}:{index:Ee??0,viewOffset:xe??0}:Kn?{contentOffset:xe??0,index:0,viewOffset:0}:void 0,[Wa,Ga]=G(!SC),[,Ni]=Za($e=>$e+1,0),he=Br();he.columnWrapperStyle=E||(ln?SW(ln):void 0);let da=fe?(d=(s=he.columnWrapperStyle)==null?void 0:s.columnGap)!=null?d:(l=he.columnWrapperStyle)==null?void 0:l.gap:(p=(c=he.columnWrapperStyle)==null?void 0:c.rowGap)!=null?p:(f=he.columnWrapperStyle)==null?void 0:f.gap,Go=typeof da=="number"&&Number.isFinite(da)?da:0,ja=_(null),gd=CW(ja,Y),ca=st??(($e,vt)=>vt.toString()),qn=pt,_t=O,ro=_(_t),on=z(()=>{let $e=EW(T,R,ca,I?.anchorIndex);return{arr:$e,set:new Set($e)}},[I?.anchorIndex,T?.top,T?.bottom,(m=T?.indices)==null?void 0:m.join(","),(h=T?.keys)==null?void 0:h.join(","),R,$,H,ca]),_i=!!ht&&!ce,It=_(void 0),xo=!!Je,bn=_(xo);if(!It.current){if(!he.state){let $e=(ee??{height:0,width:0})[fe?"width":"height"];he.values.set("adaptiveRender",(g=re?.initialMode)!=null?g:"normal"),he.state={averageSizes:{},columnSpans:[],columns:[],containerItemGenerations:[],containerItemKeys:new Map,containerItemMetadata:new Map,contentInsetOverride:void 0,dataChangeEpoch:0,dataChangeNeedsScrollUpdate:!1,didColumnsChange:!1,didDataChange:!1,didLoad:!1,enableScrollForNextCalculateItemsInView:!0,endBuffered:-1,endNoBuffer:-1,endReachedSnapshot:void 0,firstFullyOnScreenIndex:-1,freshDataTransitionEpoch:0,hasHadNonEmptyData:R.length>0,idCache:[],idsInView:[],indexByKey:new Map,initialScroll:vo,initialScrollSession:vo?{kind:Kn?"offset":"bootstrap",previousDataLength:R.length}:void 0,isEndReached:null,isFirst:!0,isStartReached:null,lastBatchingAction:Date.now(),lastLayout:void 0,lastScrollDelta:0,loadStartTime:Date.now(),minIndexSizeChanged:0,nativeContentInset:void 0,nativeMarginTop:0,pendingDataComparison:void 0,pendingNativeMVCPAdjust:void 0,positions:[],props:{},queuedCalculateItemsInView:0,refScroller:{current:null},scheduledWork:new vW,scroll:0,scrollAdjustHandler:new xW(he),scrollForNextCalculateItemsInView:void 0,scrollHistory:[],scrollLength:$e,scrollPending:0,scrollPrev:0,scrollPrevTime:0,scrollProcessingEnabled:!0,scrollTime:0,sizes:new Map,sizesKnown:new Map,startBuffered:-1,startNoBuffer:-1,startReachedSnapshot:void 0,stickyContainerPool:new Set,stickyContainers:new Map,totalSize:0,viewabilityConfigCallbackPairs:void 0};let vt=he.state;vt.triggerCalculateItemsInView=cn=>Ha(he,cn),vt.reprocessCurrentScroll=()=>qs(he,vt.scroll,!0),Pe(he,"maintainVisibleContentPosition",wn),Pe(he,"extraData",W),Ae!==void 0&&Pe(he,"headerSize",Ae)}It.current=he.state}let _e=It.current,Gt=_e.isFirst,Eo=_e.props.adaptiveRender,gr=_e.props.numColumns,Di=!Gt&&he.scrollAxisGap!==Go;he.scrollAxisGap=Go,_e.didColumnsChange=ze!==gr||Di;let yo=(x=(v=_e.props.data)==null?void 0:v.length)!=null?x:0,Hr=_e.props.data!==R,jo=_e.props.dataKey!==$,hr=_e.props.dataVersion!==H,ao=jo||hr||Hr&&cW(_e,R,_e.props.data),Ur=!Gt&&ao&&_e.hasHadNonEmptyData&&(jo||yo===0)&&R.length>0;ao&&!ae&&_e.didFinishInitialScroll&&((y=_e.initialScroll)==null?void 0:y.viewPosition)===1&&_e.props.data.length>0&&ld(_e),ao&&(_e.dataChangeEpoch+=1,_e.dataChangeNeedsScrollUpdate=!0,_e.didDataChange=!0,_e.previousData=_e.props.data),Ur&&(_e.freshDataTransitionEpoch+=1);let ua=OW(Mt??S,pe??0),Oi=pe&&Mt?ua:Mt,_n=!Gt&&!ao&&((C=_e.props.anchoredEndSpace)==null?void 0:C.anchorIndex)!==I?.anchorIndex;_e.props={adaptiveRender:re,alignItemsAtEnd:L,alignItemsAtEndPaddingEnabled:ft,alwaysRender:T,alwaysRenderIndicesArr:on.arr,alwaysRenderIndicesSet:on.set,anchoredEndSpace:I,anchoredEndSpaceOwner:sn,animatedProps:yn,contentContainerAlignItems:ln.alignItems,contentInset:N,contentInsetEndAdjustment:_t,data:R,dataKey:$,dataVersion:H,drawDistance:K,estimatedItemSize:oe,getFixedItemSize:iC(qe),getItemType:iC(ve),horizontal:!!fe,itemsAreEqual:Ie,keyExtractor:iC(ca),maintainScrollAtEnd:je,maintainScrollAtEndThreshold:He,maintainVisibleContentPosition:wn,numColumns:ze,onEndReached:qt,onEndReachedThreshold:X,onFirstVisibleItemChanged:Vt,onItemSizeChanged:nn,onLoad:Tt,onMomentumScrollEnd:Yt,onScroll:Oi,onScrollBeginDrag:zn,onStartReached:kn,onStartReachedThreshold:vn,onStickyHeaderChange:$n,overrideItemLayout:Je,positionComponentInternal:ge,recycleItems:!!ho,renderItem:ie,rtl:Ne,snapToIndices:Ze,stickyHeaderIndicesArr:qn??[],stickyHeaderIndicesSet:z(()=>new Set(qn??[]),[qn?.join(",")]),stickyPositionComponentInternal:Rt,stylePaddingBottom:Un,stylePaddingLeft:ne,stylePaddingRight:Fe,stylePaddingTop:Hn,useWindowScroll:_i},_e.refScroller=ja,!Gt&&Eo&&!re&&wC(he);let Fi=z(()=>R.length?Array.from({length:Math.min(ze,R.length)},($e,vt)=>Bt(_e,R.length-1-vt)):[],[R,$,H,ze]),Oo=$e=>{Pe(he,"lastItemKeys",Fi),Pe(he,"numColumns",ze);let vt=de(he,"stylePaddingTop");_W(he,{stylePaddingTop:Hn}),It.current.props.stylePaddingBottom=Un,Gs(he);let cn=Hn-vt;$e&&wn.size&&cn&&vt!==void 0&&Ua.OS};Gt&&(Oo(!1),JR(_e),eN(he,!0));let Bi=z(()=>{var $e,vt;let cn=_e.initialScroll;if(!cn)return;let rn=($e=cn.contentOffset)!=null?$e:Fr(he,cn);return Wt&&((vt=_e.initialScrollSession)==null?void 0:vt.kind)==="bootstrap"&&Ua.OS==="web"?void 0:rn},[Wt]);ye(()=>{wV(he,{alwaysDispatchInitialScroll:$t,dataLength:R.length,hasFooterComponent:!!lt,initialContentOffset:Bi,initialScrollAtEnd:ae,useBootstrapInitialScroll:Wt})},[]),(Gt||ao||_e.didColumnsChange)&&(It.current.lastBatchingAction=Date.now(),!st&&!Gt&&ao&&(It.current.sizes.clear(),It.current.positions.length=0,It.current.totalSize=0,Pe(he,"totalSize",0))),Vo&&lW(t),ye(()=>{Ur&&LC(he,{resetInitialScroll:!!vo,resetLayout:!0}),TV(he,{dataLength:R.length,didDataChange:ao,didStartFreshData:Ur,initialScrollAtEnd:ae,latestInitialScroll:vo,latestInitialScrollSessionKind:Kn?"offset":"bootstrap",stylePaddingEnd:at,useBootstrapInitialScroll:Wt})},[R.length,$,ao,Ur,ae,at,Wt]),ye(()=>{var $e;_n&&(_e.scrollForNextCalculateItemsInView=void 0,($e=_e.triggerCalculateItemsInView)==null||$e.call(_e)),dg(he)},[he,R,H,I?.anchorIndex,I?.anchorMaxSize,I?.anchorOffset,_n,fe,ze,Ne,Un,ne,Fe]),ye(()=>{let $e=ro.current;ro.current=_t,yW(he,$e)},[he,_t]);let Fo=B($e=>{Wt&&sV(he,{dataLength:R.length,footerSize:$e[fe?"width":"height"],initialScrollAtEnd:ae,stylePaddingEnd:at})},[R.length,ae,fe,at,Wt]),vr=B(($e,vt)=>{let cn=_e.scrollLength,rn=_e.otherAxisSize;fW(he,$e,Ga),dg(he);let Qa=cn!==_e.scrollLength||rn!==_e.otherAxisSize;Wt&&!vt&&Qa&&lV(he),!Wt&&Pu(he)},[R.length,ae,at,Wt]),{onLayout:Qo}=DC({onLayoutChange:vr,onLayoutProp:mn,ref:ja});ye(()=>{Ze&&ZR(he)},[Ze]),ye(()=>Oo(!0),[$,H,Fi.join(","),ze,Go,Un,Hn,ft]),ye(()=>{let{didColumnsChange:$e,didDataChange:vt,isFirst:cn,props:{data:rn}}=_e;!(rn.length>0&&mN(he))&&!cn&&(vt||$e)&&dW(he,rn,{didColumnsChange:$e}),vt&&(_e.pendingDataComparison=void 0),_e.didColumnsChange=!1,_e.didDataChange=!1,_e.isFirst=!1},[R,$,H,ze,Go]),ye(()=>{var $e;Pe(he,"extraData",W);let vt=bn.current!==xo;bn.current=xo,(xo||vt)&&ze>1&&(($e=_e.triggerCalculateItemsInView)==null||$e.call(_e,{forceFullItemPositions:!0}))},[W,xo,ze]),q(()=>{if(!xt)return;let $e,vt=()=>{let rn={footerSize:de(he,"footerSize")||0,headerSize:de(he,"headerSize")||0};(!$e||rn.headerSize!==$e.headerSize||rn.footerSize!==$e.footerSize)&&($e=rn,xt(rn))};vt();let cn=[$a(he,"headerSize",vt),$a(he,"footerSize",vt)];return()=>{for(let rn of cn)rn()}},[he,xt]),q(()=>{let $e=MV({onViewableItemsChanged:Zt,viewabilityConfig:en,viewabilityConfigCallbackPairs:tn});_e.viewabilityConfigCallbackPairs=$e,_e.enableScrollForNextCalculateItemsInView=!0,$e&&(_e.scrollForNextCalculateItemsInView=void 0)},[en,tn,Zt]),d4(()=>{}),Gr(n,()=>PW(he,Ni),[]),q(()=>()=>{rq(_e),_e.scheduledWork.dispose()},[_e]),ye(()=>{var $e;($e=_e.runPendingScrollToEnd)==null||$e.call(_e)}),q(()=>{Wt||Pu(he)},[he,Wt]);let io=z(()=>({getRenderedItem:$e=>MW(he,$e),onMomentumScrollEnd:$e=>{IV(he),_e.props.onMomentumScrollEnd&&_e.props.onMomentumScrollEnd($e)},onScroll:$e=>hW(he,$e),onScrollBeginDrag:$e=>{var vt,cn;KM(he),(cn=(vt=_e.props).onScrollBeginDrag)==null||cn.call(vt,$e)},onScrollEnd:()=>KM(he)}),[]),zi=IW(qn,fe,he,io.onScroll),Bo=zt;return Te(Ja,null,Te(nW,{...Nt,alignItemsAtEnd:L,canRender:Wa,contentContainerStyle:ln,contentInset:N,freshDataTransitionEpoch:_e.freshDataTransitionEpoch,getRenderedItem:io.getRenderedItem,horizontal:fe,initialContentOffset:Bi,ListEmptyComponent:R.length===0?dt:void 0,ListFooterComponent:lt,ListFooterComponentStyle:ct,ListHeaderComponent:Et,onInternalScrollBeginDrag:io.onScrollBeginDrag,onInternalScrollEnd:io.onScrollEnd,onLayout:Qo,onLayoutFooter:Fo,onMomentumScrollEnd:io.onMomentumScrollEnd,onScroll:zi,recycleItems:ho,refreshControl:Bo?Hn>0?lf(Bo,{progressViewOffset:((w=Bo.props.progressViewOffset)!=null?w:0)+Hn}):Bo:Jt&&Te(bW,{onRefresh:Jt,progressViewOffset:(Sn||0)+Hn,refreshing:!!D}),refScrollView:gd,renderScrollComponent:ce,scrollAdjustHandler:(k=It.current)==null?void 0:k.scrollAdjustHandler,scrollEventThrottle:0,snapToIndices:Ze,stickyHeaderIndices:qn,style:Nn,useWindowScroll:_i}),Vo&&oq)});var zW=FW;var gN=zW;me();me();function $W(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function HW(e,t){let n=t?.trim();if(!n)return e;let o=new RegExp(`^${$W(n)}(?:\\s*[.:/-]\\s*|\\s+)`,"iu");return e.replace(o,"").trim()||e}function OC(e,t){let n=t?.preferShortName&&e.shortName?e.shortName:e.name;return HW(n,e.subProvider)}function ud(e){return OC(e,{preferShortName:!0})}var FC="model:",BC="legacy-models:",zC="action:",fd="pluginActions:manage";function Nu(e,t){return`${FC}${e.length}:${e}${t}`}function HC(e){if(!e.startsWith(FC))return null;let t=e.slice(FC.length),n=t.indexOf(":");if(n===-1)return null;let o=t.slice(0,n);if(!/^\d+$/.test(o))return null;let r=Number(o),a=t.slice(n+1);return!Number.isSafeInteger(r)||r>a.length?null:{instanceId:a.slice(0,r),slug:a.slice(r)}}function UC(e){return`${BC}${e}`}function hN(e){return e.startsWith(BC)?e.slice(BC.length):null}function _u(e){return`${zC}${e}`}function vN(e){if(!e.startsWith(zC))return null;let t=e.slice(zC.length);return t.length>0?t:null}var $C="choice:";function KC(e){return`${$C}${JSON.stringify([e.environmentId,e.runtimeId,e.sourceId,e.profileId,e.endpointId??""])}`}function xN(e){if(!e.startsWith($C))return null;try{let t=JSON.parse(e.slice($C.length));if(!Array.isArray(t)||t.length!==5)return null;let[n,o,r,a,i]=t;return typeof n!="string"||typeof o!="string"||typeof r!="string"||typeof a!="string"||typeof i!="string"?null:{environmentId:n,runtimeId:o,sourceId:r,profileId:a,...i.length>0?{endpointId:i}:{}}}catch{return null}}var yN=ue(function(t){let{t:n}=De(),o=t.isFavorite?n("modelPicker.removeFromFavorites"):n("modelPicker.addToFavorites"),r=[t.providerDisplayName,t.sourceLabel,t.model.subProvider,t.providerAccountEmail].filter(s=>typeof s=="string"&&s.length>0).join(" \xB7 "),a=b(gl,{hideIndicator:!0,index:t.index,value:t.itemKey??Nu(t.instanceId,t.model.slug),disabled:!!t.disabledReason,contentClassName:"flex w-full items-center gap-3",className:F("group relative w-full !min-w-0 max-w-full cursor-pointer rounded-md px-2 py-2 transition-colors duration-(--control-duration)","hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-highlighted:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-selected:bg-foreground/[0.08] data-selected:text-foreground data-selected:ring-0 [&[data-highlighted][data-selected]]:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]",t.disabledReason&&"data-disabled:pointer-events-auto data-disabled:cursor-not-allowed data-disabled:hover:bg-transparent"),children:[b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"flex min-w-0 items-center gap-2",children:u("div",{className:"min-w-0 truncate text-xs font-medium leading-snug",children:t.useTriggerLabel?ud(t.model):OC(t.model,t.preferShortName?{preferShortName:!0}:void 0)})}),t.showProvider&&b("div",{className:"mt-1 flex items-center gap-1.5",children:[u(Ia,{providerId:t.providerId,displayName:t.providerDisplayName,accentColor:t.providerAccentColor,className:"size-icon-2",iconClassName:"size-3",indicatorBackground:"var(--popover)"}),u("span",{className:"truncate text-xs font-normal leading-snug text-muted-foreground/70",children:r})]})]}),b("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jumpLabel?u(Ef,{className:"h-4 min-w-0 rounded-sm px-1.5 text-[10px]",children:t.jumpLabel}):null,b(Qe,{children:[u(Ye,{render:u(te,{size:"icon-xs",variant:"ghost",className:F("-mr-1 shrink-0 text-muted-foreground/70 opacity-64 transition-[color,opacity] hover:text-foreground hover:opacity-100 group-hover:opacity-100",t.isFavorite&&"text-foreground opacity-100"),onClick:s=>{s.stopPropagation(),t.onToggleFavorite()},onKeyDown:s=>{s.stopPropagation()},softDisabled:!!t.disabledReason,"aria-label":o,children:u(rs,{className:F("size-icon-1",t.isFavorite&&"fill-current text-yellow-500")})})}),u(Xe,{side:"top",align:"center",children:o})]})]})]}),i=t.disabledReason??t.actionLabel;return i?b(Qe,{children:[u(Ye,{render:a}),u(Xe,{side:"left",align:"center",className:"max-w-64 text-balance leading-snug",children:i})]}):a});function Ig(e){return e==="ready"}function CN(e){return e==="ready"||e==="unchecked"||e==="checking"}function bN(e,t){switch(e){case"ready":return t("readiness.ready.title");case"unchecked":return t("readiness.unchecked.title");case"checking":return t("readiness.checking.title");case"disabled":return t("readiness.disabled.title");case"not-installed":return t("readiness.notInstalled.title");case"unauthenticated":return t("readiness.unauthenticated.title");case"error":return t("readiness.error.title");default:return e}}function Du(e){return e.enabled&&CN(e.readiness)}function IN(e){return e.enabled}function SN(e){let t=new Map;for(let n of e){let o=t.get(n.driverKind);o?o.push(n):t.set(n.driverKind,[n])}return[...t.values()].flat()}var Sg=e=>e.enabled;function wg(e,t){if(t!==void 0){let n=e.find(o=>o.instanceId===t);if(n&&Sg(n))return n}return e.find(n=>n.enabled&&Ig(n.readiness))??e.find(Du)??e.find(n=>Sg(n)&&n.readiness!=="error")}function wN(e,t){let n=e.find(o=>o.instanceId===t);if(n)return n.driverKind}me();function UW(e,t){let n=e.displayName,o=e.enabled?e.readiness:"disabled";if(Ig(o))return n;let r=bN(o,t),a=e.snapshot.readiness.detail?.trim();return a?t("instance.statusWithDetail",{name:n,status:r,detail:a}):t("instance.status",{name:n,status:r})}var KW="pointer-events-none absolute -right-1 top-1/2 z-10 h-5 w-0.75 -translate-y-1/2 rounded-l-full bg-primary",qW="pointer-events-none absolute -right-0.5 top-0.5 z-10 flex size-3.5 items-center justify-center rounded-full bg-transparent shadow-sm ",VW=`${qW} text-update-foreground`,TN="left",LN=8,kN="max-w-64 text-balance font-normal leading-snug",PN=ue(function(t){let{t:n}=De(),{t:o}=De(),r=Ot().model.isProviderUpdateInFlight,a=p=>{t.onSelectInstance(p)},i=t.showFavorites??!0,[s,l]=G(null),d=_(null),[c,f]=G(null);return ye(()=>{let p=d.current;if(!p)return;let m=Array.from(p.querySelectorAll("[data-model-picker-provider]")).find(h=>h.dataset.modelPickerProvider===t.selectedInstanceId);if(!m){f(null);return}f(m.offsetTop+m.offsetHeight/2-10)},[t.instanceEntries,t.selectedInstanceId,i]),u("div",{className:"w-11 shrink-0 overflow-hidden bg-muted/30","data-model-picker-sidebar":"true",children:u("div",{className:"h-full overflow-y-auto overscroll-contain [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:b("div",{ref:d,className:"relative flex min-h-full flex-col gap-1 p-1",children:[c!==null?u("div",{"data-model-picker-selected-indicator":"true",className:F(KW,"right-0 translate-y-0 transition-[top] duration-200 ease-out"),style:{top:c}}):null,i?b(be,{children:[u("div",{className:"relative w-full","data-model-picker-provider":"favorites",children:b(Qe,{children:[u(Ye,{render:u("button",{className:F("relative isolate flex w-full cursor-pointer aspect-square items-center justify-center rounded-md transition-colors hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] focus-visible:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]"),onClick:()=>a("favorites"),type:"button","aria-label":n("modelPicker.favorites"),children:u(rs,{className:"size-5 fill-current shrink-0","aria-hidden":!0})})}),u(Xe,{side:TN,sideOffset:LN,align:"center",className:kN,children:"Favorites"})]})}),u("div",{className:"border-b border-border/70","aria-hidden":"true"})]}):null,t.instanceEntries.map(p=>{let m=!Du(p),h=t.disabledInstanceIds?.has(p.instanceId)??!1,g=m||h,v=t.selectedInstanceId===p.instanceId,x=s===p.instanceId,y=r(p.snapshot),C=p.snapshot.versionAdvisory?.latestVersion!=null?o("updates.rail.updatingToVersion",{version:p.snapshot.versionAdvisory.latestVersion}):o("updates.rail.updating"),w=m?UW(p,o):h?t.getDisabledInstanceTooltip?.(p)??p.displayName:y?`${p.displayName} \u2014 ${C}`:p.displayName,k=b("button",{className:F("relative isolate flex w-full cursor-pointer aspect-square items-center justify-center rounded-md transition-colors hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] focus-visible:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]",g&&"opacity-50 cursor-not-allowed hover:bg-transparent"),"data-provider-accent-color":p.accentColor,onClick:()=>!g&&a(p.instanceId),onMouseEnter:()=>l(p.instanceId),onMouseLeave:()=>l(L=>L===p.instanceId?null:L),onFocus:()=>l(p.instanceId),onBlur:()=>l(L=>L===p.instanceId?null:L),disabled:g,type:"button","aria-label":g?w:p.displayName,children:[u(Ia,{providerId:p.providerId,displayName:p.displayName,accentColor:p.accentColor,className:"size-6",iconClassName:"size-5",indicatorBackground:x&&!g?"var(--muted)":v?"var(--background)":"color-mix(in oklab, var(--muted) 30%, transparent)"}),y?u("span",{className:VW,"aria-hidden":!0,children:u(vf,{className:"size-2.5"})}):null]}),S=g?u("span",{className:"relative block w-full",children:k}):k;return u("div",{className:"relative w-full","data-model-picker-provider":p.instanceId,children:b(Qe,{children:[u(Ye,{render:S}),b(Xe,{side:TN,sideOffset:LN,align:"center",className:kN,children:[w,p.accountEmail?u("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:p.accountEmail}):null]})]})},p.instanceId)})]})})})});function go(e,t){let n=e.trim();return n?t?.trimLeadingPattern?n.replace(t.trimLeadingPattern,"").toLowerCase():n.toLowerCase():""}function WW(e,t){if(!t)return 0;let n=0,o=-1,r=-1,a=0;for(let i=0;i<e.length;i+=1)if(e[i]===t[n]&&(o===-1&&(o=i),r!==-1&&(a+=i-r-1),r=i,n+=1,n===t.length)){let s=i-o+1-t.length,l=Math.min(64,e.length-t.length);return o*2+a*3+s+l}return null}function qC(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function GW(e,t,n){let o=null;for(let r of n){let a=e.indexOf(`${r}${t}`);if(a===-1)continue;let i=a+r.length;(o===null||i<o)&&(o=i)}return o}function zr(e){let{value:t,query:n}=e;if(!t||!n)return null;if(t===n)return e.exactBase;if(e.prefixBase!==void 0&&t.startsWith(n))return e.prefixBase+qC(t,n);if(e.boundaryBase!==void 0){let o=GW(t,n,e.boundaryMarkers??[" ","-","_","/"]);if(o!==null)return e.boundaryBase+o*2+qC(t,n)}if(e.includesBase!==void 0){let o=t.indexOf(n);if(o!==-1)return e.includesBase+o*2+qC(t,n)}if(e.fuzzyBase!==void 0){let o=WW(t,n);if(o!==null)return e.fuzzyBase+o}return null}function jW(e,t){let n=e.score-t.score;return n!==0?n:e.tieBreaker.localeCompare(t.tieBreaker)}function QW(e,t){let n=0,o=e.length;for(;n<o;){let r=n+Math.floor((o-n)/2),a=e[r];if(!a)break;jW(t,a)<0?o=r:n=r+1}return n}function Tg(e,t,n){if(n<=0)return;let o=QW(e,t);if(e.length<n){e.splice(o,0,t);return}o>=n||(e.splice(o,0,t),e.pop())}var XW=24;function YW(e){return[go(e.name),...e.shortName?[go(e.shortName)]:[],...e.subProvider?[go(e.subProvider)]:[],go(e.driverKind),go(e.providerDisplayName),...e.providerAccountEmail?[go(e.providerAccountEmail)]:[],VC(e),...e.slug?[go(e.slug)]:[]]}function JW(e,t,n){return zr({value:e,query:t,exactBase:n,prefixBase:n+2,boundaryBase:n+4,includesBase:n+6,...t.length>=3?{fuzzyBase:n+100}:{}})}function VC(e){return go([e.name,e.shortName,e.subProvider,e.driverKind,e.providerDisplayName,e.providerAccountEmail,e.slug].filter(t=>typeof t=="string"&&t.length>0).join(" "))}function AN(e,t){let n=go(t).split(/\s+/u).filter(r=>r.length>0);if(n.length===0)return 0;let o=0;for(let r of n){let a=[];for(let i=0;i<e.length;i+=1){let s=JW(e[i],r,i*10);s!==null&&a.push(s)}if(a.length===0)return null;o+=Math.min(...a)}return o}function EN(e,t){let n=AN(YW(e),t);return n===null?null:e.isFavorite?n-XW:n}function MN(e,t){return AN([go(e.title),go(e.description??"")],t)}function RN({top:e,bottom:t}){if(!(!e&&!t))return F("virtualized-scroll-fade [--fade-size:1.5rem]",e&&t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,transparent,black_var(--fade-size),black_calc(100%-var(--fade-size)),transparent)]",e&&!t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,transparent,black_var(--fade-size))]",!e&&t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,black_calc(100%-var(--fade-size)),transparent)]")}function Lg(e,t){return`${e}:${t}`}var NN=new Map,_N=[],ZW=[],eG=[];function Ou(e){return e.choiceKey??Nu(e.instanceId,e.slug)}function DN(e,t,n){return t.environmentId!==n||t.instanceId!==e.instanceId?!1:t.sourceId&&t.profileId?t.sourceId===e.sourceId&&t.profileId===e.profileId&&t.model===e.slug:e.sourceId&&e.profileId?!1:t.model===e.slug}function tG(){return u("div",{className:"h-0.5"})}function WC(e){return e?.trim()||null}function ON({label:e}){return u("div",{className:"px-2 pt-2 pb-1 text-[10px] font-medium uppercase leading-none tracking-wide text-muted-foreground/70",children:e})}var nG=ue(function({index:t,itemKey:n,action:o,showSectionHeader:r}){let{t:a}=De(),i=WC(o.description);return b(be,{children:[r?u(ON,{label:a("modelPicker.plugins")}):null,b(gl,{hideIndicator:!0,index:t,value:n,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(ts,{className:"size-4 shrink-0 text-muted-foreground/70"}),b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"truncate text-xs font-medium leading-snug",children:o.title}),u("div",{className:"mt-1 truncate text-xs font-normal leading-snug text-muted-foreground/70",children:i})]})]})]})}),oG=ue(function({index:t,showSectionHeader:n}){let{t:o}=De();return b(be,{children:[n?u(ON,{label:o("modelPicker.plugins")}):null,b(gl,{hideIndicator:!0,index:t,value:fd,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(kd,{className:"size-4 shrink-0 text-muted-foreground/70"}),u("span",{className:"min-w-0 flex-1 truncate text-left text-xs font-normal leading-snug text-muted-foreground",children:o("modelPicker.managePlugins")})]})]})}),FN=ue(function(t){let{keybindings:n,modelOptionsByInstance:o,instanceEntries:r,getModelDisabledReason:a,getModelContinuationLabel:i,onContinueInModel:s,onInstanceModelChange:l,onChooseExecution:d,composerChoices:c,selectedExecutionSelection:f,onManagePlugins:p,onSelectPluginAction:m}=t,h=t.pluginActions??_N,g=t.selectedPluginActionKey??null,{t:v}=De(),{t:x}=De(),y=Ot(),[C,w]=G(""),[k,S]=G(!1),[L,I]=G(!1),T=_(null),E=_(null),A=_(null),N=y.environment.useActiveEnvironmentId(),R=y.settings.useClientSettings(D=>D.favorites??[]),$=z(()=>N===null?eG:R.filter(D=>D.environmentId===N),[N,R]),[H,K]=G(()=>t.lockedProvider!==null?t.activeInstanceId:$.length>0?"favorites":t.activeInstanceId),[O,oe]=G(()=>new Set(o.get(t.activeInstanceId)?.some(D=>D.slug===t.model&&D.isLegacy)?[t.activeInstanceId]:[])),ee=z(()=>n??[],[n]),W=y.settings.useUpdateClientSettings(),qe=B(()=>{T.current?.focus({preventScroll:!0})},[]),ve=B(D=>{K(D),window.requestAnimationFrame(()=>{qe()})},[qe]);ye(()=>{qe();let D=window.requestAnimationFrame(()=>{qe()}),Y=window.setTimeout(()=>{qe()},0);return()=>{window.cancelAnimationFrame(D),window.clearTimeout(Y)}},[qe]);let fe=z(()=>new Set($.map(D=>Lg(D.instanceId,D.model))),[$]),Ne=B(D=>N===null?!1:$.some(Y=>DN(D,Y,N)),[N,$]),Ae=z(()=>new Map(r.map(D=>[D.instanceId,D])),[r]),ae=B(D=>t.lockedProvider===null?!0:D.driverKind!==t.lockedProvider?!1:t.lockedContinuationGroupKey?D.continuationGroupKey===t.lockedContinuationGroupKey:!0,[t.lockedContinuationGroupKey,t.lockedProvider]),Ee=z(()=>{let D=new Set;for(let Y of r)Du(Y)&&D.add(Y.instanceId);return D},[r]),xe=z(()=>{let D=[];for(let[Y,ce]of o){let ie=Ae.get(Y);if(ie&&Ee.has(Y))for(let pe of ce)D.push({slug:pe.slug,name:pe.name,...pe.shortName?{shortName:pe.shortName}:{},...pe.subProvider?{subProvider:pe.subProvider}:{},...pe.isLegacy?{isLegacy:!0}:{},instanceId:Y,driverKind:ie.driverKind,providerId:ie.providerId,instanceDisplayName:ie.displayName,...ie.accentColor?{instanceAccentColor:ie.accentColor}:{},...ie.accountEmail?{instanceAccountEmail:ie.accountEmail}:{},...ie.continuationGroupKey?{continuationGroupKey:ie.continuationGroupKey}:{}})}if(c&&c.length>0){let Y=new Set,ce=[];for(let pe of c){let Ze=pe.legacyInstanceId;if(!Ze||!Ee.has(Ze))continue;let pt=Ae.get(Ze);if(!pt)continue;let ht=o.get(Ze)?.find(tn=>tn.slug===pe.modelId),en=KC({environmentId:pe.selection.environmentId,runtimeId:pe.runtimeId,sourceId:pe.sourceId,profileId:pe.profileId,endpointId:pe.endpointId});Y.add(Lg(Ze,pe.modelId)),ce.push({slug:pe.modelId,name:ht?.name??pe.modelLabel,...ht?.shortName?{shortName:ht.shortName}:{},instanceId:Ze,driverKind:pt.driverKind,providerId:pt.providerId,instanceDisplayName:pt.displayName,...pt.accentColor?{instanceAccentColor:pt.accentColor}:{},...pt.accountEmail?{instanceAccountEmail:pt.accountEmail}:{},...pt.continuationGroupKey?{continuationGroupKey:pt.continuationGroupKey}:{},runtimeId:pe.runtimeId,sourceId:pe.sourceId,sourceLabel:pe.sourceLabel,profileId:pe.profileId,ready:pe.ready,...pe.reasonCode?{reasonCode:pe.reasonCode}:{},choiceKey:en})}let ie=D.filter(pe=>!Y.has(Lg(pe.instanceId,pe.slug)));return[...ce,...ie]}return D},[c,o,Ae,Ee]),re=t.lockedProvider!==null,Ie=C.trim().length>0,st=z(()=>{if(!re)return;let D=new Set;for(let Y of r)ae(Y)||D.add(Y.instanceId);return D},[r,re,ae]),dt=z(()=>{let D=r.filter(IN);if(!re)return D;let Y=[],ce=[];for(let ie of D)ae(ie)?Y.push(ie):ce.push(ie);return[...Y,...ce]},[r,re,ae]),lt=!Ie&&dt.length>0,ct=z(()=>r.map(D=>D.instanceId),[r]),Et=z(()=>{let D=xe;if(C.trim()){let Y=D.map(ce=>({model:ce,score:EN({name:ce.name,...ce.shortName?{shortName:ce.shortName}:{},...ce.subProvider?{subProvider:ce.subProvider}:{},driverKind:ce.driverKind,providerDisplayName:ce.instanceDisplayName,...ce.instanceAccountEmail?{providerAccountEmail:ce.instanceAccountEmail}:{},isFavorite:Ne(ce)},C),isFavorite:Ne(ce),tieBreaker:VC({name:ce.name,...ce.shortName?{shortName:ce.shortName}:{},...ce.subProvider?{subProvider:ce.subProvider}:{},driverKind:ce.driverKind,providerDisplayName:ce.instanceDisplayName,...ce.instanceAccountEmail?{providerAccountEmail:ce.instanceAccountEmail}:{}})})).filter(ce=>ce.score!==null);if(t.lockedProvider!==null){let ce=[];for(let ie of Y)ae(ie.model)&&ce.push(ie);return ce.toSorted((ie,pe)=>{let Ze=ie.score-pe.score;return Ze!==0?Ze:ie.isFavorite!==pe.isFavorite?ie.isFavorite?-1:1:ie.tieBreaker.localeCompare(pe.tieBreaker)}).map(ie=>ie.model)}return Y.toSorted((ce,ie)=>{let pe=ce.score-ie.score;return pe!==0?pe:ce.isFavorite!==ie.isFavorite?ce.isFavorite?-1:1:ce.tieBreaker.localeCompare(ie.tieBreaker)}).map(ce=>ce.model)}return t.lockedProvider!==null?(D=D.filter(Y=>ae(Y)),H==="favorites"?D=D.filter(Y=>Ne(Y)):D=D.filter(Y=>Y.instanceId===H)):H==="favorites"?D=D.filter(Y=>Ne(Y)):D=D.filter(Y=>Y.instanceId===H),y.model.sortProviderModelItems(D,{favoriteModelKeys:fe,groupFavorites:H!=="favorites",instanceOrder:H==="favorites"?ct:[]})},[fe,xe,ct,ae,t.lockedProvider,C,H,Ne]),ot=z(()=>{if(Ie||H==="favorites")return null;let D=Et.filter(ce=>!ce.isLegacy),Y=Et.filter(ce=>ce.isLegacy);return Y.length===0?null:{key:UC(H),currentModels:D,legacyModels:Y,isExpanded:O.has(H)}},[O,Et,Ie,H]),He=z(()=>ot?[...ot.currentModels,...ot.isExpanded?ot.legacyModels:[]]:Et,[Et,ot]),Se=m!==void 0,ze=z(()=>{if(!Se)return _N;let D=C.trim();return D.length===0?h:h.map(Y=>({action:Y,score:MN(Y,D)})).filter(Y=>Y.score!==null).toSorted((Y,ce)=>Y.score-ce.score||Y.action.title.localeCompare(ce.action.title)).map(Y=>Y.action)},[C,h,Se]),Je=Se&&(!Ie||ze.length>0),qt=z(()=>Je?[...ze.map(D=>_u(D.id)),fd]:ZW,[Je,ze]),X=z(()=>new Map(ze.map(D=>[_u(D.id),D])),[ze]),nn=qt[0]??null,xt=B(D=>{oe(Y=>{let ce=new Set(Y);return ce.has(D)?ce.delete(D):ce.add(D),ce})},[]),mn=B((D,Y)=>y.model.resolvePickerRowAction({disabledReason:a?.(D,Y)??null,continuationLabel:s?i?.(D,Y)??null:null}),[i,a,s]),Tt=B((D,Y)=>{let ce=mn(Y,D);if(ce.kind==="blocked")return;if(ce.kind==="continue"){s?.(Y,D);return}let ie=o.get(Y);if(!ie)return;let pe=Ae.get(Y);if(!pe)return;let Ze=y.model.resolveSelectableModel(pe.driverKind,D,ie);Ze&&l(Y,Ze)},[Ae,o,s,l,mn]),Yt=B(D=>{let Y=hN(D);if(Y){xt(Y);return}if(D===fd){p?.();return}let ce=vN(D);if(ce!==null){m?.(ce);return}let ie=xN(D);if(ie){let Ze=c?.find(pt=>pt.selection.environmentId===ie.environmentId&&pt.runtimeId===ie.runtimeId&&pt.sourceId===ie.sourceId&&pt.profileId===ie.profileId&&(pt.endpointId??void 0)===(ie.endpointId??void 0));if(!Ze||!Ze.legacyInstanceId)return;if(d){d(Ze);return}Tt(Ze.modelId,Ze.legacyInstanceId);return}let pe=HC(D);pe&&Tt(pe.slug,pe.instanceId)},[c,Tt,d,p,m,xt]),Jt=B(D=>{if(N===null)return;let Y=R.findIndex(ie=>DN(D,ie,N)),ce=[...R];Y>=0?ce.splice(Y,1):ce.push({environmentId:N,instanceId:D.instanceId,model:D.slug,...D.runtimeId?{runtimeId:D.runtimeId}:{},...D.sourceId?{sourceId:D.sourceId}:{},...D.profileId?{profileId:D.profileId}:{}}),W({favorites:ce})},[N,R,W]),Mt=z(()=>{let D=new Map,Y=0;for(let ce of He){if(ce.ready===!1||mn(ce.instanceId,ce.slug).kind==="blocked")continue;let ie=y.keybindings.modelPickerJumpCommandForIndex(Y);if(!ie)return D;D.set(Ou(ce),ie),Y+=1}return D},[mn,He]),zn=z(()=>[...Mt.keys()],[Mt]),kn=z(()=>[...xe.map(D=>Ou(D)),...new Set(xe.filter(D=>D.isLegacy).map(D=>UC(D.instanceId))),...Se?[...h.map(D=>_u(D.id)),fd]:[]],[xe,h,Se]),vn=z(()=>{let D=He.map(Y=>Ou(Y));return ot&&D.splice(ot.currentModels.length,0,ot.key),qt.length>0?[...D,...qt]:D},[ot,qt,He]),$n=z(()=>new Map(He.map(D=>[Ou(D),D])),[He]),Vt=B(()=>{let D=E.current?.getScrollableNode();if(!(D instanceof HTMLElement))return;let Y=Math.max(0,D.scrollHeight-D.clientHeight);S(D.scrollTop>1),I(Y-D.scrollTop>1)},[]),Zt=z(()=>({terminalFocus:!1,terminalOpen:t.terminalOpen,modelPickerOpen:!0}),[t.terminalOpen]),Sn=z(()=>{if(Mt.size===0)return NN;let D={platform:navigator.platform,context:Zt},Y=new Map;for(let[ce,ie]of Mt){let pe=y.keybindings.shortcutLabelForCommand(ee,ie,D);pe&&Y.set(ce,pe)}return Y.size>0?Y:NN},[ee,Mt,Zt]),ho=g===null?f?KC(f):Nu(t.activeInstanceId,t.model):_u(g),zt=z(()=>({favoritesSet:fe,modelJumpLabelByKey:Sn,selectedItemKey:ho}),[fe,Sn,ho]);return y.pane.useKeydown(D=>{if(D.defaultPrevented||D.repeat)return;let Y=y.keybindings.resolveShortcutCommand(D,ee,{platform:navigator.platform,context:Zt}),ce=y.keybindings.modelPickerJumpIndexFromCommand(Y??"");if(ce===null)return;let ie=zn[ce];if(!ie)return;let pe=HC(ie);pe&&(D.preventDefault(),D.stopPropagation(),Tt(pe.slug,pe.instanceId))},{capture:!0}),ye(()=>{S(!1),I(vn.length>5);let D=0,Y=window.requestAnimationFrame(()=>{Vt(),D=window.requestAnimationFrame(Vt)});return()=>{window.cancelAnimationFrame(Y),window.cancelAnimationFrame(D)}},[vn,Vt]),u(eS,{delay:0,children:b("div",{className:"relative flex h-screen max-h-86.5 w-screen max-w-90 flex-row overflow-hidden","data-model-picker-content":"true",children:[lt&&u(PN,{selectedInstanceId:H,onSelectInstance:ve,instanceEntries:dt,showFavorites:!0,...st?{disabledInstanceIds:st,getDisabledInstanceTooltip:D=>x("instance.lockedToThread",{name:D.displayName})}:{}}),u(XI,{inline:!0,items:kn,filteredItems:vn,filter:null,autoHighlight:!0,open:!0,virtualized:!0,value:ho,onItemHighlighted:(D,Y)=>{A.current=typeof D=="string"?D:null,Y.reason==="keyboard"&&Y.index>=0&&E.current?.scrollIndexIntoView?.({index:Y.index,animated:!1})},onValueChange:D=>{typeof D=="string"&&Yt(D)},children:b("div",{className:F("flex min-h-0 flex-1 flex-col overflow-hidden bg-muted/40",lt&&"border-l border-border/70"),children:[f&&t.onClearExecutionSelection?u("div",{className:"shrink-0 border-b border-border/70 px-2 py-1",children:u(te,{size:"sm",variant:"ghost-muted",className:"w-full justify-start",onClick:t.onClearExecutionSelection,children:v("modelPicker.useExecutorAccount")})}):null,u("div",{className:"px-2 pt-2",children:u("div",{className:"border-b border-border/70 pb-2.5 transition-colors focus-within:border-ring",children:u(JI,{ref:T,className:"[&_input]:h-control-3 [&_input]:font-sans [&_input]:leading-control-3",inputClassName:"rounded-none bg-transparent text-sm",placeholder:v("modelPicker.searchPlaceholder"),showTrigger:!1,startAddon:u(os,{className:"-translate-x-0.5 size-4 shrink-0 text-muted-foreground opacity-70"}),value:C,onChange:D=>w(D.target.value),onKeyDown:D=>{if(D.key==="Escape"){D.preventDefault(),D.stopPropagation(),t.onRequestClose?.();return}if(D.key==="Enter"&&A.current){D.preventBaseUIHandler?.(),D.preventDefault(),D.stopPropagation(),Yt(A.current);return}D.stopPropagation()},onMouseDown:D=>D.stopPropagation(),onTouchStart:D=>D.stopPropagation(),size:"sm",unstyled:!0})})}),u("div",{className:"relative min-h-0 flex-1 overflow-hidden pr-px",children:u(ZI,{className:"size-full min-w-0 p-0 not-empty:p-0",children:u(gN,{ref:E,data:vn,extraData:zt,keyExtractor:D=>D,renderItem:({item:D,index:Y})=>{if(ot?.key===D)return b(gl,{hideIndicator:!0,index:Y,value:D,"aria-expanded":ot.isExpanded,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-3",children:[b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"text-xs font-medium leading-snug",children:v("modelPicker.legacyModels")}),u("div",{className:"mt-1 text-xs font-normal leading-snug text-muted-foreground/70",children:v("modelPicker.legacyModelCount",{count:ot.legacyModels.length})})]}),u(Uo,{className:F("size-4 transition-transform",ot.isExpanded&&"rotate-90")})]});let ce=X.get(D);if(ce)return u(nG,{index:Y,itemKey:D,action:ce,showSectionHeader:D===nn});if(D===fd)return u(oG,{index:Y,showSectionHeader:D===nn});let ie=$n.get(D);if(!ie)return null;let pe=ie.ready===!1?{kind:"blocked",reason:v("modelPicker.notReady")}:mn(ie.instanceId,ie.slug);return u(yN,{index:Y,model:ie,instanceId:ie.instanceId,itemKey:Ou(ie),sourceLabel:ie.sourceLabel,providerId:ie.providerId,providerDisplayName:ie.instanceDisplayName,providerAccentColor:ie.instanceAccentColor,providerAccountEmail:ie.instanceAccountEmail,isFavorite:Ne(ie),isSelected:D===ho,showProvider:!0,preferShortName:!re,useTriggerLabel:!1,jumpLabel:Sn.get(D)??null,disabledReason:pe.kind==="blocked"?pe.reason:null,actionLabel:pe.kind==="continue"?pe.label:null,onToggleFavorite:()=>Jt(ie)},D)},estimatedItemSize:52,drawDistance:480,recycleItems:!0,contentContainerClassName:"pl-2 pr-px",ItemSeparatorComponent:tG,onLayout:Vt,onScroll:Vt,className:F("scrollbar-gutter-stable h-full overflow-x-hidden overscroll-y-contain py-1.5 [&::-webkit-scrollbar-track]:my-2",RN({top:k,bottom:L}))})})}),u(YI,{className:"not-empty:py-6 empty:h-0 text-xs font-normal leading-snug",children:v("modelPicker.noModelsFound")})]})})]})})});var BN="h-7 min-h-7 gap-1.5 rounded-[var(--control-radius)] px-2.5 text-secondary-label transition-none hover:text-foreground [&_svg[data-composer-control-icon]]:mx-0 [&_svg[data-composer-control-chevron]]:-mx-0.5";function $r({className:e,size:t="sm",variant:n="ghost",...o}){return u(te,{className:F(BN,e),size:t,variant:n,...o})}function mr({icon:e,className:t,opticalSize:n="default"}){return u(e,{"aria-hidden":"true",className:F("shrink-0",n==="large"?"size-4.5":"size-4",t),"data-composer-control-icon":!0})}function Ri(){return u(pn,{"aria-hidden":"true",className:"-mx-0.5 size-icon-2 shrink-0 text-icon-muted","data-composer-control-chevron":!0,strokeWidth:2.25})}function kg({className:e,size:t="sm",variant:n="ghost",...o}){return u(_I,{className:F(BN,e),icon:u(Ri,{}),size:t,variant:n,...o})}function rG(e){let t=e.profileLabel?.trim();if(t)return t;let n=e.profileModelId?.trim();if(n)return n;let o=e.catalogOptions.find(r=>r.slug===e.model);return o?ud(o):e.model}function aG(e,t){return!e?.length||!t?null:e.find(n=>n.runtimeId===t.runtimeId&&n.sourceId===t.sourceId&&n.profileId===t.profileId&&(n.endpointId??void 0)===(t.endpointId??void 0))??null}var zN=ue(function(t){let{t:n}=De(),[o,r]=G(!1),i=ni()&&(t.open??o),s=z(()=>t.instanceEntries.find(C=>C.instanceId===t.activeInstanceId)??null,[t.activeInstanceId,t.instanceEntries]),l=t.activeInstanceId,d=t.modelOptionsByInstance.get(l)??[],c=aG(t.composerChoices,t.selectedExecutionSelection),f=rG({model:t.model,catalogOptions:d,profileLabel:c?.modelLabel,profileModelId:c?.modelId}),p=C=>{t.onOpenChange?.(C),t.open===void 0&&r(C)};q(()=>{if(!i)return;let{documentElement:C,body:w}=document,k=C.style.overscrollBehavior,S=w.style.overflow,L=w.style.paddingRight,I=window.innerWidth-C.clientWidth;C.style.overscrollBehavior="contain",w.style.overflow="hidden",I>0&&(w.style.paddingRight=`${I}px`);let T=N=>N instanceof Element&&N.closest("[data-model-picker-content]"),E=N=>{T(N.target)||N.preventDefault()},A=N=>{T(N.target)||N.preventDefault()};return document.addEventListener("wheel",E,{capture:!0,passive:!1}),document.addEventListener("touchmove",A,{capture:!0,passive:!1}),()=>{document.removeEventListener("wheel",E,{capture:!0}),document.removeEventListener("touchmove",A,{capture:!0}),C.style.overscrollBehavior=k,w.style.overflow=S,w.style.paddingRight=L}},[i]);let m=(C,w)=>{t.disabled||(t.onInstanceModelChange(C,w),p(!1))},h=(C,w)=>{t.disabled||(t.onContinueInModel?.(C,w),p(!1))},g=C=>{t.disabled||(t.onSelectPluginAction?.(C),p(!1))},v=()=>{t.onManagePlugins?.(),p(!1)},x=t.selectedPluginActionKey==null?null:t.pluginActions?.find(C=>C.id===t.selectedPluginActionKey)??null,y=x?WC(x.description):null;return b(fl,{open:i,onOpenChange:C=>{if(t.disabled){p(!1);return}p(C)},children:[b(ml,{render:u($r,{"aria-label":t.triggerAriaLabel,variant:t.triggerVariant??"ghost","data-chat-provider-model-picker":"true",className:F("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-42 shrink-0":"max-w-48 shrink sm:max-w-56",t.triggerClassName),disabled:t.disabled}),children:[u("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:x?b(be,{children:[u(ts,{className:"size-4 shrink-0"}),b(Qe,{children:[b(Ye,{render:u("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 truncate"}),children:[u("span",{className:"shrink-0",children:x.title}),y?b("span",{className:"min-w-0 truncate text-muted-foreground/80",children:["\xB7 ",y]}):null]}),u(Xe,{side:"top",children:y?`${x.title} \xB7 ${y}`:x.title})]})]}):b(be,{children:[s?u(Ia,{providerId:s.providerId,displayName:s.displayName,accentColor:s.accentColor,className:F("size-4",t.activeProviderIconClassName),iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,b(Qe,{children:[u(Ye,{render:u("span",{className:"min-w-0 flex-1 overflow-hidden truncate"}),children:t.sourceLabel?`${t.sourceLabel} \xB7 ${f}`:f}),u(Xe,{side:"top",children:t.executionAppliesTo==="next-message"?`${n("modelPicker.nextMessage")}: ${t.sourceLabel?`${t.sourceLabel} \xB7 ${f}`:f}`:t.sourceLabel?`${t.sourceLabel} \xB7 ${f}`:f})]}),t.executionAppliesTo==="next-message"?u("span",{className:"shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/80",children:n("modelPicker.nextMessage")}):null]})}),u("span",{"aria-hidden":"true",className:"flex items-center",children:u(Ri,{})})]}),u(pl,{align:"start",className:"before:hidden [--viewport-inline-padding:0]",viewportClassName:"!overflow-hidden rounded-[calc(var(--radius-lg)-1px)] p-0 [clip-path:inset(0_round_calc(var(--radius-lg)-1px))]",children:u(FN,{activeInstanceId:l,model:t.model,lockedProvider:t.lockedProvider,lockedContinuationGroupKey:t.lockedContinuationGroupKey??null,instanceEntries:t.instanceEntries,...t.keybindings?{keybindings:t.keybindings}:{},modelOptionsByInstance:t.modelOptionsByInstance,terminalOpen:t.terminalOpen??!1,onRequestClose:()=>p(!1),...t.getModelDisabledReason?{getModelDisabledReason:t.getModelDisabledReason}:{},...t.getModelContinuationLabel?{getModelContinuationLabel:t.getModelContinuationLabel}:{},...t.onContinueInModel?{onContinueInModel:h}:{},onInstanceModelChange:m,...t.composerChoices?{composerChoices:t.composerChoices}:{},selectedExecutionSelection:t.selectedExecutionSelection??null,...t.onClearExecutionSelection?{onClearExecutionSelection:()=>{t.onClearExecutionSelection?.(),p(!1)}}:{},...t.onChooseExecution?{onChooseExecution:C=>{t.disabled||(t.onChooseExecution?.(C),p(!1))}}:{},...t.pluginActions?{pluginActions:t.pluginActions}:{},selectedPluginActionKey:t.selectedPluginActionKey??null,...t.onSelectPluginAction?{onSelectPluginAction:g}:{},...t.onManagePlugins?{onManagePlugins:v}:{}})})]})});me();var $N=ue(function(t){let n=_(null);return ye(()=>{if(!t.activeItemId||!n.current)return;n.current.querySelector(`[data-composer-item-id="${CSS.escape(t.activeItemId)}"]`)?.scrollIntoView({block:"nearest"})},[t.activeItemId]),u(Mf,{autoHighlight:!1,mode:"none",onItemHighlighted:o=>{t.onHighlightedItemChange(typeof o=="string"?o:null)},children:u("div",{ref:n,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden **:data-[slot=scroll-area-scrollbar]:data-[orientation=vertical]:my-4","data-composer-command-drawer":"true",children:t.items.length>0?u(_f,{className:"max-h-72 scroll-pb-6",children:u(Rf,{children:t.items.map(o=>u(iG,{item:o,triggerKind:t.triggerKind,resolvedTheme:t.resolvedTheme,isActive:t.activeItemId===o.id,onHighlight:t.onHighlightedItemChange,onSelect:t.onSelect},o.id))})}):u("div",{className:"px-5 pt-3.5 pb-7",children:u("p",{className:"text-secondary-label text-xs",children:t.isLoading?t.triggerKind==="skill"?"Searching workspace skills...":"Searching workspace files...":t.emptyStateText??(t.triggerKind==="skill"?"No skills found. Try / to browse provider commands.":t.triggerKind==="path"?"No matching files or folders.":"No matching command.")})})})})}),iG=ue(function(t){let n=t.item.type==="skill"?xM(t.item.skill):null,o=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return b(Nf,{value:t.item.id,"data-composer-item-id":t.item.id,className:F("cursor-pointer select-none gap-3 rounded-lg px-3 py-2! hover:bg-transparent hover:text-inherit data-highlighted:bg-transparent data-highlighted:text-inherit",t.isActive&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{t.isActive||t.onHighlight(t.item.id)},onMouseDown:r=>{r.preventDefault()},onClick:()=>{t.onSelect(t.item)},children:[t.item.type==="path"?u(Gm,{pathValue:t.item.path,kind:t.item.pathKind,theme:t.resolvedTheme}):null,b("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[u("span",{className:"min-w-0 max-w-[45%] shrink-0 truncate font-sans text-xs font-medium",children:o?b(be,{children:[u("span",{className:"text-secondary-label",children:"/skill:"}),sa(o)]}):t.item.label}),u("span",{className:"min-w-0 max-w-[48ch] flex-1 truncate text-left text-secondary-label text-xs",children:t.item.description}),n?u(dG,{kind:n,showSkillSuffix:t.triggerKind==="skill"}):null]})]})}),sG={app:Ad,repo:oi,project:oi,personal:Yr,system:jd,other:qd},lG={app:"App",repo:"Repo",project:"Project",personal:"Personal",system:"System",other:"Provider"};function dG(e){let t=sG[e.kind];return b(ul,{className:"ms-auto",variant:"secondary",children:[u(t,{"aria-hidden":"true",className:"text-current"}),lG[e.kind],e.showSkillSuffix?" Skill":null]})}me();var cG=(e,t)=>t.isResponding?e("primaryActions.submitting"):t.compact?t.isLastQuestion?e("primaryActions.submit"):e("primaryActions.next"):t.isLastQuestion?t.questionIndex>0?e("primaryActions.submitAnswers"):e("primaryActions.submitAnswer"):e("primaryActions.nextQuestion"),uG=e=>{e.preventDefault()},Fu=ue(function({compact:t,pendingAction:n,isRunning:o,showPlanFollowUpPrompt:r,promptHasText:a,isSendBusy:i,sendDisabledReason:s,isConnecting:l,isEnvironmentUnavailable:d,isPreparingWorktree:c,hasSendableContent:f,preserveComposerFocusOnPointerDown:p=!1,showSendWhileRunning:m=!1,onPreviousPendingQuestion:h,onInterrupt:g,onImplementPlanInNewThread:v}){let{t:x}=De(),y=Ot(),C=p?{onPointerDown:uG}:void 0,w=y.settings.useEnvironmentIdentificationMode(),k=s!==null,S=y.devBackdrop.useVisible(w==="artwork"),L=T=>u("button",{type:"button",className:F("flex cursor-pointer items-center justify-center rounded-full bg-destructive/90 text-white shadow-xs shadow-destructive/24 inset-shadow-[0_1px_--theme(--color-white/16%)] transition-[background-color,scale] duration-(--control-duration) hover:bg-destructive hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none",T?"size-8 sm:size-7":m&&f?"size-9 sm:size-8":"size-8 sm:h-8 sm:w-8"),...C,onClick:g,"aria-label":x("primaryActions.stopGeneration"),children:u("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":"true",children:u("rect",{x:"2",y:"2",width:"8",height:"8",rx:"1.5"})})});if(n)return b("div",{className:F("flex items-center justify-end",t?"gap-1.5":"gap-2"),children:[o?L(!0):null,n.questionIndex>0?t?u(te,{size:"icon-sm",variant:"outline",className:"rounded-full",...C,onClick:h,disabled:n.isResponding,"aria-label":x("primaryActions.previousQuestion"),children:u(Wi,{})}):u(te,{size:"sm",variant:"outline",className:"rounded-full",...C,onClick:h,disabled:n.isResponding,children:x("primaryActions.previous")}):null,u(te,{type:"submit",size:"sm",className:F("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"px-3":"px-4"),...C,disabled:d||n.isResponding||(n.isLastQuestion?!n.isComplete:!n.canAdvance),children:cG(x,{compact:t,isLastQuestion:n.isLastQuestion,isResponding:n.isResponding,questionIndex:n.questionIndex})})]});if(r)return a?u(te,{type:"submit",size:"sm",className:F("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"h-9 px-3 sm:h-8":"h-9 px-4 sm:h-8"),...C,disabled:i||k||l||d,children:x(l||i?"primaryActions.sendingButtonLabel":"primaryActions.refine")}):b("div",{"data-chat-composer-implement-actions":"true",className:"flex items-center justify-end",children:[u(te,{type:"submit",size:"sm",className:"h-9 rounded-l-full rounded-r-none bg-message-action px-4 text-message-action-foreground hover:bg-message-action-hover sm:h-8",...C,disabled:i||k||l||d,children:x(l||i?"primaryActions.sendingButtonLabel":"primaryActions.implement")}),b(Jo,{children:[u(tr,{render:u(te,{size:"sm",variant:"default",className:"h-9 rounded-l-none rounded-r-full border-l-message-action-foreground/20 bg-message-action px-2 text-message-action-foreground hover:bg-message-action-hover sm:h-8","aria-label":x("primaryActions.implementationActions"),...C,disabled:i||k||l||d}),children:u(pn,{})}),u(er,{align:"end",side:"top",children:u(Zo,{disabled:i||k||l||d,onClick:()=>{v()},children:x("primaryActions.implementInNewThread")})})]})]});let I=b("button",{type:"submit",className:F("relative isolate flex h-9 w-9 items-center justify-center overflow-hidden rounded-full shadow-xs transition-[background-color,filter,opacity,scale] duration-(--control-duration) enabled:cursor-pointer enabled:inset-shadow-[0_1px_--theme(--color-white/16%)] hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none disabled:pointer-events-none disabled:opacity-64 disabled:shadow-none disabled:hover:scale-100 sm:h-8 sm:w-8",S?"bg-transparent text-white enabled:shadow-black/24 enabled:hover:brightness-110":"bg-message-action text-message-action-foreground enabled:shadow-message-action/24 hover:bg-message-action-hover"),...C,disabled:i||k||l||d||!f,"aria-label":d?x("primaryActions.environmentDisconnected"):s||x(l?"primaryActions.connecting":c?"primaryActions.preparingWorktree":i?"primaryActions.sendingAriaLabel":"primaryActions.sendMessage"),children:[S?u("span",{className:"absolute inset-0 -z-10","aria-hidden":"true",children:u(nS,{compact:!0})}):null,l||i?u(vf,{className:"size-3.5","aria-hidden":"true"}):u("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:u("path",{d:"M7 11.5V2.5M7 2.5L3 6.5M7 2.5L11 6.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})]});return o?b(be,{children:[L(!1),m&&f?I:null]}):I});function HN(e){let t=e.activePendingProgress?.activeQuestion?.multiSelect??!1;return u("div",{className:"px-3 pb-3 sm:px-4",children:b("div",{"data-chat-composer-mobile-pending-compact":"true",className:F("flex min-w-0 items-center gap-2 rounded-lg border border-border/55 bg-background/55 p-1.5 pl-3 transition-colors hover:bg-background/90",!t&&"p-0"),children:[e.isPendingUserInputChoiceOnly?null:u("button",{type:"button",className:F("min-w-0 flex-1 truncate bg-transparent py-1.5 text-left text-sm",e.activePendingProgress?.customAnswer?"text-foreground":"text-placeholder",!t&&"px-3 py-2"),onPointerDown:n=>n.preventDefault(),onClick:e.expandMobileComposer,"aria-label":"Write custom answer",children:e.activePendingProgress?.customAnswer||"Write custom answer"}),e.inlineTasksBadge,e.inlineStashBadge,t?u(Fu,{compact:!0,pendingAction:e.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:e.isSendBusy,sendDisabledReason:e.sendDisabledReason,isConnecting:e.isConnecting,isEnvironmentUnavailable:e.isEnvironmentUnavailable,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:e.onPreviousActivePendingUserInputQuestion,onInterrupt:e.handleInterruptPrimaryAction,onImplementPlanInNewThread:e.handleImplementPlanInNewThreadPrimaryAction}):null]})})}function UN(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}me();function fG(e){return e!==null&&"tagName"in e&&"closest"in e}function Pg(e){return fG(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function GC(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function KN(e,t){let n=e.findIndex(o=>o.decision===t);return n===-1?null:{type:"respond",index:n}}function qN(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return KN(t,"accept");case"Escape":return KN(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let n=GC(e.key,t.length);return n===null?null:{type:"respond",index:n}}}}var pG=2e3,mG="min-h-8 max-w-full py-1.5 font-normal whitespace-normal text-start",gG=[{decision:"cancel",label:"Cancel"},{decision:"decline",label:"Decline"},{decision:"acceptForSession",label:"Always allow this session"},{decision:"accept",label:"Approve"}];function hG(e,t){let n=[];return t<9&&n.push(String(t+1)),e==="accept"&&n.push("Enter"),e==="cancel"&&n.push("Escape"),n.length>0?n.join(" "):void 0}var VN=ue(function({requestId:t,isResponding:n,options:o=gG,keybindings:r,declineReasonRelay:a,onRespondToApproval:i}){let{t:s}=De(),l=Ot(),d=a==="native"||a==="queued",[c,f]=G(""),p=_([]);q(()=>{f("")},[t]);let m=B(g=>{let v=g==="decline"?c.trim():"";i(t,g,v.length>0?v:void 0)},[c,i,t]),h=B(g=>{let v=p.current.filter(C=>C!==null);if(v.length===0)return;let x=v.findIndex(C=>C===document.activeElement),y=x===-1?g===1?0:v.length-1:(x+g+v.length)%v.length;v[y]?.focus()},[]);return l.pane.useKeydown(g=>{if(n||l.terminalFocus.getOwner()!==null||g.isComposing||g.keyCode===229)return;let v=Pg(g.target);if(r&&(!v||g.metaKey||g.ctrlKey||g.altKey)){let C=l.keybindings.approvalDecisionFromCommand(l.keybindings.resolveShortcutCommand(g,r));if(C!==null&&o.some(w=>w.decision===C)){g.preventDefault(),m(C);return}}if(v)return;let x=qN(g,o);if(x===null)return;if(g.preventDefault(),x.type==="move"){h(x.delta);return}let y=o[x.index];y&&m(y.decision)},{target:"document"}),u(be,{children:o.map((g,v)=>{let x=v<9?v+1:null,y=b(te,{ref:C=>{p.current[v]=C},size:"xs",variant:g.decision==="accept"?"default":"outline",style:{height:"auto"},"aria-keyshortcuts":hG(g.decision,v),className:`${mG}${g.decision==="decline"?" text-destructive-foreground [:hover,[data-pressed]]:text-destructive-foreground":""}`,disabled:n,onClick:()=>m(g.decision),children:[u("span",{className:"min-w-0 break-words",children:g.label}),x===null?null:u(Ef,{className:"h-3.5 min-w-3.5 rounded-[3px] bg-transparent px-0 text-[10px] tabular-nums opacity-70",children:x})]},g.decision);return g.decision!=="decline"||!d?y:b(Ja,{children:[u(hf,{type:"text",value:c,disabled:n,maxLength:pG,placeholder:s(a==="queued"?"approval.declineReasonQueuedPlaceholder":"approval.declineReasonPlaceholder"),"aria-label":s("approval.declineReasonLabel"),"data-approval-decline-reason":"true",className:"h-8 min-w-24 max-w-56 flex-1",onChange:C=>f(C.target.value),onKeyDown:C=>{if(C.key==="Enter"){C.preventDefault(),m("decline");return}C.key==="Escape"&&(C.preventDefault(),c.length>0?f(""):C.currentTarget.blur())}}),y]},g.decision)})})});me();var vG=["command","cmd"],xG=["file_path","filePath","path","notebook_path","notebookPath"],yG=["url"],CG=["query","q"],bG=["name","skill","skill_name","skillName"],WN=["toolName","tool_name"],GN=["description"],IG=[],SG=[];function Va(e,t,n){for(let o of t){let a=e.find(i=>i.name===o)?.value.trim();if(!(a===void 0||a.length===0))return n.add(o),a}return null}function wG(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t>=0?e.slice(t+1):e;return n.length>0?n:e}function TG(e){let t=e[0];return t===void 0?null:e.every(n=>n.path===t.path)?t.path:null}function QN(e){let t=e.args??IG,n=e.fileChanges??SG,o=new Set,r=e.detail?.trim()??"",a=r.length>0?{shape:"text",text:r}:{shape:"none"},i=null,s=a,l=null;switch(e.requestKind){case"command":{let d=Va(t,vG,o);d!==null&&(s={shape:"command",command:d});break}case"file-read":case"file-change":{let d=Va(t,xG,o)??TG(n);d!==null&&(i=wG(d),s=n.some(c=>c.path===d)?{shape:"none"}:{shape:"path",path:d});break}case"web-fetch":{let d=Va(t,yG,o);d!==null&&(s={shape:"url",url:d});break}case"web-search":{let d=Va(t,CG,o);d!==null&&(s={shape:"query",query:d});break}case"skill":{i=Va(t,bG,o)??Va(t,WN,o),l=Va(t,GN,o),t.length>0&&(s={shape:"none"});break}case"mcp-tool":case"tool":{i=Va(t,WN,o),l=Va(t,GN,o),t.length>0&&(s={shape:"none"});break}case"mcp-elicitation":{i=e.appName?.trim()||null;break}}return{kind:e.requestKind,subject:i,body:s,description:l,args:t.filter(d=>!o.has(d.name)),fileChanges:n}}var LG={"file-read":"approval.title.fileRead","file-change":"approval.title.fileChange",skill:"approval.title.skill","mcp-tool":"approval.title.tool",tool:"approval.title.tool","mcp-elicitation":"approval.title.appAccess"},kG={command:"approval.title.command","file-read":"approval.title.fileReadGeneric","file-change":"approval.title.fileChangeGeneric","web-fetch":"approval.title.webFetch","web-search":"approval.title.webSearch",skill:"approval.title.skillGeneric","mcp-tool":"approval.title.toolGeneric",tool:"approval.title.toolGeneric","mcp-elicitation":"approval.title.appAccessGeneric"},PG={command:"approval.commandLabel","file-read":"approval.fileReadLabel","file-change":"approval.fileChangeLabel","web-fetch":"approval.webFetchLabel","web-search":"approval.webSearchLabel",skill:"approval.skillLabel","mcp-tool":"approval.mcpToolLabel",tool:"approval.toolLabel","mcp-elicitation":"approval.appAccessLabel"},AG={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function XN(e,t){let n=e.subject!==null?LG[e.kind]:void 0;return n!==void 0?t(n,{name:e.subject}):t(kG[e.kind])}function YN(e,t){return t(PG[e])}function JN(e,t){return t(AG[e])}function ZN(e){let t=e.content;if(t===void 0)return null;if(t.kind==="unified")return t.diff.length>0?t.diff:null;let n=jN(t.oldText??""),o=jN(t.newText);if(n.length===0&&o.length===0)return null;let r=`--- a/${e.path}
3715
+ `?d.insertParagraph():c===" "?d.insertNodes([gP()]):d.insertText(c)}}}else t.insertRawText(i)}function jy(e,t,n){e.dispatchCommand(sA,{nodes:t,selection:n})||(n.insertNodes(t),(function(o){if(Se(o)&&o.isCollapsed()){let r=o.anchor,a=null,i=nd(r,"previous");if(i)if(mm(i))a=i.origin;else{let s=vP(i,Di(bt(),"next").getFlipped());for(let l of s){if(nt(l.origin)){a=l.origin;break}if(Qe(l.origin)&&!l.origin.isInline())break}}if(a&&nt(a)){let s=a.getFormat(),l=a.getStyle();o.format===s&&o.style===l||(o.format=s,o.style=l,o.dirty=!0)}}})(n))}function aM(e,t,n,o=[]){let r=t===null||n.isSelected(t),a=Qe(n)&&n.excludeFromCopy("html"),i=n;t!==null&&nt(i)&&(i=zm(t,i,"clone"));let s=Qe(i)?i.getChildren():[],l=(function(d){let c=d.exportJSON(),f=d.constructor;if(c.type!==f.getType()&&Jm(58,f.name),Qe(d)){let p=c.children;Array.isArray(p)||Jm(59,f.name)}return c})(i);nt(i)&&i.getTextContentSize()===0&&(r=!1);for(let d=0;d<s.length;d++){let c=s[d],f=aM(e,t,c,l.children);!r&&Qe(n)&&f&&n.extractWithChild(c,t,"clone")&&(r=!0)}if(r&&!a)o.push(l);else if(Array.isArray(l.children))for(let d=0;d<l.children.length;d++){let c=l.children[d];o.push(c)}return r}function iM(e,t){let n=[],o=bt().getChildren();for(let r=0;r<o.length;r++)aM(e,t,o[r],n);return{namespace:e._config.namespace,nodes:n}}function sM(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n],r=AP(o);nt(r)&&BA(r),t.push(r)}return t}var cd=null;async function Z3(e,t,n){if(cd!==null)return!1;if(t!==null)return new Promise((d,c)=>{e.update(()=>{d(nM(e,t,n))})});let o=e.getRootElement(),r=e._window||window,a=r.document,i=oy(r);if(o===null||i===null)return!1;let s=a.createElement("span");s.style.cssText="position: fixed; top: -1000px;",s.append(a.createTextNode("#")),o.append(s);let l=new Range;return l.setStart(s,0),l.setEnd(s,1),i.removeAllRanges(),i.addRange(l),new Promise((d,c)=>{let f=e.registerCommand(ym,p=>(mu(p,ClipboardEvent)&&(f(),cd!==null&&(r.clearTimeout(cd),cd=null),d(nM(e,p,n))),!0),xm);cd=r.setTimeout(()=>{f(),cd=null,d(!1)},50),a.execCommand("copy"),s.remove()})}function nM(e,t,n){if(n===void 0){let r=oy(e._window),a=$e();if(!a||a.isCollapsed()||!r)return!1;let i=r.anchorNode,s=r.focusNode;if(i!==null&&s!==null&&!bA(e,i,s))return!1;n=dM(a)}t.preventDefault();let o=t.clipboardData;return o!==null&&(cM(o,n),!0)}var lM=[["text/html",oM],["application/x-lexical-editor",rM]];function dM(e=$e()){let t={"text/plain":e?e.getTextContent():""};if(e){let n=cm();for(let[o,r]of lM){let a=r(n,e);a!==null&&(t[o]=a)}}return t}function cM(e,t){for(let[n]of lM)t[n]===void 0&&e.setData(n,"");for(let n in t){let o=t[n];o!==void 0&&e.setData(n,o)}}var ca=Qy,Hie=ca.$generateJSONFromSelectedNodes,Uie=ca.$generateNodesFromSerializedNodes,Kie=ca.$getClipboardDataFromSelection,uM=ca.$getHtmlContent,qie=ca.$getLexicalContent,Xy=ca.$insertDataTransferForPlainText,Vie=ca.$insertDataTransferForRichText,Wie=ca.$insertGeneratedNodes,Gie=ca.copyToClipboard,jie=ca.setLexicalClipboardDataTransfer;var Yy={};Mn(Yy,{PlainTextExtension:()=>iK,registerPlainText:()=>mM});var $s=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,eK=$s&&"documentMode"in document?document.documentMode:null,tK=$s&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),nK=!(!$s||!("InputEvent"in window)||eK)&&"getTargetRanges"in new window.InputEvent("input"),oK=$s&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),fM=$s&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,rK=$s&&/^(?=.*Chrome).*/i.test(navigator.userAgent),aK=$s&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&tK&&!rK;function pM(e,t){t.update(()=>{if(e!==null){let n=mu(e,KeyboardEvent)?null:e.clipboardData,o=$e();if(o!==null&&!o.isCollapsed()&&n!=null){e.preventDefault();let r=uM(t);r!==null&&n.setData("text/html",r),n.setData("text/plain",o.getTextContent())}}})}function mM(e){return qa(e.registerCommand(Cm,t=>{let n=$e();return!!Se(n)&&(n.deleteCharacter(t),!0)},Xt),e.registerCommand(UP,t=>{let n=$e();return!!Se(n)&&(n.deleteWord(t),!0)},Xt),e.registerCommand(HP,t=>{let n=$e();return!!Se(n)&&(n.deleteLine(t),!0)},Xt),e.registerCommand(zP,t=>{let n=$e();if(!Se(n))return!1;if(typeof t=="string")n.insertText(t);else{let o=t.dataTransfer;if(o!=null)Xy(o,n);else{let r=t.data;r&&n.insertText(r)}}return!0},Xt),e.registerCommand(aA,()=>{let t=$e();return!!Se(t)&&(t.removeText(),!0)},Xt),e.registerCommand(ny,t=>{let n=$e();return!!Se(n)&&(n.insertLineBreak(t),!0)},Xt),e.registerCommand(jP,()=>{let t=$e();return!!Se(t)&&(t.insertLineBreak(),!0)},Xt),e.registerCommand(Im,t=>{let n=$e();if(!Se(n))return!1;let o=t,r=o.shiftKey;return!!vy(n,!0)&&(o.preventDefault(),hy(n,r,!0),!0)},Xt),e.registerCommand(Sm,t=>{let n=$e();if(!Se(n))return!1;let o=t,r=o.shiftKey;return!!vy(n,!1)&&(o.preventDefault(),hy(n,r,!1),!0)},Xt),e.registerCommand(wm,t=>{let n=$e();return!!Se(n)&&(!fM||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(Cm,!0))},Xt),e.registerCommand(JP,t=>{let n=$e();return!!Se(n)&&(t.preventDefault(),e.dispatchCommand(Cm,!1))},Xt),e.registerCommand(Tm,t=>{let n=$e();if(!Se(n))return!1;if(t!==null){if((fM||oK||aK)&&nK)return!1;t.preventDefault()}return e.dispatchCommand(ny,!1)},Xt),e.registerCommand(lA,()=>(gm(),!0),Xt),e.registerCommand(ym,t=>{let n=$e();return!!Se(n)&&(pM(t,e),!0)},Xt),e.registerCommand($P,t=>{let n=$e();return!!Se(n)&&((function(o,r){pM(o,r),r.update(()=>{let a=$e();Se(a)&&a.removeText()})})(t,e),!0)},Xt),e.registerCommand(Lm,t=>{let n=$e();return!!Se(n)&&((function(o,r){o.preventDefault(),r.update(()=>{let a=$e(),i=mu(o,ClipboardEvent)?o.clipboardData:null;i!=null&&Se(a)&&Xy(i,a)},{tag:nA})})(t,e),!0)},Xt),e.registerCommand(qP,t=>{let n=$e();return!!Se(n)&&(t.preventDefault(),!0)},Xt),e.registerCommand(KP,t=>{let n=$e();return!!Se(n)&&(t.preventDefault(),!0)},Xt))}var iK=Nn({conflictsWith:["@lexical/rich-text"],dependencies:[jE],name:"@lexical/plain-text",register:mM});var gM=Yy,tse=gM.PlainTextExtension,hM=gM.registerPlainText;var Zy={};Mn(Zy,{PlainTextPlugin:()=>cK});ge();var Zm=Rd(Cc(),1);function sK(e,...t){let n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(let r of t)o.append("v",r);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Jy=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?xe:K;function lK({editor:e,ErrorBoundary:t}){return(function(n,o){let[r,a]=G(()=>n.getDecorators());return Jy(()=>n.registerDecoratorListener(i=>{(0,Zm.flushSync)(()=>{a(i)})}),[n]),K(()=>{a(n.getDecorators())},[n]),z(()=>{let i=[],s=Object.keys(r);for(let l=0;l<s.length;l++){let d=s[l],c=u(o,{onError:p=>n._onError(p),children:u(uh,{fallback:null,children:r[d]})}),f=n.getElementByKey(d);f!==null&&i.push((0,Zm.createPortal)(c,f,d))}return i},[o,r,n])})(e,t)}function dK({editor:e,ErrorBoundary:t}){return(function(n){let o=NE.maybeFromEditor(n);if(o&&o.hasExtensionByName(VE.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])o.hasExtensionByName(r)&&sK(320,r);return!0}return!1})(e)?null:u(lK,{editor:e,ErrorBoundary:t})}function vM(e){return e.getEditorState().read(Dm(e.isComposing()))}function cK({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[o]=wn();return(function(r){Jy(()=>qa(hM(r),QE(r)),[r])})(o),b(Ce,{children:[e,u(uK,{content:t}),u(dK,{editor:o,ErrorBoundary:n})]})}function uK({content:e}){let[t]=wn(),n=(function(r){let[a,i]=G(()=>vM(r));return Jy(()=>{function s(){let l=vM(r);i(l)}return s(),qa(r.registerUpdateListener(()=>{s()}),r.registerEditableListener(()=>{s()}))},[r]),a})(t),o=qE();return n?typeof e=="function"?e(o):e:null}var fK=Zy,xM=fK.PlainTextPlugin;ge();function yM(e){return/mac|iphone|ipad|ipod/i.test(e)}function yu(){let e=globalThis.crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Cu(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function CM(e){let t=Cu(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}ge();var eg=de(function(t){let n=Ot().pierreIcons,o=n.useSpriteReady();Nd(n.ensureSprite,[n]);let r=z(()=>n.resolveForEntry(t.pathValue,t.kind),[n,t.kind,t.pathValue]);return o?u("svg",{"aria-hidden":"true","data-file-icon":r.symbolId,className:O("size-4 shrink-0",t.className),children:u("use",{href:`#${r.symbolId}`})}):t.kind==="directory"?u(ui,{className:O("size-4 shrink-0 text-icon-muted",t.className)}):u(Kd,{className:O("size-4 shrink-0 text-icon-muted",t.className)})});var bM=Ii;function IM(e){return b(Ce,{children:[u(eg,{pathValue:e.path,kind:CM(e.path),theme:e.theme,className:oa}),u("span",{className:e.selectable?LT:ra,children:e.label})]})}function SM(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Ve,{children:[u(Ge,{render:b("span",{className:O(Ii,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0,children:[u(Ea,{className:O(oa,"size-icon-1",o&&"opacity-100")}),u("span",{className:ra,children:t})]})}),u(We,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}function wM({context:e}){let{t}=De(),n=nT(e),o=tT(e),r=o?t("pendingContext.terminalExpired",{label:n}):e.text;return u(SM,{label:n,tooltipText:r,expired:o})}function pK(e){let t=[];for(let n of e.split(/[\s:_-]+/))n.length!==0&&t.push(n.charAt(0).toUpperCase()+n.slice(1));return t.join(" ")}function mK(e){return e.replaceAll("\\","/")}function ua(e){let t=e.displayName?.trim();return t||pK(e.name)}function TM(e,t){return t?e.filter(n=>n.enabled):[]}function kM(e,t){let n=new Set(t.map(o=>o.name.trim().toLowerCase()));return e.filter(o=>!n.has(o.name.trim().toLowerCase()))}function LM(e){let t=mK(e.path);if(t.includes("/.codex/plugins/")||t.includes("/.agents/plugins/"))return"app";switch(e.scope?.trim().toLowerCase()){case"repo":case"repository":return"repo";case"project":case"workspace":case"local":return"project";case"user":case"personal":return"personal";case"system":return"system";case void 0:case"":return"other";default:return"other"}}function PM(e,t){return e.registerCommand(Lm,n=>{if(!(n instanceof ClipboardEvent)||n.clipboardData===null||n.clipboardData.files.length>0)return!1;let o=n.clipboardData.getData("text/plain");if(o.length===0)return!1;let r=Mc(`${o}
3716
+ `).filter(c=>c.type==="mention"&&c.end<=o.length);if(r.length===0)return!1;let a=$e();if(!Se(a))return!1;let i=[],s=c=>{let f=c.split(`
3717
+ `);for(let p=0;p<f.length;p+=1){let m=f[p]??"";m.length>0&&i.push(_r(m)),p<f.length-1&&i.push(Ns())}},l=r[0];if(l&&l.start===0){let c=a.isBackward()?a.focus:a.anchor,f=t.getExpandedAbsoluteOffsetForPoint(c.getNode(),c.offset),p=bt().getTextContent().slice(f-1,f);p.length>0&&!/\s/.test(p)&&i.push(_r(" "))}let d=0;for(let c of r)c.start<d||(c.start>d&&s(o.slice(d,c.start)),i.push(t.createMentionNode(c.value)),d=c.end);return d<o.length?s(o.slice(d)):i.push(_r(" ")),a.insertNodes(i),n.preventDefault(),!0},Or)}var ud=new Map,gK=32;function AM(e,t){for(ud.delete(e),ud.set(e,t);ud.size>gK;){let n=ud.keys().next().value;if(n===void 0)break;ud.delete(n)}}function hK(e){return{anchor:e.length,focus:e.length}}function Va(e,t,n){let o=ud.get(e);if(o)return AM(e,o),o;let r={cursor:n?.cursor??t.length,expandedCursor:n?.expandedCursor??t.length,selection:n?{anchor:n.cursor,focus:n.cursor}:hK(t),history:UE()};return AM(e,r),r}function fd(e,t,n){let o=Va(e,t);o.cursor=n.cursor,o.expandedCursor=n.expandedCursor,o.selection=n.selection}function EM(e,t,n,o){let r=Va(e,t);r.cursor=n,r.expandedCursor=o}function MM(e,t){let n=e.current,o=[...e.undoStack],r=[...e.redoStack];t(),e.current=n,e.undoStack.splice(0,e.undoStack.length,...o),e.redoStack.splice(0,e.redoStack.length,...r)}var vK=`composer-editor-${Math.random().toString(36).slice(2)}`,xK=[["(",")"],["[","]"],["{","}"],["'","'"],['"','"'],["\u201C","\u201D"],["`","`"],["<",">"],["\xAB","\xBB"],["*","*"],["_","_"]],OM=new Map(xK),RM=OM.get("`")??null,FM=Ut({onRemoveTerminalContext:()=>{}});function yK(e){let t=SK(),n=u("span",{className:bM,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:u(IM,{path:e.path,label:Cu(e.path),theme:t})});return b(Ve,{children:[u(Ge,{render:n}),u(We,{side:"top",className:"max-w-120 whitespace-normal leading-tight wrap-anywhere",children:e.path})]})}var bu=class e extends Ka{__path;static getType(){return"composer-mention"}static clone(t){return new e(t.__path,t.__key)}static importJSON(t){return oC(t.path).updateFromJSON(t)}constructor(t,n){super(n),this.__path=t}exportJSON(){return{...super.exportJSON(),path:this.__path,type:"composer-mention",version:1}}createDOM(){let t=document.createElement("span");return t.className=Cp,t}updateDOM(){return!1}getTextContent(){return Ec(this.__path)}isInline(){return!0}decorate(){return u(yK,{path:this.__path})}};function oC(e){return lm(new bu(e))}function CK(e){let t=e.shortDescription?.trim();return t||e.description?.trim()||null}function Iu(e){return new Map(e.map(t=>[t.name,{label:ua(t),description:CK(t)}]))}function bK(e){let t=b("span",{className:PT,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[u("span",{"aria-hidden":"true",className:oa,dangerouslySetInnerHTML:{__html:AT}}),u("span",{className:ra,children:e.skillLabel})]});return e.skillDescription?b(Ve,{children:[u(Ge,{render:t}),u(We,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:e.skillDescription})]}):t}var Su=class e extends Ka{__skillName;__skillLabel;__skillDescription;static getType(){return"composer-skill"}static clone(t){return new e(t.__skillName,t.__skillLabel,t.__skillDescription,t.__key)}static importJSON(t){return BM(t.skillName,t.skillLabel??t.skillName,t.skillDescription??null).updateFromJSON(t)}constructor(t,n,o,r){super(r);let a=t.startsWith("$")?t.slice(1):t;this.__skillName=a,this.__skillLabel=n,this.__skillDescription=o}exportJSON(){return{...super.exportJSON(),skillName:this.__skillName,skillLabel:this.__skillLabel,...this.__skillDescription?{skillDescription:this.__skillDescription}:{},type:"composer-skill",version:1}}createDOM(){let t=document.createElement("span");return t.className=Cp,t}updateDOM(){return!1}getTextContent(){return`$${this.__skillName}`}isInline(){return!0}decorate(){return u(bK,{skillLabel:this.__skillLabel,skillDescription:this.__skillDescription})}};function BM(e,t,n){return lm(new Su(e,t,n))}function IK(e){return u(wM,{context:e.context})}var Hs=class e extends Ka{__context;static getType(){return"composer-terminal-context"}static clone(t){return new e(t.__context,t.__key)}static importJSON(t){return zM(t.context)}constructor(t,n){super(n),this.__context=t}exportJSON(){return{...super.exportJSON(),context:this.__context,type:"composer-terminal-context",version:1}}createDOM(){let t=document.createElement("span");return t.className=Cp,t}updateDOM(){return!1}getTextContent(){return"\uFFFC"}isInline(){return!0}decorate(){return u(IK,{context:this.__context})}};function zM(e){return lm(new Hs(e))}function Bi(e){return e instanceof bu||e instanceof Su||e instanceof Hs}function SK(){return document.documentElement.classList.contains("dark")?"dark":"light"}function wK(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function TK(e){return e.map(t=>[t.name,t.displayName??"",t.shortDescription??"",t.description??"",t.path,t.scope??"",t.enabled?"1":"0"].join("")).join("")}function tg(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function og(e){return 1}function $M(e){return e.getTextContentSize()}function kK(e,t,n){return t+(n>0?og(e):0)}function LK(e,t,n){return t+(n>0?$M(e):0)}function PK(e,t){let n=e.getParent();if(!n||!Qe(n))return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===og(e)?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=og(e),null)}function rg(e){return Bi(e)?og(e):nt(e)?e.getTextContentSize():rd(e)?1:Qe(e)?e.getChildren().reduce((t,n)=>t+rg(n),0):0}function tC(e){return Bi(e)?$M(e):nt(e)?e.getTextContentSize():rd(e)?1:Qe(e)?e.getChildren().reduce((t,n)=>t+tC(n),0):0}function wu(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!Qe(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=rg(l))}o=r}if(nt(e))return n+Math.min(t,e.getTextContentSize());if(Bi(e))return kK(e,n,t);if(rd(e))return n+Math.min(t,1);if(Qe(e)){let r=e.getChildren(),a=Math.max(0,Math.min(t,r.length));for(let i=0;i<a;i+=1){let s=r[i];s&&(n+=rg(s))}return n}return n}function ag(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!Qe(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=tC(l))}o=r}if(nt(e))return n+Math.min(t,e.getTextContentSize());if(Bi(e))return LK(e,n,t);if(rd(e))return n+Math.min(t,1);if(Qe(e)){let r=e.getChildren(),a=Math.max(0,Math.min(t,r.length));for(let i=0;i<a;i+=1){let s=r[i];s&&(n+=tC(s))}return n}return n}function ig(e,t){if(Bi(e))return PK(e,t);if(nt(e)){let n=e.getTextContentSize();return t.value<=n?{key:e.getKey(),offset:t.value,type:"text"}:(t.value-=n,null)}if(rd(e)){let n=e.getParent();if(!n)return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===1?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=1,null)}if(Qe(e)){let n=e.getChildren();for(let o of n){let r=ig(o,t);if(r)return r}if(t.value===0)return{key:e.getKey(),offset:n.length,type:"element"}}return null}function sg(){return bt().getChildren().reduce((n,o)=>n+rg(o),0)}function Us(e){let t=bt(),n=sg(),r={value:Math.max(0,Math.min(e,n))},a=ig(t,r)??{key:t.getKey(),offset:t.getChildren().length,type:"element"},i=_s();i.anchor.set(a.key,a.offset,a.type),i.focus.set(a.key,a.offset,a.type),Dr(i)}function ng(e,t){let n=bt(),o=sg(),r=Math.max(0,Math.min(e,o)),a=Math.max(0,Math.min(t,o)),i={value:r},s={value:a},l=ig(n,i)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},d=ig(n,s)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},c=_s();c.anchor.set(l.key,l.offset,l.type),c.focus.set(d.key,d.offset,d.type),Dr(c)}function NM(e){if(!Se(e))return null;let t=e.anchor.getNode(),n=e.focus.getNode(),o=ag(t,e.anchor.offset),r=ag(n,e.focus.offset);return{start:Math.min(o,r),end:Math.max(o,r)}}function _M(e){return Se(e)?e.getNodes().some(t=>Bi(t)):!1}function Tu(e){let t=$e();if(!Se(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=wu(n,t.anchor.offset),r=sg();return Math.max(0,Math.min(o,r))}function DM(e){let t=$e();if(!Se(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=ag(n,t.anchor.offset),r=bt().getTextContent().length;return Math.max(0,Math.min(o,r))}function eC(e){let t=$e();return Se(t)?{anchor:wu(t.anchor.getNode(),t.anchor.offset),focus:wu(t.focus.getNode(),t.focus.offset)}:e}function AK(e,t){let n=t.split(`
3718
+ `);for(let o=0;o<n.length;o+=1){let r=n[o]??"";r.length>0&&e.append(_r(r)),o<n.length-1&&e.append(Ns())}}function rC(e,t,n){let o=bt();o.clear();let r=mr();o.append(r);let a=bs(e,t);for(let i of a){if(i.type==="mention"){r.append(oC(i.path));continue}if(i.type==="skill"){let s=n.get(i.name);r.append(BM(i.name,s?.label??ua({name:i.name}),s?.description??null));continue}if(i.type==="terminal-context"){i.context&&r.append(zM(i.context));continue}AK(r,i.text)}}function nC(e){return e instanceof Hs?[e.__context.id]:Qe(e)?e.getChildren().flatMap(t=>nC(t)):[]}function EK(e){let[t]=wn();return K(()=>{let n=(s,l)=>{if(!e.onCommandKeyDown||!l)return!1;if(s==="Enter"&&(l.isComposing||l.keyCode===229))return l.stopPropagation(),!0;let d=e.onCommandKeyDown(s,l);return d&&(l.preventDefault(),l.stopPropagation()),d},o=t.registerCommand(XP,s=>n("ArrowDown",s),Or),r=t.registerCommand(YP,s=>n("ArrowUp",s),Or),a=t.registerCommand(Tm,s=>n("Enter",s),Or),i=t.registerCommand(km,s=>n("Tab",s),Or);return()=>{o(),r(),a(),i()}},[t,e]),null}function MK(){let[e]=wn();return K(()=>{let t=e.registerCommand(Im,o=>{let r=null;if(e.getEditorState().read(()=>{let i=$e();if(!Se(i)||!i.isCollapsed())return;let s=Tu(0);if(s<=0)return;let l=bt().getTextContent();Rc(l,s,"left")&&(r=s-1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{Us(a)}),!0},Or),n=e.registerCommand(Sm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=$e();if(!Se(i)||!i.isCollapsed())return;let s=Tu(0),l=sg();if(s>=l)return;let d=bt().getTextContent();Rc(d,s,"right")&&(r=s+1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{Us(a)}),!0},Or);return()=>{t(),n()}},[e]),null}function RK(){let[e]=wn();return K(()=>e.registerCommand(ZP,t=>{if(!yM(navigator.platform)||t.key!=="Home"&&t.key!=="End"||t.altKey||t.metaKey||t.ctrlKey||t.isComposing)return!1;let n=e.getRootElement(),o=window.getSelection(),r=o?.anchorNode;return!n||!o||!r||!n.contains(r)||o.rangeCount===0||typeof o.modify!="function"?!1:(t.preventDefault(),t.stopPropagation(),o.modify(t.shiftKey?"extend":"move",t.key==="Home"?"backward":"forward","lineboundary"),e.update(()=>{Dr(mP(o,e))}),!0)},Or),[e]),null}function NK(){let[e]=wn();return K(()=>e.registerUpdateListener(({editorState:t})=>{let n=null;t.read(()=>{let o=$e();if(!Se(o)||!o.isCollapsed())return;let r=o.anchor.getNode();if(!Bi(r)||o.anchor.offset===0)return;n=wu(r,0)+1}),n!==null&&queueMicrotask(()=>{e.update(()=>{Us(n)})})}),[e]),null}function _K(){let[e]=wn(),{onRemoveTerminalContext:t}=Kt(FM);return K(()=>e.registerCommand(wm,n=>{let o=$e();if(!Se(o)||!o.isCollapsed())return!1;let r=o.anchor.getNode(),a=Tu(0),i=s=>{if(!Bi(s))return!1;let l=wu(s,0);return s.remove(),s instanceof Hs?(t(s.__context.id),Us(a)):Us(l),n?.preventDefault(),!0};if(i(r))return!0;if(nt(r)){if(o.anchor.offset>0)return!1;if(i(r.getPreviousSibling()))return!0;let s=r.getParent();if(Qe(s)){let l=r.getIndexWithinParent();if(l>0&&i(s.getChildAtIndex(l-1)))return!0}return!1}if(Qe(r)){let s=o.anchor.offset-1;if(s>=0&&i(r.getChildAtIndex(s)))return!0}return!1},Or),[e,t]),null}function DK(){let[e]=wn();return K(()=>{let t=new Set,n=e.getRootElement()===document.activeElement,o=l=>{for(let d of t)l.has(d)||e.getElementByKey(d)?.removeAttribute("data-composer-chip-selected");for(let d of l)e.getElementByKey(d)?.setAttribute("data-composer-chip-selected","true");t=l},r=()=>{let l=new Set;return e.getEditorState().read(()=>{let d=$e();if(Se(d)&&!d.isCollapsed())for(let c of d.getNodes())c instanceof Ka&&l.add(c.getKey())}),l},a=e.registerUpdateListener(()=>{o(n?r():new Set)}),i=e.registerCommand(VP,()=>(n=!0,o(r()),!1),ad),s=e.registerCommand(_P,()=>(n=!1,o(new Set),!1),ad);return()=>{a(),i(),s()}},[e]),null}function OK(){let[e]=wn();return K(()=>PM(e,{createMentionNode:oC,getExpandedAbsoluteOffsetForPoint:ag}),[e]),null}function FK(e){let[t]=wn(),n=D(e.terminalContexts),o=D(Iu(e.skills)),r=D(null),a=D(null);K(()=>{n.current=e.terminalContexts},[e.terminalContexts]),K(()=>{o.current=Iu(e.skills)},[e.skills]);let i=ph(s=>{let l=OM.get(s),d=r.current;if(!l)return r.current=null,!1;let c=!1;return t.update(()=>{let f=d??(()=>{let g=$e();if(!Se(g)||g.isCollapsed()||_M(g))return null;let v=NM(g);if(!v||v.start===v.end)return null;let x=bt().getTextContent();return pv(x,v.start,v.end)?null:{value:x,expandedStart:v.start,expandedEnd:v.end}})();if(!f||!l)return;let p=f.value.slice(f.expandedStart,f.expandedEnd),m=`${f.value.slice(0,f.expandedStart)}${s}${p}${l}${f.value.slice(f.expandedEnd)}`;rC(m,n.current,o.current);let h=cr(m,f.expandedStart);ng(h+s.length,h+s.length+p.length),c=!0,r.current=null}),c});return K(()=>{let s=h=>{if(a.current){if(h.key==="Dead"||h.key===" "||h.code==="Space")return;a.current=null}if(h.defaultPrevented||h.isComposing||h.metaKey||h.ctrlKey){r.current=null,a.current=null;return}t.getEditorState().read(()=>{let g=$e();if(!Se(g)||g.isCollapsed()){r.current=null,a.current=null;return}if(_M(g)){r.current=null,a.current=null;return}let v=NM(g);if(!v||v.start===v.end){r.current=null,a.current=null;return}let x=bt().getTextContent();if(pv(x,v.start,v.end)){r.current=null,a.current=null;return}let y={value:x,expandedStart:v.start,expandedEnd:v.end};r.current=y,a.current=null})},l=h=>{if(h.inputType==="insertCompositionText"&&h.data==="`"&&RM!==null&&r.current){a.current=r.current;return}if(a.current||h.inputType==="insertCompositionText")return;if(typeof h.data!="string"){r.current=null;return}let g=h.inputType==="insertText"?h.data:null;if(!g||g.length!==1){r.current=null;return}i(g)&&(h.preventDefault(),h.stopPropagation(),h.stopImmediatePropagation())},d=h=>{queueMicrotask(()=>{t.update(()=>{let g=a.current;if(!g)return;let v=bt().getTextContent(),x=RM;if(x===null){a.current=null;return}let y=`${g.value.slice(0,g.expandedStart)}\`${g.value.slice(g.expandedEnd)}`;if(v!==y){h?.finalAttempt&&(r.current=null,a.current=null);return}let C=g.value.slice(g.expandedStart,g.expandedEnd),S=cr(v,g.expandedStart);ng(S,S+1);let L=$e();if(!Se(L)){r.current=null,a.current=null;return}L.insertText(`\`${C}${x}`),ng(S+1,S+1+C.length),r.current=null,a.current=null},{tag:Fr})})},c=h=>{let g=h;(g.inputType==="insertText"||g.inputType==="insertCompositionText")&&d()},f=()=>{d({finalAttempt:!0})},p=null,m=t.registerRootListener((h,g)=>{g?.removeEventListener("keydown",s),g?.removeEventListener("beforeinput",l,!0),g?.removeEventListener("input",c),g?.removeEventListener("compositionend",f),h?.addEventListener("keydown",s),h?.addEventListener("beforeinput",l,!0),h?.addEventListener("input",c),h?.addEventListener("compositionend",f),p=h});return()=>{p&&(p.removeEventListener("keydown",s),p.removeEventListener("beforeinput",l,!0),p.removeEventListener("input",c),p.removeEventListener("compositionend",f)),m()}},[t]),null}function BK({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,onRemoveTerminalContext:l,onChange:d,onCommandKeyDown:c,onPaste:f,editorRef:p}){let[m]=wn(),h=D(d);h.current=d;let g=dr(t,n),v=Va(e,t,{cursor:g,expandedCursor:Tr(t,g)}),x=dr(t,v.cursor),y=wK(o),C=D(y),S=TK(r),L=D(S),w=D(Iu(r)),k=D({value:t,cursor:x,expandedCursor:v.expandedCursor,selection:v.selection,terminalContextIds:o.map(U=>U.id)}),I=D(e),T=v.history,E=D(!1),A=z(()=>({onRemoveTerminalContext:l}),[l]);xe(()=>{w.current=Iu(r)},[r]),K(()=>{m.setEditable(!a)},[a,m]),xe(()=>{let U=dr(t,n),H=k.current,F=I.current,oe=F!==e,ee=C.current!==y,W=L.current!==S;if(!oe&&H.value===t&&H.cursor===U&&!ee&&!W)return;if(oe){let Ie=H.selection;m.getEditorState().read(()=>{Ie=eC(Ie)}),fd(F,H.value,{cursor:H.cursor,expandedCursor:H.expandedCursor,selection:Ie})}let Ze=Va(e,t),ue=oe?Ze.selection:{anchor:U,focus:U};k.current={value:t,cursor:oe?Ze.cursor:U,expandedCursor:oe?Ze.expandedCursor:Tr(t,U),selection:ue,terminalContextIds:o.map(Ie=>Ie.id)},I.current=e,C.current=y,L.current=S;let pe=m.getRootElement(),Fe=!!(pe&&document.activeElement===pe);if(!oe&&H.value===t&&!ee&&!W&&!Fe)return;let Le=oe?Va(F,H.value).history:null;E.current=!0;let ie=()=>m.update(()=>{let Ie=oe||H.value!==t||ee||W;Ie&&rC(t,o,w.current),oe?ng(ue.anchor,ue.focus):(Ie||Fe)&&Us(U)},{discrete:!0,tag:Fr});Le?MM(Le,ie):ie(),fd(e,t,k.current),queueMicrotask(()=>{E.current=!1})},[n,e,m,S,o,y,t]);let N=B(U=>{let H=m.getRootElement();if(!H)return;let F=dr(k.current.value,U);H.focus({preventScroll:!0}),m.update(()=>{Us(F)}),k.current={value:k.current.value,cursor:F,expandedCursor:Tr(k.current.value,F),selection:{anchor:F,focus:F},terminalContextIds:k.current.terminalContextIds},fd(I.current,k.current.value,{cursor:k.current.cursor,expandedCursor:k.current.expandedCursor,selection:k.current.selection}),h.current(k.current.value,F,k.current.expandedCursor,!1,k.current.terminalContextIds)},[m]),R=B(()=>{let U=k.current;return m.getEditorState().read(()=>{let H=bt().getTextContent(),F=dr(H,k.current.cursor),oe=dr(H,Tu(F)),ee=tg(H,k.current.expandedCursor),W=tg(H,DM(ee)),Ze=nC(bt()),ue=eC(k.current.selection);U={value:H,cursor:oe,expandedCursor:W,selection:ue,terminalContextIds:Ze}}),k.current=U,fd(I.current,U.value,U),U},[m]);Yr(p,()=>({focus:()=>{N(k.current.cursor)},focusAt:N,focusAtEnd:()=>{N(cr(k.current.value,k.current.value.length))},readSnapshot:R}),[N,R]);let $=B(U=>{U.read(()=>{let H=bt().getTextContent(),F=dr(H,k.current.cursor),oe=dr(H,Tu(F)),ee=tg(H,k.current.expandedCursor),W=tg(H,DM(ee)),Ze=nC(bt()),ue=eC(k.current.selection),pe=k.current;if(pe.value===H&&pe.cursor===oe&&pe.expandedCursor===W&&pe.selection.anchor===ue.anchor&&pe.selection.focus===ue.focus&&pe.terminalContextIds.length===Ze.length&&pe.terminalContextIds.every((Le,ie)=>Le===Ze[ie])||E.current)return;k.current={value:H,cursor:oe,expandedCursor:W,selection:ue,terminalContextIds:Ze},fd(I.current,H,{cursor:oe,expandedCursor:W,selection:ue});let Fe=Rc(H,oe,"left")||Rc(H,oe,"right");h.current(H,oe,W,Fe,Ze)})},[]);return u(FM,{value:A,children:b("div",{className:"relative [font-family:var(--font-composer,var(--font-sans))] [font-size:var(--font-size-prompt,0.875rem)] [@media(max-width:39.999rem)_and_(pointer:coarse)]:[font-size:max(var(--font-size-prompt,1rem),16px)]",children:[u(xM,{contentEditable:u(dE,{className:O("block max-h-50 min-h-17.5 w-full overflow-y-auto whitespace-pre-wrap wrap-break-word bg-transparent leading-relaxed text-foreground focus:outline-none",s),"data-testid":"composer-editor","data-composer-prompt":"true",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off","aria-placeholder":i,placeholder:u("span",{}),onPaste:f}),placeholder:o.length>0?null:u("div",{className:"pointer-events-none absolute inset-0 leading-relaxed text-placeholder",children:i}),ErrorBoundary:cE}),u(KE,{onChange:$}),u(EK,{...c?{onCommandKeyDown:c}:{}}),u(FK,{terminalContexts:o,skills:r}),u(RK,{}),u(MK,{}),u(NK,{}),u(_K,{}),u(OK,{}),u(DK,{}),u(HE,{externalHistoryState:T},e)]})})}function zK(e){let[t]=wn(),n=D(e),o=D(e),[r,a]=G(e.documentKey);r===e.documentKey&&(n.current=e),o.current=e,xe(()=>{r===e.documentKey||t.isComposing()||a(e.documentKey)},[r,t,e.documentKey]),K(()=>{let s=null,l=()=>{let c=o.current.documentKey;a(f=>f===c?f:c)},d=t.registerRootListener((c,f)=>{f?.removeEventListener("compositionend",l),c?.addEventListener("compositionend",l),s=c});return()=>{s?.removeEventListener("compositionend",l),d()}},[t]);let i=r===e.documentKey?e:n.current;return u(BK,{...i})}function HM({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,onRemoveTerminalContext:l,onChange:d,onCommandKeyDown:c,onPaste:f,editorRef:p}){let m=D(t),h=D(o),g=D(Iu(r)),v=z(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[bu,Su,Hs],editorState:()=>{rC(m.current,h.current,g.current)},onError:x=>{throw x}}),[]);return u(SA,{initialConfig:v,children:u(zK,{documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,onRemoveTerminalContext:l,onChange:d,onPaste:f,editorRef:p,...c?{onCommandKeyDown:c}:{},...s?{className:s}:{}})},vK)}ge();function lg(e){return e==="ready"}function UM(e){return e==="ready"||e==="unchecked"||e==="checking"}function KM(e,t){switch(e){case"ready":return t("readiness.ready.title");case"unchecked":return t("readiness.unchecked.title");case"checking":return t("readiness.checking.title");case"disabled":return t("readiness.disabled.title");case"not-installed":return t("readiness.notInstalled.title");case"unauthenticated":return t("readiness.unauthenticated.title");case"error":return t("readiness.error.title");default:return e}}function ku(e){return e.enabled&&UM(e.readiness)}function cg(e){return e.enabled}function qM(e){let t=new Map;for(let n of e){let o=t.get(n.driverKind);o?o.push(n):t.set(n.driverKind,[n])}return[...t.values()].flat()}var dg=e=>e.enabled;function ug(e,t){if(t!==void 0){let n=e.find(o=>o.instanceId===t);if(n&&dg(n))return n}return e.find(n=>n.enabled&&lg(n.readiness))??e.find(ku)??e.find(n=>dg(n)&&n.readiness!=="error")}function VM(e,t){let n=e.find(o=>o.instanceId===t);if(n)return n.driverKind}var WM="h-7 min-h-7 gap-1.5 rounded-[var(--control-radius)] px-2.5 text-secondary-label transition-none hover:text-foreground [&_svg[data-composer-control-icon]]:mx-0 [&_svg[data-composer-control-chevron]]:-mx-0.5";function Po({className:e,size:t="sm",variant:n="ghost",...o}){return u(ne,{className:O(WM,e),size:t,variant:n,...o})}function ro({icon:e,className:t,opticalSize:n="default"}){return u(e,{"aria-hidden":"true",className:O("shrink-0",n==="large"?"size-4.5":"size-4",t),"data-composer-control-icon":!0})}function fa(){return u(dn,{"aria-hidden":"true",className:"-mx-0.5 size-icon-2 shrink-0 text-icon-muted","data-composer-control-chevron":!0,strokeWidth:2.25})}function pd({className:e,size:t="sm",variant:n="ghost",...o}){return u(KI,{className:O(WM,e),icon:u(fa,{}),size:t,variant:n,...o})}var aC=de(function(t){let n=t.instanceEntries.filter(cg),o=n.find(a=>a.instanceId===t.activeInstanceId)??n[0]??null,r=t.lockedProvider!=null&&t.lockedProvider.length>0;return b(Oo,{children:[b(Bo,{render:u(Po,{"aria-label":"Agent","data-composer-agent-picker":"true",disabled:t.disabled||r||n.length===0,className:O("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-36 shrink-0":"max-w-44 shrink")}),children:[o?u(Ir,{providerId:o.providerId,displayName:o.displayName,accentColor:o.accentColor,className:"size-4",iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,u("span",{className:"min-w-0 truncate",children:o?.displayName??"Agent"}),u(fa,{})]}),u(Fo,{align:"start",children:u(Sr,{value:t.activeInstanceId,onValueChange:a=>{if(!a||a===t.activeInstanceId)return;let i=t.modelOptionsByInstance.get(a)??[],l=i.some(d=>d.slug===t.model)?t.model:i[0]?.slug??t.model;t.onInstanceModelChange(a,l)},children:n.map(a=>u(jo,{value:a.instanceId,children:a.displayName},a.instanceId))})})]})});function GM(e){return u(aC,{...e})}ge();ge();ge();var wC=Rd(YM(),1),NR=Rd(Cc(),1),_R=Rd(Cc(),1);qn(function(t,n){return we("div",{ref:n,...t})});var bg=qn(function(t,n){return we("div",{ref:n,...t})}),gr=bg,Qa={OS:"web"};function Ks(e,t){return t===void 0?e:Math.max(0,Math.min(t,e))}function TC(e,t){return t===void 0||!Number.isFinite(t)||!Number.isFinite(e.scrollLength)||t<=e.scrollLength?t!==void 0&&Number.isFinite(t)&&Number.isFinite(e.scrollLength)?0:void 0:Math.max(0,t-e.scrollLength)}function DR(){return"normal"}function QK(e){var t;return(t=e?.horizontalRTLScrollType)!=null?t:DR()}function XK(e){var t;return(t=e?.rtl)!=null?t:!1}function Ya(e){return kC(e?.props)}function kC(e){return!!e?.horizontal&&XK(e)}function LC(e){return e?.horizontal?(kC(e)?e.stylePaddingLeft:e.stylePaddingRight)||0:e?.stylePaddingBottom||0}function YK(e,t){var n;return(n=TC(e,t))!=null?n:0}function JM(e,t){return t&&(Ya(e)?t.left:t.right)||0}function JK(e,t,n,o){return!Ya(e)||o===void 0||!Number.isFinite(o)?t:Math.max(0,o-t-n)}function PC(e,t,n){if(!e||!Ya(e))return t;let o=TC(e,n),r=Ks(t,o),a=QK(e);return a==="negative"?r===0?0:-r:a==="inverted"?o===void 0?r:Ks(o-r,o):r}function ZK(e,t,n){if(!Ya(e))return e.horizontalRTLScrollType=void 0,t;let o=TC(e,n);if(t<0)return e.horizontalRTLScrollType="negative",Ks(-t,o);if(o===void 0)return t;let r=t,a=o-t;if(!Number.isFinite(a))return e.horizontalRTLScrollType="normal",r;let i=e.horizontalRTLScrollType;if(i==="inverted")return Ks(a,o);if(i==="normal")return Ks(r,o);if(!e.hasScrolled){let f=DR();return e.horizontalRTLScrollType=f,Ks(r,o)}let s=e.scroll,l=Math.abs(r-s),c=Math.abs(a-s)+.5<l;return e.horizontalRTLScrollType=c?"inverted":"normal",Ks(c?a:r,o)}var eq=e=>e,Ig=Ut(null),OR="\0",tq=0;function nq({children:e}){let[t]=G(()=>({animatedScrollY:eq(0),columnWrapperStyle:void 0,containerLayoutTriggers:new Map,contextNum:tq++,listeners:new Map,mapViewabilityAmountCallbacks:new Map,mapViewabilityAmountValues:new Map,mapViewabilityCallbacks:new Map,mapViewabilityConfigStates:new Map,mapViewabilityValues:new Map,pendingContainerIds:void 0,positionListeners:new Map,scrollAxisGap:0,state:void 0,values:new Map([["alignItemsAtEndPadding",0],["containerLayoutEpoch",0],["stylePaddingTop",0],["headerSize",0],["numContainers",0],["activeStickyIndex",-1],["isAtEnd",!1],["isAtStart",!1],["isNearEnd",!1],["isNearStart",!1],["isWithinMaintainScrollAtEndThreshold",!1],["adaptiveRender","normal"],["totalSize",0],["scrollAdjustPending",0]]),viewRefs:new Map}));return we(Ig.Provider,{value:t},e)}function Hr(){return ln(Ig)}function FR(e,t){if(!e){let r=[];return{get:()=>r,subscribe:()=>()=>{}}}let n=[],o=[];return{get:()=>{let r=[],a=!1;for(let i=0;i<t.length;i++){let s=le(e,t[i]);r.push(s),s!==o[i]&&(a=!0)}return o=r,a&&(n=r),n},subscribe:r=>{let a=[];for(let i of t)a.push(Ga(e,i,r));return()=>{for(let i of a)i()}}}}function oq(e){return e.length===1?e[0]:e.join(OR)}function rq(e){return e.split(OR)}function Ga(e,t,n){let{listeners:o}=e,r=o.get(t);return r||(r=new Set,o.set(t,r)),r.add(n),()=>r.delete(n)}function le(e,t){let{values:n}=e;return n.get(t)}function Ae(e,t,n){let{listeners:o,values:r}=e;if(r.get(t)!==n){r.set(t,n);let a=o.get(t);if(a)for(let i of a)i(n)}}function aq(e,t,n){let{positionListeners:o}=e,r=o.get(t);return r||(r=new Set,o.set(t,r)),r.add(n),()=>r.delete(n)}function iq(e,t,n){let{positionListeners:o}=e,r=o.get(t);if(r)for(let a of r)a(n)}function Jo(e){let t=ln(Ig),n=oq(e),{subscribe:o,get:r}=z(()=>FR(t,rq(n)),[t,n]);return(0,wC.useSyncExternalStore)(o,r,r)}function sq(e,t){let n=ln(Ig),{subscribe:o,get:r}=z(()=>FR(n,[e]),[n,e]),a=B(()=>t(r()[0]),[r,t]);return(0,wC.useSyncExternalStore)(o,a,a)}function lq(e){return Math.max(0,e??0)}function Vs(e,t){var n;let o=e.state,{props:r}=o,a=r.horizontal,i=r.contentInset,s=i??o.nativeContentInset,l=(a?JM(o,s):s?.bottom)||0,d=lq(t??r.contentInsetEndAdjustment),c=le(e,"anchoredEndSpaceSize"),f=r.anchoredEndSpace&&c?c:0,p=(n=o.contentInsetOverride)!=null?n:void 0,m=l+d;if(p){let h={bottom:0,left:0,right:0,...s,...p};return Math.max(((a?JM(o,h):h.bottom)||0)+d,f)}return Math.max(m,f)}function ho(e){var t,n;let{values:o,state:r}=e,a=r.props.horizontal?r.props.stylePaddingLeft||0:o.get("stylePaddingTop")||0,i=r.props.horizontal?r.props.stylePaddingRight||0:r.props.stylePaddingBottom||0,s=o.get("alignItemsAtEndPadding")||0,l=o.get("headerSize")||0,d=o.get("footerSize")||0,c=Vs(e),f=(n=(t=r.pendingTotalSize)!=null?t:r.totalSize)!=null?n:o.get("totalSize"),p=Math.max(0,f-(r.props.data.length>0?e.scrollAxisGap:0));return l+d+p+a+s+i+(c||0)}var gd=({children:e})=>we(bg,{style:{alignItems:"center",flexDirection:"row",justifyContent:"space-between"}},e);de(function(){let t=Hr(),[n=0,o=0,r=0,a=0,i=0,s=0,l=!1]=Jo(["totalSize","scrollAdjust","debugRawScroll","debugComputedScroll","numContainers","numContainersPooled","isAtEnd"]),d=ho(t),[,c]=si(f=>f+1,0);return dq(()=>{c()},100),we(bg,{pointerEvents:"none",style:{backgroundColor:"#FFFFFFCC",borderRadius:4,padding:4,paddingBottom:4,paddingLeft:4,position:"absolute",right:0,top:0}},we(gd,null,we(gr,null,"TotalSize:"),we(gr,null,n.toFixed(2))),we(gd,null,we(gr,null,"ContentSize:"),we(gr,null,d.toFixed(2))),we(gd,null,we(gr,null,"At end:"),we(gr,null,String(l))),we(gd,null,we(gr,null,"ScrollAdjust:"),we(gr,null,o.toFixed(2))),we(gd,null,we(gr,null,"RawScroll: "),we(gr,null,r.toFixed(2))),we(gd,null,we(gr,null,"ComputedScroll: "),we(gr,null,a.toFixed(2))))});function dq(e,t){K(()=>{let n=setInterval(e,t);return()=>clearInterval(n)},[t])}var AC=!0,BR=new WeakMap;function cq(e){return BR.get(e)}function uq(e,t){BR.set(e,t)}var fq=typeof __DEV__<"u"?__DEV__:void 0,ZM,eR=typeof process<"u"&&typeof process.env=="object"&&process.env?(ZM="production")!=null?ZM:process.env.MODE:void 0,tR=typeof eR=="string"?eR.toLowerCase()!=="production":void 0,nR,Yo=(nR=tR??fq)!=null?nR:!1,hd=-1e7,zR=1,pq=Yo&&!1,mq=Yo&&!1;function Sg({scheduledWork:e}){e.cancel("checkFinishedScrollFrame"),e.cancel("checkFinishedScrollRetryFrame"),e.cancel("checkFinishedScrollFallback"),e.cancel("platformScrollCompletion")}function $R(e){var t,n;let o=(n=e.pendingScrollResolve)!=null?n:(t=e.pendingScrollToEnd)==null?void 0:t.resolve;e.pendingScrollResolve=void 0,e.pendingScrollToEnd=void 0,o?.()}function gq(e){Sg(e),e.scheduledWork.cancel("imperativeScrollReady"),e.scrollingTo=void 0,e.scrollTargetPinnedRange=void 0,$R(e)}function hq(e,t,n){return{...t,nativeEvent:{...t.nativeEvent,contentOffset:e.props.horizontal?{x:n,y:0}:{x:0,y:n}}}}function vq(e,t){var n,o,r,a;let i=e.state,s=i.deferredPublicOnScrollEvent;i.deferredPublicOnScrollEvent=void 0,s&&((a=(r=i.props).onScroll)==null||a.call(r,hq(i,s,(o=(n=t??i.scrollPending)!=null?n:i.scroll)!=null?o:0)))}var sC=1;function xq(e){return!!(e?.didDispatchNativeScroll||e?.didRetrySilentInitialScroll||e?.watchdog)}function oR(e){e.initialScrollSession=void 0}function pC(e){let{bootstrap:t,completion:n,kind:o,previousDataLength:r}=e;return o==="offset"?{completion:n,kind:o,previousDataLength:r}:{bootstrap:t,completion:n,kind:o,previousDataLength:r}}function fg(e,t=(n=>(n=(o=>(o=e.initialScrollSession)==null?void 0:o.kind)())!=null?n:"bootstrap")()){var n,o;return e.initialScrollSession?e.initialScrollSession.kind!==t&&(e.initialScrollSession=pC({bootstrap:e.initialScrollSession.kind==="bootstrap"?e.initialScrollSession.bootstrap:void 0,completion:e.initialScrollSession.completion,kind:t,previousDataLength:e.initialScrollSession.previousDataLength})):e.initialScrollSession=pC({completion:{},kind:t,previousDataLength:0}),(o=(n=e.initialScrollSession).completion)!=null||(n.completion={}),e.initialScrollSession.completion}var wg={didDispatchNativeScroll(e){var t,n;return!!((n=(t=e.initialScrollSession)==null?void 0:t.completion)!=null&&n.didDispatchNativeScroll)},didRetrySilentInitialScroll(e){var t,n;return!!((n=(t=e.initialScrollSession)==null?void 0:t.completion)!=null&&n.didRetrySilentInitialScroll)},markInitialScrollNativeDispatch(e){fg(e).didDispatchNativeScroll=!0},markSilentInitialScrollRetry(e){fg(e).didRetrySilentInitialScroll=!0},resetFlags(e){if(!e.initialScrollSession)return;let t=fg(e,e.initialScrollSession.kind);t.didDispatchNativeScroll=void 0,t.didRetrySilentInitialScroll=void 0}},ao={clear(e){ao.set(e,void 0)},didReachTarget(e,t){return Math.abs(e-t.targetOffset)<=sC},get(e){var t,n;return(n=(t=e.initialScrollSession)==null?void 0:t.completion)==null?void 0:n.watchdog},hasNonZeroTargetOffset(e){return e!==void 0&&e>sC},isAtZeroTargetOffset(e){return e<=sC},set(e,t){var n,o;if(!t&&!((o=(n=e.initialScrollSession)==null?void 0:n.completion)!=null&&o.watchdog))return;let r=fg(e);r.watchdog=t?{startScroll:t.startScroll,targetOffset:t.targetOffset}:void 0}};function Xa(e,t={}){var n,o,r,a;let i=e.initialScrollSession,s=(n=t.kind)!=null?n:i?.kind,l=i?.completion,d=i?.kind==="bootstrap"?i.bootstrap:void 0,c=s==="bootstrap"?t.bootstrap===null?void 0:(o=t.bootstrap)!=null?o:d:void 0;if(!s||!e.initialScroll&&!c&&!xq(l))return oR(e);let f=(a=(r=t.previousDataLength)!=null?r:i?.previousDataLength)!=null?a:0;return e.initialScrollSession=pC({bootstrap:c,completion:l,kind:s,previousDataLength:f}),e.initialScrollSession}var yq=1.3;function mC(e,t,n){let o=Math.abs(e);return!t&&n>0&&o>=n*yq||!t&&n<=0&&o>0}var HR=(e,t,n,o,r,a,i,s)=>{let l=Math.abs(e),d=t||n>0&&l<=n,c=()=>{s({atThreshold:t,contentSize:a.contentSize,dataLength:a.dataLength,scrollPosition:a.scrollPosition})};return o?mC(e,t,n)?(s(void 0),!1):(d&&(!r||r.atThreshold!==t||r.contentSize!==a.contentSize||r.dataLength!==a.dataLength)&&c(),!0):d?(i(e),c(),!0):!1};function Cq(e,t){let n=e.state;t==="start"?(n.isStartReached=!1,n.startReachedSnapshot=void 0):(n.isEndReached=!1,n.endReachedSnapshot=void 0)}function UR(e){let t=e.state;if(!t.edgeReachedGate)return;let n=ho(e),o=n-t.scroll-t.scrollLength-Vs(e),r=n<t.scrollLength,a=t.props.onStartReachedThreshold*t.scrollLength,i=t.props.onEndReachedThreshold*t.scrollLength,s=mC(t.scroll,!1,a),l=mC(o,r,i);s&&l&&(t.edgeReachedGate=void 0)}function KR(e,t,n,o){return!e.state.edgeReachedGate||n===t||!!o}function qR(e){e.state.edgeReachedGate="closed"}function rR(e){e.state.edgeReachedGate&&(e.state.edgeReachedGate="prepared")}function bq(e,t){let n=e.state;if(n.edgeReachedGate!=="prepared")return;let o=t<0?"start":"end";return n.edgeReachedGate="closed",Cq(e,o),o}function Au(e){return!!e?.initialScroll&&!e.didFinishInitialScroll}function VR(e,t,n){var o;let r=e.state;if(!r)return;let{queuedInitialLayout:a,scrollLength:i,scroll:s,maintainingScrollAtEnd:l,props:{maintainScrollAtEndThreshold:d,onEndReachedThreshold:c}}=r,f=ho(e);if(UR(e),f>0&&a){let p=Vs(e),m=f-s-i-p,h=f<i;Ae(e,"isAtEnd",h||m<=zR),Ae(e,"isNearEnd",h||m<=c*i),Ae(e,"isWithinMaintainScrollAtEndThreshold",h||m<=d*i),Au(r)||l||(r.isEndReached=HR(m,h,c*i,r.isEndReached,r.endReachedSnapshot,{contentSize:f,dataLength:(o=r.props.data)==null?void 0:o.length,scrollPosition:s},v=>{var x,y;KR(e,"end",t,n)&&(qR(e),(y=(x=r.props).onEndReached)==null||y.call(x,{distanceFromEnd:v}))},v=>{r.endReachedSnapshot=v}))}}function Iq(e,t,n){let o=e?.state;if(!o)return;let{isStartReached:r,props:{data:a,onStartReachedThreshold:i},scroll:s,scrollLength:l,startReachedSnapshot:d,totalSize:c}=o,f=a.length,p=i*l;UR(e),r&&p>0&&s>p&&d&&(d.contentSize!==c||d.dataLength!==f)&&(o.isStartReached=!1,o.startReachedSnapshot=void 0),Ae(e,"isAtStart",s<=zR),Ae(e,"isNearStart",s<=p),Au(o)||o.scrollingTo||(o.isStartReached=HR(s,!1,p,o.isStartReached,d,{contentSize:c,dataLength:f,scrollPosition:s},h=>{var g,v;KR(e,"start",t,n)&&(qR(e),(v=(g=o.props).onStartReached)==null||v.call(g,{distanceFromStart:h}))},h=>{o.startReachedSnapshot=h}))}function Tg(e,t){let n=!e.state.edgeReachedGate;VR(e,t,n),Iq(e,t,n)}function WR(e){var t,n;let o=e.state;(t=o.props)!=null&&t.data&&((n=o.triggerCalculateItemsInView)==null||n.call(o,{forceFullItemPositions:!0})),Tg(e)}var Sq=6,wq=3,Tq=250;function GR(e){e.state.scheduledWork.cancel("adaptiveRender")}function aR(e,t){let n=e.state;GR(e),t<=0?Nu(e,"normal","scroll"):n.scheduledWork.timeout(()=>Nu(e,"normal","scroll"),t,"adaptiveRender")}function Nu(e,t,n){var o,r;le(e,"adaptiveRender")!==t&&(Ae(e,"adaptiveRender",t),(r=(o=e.state.props.adaptiveRender)==null?void 0:o.onChange)==null||r.call(o,t,n))}function EC(e){var t,n;GR(e);let o=(n=(t=e.state.props.adaptiveRender)==null?void 0:t.initialMode)!=null?n:"normal";le(e,"adaptiveRender")!==o&&Nu(e,o,"initial")}function kq(e,t,n){var o,r,a;let i=e.state,s=i.props.adaptiveRender,l=le(e,"adaptiveRender");if(le(e,"readyToRender"))if(s){let d=(o=s.enterVelocity)!=null?o:Sq,c=(r=s.exitVelocity)!=null?r:wq,f=(a=s.exitDelay)!=null?a:Tq,p=l==="light"?c:d,m=n?.forceLight||Math.abs(t)>p?"light":"normal",h=i.scheduledWork.has("adaptiveRender")?"normal":l;m!==h&&(m==="light"?(Nu(e,"light","scroll"),aR(e,f)):l==="light"&&aR(e,f))}else EC(e)}var MC=50;function jR(e,t){var n;let o=e.state.props.drawDistance,r=e.state.initialScroll,a=r!==void 0&&((n=r.viewPosition)!=null?n:0)>0;return t==="visible-first"||t!=="full"&&!le(e,"readyToRender")&&!a?Math.min(o,MC):o}function QR(e){let{state:t}=e;t.props.drawDistance<=MC||t.scheduledWork.has("fullDrawDistancePrewarm")||t.scheduledWork.frame(()=>{var n;return(n=t.triggerCalculateItemsInView)==null?void 0:n.call(t)},"fullDrawDistancePrewarm")}function RC(e,{resetLayout:t,resetInitialScroll:n}){let{state:o}=e;t&&(o.didContainersLayout=!1,o.queuedInitialLayout=!1),n&&(o.didFinishInitialScroll=!1),Ae(e,"readyToRender",!1),EC(e)}function NC(e,{didLayout:t,didInitialScroll:n}){let{state:o}=e,{loadStartTime:r,props:{onLoad:a}}=o;t&&(o.didContainersLayout=!0),n&&(o.didFinishInitialScroll=!0),o.didContainersLayout&&o.didFinishInitialScroll&&!le(e,"readyToRender")&&(Ae(e,"readyToRender",!0),Nu(e,"normal","ready"),o.props.drawDistance>MC&&QR(e),o.didLoad||(o.didLoad=!0,a&&a({elapsedTimeInMs:Date.now()-r})))}var Lq=2e3;function iR(e,t){e.scroll=t,e.scrollPending=t,e.scrollPrev=t}function XR(e){e.scheduledWork.cancel("preservedInitialScroll")}function vd(e){XR(e),e.clearPreservedInitialScrollOnNextFinish=void 0,e.initialScroll=void 0,Xa(e)}function sR(e){var t,n,o;let r=e.state,a=((t=r.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?r.initialScrollSession.bootstrap:void 0;(r.initialScroll||a||(n=r.scrollingTo)!=null&&n.isInitialScroll)&&(a?.frameHandle!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(a.frameHandle),(o=r.scrollingTo)!=null&&o.isInitialScroll&&(Sg(r),r.scrollingTo=void 0,r.scrollTargetPinnedRange=void 0),wg.resetFlags(r),Xa(r,{bootstrap:null}),xd(e))}function xd(e,t){var n,o,r;let a=e.state;if(t?.resolvedOffset!==void 0)iR(a,t.resolvedOffset);else if(t?.syncObservedOffset&&((n=a.initialScrollSession)==null?void 0:n.kind)==="offset"){let s=(r=(o=a.refScroller.current)==null?void 0:o.getCurrentScrollOffset)==null?void 0:r.call(o);typeof s=="number"&&Number.isFinite(s)&&iR(a,s)}let i=()=>{var s,l,d,c,f;let p=((s=a.initialScrollSession)==null?void 0:s.kind)==="bootstrap",m=(c=(d=(l=t?.resolvedOffset)!=null?l:a.scrollPending)!=null?d:a.scroll)!=null?c:0;ao.clear(a),t?.preserveTarget&&a.initialScroll?(a.clearPreservedInitialScrollOnNextFinish=void 0,Xa(a),XR(a),t?.schedulePreservedTargetClear&&a.scheduledWork.timeout(()=>{var h;!a.didFinishInitialScroll||(h=a.scrollingTo)!=null&&h.isInitialScroll||!a.initialScroll||vd(a)},Lq,"preservedInitialScroll")):vd(a),t?.recalculateItems&&WR(e),NC(e,{didInitialScroll:!0}),p&&vq(e,m),(f=t?.onFinished)==null||f.call(t)};if(t?.waitForCompletionFrame){requestAnimationFrame(i);return}i()}function kg(e,t){let n=e.state;return t!==void 0&&n.positions[t]||0}function Pq(e){let{state:t}=e;return(t.props.horizontal?(Ya(t)?t.props.stylePaddingRight:t.props.stylePaddingLeft)||0:le(e,"stylePaddingTop")||0)+(le(e,"alignItemsAtEndPadding")||0)+(le(e,"headerSize")||0)}function Bt(e,t){let{data:n,keyExtractor:o}=e.props;if(!n)return"";let a=t<n.length?o?o(n[t],t):t:null;return e.idCache[t]=a,a}function Aq(e){var t,n,o;let{state:r,values:a}=e;return(a.get("headerSize")||0)+(a.get("footerSize")||0)+((o=(n=(t=r.pendingTotalSize)!=null?t:r.totalSize)!=null?n:a.get("totalSize"))!=null?o:0)+(r.props.stylePaddingTop||0)+(r.props.stylePaddingBottom||0)}function Eq(e){let{state:t}=e;return!!t.props.alignItemsAtEndPaddingEnabled&&!t.props.horizontal&&t.props.data.length>0&&t.scrollLength>0?Math.max(0,t.scrollLength-Aq(e)-Vs(e)):0}function Qs(e){let t=le(e,"alignItemsAtEndPadding")||0,n=Eq(e);t!==n&&Ae(e,"alignItemsAtEndPadding",n)}function Eu(e,t,n,o=!0){let r=e.state,a=r.totalSize,i=r.totalSize;t===null?(i=n,r.timeoutSetPaddingTop&&(clearTimeout(r.timeoutSetPaddingTop),r.timeoutSetPaddingTop=void 0)):i+=n,a!==i?(r.pendingTotalSize=void 0,r.totalSize=i,o&&Ae(e,"totalSize",i),Qs(e)):o&&e.values.get("totalSize")!==i&&Ae(e,"totalSize",i)}function gC(e,t,n,o=!0){let r=e.state,{sizes:a}=r,i=a.get(t),s=i!==void 0?n-i:n;s!==0&&Eu(e,t,s,o),a.set(t,n)}function YR(e){return typeof e=="function"}function Lg(e){return Array.isArray(e)}var lR=new Set;function qs(e,t){Yo&&!lR.has(e)&&(lR.add(e),console.warn(`[legend-list] ${t}`))}function _u(e){return Math.floor(e*8)/8}function Mu(e){return e==null}function dR(e,t){var n,o,r;let a=t==="Left"||t==="Right"?e.paddingHorizontal:e.paddingVertical;return(r=(o=(n=e[`padding${t}`])!=null?n:a)!=null?o:e.padding)!=null?r:0}function Pu(e,t,n){return dR(e,n)+dR(t,n)}function hC(e,t){var n,o;let r=(o=(n=e.state)==null?void 0:n.containerItemKeys)==null?void 0:o.get(t);if(r!==void 0)return r;let a=le(e,"numContainers");for(let i=0;i<a;i++)if(le(e,`containerItemKey${i}`)===t)return i;return-1}function JR(e,t,n,o,r){var a,i;let s=e.state,{getFixedItemSize:l,getItemType:d}=s.props,c=t?s.sizesKnown.get(t):void 0;if(c===void 0&&t&&l){let f=(i=r?.itemType)!=null?i:d&&(a=d(o,n))!=null?a:"",p=r?.didResolveFixedItemSize?r.fixedItemSize:l(o,n,f);p!==void 0&&(c=p+e.scrollAxisGap,s.sizesKnown.set(t,c))}return c}function ZR(e,t){let n=Bt(e.state,t);return JR(e,n,t,e.state.props.data[t])}function Mq(e,t,n){for(let o=t;o<=n;o++)if(ZR(e,o)===void 0)return!1;return!0}function vo(e,t,n,o,r,a,i,s){var l,d,c,f;let p=e.state,{sizes:m,averageSizes:h,props:{estimatedItemSize:g,getItemType:v},scrollingTo:x}=p,y=p.sizesKnown.get(t);if(y!==void 0)return y;let C,S=m.get(t);if(a&&S!==void 0)return S;if(C=JR(e,t,n,o,s),C!==void 0)return gC(e,t,C,i),C;let L=(d=s?.itemType)!=null?d:v&&(l=v(o,n))!=null?l:"";if(r&&!x){let w=(c=h[L])==null?void 0:c.avg;w!==void 0&&(C=_u(w))}if(C===void 0&&S!==void 0)return S;if(C===void 0&&r&&x){let w=(f=x.averageSizeSnapshot)==null?void 0:f[L];w!==void 0&&(C=_u(w))}return C===void 0&&(C=g+e.scrollAxisGap),gC(e,t,C,i),C}function _C(e,t){if(t===void 0||t<0)return;let n=Bt(e.state,t);return vo(e,n,t,e.state.props.data[t])}function Pg(e,t,n){var o;let r=e.state,{index:a,viewOffset:i,viewPosition:s}=n,l=t;if(i&&(l-=i),a!==void 0){let d=Pq(e);d&&(l+=d)}if(s!==void 0&&a!==void 0){let d=r.props.data.length;if(d===0)return l;let c=a<0||a>=d,f=(o=r.props.estimatedItemSize)!=null?o:0,p=c?f:vo(e,Bt(r,a),a,r.props.data[a]),m=Math.max(0,p-(c?0:e.scrollAxisGap)),h=Vs(e);if(l-=s*(r.scrollLength-h-m),!c&&a===r.props.data.length-1){let g=le(e,"footerSize")||0;l+=g}}return l}function zi(e,t,n){let o=e.state,r=ho(e),a=t;if(Number.isFinite(r)&&Number.isFinite(o.scrollLength)&&Qa.OS!=="android"){let i=Math.max(0,r-o.scrollLength),s=n?.viewOffset,l=typeof s=="number"&&s<0?-s:0,d=i+l;a=Math.min(t,d)}return a=Math.max(0,a),a}function Du(e){var t,n;let o=e.state;if(o?.scrollingTo){Sg(o);let r=o.pendingScrollResolve;o.pendingScrollResolve=void 0;let a=o.scrollingTo;if(o.scrollHistory.length=0,o.scrollingTo=void 0,o.scrollTargetPinnedRange=void 0,o.pendingTotalSize!==void 0&&Eu(e,null,o.pendingTotalSize),o.scrollAdjustHandler.commitPendingAdjust(a),a.isInitialScroll||o.initialScroll){let i=((t=o.initialScrollSession)==null?void 0:t.kind)==="offset",s=!!a.isInitialScroll&&!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;xd(e,{onFinished:()=>{r?.()},preserveTarget:i&&o.props.data.length===0||s,recalculateItems:!0,schedulePreservedTargetClear:s,syncObservedOffset:i,waitForCompletionFrame:!!a.waitForInitialScrollCompletionFrame});return}WR(e),r?.()}}var Rq=80,Nq=1500,_q=320,Dq=1;function Oq(e,t){var n,o;let r=e.state,{animated:a,horizontal:i,offset:s}=t;r.scheduledWork.cancel("platformScrollCompletion");let l=r.refScroller.current,d=l?.getScrollableNode();if(!l||!d)return;let c=!!a,f=!!i,p=f?ho(e):void 0,m=f?PC(r,s,p):0,h=f?0:s;if(l.scrollTo({animated:c,x:m,y:h}),c){let g=(o=(n=l.getScrollEventTarget)==null?void 0:n.call(l))!=null?o:null;Fq(e,{readOffset:()=>l.getCurrentScrollOffset(),target:g,targetOffset:s})}else{r.scroll=s;let g=r.scrollingTo;r.scheduledWork.timeout(()=>{g===r.scrollingTo&&Du(e)},100,"platformScrollCompletion")}}function Fq(e,t){let{readOffset:n,target:o,targetOffset:r}=t;if(!o){Du(e);return}let a="onscrollend"in o,i,s=!1,{scheduledWork:l,scrollingTo:d}=e.state,c=setTimeout(()=>m("max"),Nq),f=()=>{o.removeEventListener("scroll",h),a&&o.removeEventListener("scrollend",g),i!==void 0&&clearTimeout(i),clearTimeout(c)},p=()=>{s||(s=!0,f())},m=v=>{if(s)return;if(d!==e.state.scrollingTo){l.cancel("platformScrollCompletion");return}let x=n(),y=Math.abs(x-r)<=Dq;v==="scrollend"&&!y||(l.cancel("platformScrollCompletion"),Du(e))},h=()=>{i!==void 0&&clearTimeout(i),i=setTimeout(()=>m("idle"),Rq)},g=()=>m("scrollend");o.addEventListener("scroll",h),a?o.addEventListener("scrollend",g):i=setTimeout(()=>m("idle"),_q),l.register("platformScrollCompletion",p)}function yd(e){let t=e.state,{didContainersLayout:n,pendingNativeMVCPAdjust:o,refScroller:r,props:{maintainScrollAtEnd:a}}=t,s=!!(le(e,"isWithinMaintainScrollAtEndThreshold")&&a&&n);if(o)return t.pendingMaintainScrollAtEnd=s,!1;if(s){if(t.pendingMaintainScrollAtEnd=!1,ho(e)<t.scrollLength&&(t.scroll=0),t.maintainingScrollAtEnd)t.pendingMaintainScrollAtEnd=!0;else{let d=a.animated?"pending-animated":"pending-instant",c=a.animated?"animated":"instant",f=t.scroll;t.maintainingScrollAtEnd=d,requestAnimationFrame(()=>{let p=le(e,"isWithinMaintainScrollAtEndThreshold"),m=t.scroll!==f;if(p||!m){t.maintainingScrollAtEnd=c;let h=r.current;if(t.props.horizontal&&Ya(t)){let g=ho(e),v=YK(t,g),x=PC(t,v,g);h?.scrollTo({animated:a.animated,x,y:0})}else h?.scrollToEnd({animated:a.animated});setTimeout(()=>{t.maintainingScrollAtEnd===c&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd&&yd(e))},a.animated?500:0)}else t.maintainingScrollAtEnd===d&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd=!1)})}return!0}return t.pendingMaintainScrollAtEnd=!1,!1}function Xs(e,t,n){let o=e.state;if(Math.abs(t)>.1){let r=()=>{o.scrollAdjustHandler.requestAdjust(t),o.adjustingFromInitialMount&&o.adjustingFromInitialMount--};o.scroll+=t,o.scrollForNextCalculateItemsInView=void 0,le(e,"readyToRender")?r():(o.adjustingFromInitialMount=(o.adjustingFromInitialMount||0)+1,requestAnimationFrame(r))}}var Ao=.1,Bq=300,zq=2,$q=1;function Hq(e,t,n,o){if(!t){e.mvcpAnchorLock=void 0;return}let r=e.mvcpAnchorLock;if(!r)return;let a=o>r.expiresAt,i=e.indexByKey.get(r.id)===void 0;if(a||i||!n){e.mvcpAnchorLock=void 0;return}return r}function Uq(e,t){{let{anchorId:n,anchorPosition:o,dataChanged:r,now:a,positionDiff:i}=t,s=!!r||!!e.mvcpAnchorLock,l=e.props.maintainVisibleContentPosition.data;if(!s||!l||e.scrollingTo||!n||o===void 0)return;let d=e.mvcpAnchorLock,c=!r&&Math.abs(i)<=Ao&&d?.id===n?d.quietPasses+1:0;if(!r&&c>=zq){e.mvcpAnchorLock=void 0;return}e.mvcpAnchorLock={expiresAt:a+Bq,id:n,position:o,quietPasses:c}}}function Kq(e,t,n,o,r,a){return!1}function qq(e,t,n){if(Math.abs(t)<=Ao)return 0;let r=Math.max(0,n-e.scrollLength)-e.scroll;return t<0?Math.max(t,Math.min(0,r)):t>0?Math.min(t,Math.max(0,r)):0}function Vq(e,t){return e<0?-t:t}function lC(e,t,n){let o=e.state;o.pendingNativeMVCPAdjust=void 0;let r=t-n;Math.abs(r)>Ao&&Xs(e,r)}function Wq(e){let t=e.state,n=t.pendingNativeMVCPAdjust;if(!n||Math.abs(n.manualApplied)>Ao)return;let o=ho(e),r=qq(t,n.amount,o);if(Math.abs(r)<=Ao)return;let a=n.amount-r;Math.abs(a)<=Ao||(n.manualApplied=a,Xs(e,a),n.furthestProgressTowardAmount=0)}function Gq(e,t){let n=e.state,o=n.pendingNativeMVCPAdjust;if(!o)return!1;let r=o.amount-o.manualApplied,a=t-(o.startScroll+o.manualApplied),i=r<0&&a>Ao||r>0&&a<-Ao,s=Vq(r,a);if(Math.abs(r)<=Ao)return n.pendingNativeMVCPAdjust=void 0,!0;if(i)return n.pendingNativeMVCPAdjust=void 0,!1;if(s+Ao>=Math.abs(r))return lC(e,r,a),!0;let l=Math.max(0,ho(e)-n.scrollLength);return Math.abs(t-l)<=$q||n.pendingMaintainScrollAtEnd&&le(e,"isWithinMaintainScrollAtEndThreshold")&&s>Ao?(lC(e,r,a),!0):s>o.furthestProgressTowardAmount+Ao?(o.furthestProgressTowardAmount=s,!1):(o.furthestProgressTowardAmount>Ao&&s<o.furthestProgressTowardAmount-Ao&&(n.pendingNativeMVCPAdjust=void 0),!1)}function jq(e,t){let n=e.state,{idsInView:o,positions:r,props:a}=n,{maintainVisibleContentPosition:{data:i,size:s,shouldRestorePosition:l}}=a,d=Date.now(),c=!!t||!!n.mvcpAnchorLock,f=n.scrollingTo;if(t&&n.pendingScrollToEnd&&f===void 0){n.mvcpAnchorLock=void 0;return}let p=Hq(n,c,i,d),m,h,g=[],v=f?.index,x=f?.viewPosition,y=v!==void 0&&n.props.data.length>0&&v>=n.props.data.length-1&&(x??0)>0,C=t?i:s,S=n.indexByKey,L=n.scroll;if(ho(e),C){if(p&&v===void 0?(h=p.id,m=p.position):v!==void 0?h=Bt(n,v):o.length>0&&n.didContainersLayout&&!t&&(h=o.find(w=>S.get(w)!==void 0)),t&&o.length>0&&n.didContainersLayout)for(let w=0;w<o.length;w++){let k=o[w],I=S.get(k);if(I!==void 0){let T=r[I];T!==void 0&&g.push({id:k,position:T})}}if(h!==void 0&&m===void 0){let w=S.get(h);w!==void 0&&(m=r[w])}return()=>{let w=0,k=p?.id,I,T=!1,E=n.props.data;if(t&&i&&v===void 0&&h!==void 0&&p?.id===h&&l!==void 0&&h!==void 0){let R=S.get(h);if(R!==void 0){let $=E[R];T=$===void 0||!l($,R,E),T&&p?.id===h&&(n.mvcpAnchorLock=void 0)}}if(t&&i&&v===void 0&&(()=>{if(h===void 0||T)return!0;let R=S.get(h);return R===void 0||r[R]===void 0})())for(let R=0;R<g.length;R++){let{id:$,position:U}=g[R],H=S.get($);if(H!==void 0&&l){let oe=E[H];if(oe===void 0||!l(oe,H,E))continue}let F=H!==void 0?r[H]:void 0;if(F!==void 0){w=F-U,k=$,I=F;break}}if(!T&&h!==void 0&&m!==void 0){let R=S.get(h),$=R!==void 0?r[R]:void 0;if($!==void 0){let U=ho(e),H=$-m;if(H!==0&&y&&n.scroll+n.scrollLength>U)if(H>0)H=Math.max(0,U-n.scroll-n.scrollLength);else{let F=Math.max(0,U-n.scrollLength);n.scroll=F,n.scrollPending=F,H=0}w=H,k=h,I=$}}if(x&&x>0){let R=vo(e,h,v,n.props.data[v]),$=f?.itemSize;if(R!==void 0&&$!==void 0&&R!==$){let U=R-$;U!==0&&(w+=U*x,f.itemSize=R)}}if(Uq(n,{anchorId:k,anchorPosition:I,dataChanged:t,now:d,positionDiff:w}),Kq()){n.pendingNativeMVCPAdjust={amount:w,furthestProgressTowardAmount:0,manualApplied:0,startScroll:L},Wq(e);return}Math.abs(w)>Ao&&((n.maintainingScrollAtEnd==="pending-animated"||n.maintainingScrollAtEnd==="animated")&&le(e,"isWithinMaintainScrollAtEndThreshold")||Xs(e,w))}}}var cR=1e3,Qq=200,Ag=e=>{let{scrollHistory:t}=e,n=t.length-1;if(n<1)return 0;let o=t[n];if(Date.now()-o.time>cR)return 0;let r=0,a=0,i=0;for(let s=n;s>0;s--){let l=t[s],d=t[s-1],c=l.scroll-d.scroll,f=l.time-d.time,p=Math.sign(c);if(p!==0){if(r===0)r=p;else if(p!==r)break}if(o.time-d.time>cR)break;if(c===0||f<=0)continue;let m=o.time-l.time,h=Math.exp(-m/Qq);a+=c/f*h,i+=h}return i>0?a/i:0};function Xq(e){let t=e.mvcpAnchorLock;return t?Date.now()>t.expiresAt?(e.mvcpAnchorLock=void 0,!1):!0:!1}function $u(e){return e.dataChangeNeedsScrollUpdate||Xq(e)}function Ws(e,t,n,o){var r;let a=e.state,{ignoreScrollFromMVCP:i,lastScrollAdjustForHistory:s,scrollAdjustHandler:l,scrollHistory:d,scrollingTo:c}=a,f=a.scroll;o?.markHasScrolled!==!1&&(a.hasScrolled=!0);let p=Date.now();a.lastBatchingAction=p;let m=l.getAdjust(),h=s!==void 0&&Math.abs(m-s)>.1;if(h&&(d.length=0),a.lastScrollAdjustForHistory=m,c===void 0&&!(d.length===0&&t===a.scroll)&&(h||d.push({scroll:t,time:p})),d.length>5&&d.shift(),i&&!c){let{lt:T,gt:E}=i;if(T&&t<T||E&&t>E){a.ignoreScrollFromMVCPIgnored=!0;return}}a.scrollPrev=f,a.scrollPrevTime=a.scrollTime,a.scroll=t,a.scrollTime=p;let g=Math.abs(t-f),x=!!o?.fromNativeScrollEvent&&g>.1&&!h&&c===void 0&&!a.pendingNativeMVCPAdjust?bq(e,t-f):void 0,y=Gq(e,t),C=a.scrollLength,S=C>0&&c===void 0&&g>C&&!a.pendingNativeMVCPAdjust,L=Ag(a);kq(e,L,{forceLight:S});let w=a.scrollLastCalculate;if($u(a)||y||x!==void 0||n||w===void 0||Math.abs(a.scroll-w)>2){a.scrollLastCalculate=a.scroll,a.ignoreScrollFromMVCPIgnored=!1,a.lastScrollDelta=g;let T=()=>{var A;let N={doMVCP:c!==void 0,scrollVelocity:L};S&&(N.drawDistanceMode="visible-first"),(A=a.triggerCalculateItemsInView)==null||A.call(a,N),Tg(e,x)};S?(a.mvcpAnchorLock=void 0,a.pendingNativeMVCPAdjust=void 0,a.userScrollAnchorReset={keys:new Set},a.scheduledWork.cancel("mvcpRecalculate"),(0,_R.flushSync)(T),QR(e)):T();let E=!!a.pendingMaintainScrollAtEnd||!!((r=a.props.maintainScrollAtEnd)!=null&&r.onDataChange);y&&E&&(a.pendingMaintainScrollAtEnd=!1,yd(e)),a.dataChangeNeedsScrollUpdate=!1,a.lastScrollDelta=0}}function Yq(e){if(Object.keys(e.averageSizes).length===0)return;let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];t[n]=o.avg}return t}function Jq(e,t){var n;let{isInitialScroll:o,requestedOffset:r,targetOffset:a}=t,i=ao.get(e),s=!e.didFinishInitialScroll&&(o||!!i)&&ao.hasNonZeroTargetOffset(a),l=!e.didFinishInitialScroll&&!!i&&ao.isAtZeroTargetOffset(r);if(s){e.hasScrolled=!1,ao.set(e,{startScroll:(n=i?.startScroll)!=null?n:e.scroll,targetOffset:a});return}l&&ao.clear(e)}function Zq(e,t){let n=e.state,o=n.props.data.length,r=0,a=o-1,i;for(;r<=a;){let s=Math.floor((r+a)/2),l=n.positions[s];l===void 0?a=s-1:l<=t?(i=s,r=s+1):a=s-1}return i}function uR(e,t){var n;let o=e.state.positions[t];if(o===void 0)return;let r=(n=_C(e,t))!=null?n:0;return o+(Number.isFinite(r)?r:0)}function e4(e,t,n){let o=e.state,r=o.props.data.length;if(r===0)return;let a=Math.max(0,t),i=Math.max(a,t+o.scrollLength),s=n!==void 0?Math.max(0,Math.min(r-1,n)):Zq(e,a);if(s===void 0)return;if(n!==void 0&&o.positions[s]===void 0)return{end:s,start:s};if(n===void 0){let d=uR(e,s);if(d===void 0||d<=a)return}for(;s>0;){let d=o.positions[s];if(d===void 0||d<=a||o.positions[s-1]===void 0)break;s--}for(;s>0;){let d=uR(e,s-1);if(d===void 0||d<=a)break;s--}let l=s;for(;l+1<r;){let d=o.positions[l+1];if(d===void 0||d>i)break;l++}return{end:l,start:s}}function t4(e,t,n){let o=e4(e,t,n);o?(e.state.scrollTargetPinnedRange=o,e.state.scrollForNextCalculateItemsInView=void 0):e.state.scrollTargetPinnedRange=void 0}function Eg(e,t){var n,o;let r=e.state,{noScrollingTo:a,forceScroll:i,...s}=t,{animated:l,isInitialScroll:d,offset:c,precomputedWithViewOffset:f,waitForInitialScrollCompletionFrame:p}=s,{props:{horizontal:m}}=r;Sg(r);let h=f?c:Pg(e,c,s),g=!!d&&((n=r.initialScrollSession)==null?void 0:n.kind)==="offset",v=zi(e,h,s),x=g?h:v;if(r.scrollHistory.length=0,!a){d&&wg.resetFlags(r);let y=Yq(r);r.scrollingTo={...s,...y?{averageSizeSnapshot:y}:{},targetOffset:v,waitForInitialScrollCompletionFrame:p},d||t4(e,v,s.index)}r.scrollPending=v,Jq(r,{isInitialScroll:d,requestedOffset:x,targetOffset:v}),!d&&!a&&Math.abs(r.scroll-v)>1&&(l?r.scrollTargetPinnedRange&&((o=r.triggerCalculateItemsInView)==null||o.call(r)):Ws(e,v,!0,{markHasScrolled:!1})),i||!d||Qa.OS==="android"?Oq(e,{animated:l,horizontal:m,offset:x}):r.scroll=x}function eN(e,t){return t<=0?-1:e>=t?t-1:e<0?0:e}function pg(e,{index:t,viewOffset:n=0,animated:o=!0,forceScroll:r,isInitialScroll:a,viewPosition:i}){let s=e.state,{data:l}=s.props;t=eN(t,l.length);let d=_C(e,t),c=kg(e,t);t===l.length-1&&i===void 0&&(i=1),s.scrollForNextCalculateItemsInView=void 0,Eg(e,{animated:o,forceScroll:r,index:t,isInitialScroll:a,itemSize:d,offset:c,viewOffset:n,viewPosition:i??0})}function Mg(e,t){let{forceScroll:n,resolvedOffset:o,target:r,waitForCompletionFrame:a}=t,i=r.index,s=i!==void 0?eN(i,e.state.props.data.length):void 0,l=_C(e,s);Eg(e,{animated:!1,forceScroll:n,index:s!==void 0&&s>=0?s:void 0,isInitialScroll:!0,itemSize:l,offset:o,precomputedWithViewOffset:!0,viewOffset:r.viewOffset,viewPosition:r.viewPosition,waitForInitialScrollCompletionFrame:a})}function Gs(e,t,n){var o;let{state:r}=e;r.clearPreservedInitialScrollOnNextFinish=void 0,r.scheduledWork.cancel("preservedInitialScroll"),r.initialScroll=t,n?.resetDidFinish&&RC(e,{resetInitialScroll:!0}),Xa(r,{kind:((o=r.initialScrollSession)==null?void 0:o.kind)==="offset"?"offset":"bootstrap"})}function $r(e,t){var n,o;if(((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset")return(o=t.contentOffset)!=null?o:0;let a=t.index!==void 0?kg(e,t.index):0,i=Pg(e,a,t);return zi(e,i,t)}function tN(e,t){let{didFinishInitialScroll:n,queuedInitialLayout:o,scrollingTo:r}=e,a=e.initialScroll,i=!!r?.isInitialScroll,s=!!t?.requiresMeasuredLayout&&!o&&!i;if(!(!a||s||n||r&&!i))return{initialScroll:a,isInitialScrollInProgress:i,queuedInitialLayout:o,scrollingTo:r}}function n4(e,t){var n,o,r;let a=e.state,i=tN(a,{requiresMeasuredLayout:!0});if(!i)return!1;let{initialScroll:s,isInitialScrollInProgress:l,queuedInitialLayout:d}=i,c=l?i.scrollingTo:void 0,f=$r(e,s),p=c?(n=c.targetOffset)!=null?n:c.offset:void 0,m=s.contentOffset===void 0||Math.abs(s.contentOffset-f)>1,h=p!==void 0&&Math.abs(p-f)>1,g=p!==void 0&&Math.abs(a.scroll-f)<=1&&Math.abs(a.scrollPending-f)<=1;if(!t?.forceScroll&&!m&&l&&!h||t?.forceScroll&&g)return!1;m&&((o=a.initialScrollSession)==null?void 0:o.kind)!=="offset"&&Gs(e,{...s,contentOffset:f});let v=(r=t?.forceScroll)!=null?r:!!d||l&&m;return Mg(e,{forceScroll:v,resolvedOffset:f,target:s}),!0}function o4(e,t){var n,o;let r=e.state,a=tN(r);if(!a)return!1;let{initialScroll:i,queuedInitialLayout:s}=a,l=(n=i.contentOffset)!=null?n:0,d=Math.abs(r.scroll-l)<=1&&Math.abs(r.scrollPending-l)<=1;if(t?.forceScroll&&d)return!1;let c=!!r.lastLayout&&r.scrollLength>0,f=(o=t?.forceScroll)!=null?o:c||!!s;return Mg(e,{forceScroll:f,resolvedOffset:l,target:i}),!0}function Ou(e,t){var n;return((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset"?o4(e,{forceScroll:t?.forceScroll}):n4(e,{forceScroll:t?.forceScroll})}function Ru(e,t,n){if(t==null||n==null||t<0||n<t)return!1;let o=!1;for(let r of e.containerItemKeys.keys()){let a=e.indexByKey.get(r);if(a!==void 0&&a>=t&&a<=n){o=!0;let i=Bt(e,a);if(i===void 0||!e.sizesKnown.has(i))return!1}}return o}var Rg=1,r4=8,a4=24,i4="LegendList bootstrap initial scroll aborted after exceeding convergence bounds.";function hr(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?e.initialScrollSession.bootstrap:void 0}function Ys(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="offset"}function s4(e,t){if(!e||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function l4(e){let{dataLength:t,getSize:n,offset:o,positions:r,scrollLength:a,startIndex:i}=e,s=o+a,l=[],d=i!==void 0?Math.max(0,Math.min(t-1,i)):0;for(;d>0;){let c=d-1,f=r[c];if(f===void 0){d=c;continue}let p=n(c);if(p===void 0){d=c;continue}if(f+p<=o)break;d=c}for(;d<t;d++){let c=r[d];if(c===void 0)continue;let f=n(d);if(f!==void 0){if(c<s&&c+f>o)l.push(d);else if(l.length>0&&c>=s)break}}return l}function d4(e){let{mountFrameCount:t,maxFrames:n=r4,maxPasses:o=a4,passCount:r}=e;return t>=n||r>=o}function nN(e,t){return d4(t)?(Yo&&console.warn(i4),I4(e),!0):!1}function Fu(e){var t;let n=hr(e),o=n?.frameHandle;o!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o),n&&(n.frameHandle=void 0),Xa(e,{bootstrap:null,kind:(t=e.initialScrollSession)==null?void 0:t.kind})}function oN(e,t){var n,o,r;let a=hr(e);Xa(e,{bootstrap:{frameHandle:a?.frameHandle,mountFrameCount:(n=a?.mountFrameCount)!=null?n:0,passCount:0,previousResolvedOffset:void 0,scroll:t.scroll,seedContentOffset:(r=(o=t.seedContentOffset)!=null?o:a?.seedContentOffset)!=null?r:t.scroll,targetIndexSeed:t.targetIndexSeed,visibleIndices:void 0},kind:"bootstrap"})}function c4(e,t){var n,o,r;let a=hr(e);a?(a.passCount=0,a.previousResolvedOffset=void 0,a.scroll=(n=t?.scroll)!=null?n:a.scroll,a.seedContentOffset=(o=t?.seedContentOffset)!=null?o:a.seedContentOffset,a.targetIndexSeed=(r=t?.targetIndexSeed)!=null?r:a.targetIndexSeed,a.visibleIndices=void 0,Xa(e,{bootstrap:a,kind:"bootstrap"})):t?.scroll!==void 0&&oN(e,{scroll:t.scroll,seedContentOffset:t.seedContentOffset,targetIndexSeed:t.targetIndexSeed})}function vC(e){requestAnimationFrame(()=>{var t;hr(e)&&((t=e.triggerCalculateItemsInView)==null||t.call(e,{forceFullItemPositions:!0}))})}function DC(e){let t=e.state,n=hr(t);if(!n||n.frameHandle!==void 0)return;let o=()=>{let r=hr(t);r&&(r.frameHandle=void 0,r.mountFrameCount+=1,!nN(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})&&DC(e))};n.frameHandle=requestAnimationFrame(o)}function vg(e,t){c4(e.state,t),DC(e),vC(e.state)}function OC(e){let{dataLength:t,footerSize:n,preserveForFooterLayout:o,stylePaddingEnd:r}=e;return{contentOffset:void 0,index:Math.max(0,t-1),preserveForBottomPadding:!0,preserveForFooterLayout:o,viewOffset:-r-n,viewPosition:1}}function u4(e){return!!e?.preserveForBottomPadding}function js(e){return!!e?.preserveForFooterLayout}function rN(e){return!!(e&&e.viewPosition===1&&(u4(e)||js(e)))}function f4(e){let{dataLength:t,footerSize:n,initialScrollAtEnd:o,stylePaddingEnd:r,target:a}=e,i=js(a);return{...a,contentOffset:void 0,index:o?Math.max(0,t-1):a.index,preserveForBottomPadding:!0,preserveForFooterLayout:i,viewOffset:-r-(i?n:0),viewPosition:1}}function p4(e,t){return e.index===t.index&&e.preserveForBottomPadding===t.preserveForBottomPadding&&e.preserveForFooterLayout===t.preserveForFooterLayout&&e.viewOffset===t.viewOffset&&e.viewPosition===t.viewPosition}function xg(e,t){let{dataLength:n,stylePaddingEnd:o,target:r}=t;if(!js(r))return;let a=OC({dataLength:n,footerSize:0,preserveForFooterLayout:void 0,stylePaddingEnd:o});Gs(e,a)}function m4(e){vd(e)}function FC(e,t,n=Rg){let o=e.state;if(!o.didFinishInitialScroll)return!1;let r=Bu(o);return Math.abs(r-$r(e,t))>n}function Bu(e){var t,n,o,r;let a=(n=(t=e.refScroller.current)==null?void 0:t.getCurrentScrollOffset)==null?void 0:n.call(t);return typeof a=="number"&&Number.isFinite(a)?a:(r=(o=e.scrollPending)!=null?o:e.scroll)!=null?r:0}function aN(e){var t;let n=e.state,o=n.initialScroll;if(!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||!o||o.viewPosition!==1||n.props.data.length===0||Ys(n))return;let r=typeof n.lastNativeScroll=="number"&&Number.isFinite(n.lastNativeScroll)?n.lastNativeScroll:Bu(n);return $r(e,o)-r}function iN(e){return aN(e)===void 0?!1:(sN(e,{}),!0)}function sN(e,t){let n=e.state;n.preservedEndAnchorCorrection=t,requestAnimationFrame(()=>{var o;let r=n.preservedEndAnchorCorrection;if(r!==t)return;let a=aN(e);if(a===void 0||Math.abs(a)<=Rg){n.preservedEndAnchorCorrection=void 0;return}(!r.lastRequestTime||((o=n.lastNativeScrollTime)!=null?o:0)>r.lastRequestTime)&&(r.lastRequestTime=Date.now(),Xs(e,a)),sN(e,t)})}function g4(e){var t;let n=e.state,o=n.initialScroll;!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||o?.viewPosition!==1||n.preservedEndAnchorCorrection||FC(e,o)&&(rN(o)&&le(e,"isAtEnd")||(js(o)?xg(e,{dataLength:n.props.data.length,stylePaddingEnd:LC(n.props),target:o}):m4(n)))}function h4(e,t){var n,o,r;let{initialScrollAtEnd:a,target:i}=t,s=e.state,l=$r(e,i),d=l===0&&!a&&(Ys(s)?Math.abs((n=i.contentOffset)!=null?n:0)<=1:i.index===0&&((o=i.viewPosition)!=null?o:0)===0&&Math.abs((r=i.viewOffset)!=null?r:0)<=1),c=s.props.data.length===0&&i.index!==void 0;d?(Fu(s),xd(e,{resolvedOffset:l})):c?(Fu(s),xd(e,{preserveTarget:!0,resolvedOffset:l})):(oN(s,{scroll:l,seedContentOffset:0,targetIndexSeed:i.index}),DC(e))}function v4(e,t){let{dataLength:n,didDataChange:o,initialScrollAtEnd:r,previousDataLength:a,stylePaddingEnd:i}=t,s=e.state,l=s.initialScroll;if(Ys(s)||!l)return;let d=!!(s.didFinishInitialScroll&&a===0&&n>0&&l.index!==void 0),c=hr(s);if(!r&&o&&n>0&&s.didFinishInitialScroll&&!c&&!d){vd(s);return}let p=n>0&&(r||rN(l));if(!(!o&&!d&&!p)){if(p){let m=r?OC({dataLength:n,footerSize:le(e,"footerSize")||0,preserveForFooterLayout:js(l),stylePaddingEnd:i}):f4({dataLength:n,footerSize:le(e,"footerSize")||0,initialScrollAtEnd:r,stylePaddingEnd:i,target:l});if(!d&&FC(e,l)){xg(e,{dataLength:n,stylePaddingEnd:i,target:l});return}if(!p4(l,m)||c||d||o){Gs(e,m,{resetDidFinish:d}),vg(e,{scroll:$r(e,m),seedContentOffset:d&&!c?Bu(s):void 0,targetIndexSeed:m.index});return}}o&&(c||d)&&(Gs(e,l,{resetDidFinish:d}),vg(e,{scroll:$r(e,l),seedContentOffset:d&&!c?Bu(s):void 0,targetIndexSeed:l.index}))}}function x4(e,t){let{dataLength:n,footerSize:o,initialScrollAtEnd:r,stylePaddingEnd:a}=t,i=e.state;if(!r)return;let s=i.initialScroll;if(!(Ys(i)||n===0||!s||!(hr(i)||js(s))))if(FC(e,s))xg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let d=OC({dataLength:n,footerSize:o,preserveForFooterLayout:js(s),stylePaddingEnd:a});if(!(s.index!==d.index||s.viewPosition!==d.viewPosition||s.viewOffset!==d.viewOffset))xg(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let f=!!i.didFinishInitialScroll;Gs(e,d,{resetDidFinish:f}),vg(e,{scroll:$r(e,d),targetIndexSeed:d.index})}}}function y4(e){var t,n,o;let r=e.state,a=r.initialScroll,i=hr(r);if(a&&r.props.data.length>0&&!Ys(r)&&(i||a.viewPosition===1)){let s=$r(e,a),l=(t=r.scrollingTo)!=null&&t.isInitialScroll?r.scrollingTo:void 0;if(!i&&(l||r.didFinishInitialScroll)){let d=l?(n=l.targetOffset)!=null?n:l.offset:Bu(r),c=s-d;if(Math.abs(c)>Rg){if(r.didFinishInitialScroll)iN(e);else if(l){let f=ao.get(r);l.offset=s,l.targetOffset=s,r.initialScroll={...a,contentOffset:s},r.hasScrolled=!1,ao.set(r,{startScroll:(o=f?.startScroll)!=null?o:r.scroll,targetOffset:s}),Xs(e,c)}}}else vg(e,{scroll:s,targetIndexSeed:a.index})}}function C4(e){var t,n;let o=e.state,r=hr(o),a=o.initialScroll;if(!r||!a||Ys(o)||(t=o.scrollingTo)!=null&&t.isInitialScroll||(r.passCount+=1,nN(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})))return;a.index!==void 0&&o.startBuffered>=0&&o.endBuffered>=0&&a.index>=o.startBuffered&&a.index<=o.endBuffered&&(r.targetIndexSeed=void 0);let i=$r(e,a),s=Ru(o,o.startBuffered,o.endBuffered),l=Math.abs(r.scroll-i)>1,{data:d}=o.props,c=l4({dataLength:d.length,getSize:g=>{var v,x;let y=(v=o.idCache[g])!=null?v:Bt(o,g);return(x=o.sizes.get(y))!=null?x:vo(e,y,g,d[g])},offset:i,positions:o.positions,scrollLength:o.scrollLength,startIndex:(n=r.targetIndexSeed)!=null?n:o.startBuffered>=0?o.startBuffered:void 0}),f=c.length>0&&c.every(g=>{var v;let x=(v=o.idCache[g])!=null?v:Bt(o,g);return o.sizesKnown.has(x)}),p=r.previousResolvedOffset,m=r.visibleIndices;if(r.previousResolvedOffset=i,r.visibleIndices=c,l){r.scroll=i,vC(o);return}if(!s||!f)return;if(!(p!==void 0&&Math.abs(p-i)<=Rg&&s4(m,c))){vC(o);return}Fu(o),Mg(e,{forceScroll:!0,resolvedOffset:i,target:a,waitForCompletionFrame:Qa.OS==="web"})}function b4(e,t){var n;let o=e.state;Fu(o);let r=!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;xd(e,{preserveTarget:r,recalculateItems:!0,resolvedOffset:t,schedulePreservedTargetClear:r})}function I4(e){var t,n,o,r;let a=e.state,i=hr(a),s=a.initialScroll;i&&s&&!Ys(a)&&a.refScroller.current?(Fu(a),Mg(e,{forceScroll:!0,resolvedOffset:i.scroll,target:s,waitForCompletionFrame:Qa.OS==="web"})):b4(e,(r=(o=(n=(t=hr(a))==null?void 0:t.scroll)!=null?n:a.scrollPending)!=null?o:a.scroll)!=null?r:0)}function lN(e,t,n,o){return{dataChangeEpoch:e.dataChangeEpoch,getFixedItemSize:e.props.getFixedItemSize,getItemType:e.props.getItemType,itemData:n,itemIndex:t,itemType:o}}function S4(e,t,n,o){var r,a;let{getFixedItemSize:i,getItemType:s}=e.props,l=e.containerItemMetadata.get(t),d;if(l?.dataChangeEpoch===e.dataChangeEpoch&&l.getItemType===s&&l.itemData===o&&l.itemIndex===n)d=l;else{let c=s?(r=s(o,n))!=null?r:"":void 0;d=lN(e,n,o,c),e.containerItemMetadata.set(t,d)}return d.getFixedItemSize!==i&&(d.didResolveFixedItemSize=!1,d.fixedItemSize=void 0,d.getFixedItemSize=i),i&&!d.didResolveFixedItemSize&&(d.fixedItemSize=i(o,n,(a=d.itemType)!=null?a:""),d.didResolveFixedItemSize=!0),d}function dN(e){for(let t of e.containerItemMetadata.values())t.didResolveFixedItemSize=!1,t.fixedItemSize=void 0}var w4=20,T4=1,k4=1,dC=16;function BC(e,t){let n=e.state.scrollingTo;t?.onlyIfAligned&&(!n?.isInitialScroll||n.animated||!zC(e,n).isAtResolvedTarget)||e.state.scheduledWork.frame(()=>M4(e),"checkFinishedScrollFrame")}function L4(e,t){let{clampedTargetOffset:n,scrollingTo:o}=t;return!o.isInitialScroll||e.hasScrolled||n<=T4}function P4(e,t){return!!t?.isInitialScroll&&wg.didDispatchNativeScroll(e)&&!e.hasScrolled}function cN(e){var t;return(t=ao.get(e))==null?void 0:t.targetOffset}function uN(e){let t=cN(e);return!e.didFinishInitialScroll&&ao.hasNonZeroTargetOffset(t)}function fR(e,t){var n,o;if(!t.isInitialScroll||t.animated||!e.didContainersLayout||((n=e.initialScrollSession)==null?void 0:n.kind)==="bootstrap")return!1;let r=(o=t.targetOffset)!=null?o:t.offset;return ao.hasNonZeroTargetOffset(r)&&wg.didDispatchNativeScroll(e)&&!e.hasScrolled||ao.isAtZeroTargetOffset(r)||Math.abs(e.scroll-r)>1||Math.abs(e.scrollPending-r)>1?!1:!!t.waitForInitialScrollCompletionFrame||uN(e)}function pR(e){var t;let{state:n}=e;return!!((t=n.scrollingTo)!=null&&t.isInitialScroll)&&n.props.data.length>0&&ho(e)<=n.scrollLength&&n.scrollPending<=k4}function A4(e,t){return t.index===e.state.props.data.length-1&&t.viewPosition===1}function E4(e,t){var n;let o=t.index,a=A4(e,t)&&o!==void 0?Pg(e,kg(e,o),t):(n=t.targetOffset)!=null?n:zi(e,t.offset-(t.viewOffset||0),t);return zi(e,a,t)}function zC(e,t){let{state:n}=e,o=n.scrollPending,r=n.scrollAdjustHandler.getAdjust(),a=E4(e,t),i=zi(e,o,t),s=Math.abs(o-a),l=a+r,d=Math.abs(o-l),c=!t.animated||Qa.OS==="ios";return{clampedTargetOffset:a,isAtResolvedTarget:Math.abs(o-i)<1&&(s<1||c&&d<1)}}function M4(e){let t=e.state.scrollingTo;if(!t)return;let{state:n}=e,o=zC(e,t);o.isAtResolvedTarget&&L4(n,{clampedTargetOffset:o.clampedTargetOffset,scrollingTo:t})&&Du(e)}function R4(e,t){var n;(n=e.state.refScroller.current)==null||n.scrollTo({animated:!1,x:e.state.props.horizontal?t:0,y:e.state.props.horizontal?0:t})}function N4(e){let t=e.state;if(t.scheduledWork.has("checkFinishedScrollFallback"))return;let n=t.scrollingTo,o=pR(e),r=P4(t,n),a=n!==void 0?fR(t,n):!1,i=n?.isInitialScroll&&!o&&!a||!t.didContainersLayout,s=o||a?0:r?dC:i?500:100,l=0,d=f=>{t.scheduledWork.timeout(c,f,"checkFinishedScrollFallback")},c=()=>{var f,p;let m=t.scrollingTo;if(m){l++;let h=uN(t)&&!t.hasScrolled,g=r?5:h?w4:5,v=pR(e),x=fR(t,m),y=zC(e,m),C=Qa.OS==="android",S=t.hasScrolled&&(!m.isInitialScroll||y.isAtResolvedTarget),L=m.isInitialScroll&&!y.isAtResolvedTarget&&l<=g;if(v||S||x||C||l>g)Du(e);else if((h||L)&&l<=g){let w=(p=(f=cN(t))!=null?f:m.targetOffset)!=null?p:t.scrollPending;R4(e,w),d(r?dC:100)}else d(r?dC:100)}};d(s)}function fN(e){var t;let n=e.state,o=n.initialScroll;return n.didFinishInitialScroll?iN(e):!o||((t=n.initialScrollSession)==null?void 0:t.kind)==="offset"||o.viewPosition!==1||n.props.data.length===0?!1:Ou(e,{forceScroll:!0})}function _4(e){var t;if(!e.state.initialScroll)return;let n=()=>Ou(e,{forceScroll:!0});n(),((t=e.state.initialScrollSession)==null?void 0:t.kind)!=="offset"&&requestAnimationFrame(n),BC(e,{onlyIfAligned:!0})}function D4(e,t){var n,o;let{alwaysDispatchInitialScroll:r,dataLength:a,hasFooterComponent:i,initialContentOffset:s,initialScrollAtEnd:l,useBootstrapInitialScroll:d}=t,c=e.state,f=c.initialScroll,p=s??0,m=d&&l&&i;if(f&&(f.contentOffset===void 0||!!f.preserveForFooterLayout!==m&&((n=c.initialScrollSession)==null?void 0:n.kind)!=="offset")&&Gs(e,{...f,contentOffset:p,preserveForFooterLayout:m}),d&&f&&((o=c.initialScrollSession)==null?void 0:o.kind)!=="offset"){h4(e,{initialScrollAtEnd:l,target:c.initialScroll});return}!r&&!p&&!(f&&a===0&&!(p===0&&!l))&&(f&&!l?xd(e,{resolvedOffset:p}):NC(e,{didInitialScroll:!0}))}function O4(e,t){var n,o,r;let{dataLength:a,didDataChange:i,didStartFreshData:s,initialScrollAtEnd:l,latestInitialScroll:d,latestInitialScrollSessionKind:c,stylePaddingEnd:f,useBootstrapInitialScroll:p}=t,m=e.state,h=(o=(n=m.initialScrollSession)==null?void 0:n.previousDataLength)!=null?o:0,g=a>0&&(!m.hasHadNonEmptyData||s);if(a>0&&(m.hasHadNonEmptyData=!0),g&&(d?(Gs(e,d),Xa(m,{kind:c,previousDataLength:h})):vd(m)),m.initialScrollSession&&(m.initialScrollSession.previousDataLength=a),Xa(m),p){v4(e,{dataLength:a,didDataChange:i,initialScrollAtEnd:l,previousDataLength:h,stylePaddingEnd:f});return}let v=h===0&&a>0&&!!m.initialScroll&&((r=e.state.initialScrollSession)==null?void 0:r.kind)==="offset"&&!!m.didFinishInitialScroll;h!==0||a===0||!m.initialScroll||!m.queuedInitialLayout||m.didFinishInitialScroll&&!v||(v&&RC(e,{resetInitialScroll:!0}),Ou(e))}function pN(e){e.indexByKey.clear(),e.idCache.length=0,e.positions.length=0,e.columns.length=0,e.columnSpans.length=0}function F4(e){var t;let n=e.pendingContainerIds;if(e.pendingContainerIds=void 0,n===void 0)return;let o=e.state,r=n;if(r&&((t=o.userScrollAnchorReset)!=null&&t.keys.size)){r=new Set(r);for(let a of o.userScrollAnchorReset.keys){let i=o.containerItemKeys.get(a);i!==void 0&&r.add(i)}}return r}function yg(e,t){var n;let o=e.pendingContainerIds!==void 0,r=e.pendingContainerIds;if(t===void 0)e.pendingContainerIds=null;else if(r!==null){let a=r;if(!a)a=typeof t=="number"?new Set([t]):new Set(t);else if(typeof t=="number")a.add(t);else for(let i of t)a.add(i);e.pendingContainerIds=a}if(!o){let a=((n=le(e,"containerLayoutEpoch"))!=null?n:0)+1;Ae(e,"containerLayoutEpoch",a)}}function B4(e,t,n,o){var r,a,i,s,l,d,c,f,p;let m=e.state,{columns:h,columnSpans:g,positions:v,props:{data:x,itemsAreEqual:y,keyExtractor:C}}=m,S=x[n];if(S===void 0)return{didChangePosition:!1,didRefreshData:!1};let L=(r=m.idCache[n])!=null?r:Bt(m,n),w=(a=o?.updateLayout)!=null?a:!0,k=!1,I=!1;if(w){let N=v[n];if(N===void 0)return Ae(e,`containerPosition${t}`,hd),{didChangePosition:!1,didRefreshData:!1};let R=(N||0)-((i=o?.scrollAdjustPending)!=null?i:0),$=(s=m.sizes.get(L))!=null?s:vo(e,L,n,S),U=JK(m,R,$,le(e,"totalSize")),H=h[n]||1,F=g[n]||1,oe=le(e,`containerPosition${t}`),ee=le(e,`containerColumn${t}`),W=le(e,`containerSpan${t}`);U>hd&&U!==oe&&(Ae(e,`containerPosition${t}`,U),k=!0),H>=0&&H!==ee&&Ae(e,`containerColumn${t}`,H),F!==W&&Ae(e,`containerSpan${t}`,F)}le(e,`containerItemIndex${t}`)!==n&&Ae(e,`containerItemIndex${t}`,n);let E=le(e,`containerItemData${t}`),A=()=>{Ae(e,`containerItemData${t}`,S),I=!0};if(E!==S){let N=((l=m.pendingDataComparison)==null?void 0:l.previousData)===m.previousData&&((d=m.pendingDataComparison)==null?void 0:d.nextData)===x?m.pendingDataComparison:void 0,R=(c=N?.byIndex[n])!=null?c:0;if(R===2)A();else if(R!==1){let $=(f=le(e,`containerItemKey${t}`))!=null?f:L,U=C?.(E,n);if(E===void 0||!C||U!==$)A();else if(!y)A();else{let H=y(E,S,n,x);(!m.pendingDataComparison||m.pendingDataComparison.previousData!==m.previousData||m.pendingDataComparison.nextData!==x)&&m.previousData&&(m.pendingDataComparison={byIndex:[],nextData:x,previousData:m.previousData}),(p=m.pendingDataComparison)!=null&&p.byIndex&&(m.pendingDataComparison.byIndex[n]=H?1:2),H||A()}}}return{didChangePosition:k,didRefreshData:I}}function z4(e,t,n){var o;let r=e.state,a=le(e,"numColumns"),i=t;r.columns[t]!==1&&(i=mR(r,a,t));let l=0,d=r.columns[i];if(i>0){let c=i-1,f=(o=r.positions[c])!=null?o:0,p=mR(r,a,c),m=$4(e,p,c,n);l=f+m}return{column:d,currentRowTop:l,startIndex:i}}function mR(e,t,n){if(t<=1)return Math.max(0,n);let o=Math.max(0,n);for(;o>0&&e.columns[o]!==1;)o--;return o}function $4(e,t,n,o){let r=e.state;if(n<t)return 0;let{data:a}=r.props;if(!a)return 0;let i=0;for(let s=t;s<=n;s++){if(s<0||s>=a.length)continue;let l=r.idCache[s],d=vo(e,l,s,a[s],o);d>i&&(i=d)}return i}function H4(e){var t,n;let o=e.state,{positions:r,props:{data:a}}=o,i=(t=le(e,"numColumns"))!=null?t:1;if(a.length===0)Eu(e,null,0);else{let s=a.length-1,l=Bt(o,s),d=r[s];if(l!==void 0&&d!==void 0)if(i>1){let c=s;for(;c>0;){let p=o.columns[c];if(p===1||p===void 0)break;c-=1}let f=0;for(let p=c;p<=s;p++){let m=(n=o.idCache[p])!=null?n:Bt(o,p),h=vo(e,m,p,a[p]);h>f&&(f=h)}Eu(e,null,d+f)}else{let c=vo(e,l,s,a[s]);if(c!==void 0){let f=d+c;Eu(e,null,f)}}}}function mN(e){let t=e.state,{props:{snapToIndices:n}}=t,o=t.props.horizontal?ho(e):void 0,r=Array(n.length);for(let a=0;a<n.length;a++){let i=n[a];Bt(t,i);let s=t.positions[i];r[a]=PC(t,s,o)}Ae(e,"snapToOffsets",r)}function gN(e,t,{doMVCP:n,forceFullUpdate:o=!1,optimizeForVisibleWindow:r=!1,scrollBottomBuffered:a,scrollVelocity:i,startIndex:s}={doMVCP:!1,forceFullUpdate:!1,optimizeForVisibleWindow:!1,scrollBottomBuffered:-1,startIndex:0}){var l,d,c,f,p;let m=e.state,h=e.positionListeners.size>0,{columns:g,columnSpans:v,indexByKey:x,positions:y,idCache:C,sizesKnown:S,props:{data:L,overrideItemLayout:w,snapToIndices:k},scrollingTo:I}=m,T=L.length,E=(l=le(e,"numColumns"))!=null?l:1,A=E>1,N=Yo?new Map:void 0,R=le(e,"extraData"),$=w?{span:1}:void 0,U=m.lastScrollDelta,H=i??Ag(m),F=!o&&!t&&(r||Math.abs(H)>0||m.scrollLength>0&&U>m.scrollLength),oe=a+1e3,ee=!0,W=!n||t||m.scrollAdjustHandler.getAdjust()!==0||((d=le(e,"scrollAdjustPending"))!=null?d:0)!==0,Ze=!1,ue=0,pe=1,Fe=0;if(t&&(v.length=0),A||(g.length&&(g.length=0),v.length&&(v.length=0)),s>0){if(A){let{startIndex:re,currentRowTop:be}=z4(e,s,ee);s=re,ue=be}else if(s<T){let re=s-1,be=Bt(m,re),rt=(c=y[re])!=null?c:0,dt=(f=S.get(be))!=null?f:vo(e,be,re,L[re],ee,W,Ze);ue=rt+dt}}let Le=t||x.size===0,ie=A&&!!w&&!!$,Ie=!1,ve;for(let re=s;re<T;re++){if(F&&ve!==void 0&&re>ve){Ie=!0;break}F&&ve===void 0&&!I&&!t&&ue>oe&&(ve=re+(A?E:1)+10);let be=(p=C[re])!=null?p:Bt(m,re),rt=1;if(ie){$.span=1,w($,L[re],re,E,R);let ct=$.span;ct!==void 0&&Number.isFinite(ct)&&(rt=Math.max(1,Math.min(E,Math.round(ct))))}A&&pe+rt-1>E&&(ue+=Fe,pe=1,Fe=0);let dt=S.get(be),st=dt!==void 0?dt:vo(e,be,re,L[re],ee,W,Ze);Yo&&Le&&(N.has(be)&&console.error(`[legend-list] Error: Detected overlapping key (${be}) which causes missing items and gaps and other terrrible things. Check that keyExtractor returns unique values.`),N.set(be,re)),ue!==y[re]&&(y[re]=ue,h&&iq(e,be,ue)),Le&&x.set(be,re),A?(g[re]=pe,v[re]=rt,st>Fe&&(Fe=st),pe+=rt,pe>E&&(ue+=Fe,pe=1,Fe=0)):ue+=st}Ie||H4(e),k&&mN(e)}function hN(e,t){let n=e.mapViewabilityConfigStates;n||(n=new Map,e.mapViewabilityConfigStates=n);let o=n.get(t);return o||(o={end:-1,endBuffered:-1,previousEnd:-1,previousStart:-1,start:-1,startBuffered:-1,viewableItems:[]},n.set(t,o)),o}function U4(e){let{viewabilityConfig:t,viewabilityConfigCallbackPairs:n,onViewableItemsChanged:o}=e;return(t||o)&&(n=[...n||[],{onViewableItemsChanged:o,viewabilityConfig:t||{viewAreaCoveragePercentThreshold:0}}]),n}function vN(e,t,n,o,r,a,i=r,s=a){let{props:{data:l}}=e;for(let d of n){let c=hN(t,d.viewabilityConfig.id);c.start=r,c.end=a,c.startBuffered=i,c.endBuffered=s,d.viewabilityConfig.minimumViewTime?e.scheduledWork.timeout(()=>gR(l,d,e,t,o),d.viewabilityConfig.minimumViewTime):gR(l,d,e,t,o)}}function gR(e,t,n,o,r){let{viewabilityConfig:a,onViewableItemsChanged:i}=t,s=a.id,l=hN(o,s),{viewableItems:d,start:c,end:f,startBuffered:p,endBuffered:m}=l,h;for(let[y,C]of o.mapViewabilityAmountValues)xN(n,o,a,y,C.key,r,C.item,C.index).sizeVisible<0&&(h??(h=[]),h.push(y));let g=[],v=new Set;if(d)for(let y of d){v.add(y.key);let C=n.indexByKey.get(y.key),S=C!==void 0?e[C]:void 0,L=hC(o,y.key),w=!1;C!==void 0&&S!==void 0&&(w=vR(n,o,a,L,y.key,r,S,C)),w||g.push({...y,index:C??y.index,isViewable:!1,item:S??y.item})}let x=[];for(let y=c;y<=f;y++){let C=e[y];if(C){let S=Bt(n,y),L=hC(o,S);if(vR(n,o,a,L,S,r,C,y)){let w={containerId:L,index:y,isViewable:!0,item:C,key:S};x.push(w),v.has(w.key)||g.push(w)}}}if(Object.assign(l,{previousEnd:f,previousStart:c,viewableItems:x}),g.length>0){l.viewableItems=x;for(let y=0;y<g.length;y++){let C=g[y];K4(o,s,C.containerId,C)}i&&i({changed:g,end:f,endBuffered:m,start:c,startBuffered:p,viewableItems:x})}if(h)for(let y of h){let C=o.mapViewabilityAmountValues.get(y);C&&C.sizeVisible<0&&o.mapViewabilityAmountValues.delete(y)}}function hR(e,t){return!!e&&e.containerId===t.containerId&&e.index===t.index&&e.isViewable===t.isViewable&&e.item===t.item&&e.key===t.key&&e.percentOfScroller===t.percentOfScroller&&e.percentVisible===t.percentVisible&&e.scrollSize===t.scrollSize&&e.size===t.size&&e.sizeVisible===t.sizeVisible}function xN(e,t,n,o,r,a,i,s){let{sizes:l,scroll:d}=e,c=(le(t,"stylePaddingTop")||0)+(le(t,"alignItemsAtEndPadding")||0)+(le(t,"headerSize")||0),{itemVisiblePercentThreshold:f,viewAreaCoveragePercentThreshold:p}=n,m=p!=null,h=m?p:f,g=d-c,v=e.positions[s],x=l.get(r)||0;if(v===void 0){let N={containerId:o,index:s,isViewable:!1,item:i,key:r,percentOfScroller:0,percentVisible:0,scrollSize:a,size:x,sizeVisible:-1},R=t.mapViewabilityAmountValues.get(o);if(!hR(R,N)){t.mapViewabilityAmountValues.set(o,N);let $=t.mapViewabilityAmountCallbacks.get(o);$&&$(N)}return N}let y=v-g,C=y+x,S=y>=0&&C<=a&&C>y,L=S?x:Math.min(C,a)-Math.max(y,0),w=x?S?100:100*(L/x):0,k=x?100*(L/a):0,T=(S?100:m?k:w)>=h,E={containerId:o,index:s,isViewable:T,item:i,key:r,percentOfScroller:k,percentVisible:w,scrollSize:a,size:x,sizeVisible:L},A=t.mapViewabilityAmountValues.get(o);if(!hR(A,E)){t.mapViewabilityAmountValues.set(o,E);let N=t.mapViewabilityAmountCallbacks.get(o);N&&N(E)}return E}function vR(e,t,n,o,r,a,i,s){let l=t.mapViewabilityAmountValues.get(o);return(!l||l.key!==r||l.index!==s)&&(l=xN(e,t,n,o,r,a,i,s)),l.isViewable}function K4(e,t,n,o){let r=n+t;e.mapViewabilityValues.set(r,o);let a=e.mapViewabilityCallbacks.get(r);a?.(o)}var xR=NR.unstable_batchedUpdates,q4=typeof xR=="function"?xR:e=>e(),V4=32,W4=64,G4=3;function j4(e,t){if(e<=0||t<=0)return 0;let n=Math.ceil(t*G4),o=t+W4,r=Math.max(t,Math.min(n,o),Math.min(e,V4)),a=Math.max(e,t);return Math.min(a,r)}function Q4(e,t){return e<=0||t<=0?0:Math.min(Math.max(e,t),Math.max(t,Math.ceil(t*1.5)))}function X4(e,t,n,o,r,a,i){var s;let l=t.length;if(l===0)return[];let d=le(e,"numContainers"),c=e.state,{containerItemMetadata:f,stickyContainerPool:p}=c,m=c.props.recycleItems&&!!c.props.positionComponentInternal,h=r.length>0?new Set(r):void 0,g=t.map((E,A)=>({isSticky:c.props.stickyHeaderIndicesSet.has(E),itemIndex:E,itemType:a?.(E),order:A})),v=g.filter(E=>!E.isSticky),x=g.filter(E=>E.isSticky),y=[],C=[];for(let E=0;E<d;E++){let A=le(e,`containerItemKey${E}`),N=!!h?.has(E);if(!(A&&i?.has(A)&&c.indexByKey.has(A))){if(p.has(E))(A===void 0||N)&&C.push({containerIndex:E,distance:Number.POSITIVE_INFINITY});else if(A===void 0||N)y.push({containerIndex:E,distance:Number.POSITIVE_INFINITY});else if(!m){let $=c.indexByKey.get(A);if($!==void 0&&($<n||$>o)){let U=$<n?n-$:$-o;y.push({containerIndex:E,distance:U})}}}}y.sort(Y4);let S=new Array(l),L=d,w=!1,k=(E,A)=>{S[E.order]={containerIndex:A,itemIndex:E.itemIndex,itemType:E.itemType},h?.delete(A)&&(w=!0)},I=(E,A,N)=>{for(let R of E){if(S[R.order])continue;let $=A.findIndex(U=>{var H;return N((H=f.get(U.containerIndex))==null?void 0:H.itemType,R.itemType)});if($!==-1){let[U]=A.splice($,1);k(R,U.containerIndex)}}},T=(E,A,N)=>{a&&I(E,A,(R,$)=>$!==void 0&&R===$),I(E,A,R=>R===void 0),N&&I(E,A,()=>!0)};T(v,y,!0),T(x,C,!1);for(let E of g){if(S[E.order])continue;let A=L++;E.isSticky&&p.add(A),k(E,A)}if(w&&(r.length=0,h))for(let E of h)r.push(E);if(Yo){let E=(s=le(e,"numContainersPooled"))!=null?s:Number.POSITIVE_INFINITY;L>E&&console.warn("[legend-list] No unused container available, so creating one on demand. This can be a minor performance issue and is likely caused by the estimatedItemSize being too large. Consider decreasing estimatedItemSize.",{debugInfo:{numContainers:d,numContainersPooled:E,numNeeded:l,stillNeeded:L-d}})}return S}function Y4(e,t){return t.distance-e.distance}function J4(e){let t=e.state;t.queuedInitialLayout=!0,VR(e),NC(e,{didLayout:!0})}var Z4=4,eV=100;function tV(e,t){if(t<=0)return 0;let n=Math.min(1,Math.abs(e)/Z4);return Math.sign(e)*t*n}function nV(e){let t=e.state;t.scheduledWork.timeout(()=>{var n;t.scrollHistory.length=0,(n=t.triggerCalculateItemsInView)==null||n.call(t)},eV,"renderRangeProjection")}function oV(e,t,n){let o=n.positions;for(let r=e.length-1;r>=0;r--){let a=e[r],i=o[a];if(i!==void 0&&t>=i)return r}return-1}function rV(e,t){let n=e.state,o=!1;for(let r of n.stickyContainerPool){let a=le(e,`containerItemKey${r}`);if((a?n.indexByKey.get(a):void 0)===t){o=!0;break}}return o}function aV(e,t,n,o,r,a,i){var s;let l=e.state;Ae(e,"activeStickyIndex",n>=0?t[n]:-1);for(let d=0;d<=1;d++){let c=n-d;if(c<0)continue;let f=t[c];if(rV(e,f))continue;let p=(s=l.idCache[f])!=null?s:Bt(l,f);p&&!l.containerItemKeys.has(p)&&(f<a||f>i)&&!r.has(f)&&(r.add(f),o.push(f))}}function iV(e,t,n,o,r,a,i){var s,l;let d=e.state;for(let c of d.stickyContainerPool){let f=le(e,`containerItemKey${c}`),p=f?d.indexByKey.get(f):void 0;if(p===void 0||i(p))continue;let m=t.indexOf(p);if(m===-1){d.stickyContainerPool.delete(c),Ae(e,`containerSticky${c}`,!1);continue}if(m>=r-1&&m<=r+1)continue;let g=t[m+1],v=!1;if(g){let x=d.positions[g];v=x!==void 0&&n>x+o*2}else{let x=(s=d.idCache[p])!=null?s:Bt(d,p);if(x){let y=d.positions[p],C=(l=d.sizes.get(x))!=null?l:vo(e,x,p,d.props.data[p]);v=y!==void 0&&n>y+C+o*3}}v&&a.push(c)}}function yN(e,t,n,o,r,a){let i=!1;return e.startNoBuffer===null&&n+o>r&&(e.startNoBuffer=t),e.firstFullyOnScreenIndex===void 0&&n>=r-10&&n<=a&&(e.firstFullyOnScreenIndex=t),e.startNoBuffer!==null&&(n<=a?e.endNoBuffer=t:i=!0),i}function CN(e,t){var n,o;let r=[],a=(n=t.firstFullyOnScreenIndex)!=null?n:t.startNoBuffer;if(a!=null&&t.endNoBuffer!==null)for(let i=a;i<=t.endNoBuffer;i++){let s=(o=e.idCache[i])!=null?o:Bt(e,i);r.push(s)}return r}function xC(e,t){var n;let o=e.props.onFirstVisibleItemChanged;if(!o||t===null||t<0||t>=e.props.data.length)return;let r=(n=e.idCache[t])!=null?n:Bt(e,t),a=e.lastFirstVisibleItemCallback;a?.index===t&&a.key===r||(e.lastFirstVisibleItemCallback={index:t,key:r},o({index:t,item:e.props.data[t],key:r}))}function sV(e,t){var n,o;let r=e.state,{endBuffered:a,idCache:i,positions:s,props:{data:l},sizes:d,startBuffered:c}=r;if(c===null||a===null||c<0||a<c)return null;for(let f=c;f<=a&&f<l.length;f++){let p=(n=i[f])!=null?n:Bt(r,f),m=(o=d.get(p))!=null?o:vo(e,p,f,l[f]);if(s[f]+m>t)return f}return null}function lV(e,t,n,o,r){var a,i;let s=e.state,{endBuffered:l,idCache:d,positions:c,props:{data:f},sizes:p,startBuffered:m}=s;if(m===null||l===null||m<0||l<m)return;let h={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null};for(let g=m;g<=l&&g<f.length;g++){let v=(a=d[g])!=null?a:Bt(s,g),x=(i=p.get(v))!=null?i:vo(e,v,g,f[g]),y=c[g];if(yN(h,g,y,x,o,r))break}Object.assign(s,{endNoBuffer:h.endNoBuffer,firstFullyOnScreenIndex:h.firstFullyOnScreenIndex,idsInView:CN(s,h),startNoBuffer:h.startNoBuffer}),xC(s,h.startNoBuffer),h.startNoBuffer!==null&&h.endNoBuffer!==null&&vN(s,e,t,n,h.startNoBuffer,h.endNoBuffer,m,l)}function ja(e,t={}){let n=e.state;q4(()=>{var o,r,a,i,s,l,d,c,f,p,m,h,g,v,x,y,C,S,L,w,k;let{columns:I,containerItemKeys:T,enableScrollForNextCalculateItemsInView:E,idCache:A,indexByKey:N,minIndexSizeChanged:R,positions:$,props:{alwaysRenderIndicesArr:U,alwaysRenderIndicesSet:H,getItemType:F,keyExtractor:oe,onStickyHeaderChange:ee},scrollForNextCalculateItemsInView:W,scrollLength:Ze,sizes:ue,startBufferedId:pe,viewabilityConfigCallbackPairs:Fe}=n,{data:Le}=n.props,ie=n.props.stickyHeaderIndicesArr||[],Ie=n.props.stickyHeaderIndicesSet||new Set,ve=jR(e,t.drawDistanceMode),{dataChanged:re,doMVCP:be,forceFullItemPositions:rt}=t,dt=((o=n.initialScrollSession)==null?void 0:o.kind)==="bootstrap"?n.initialScrollSession.bootstrap:void 0,st=!!dt,ct=le(e,"numContainers");if(!Le||Ze===0||!ct)return;let Zt=ho(e),at,_e=le(e,"stylePaddingTop")+le(e,"alignItemsAtEndPadding")+le(e,"headerSize"),He=le(e,"numColumns"),qe=(r=t.scrollVelocity)!=null?r:Ag(n),Be=0,{initialScroll:Vt,queuedInitialLayout:he}=n,sn=st?(a=dt?.scroll)!=null?a:n.scroll:!he&&Au(n)&&Vt?$r(e,Vt):n.scroll,Re=0,Jn=0,lt=0,kt=0,Nt=0,en=0,gn=sn,Pn=te=>{var et;gn=te,Re=(et=le(e,"scrollAdjustPending"))!=null?et:0,Jn=Re-_e,lt=Math.round(te+Be+Jn),lt+Ze>Zt&&(lt=Math.max(0,Zt-Ze))};Pn(sn);let An=le(e,"activeStickyIndex"),hn=()=>{let te=ie.length>0?oV(ie,lt,n):-1,et=te>=0?ie[te]:-1,Ct=An!==et;(te>=0||An>=0)&&Ae(e,"activeStickyIndex",et);let ze=!!ee&&ie.length>0&&Ct;return{currentStickyIdx:te,finishCalculateItemsInView:ze?()=>{let on=Le[et];on!==void 0&&ee?.({index:et,item:on})}:void 0}},cn=re?void 0:hn(),Yt=ve,Hn=ve;qe>0||qe===0&&lt<Math.max(50,ve)?(Yt=ve*.5,Hn=ve*1.5):(Yt=ve*1.5,Hn=ve*.5);let It=!re&&!rt&&!st&&!Au(n)&&!n.scrollingTo&&!n.pendingNativeMVCPAdjust&&!!le(e,"readyToRender")?tV(qe,Math.min(Yt,Hn)):0,Eo=()=>{let te=Math.max(0,lt),et=Math.max(0,-gn);Nt=Math.max(te,lt+Ze+et),kt=te-Yt+It,en=Nt+Hn+It};if(Eo(),It!==0&&nV(e),E&&!st&&!re&&!rt&&W){let{top:te,bottom:et}=W;if(te===null&&et===null)n.scrollForNextCalculateItemsInView=void 0;else if((te===null||kt>te)&&(et===null||en<et)&&!$u(n)){Fe?lV(e,Fe,Ze,lt,Nt):n.props.onFirstVisibleItemChanged&&xC(n,sV(e,lt)),(i=cn?.finishCalculateItemsInView)==null||i.call(cn);return}}let _=be&&!st?jq(e,re):void 0;re&&pN(n);let Z=rt||re?0:(s=R??n.startBuffered)!=null?s:0,X=!rt&&!re&&He>1&&R!==void 0;gN(e,re,{doMVCP:be,forceFullUpdate:!!rt,optimizeForVisibleWindow:X,scrollBottomBuffered:en,scrollVelocity:qe,startIndex:Z}),Zt=ho(e),R!==void 0&&(n.minIndexSizeChanged=void 0);let ae;if(re&&be&&n.props.maintainVisibleContentPosition.data&&n.didContainersLayout&&n.idsInView.length>0){let te=n.props.maintainVisibleContentPosition.shouldRestorePosition;ae=new Set;for(let et of n.idsInView){let Ct=N.get(et);Ct!==void 0&&(te&&!te(Le[Ct],Ct,Le)||ae.add(et))}}let fe=n.scroll,ft=(l=le(e,"scrollAdjustPending"))!=null?l:0;_?.(),_&&(n.scroll!==fe||((d=le(e,"scrollAdjustPending"))!=null?d:0)!==ft)&&(Pn(n.scroll),Eo()),re&&(cn=hn());let vt=null,_t=null,Jt=null,xt=(c=st?dt?.targetIndexSeed:void 0)!=null?c:!re&&pe&&N.get(pe)||0;for(let te=xt;te>=0;te--){let et=(f=A[te])!=null?f:Bt(n,te),Ct=$[te],ze=(p=ue.get(et))!=null?p:vo(e,et,te,Le[te]);if(Ct+ze>kt)xt=te;else break}if(He>1)for(;xt>0;){let te=I[xt];if(te===1||te===void 0)break;xt-=1}let vn=!1,tn,un,Zn=0;for(let te=0;te<ct;te++){let et=le(e,`containerItemKey${te}`);if(et!==void 0){let Ct=N.get(et);Zn=Math.max(Zn,Ct)}}let me={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null},St=Le.length;for(let te=Math.max(0,xt);te<St&&(!vn||te<=Zn);te++){let et=(m=A[te])!=null?m:Bt(n,te),Ct=(h=ue.get(et))!=null?h:vo(e,et,te,Le[te]),ze=$[te];vn||(yN(me,te,ze,Ct,lt,Nt),vt===null&&ze+Ct>kt&&(vt=te,_t=et,kt<0?tn=null:tn=ze),me.startNoBuffer!==null&&(ze<=en?(Jt=te,en>Zt?un=null:un=ze+Ct):vn=!0))}Object.assign(n,{endBuffered:Jt,endNoBuffer:me.endNoBuffer,firstFullyOnScreenIndex:me.firstFullyOnScreenIndex,idsInView:CN(n,me),startBuffered:vt,startBufferedId:_t,startNoBuffer:me.startNoBuffer}),E&&tn!==void 0&&un!==void 0&&(n.scrollForNextCalculateItemsInView=Mu(tn)&&Mu(un)?void 0:{bottom:un,top:tn});let yt=ct,zt=[];if(re)for(let te=0;te<yt;te++){let et=le(e,`containerItemKey${te}`);(!oe||et&&N.get(et)===void 0)&&zt.push(te)}let Oe=n.scrollTargetPinnedRange,gt=0,Zo=-1;Oe&&(gt=Math.max(0,Math.min(Oe.start,Oe.end)),Zo=Math.min(St-1,Math.max(Oe.start,Oe.end)));let Lt=gt<=Zo,Dn=te=>H.has(te)||Lt&&te>=gt&&te<=Zo;if(vt!==null&&Jt!==null){let te=[],et=new Set,Ct=ze=>{var on;if(ze>=0&&ze<St){let yn=(on=A[ze])!=null?on:Bt(n,ze),Cn=T.get(yn);Cn!==void 0?n.stickyContainerPool.add(Cn):!Mu(yn)&&!et.has(ze)&&(et.add(ze),te.push(ze))}};for(let ze=vt;ze<=Jt;ze++){let on=(g=A[ze])!=null?g:Bt(n,ze);T.has(on)||(et.add(ze),te.push(ze))}for(let ze of U)Ct(ze);if(Lt)for(let ze=gt;ze<=Zo;ze++)Ct(ze);if(ie.length>0?aV(e,ie,(v=cn?.currentStickyIdx)!=null?v:-1,te,et,vt,Jt):An!==-1&&Ae(e,"activeStickyIndex",-1),te.length>0){let on=X4(e,te,vt,Jt,zt,F?yn=>{let Cn=F(Le[yn],yn);return Cn!==void 0?String(Cn):""}:void 0,ae);for(let yn of on){let Cn=yn.itemIndex,Pt=yn.containerIndex,Un=(x=A[Cn])!=null?x:Bt(n,Cn),Wt=le(e,`containerItemKey${Pt}`);Wt&&Wt!==Un&&T.delete(Wt),Wt!==Un&&(at??(at=new Set),at.add(Pt),n.containerItemGenerations[Pt]=((y=n.containerItemGenerations[Pt])!=null?y:0)+1),Ae(e,`containerItemKey${Pt}`,Un),Ae(e,`containerItemIndex${Pt}`,Cn),Ae(e,`containerItemData${Pt}`,Le[Cn]),n.containerItemMetadata.set(Pt,lN(n,Cn,Le[Cn],yn.itemType)),T.set(Un,Pt),(C=n.userScrollAnchorReset)==null||C.keys.add(Un);let so=`containerSticky${Pt}`,ma=Ie.has(Cn),ei=Dn(Cn);ma?(Ae(e,so,!0),n.stickyContainerPool.add(Pt)):(le(e,so)&&Ae(e,so,!1),ei?n.stickyContainerPool.add(Pt):n.stickyContainerPool.delete(Pt)),Pt>=yt&&(yt=Pt+1)}yt!==ct&&(Ae(e,"numContainers",yt),yt>le(e,"numContainersPooled")&&Ae(e,"numContainersPooled",Q4(St,yt)))}((S=n.userScrollAnchorReset)==null?void 0:S.keys.size)===0&&(n.userScrollAnchorReset=void 0)}n.stickyContainerPool.size>0&&iV(e,ie,lt,ve,(L=cn?.currentStickyIdx)!=null?L:-1,zt,Dn);let nn=zt.length>0?new Set(zt):void 0,xn=!1;for(let te=0;te<yt;te++){let et=le(e,`containerItemKey${te}`);if(nn?.has(te))et!==void 0&&(T.delete(et),at??(at=new Set),at.add(te),n.containerItemGenerations[te]=((w=n.containerItemGenerations[te])!=null?w:0)+1),n.containerItemMetadata.delete(te),n.stickyContainerPool.has(te)&&(Ae(e,`containerSticky${te}`,!1),n.stickyContainerPool.delete(te)),Ae(e,`containerItemKey${te}`,void 0),Ae(e,`containerItemIndex${te}`,void 0),Ae(e,`containerItemData${te}`,void 0),Ae(e,`containerPosition${te}`,hd),Ae(e,`containerColumn${te}`,-1),Ae(e,`containerSpan${te}`,1);else{let Ct=N.get(et);Ct!==void 0&&(xn=B4(e,te,Ct,{scrollAdjustPending:Re,updateLayout:!0}).didChangePosition||xn)}}if(at&&AC&&yg(e,at),xn&&Ae(e,"lastPositionUpdate",Date.now()),st){C4(e);return}xC(n,me.startNoBuffer),!he&&!n.didContainersLayout&&(Au(n)?Ru(n,n.startBuffered,n.endBuffered):Ru(n,n.startNoBuffer,n.endNoBuffer)||Ru(n,n.startBuffered,n.endBuffered))&&(J4(e),_4(e)),Fe&&me.startNoBuffer!==null&&me.endNoBuffer!==null&&vN(e.state,e,Fe,Ze,me.startNoBuffer,me.endNoBuffer,vt??me.startNoBuffer,Jt??me.endNoBuffer),(k=cn?.finishCalculateItemsInView)==null||k.call(cn)})}function Cg(e){var t,n;let o=e.state,r=o.props.anchoredEndSpace,a=le(e,"anchoredEndSpaceSize"),i=o.anchoredEndSpaceReadyAnchorIndex,s=o.anchoredEndSpaceReadyAnchorKey,l=r?.anchorIndex,d,c=!0,f=0;if(r){let{anchorIndex:g,anchorMaxSize:v,anchorOffset:x=0}=r,{data:y}=o.props;if(g>=0&&g<y.length&&o.scrollLength>0){d=Bt(o,g);let C=0,S=!1;for(let w=g;w<y.length;w++){let k=ZR(e,w),I=w===g&&v!==void 0?Math.min(k||0,Math.max(0,v)):k;k===void 0&&(S=!0),I!=null&&I>0&&(C+=I)}C=Math.max(0,C-e.scrollAxisGap),C+=(e.values.get("footerSize")||0)+LC(o.props),c=!S;let L=Math.max(0,o.scrollLength-C-x);f=S?Math.min(a||0,L):L}else g>=0&&(c=!1)}let p=a!==f&&(a!==void 0||r!==void 0),m=(a||0)!==f;return c&&(p||(i!==l||s!==d))?(o.anchoredEndSpaceReadyAnchorIndex=l,o.anchoredEndSpaceReadyAnchorKey=d,p&&(Ae(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f)),m&&(Qs(e),Ws(e,o.scroll,!0,{markHasScrolled:!1})),(n=r?.onReady)==null||n.call(r,{anchorIndex:l,anchorKey:d,size:f})):!c&&p&&f<(a||0)&&(Ae(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f),r?.includeInEndInset&&Ws(e,o.scroll,!0,{markHasScrolled:!1})),f}function dV(e){var t;let n=e.state;n.userScrollAnchorReset!==void 0?(ja(e),((t=n.userScrollAnchorReset)==null?void 0:t.keys.size)===0&&(n.userScrollAnchorReset=void 0)):n.mvcpAnchorLock?n.scheduledWork.has("mvcpRecalculate")||n.scheduledWork.frame(()=>ja(e,{doMVCP:!0}),"mvcpRecalculate"):(n.scheduledWork.cancel("mvcpRecalculate"),ja(e,{doMVCP:!0}))}function yR(e,t,n){if(e.state.needsOtherAxisSize){let r=n?t.height:t.width,a=le(e,"otherAxisSize");(!a||r>a)&&Ae(e,"otherAxisSize",r)}}var Wa;function bN(e){let t=Wa===void 0;Wa??(Wa=new Map);try{e()}finally{if(t){let n=Wa;Wa=void 0;for(let[o,r]of n)$C(o,r)}}}function cV(e,t){e.didChange||(e.didChange=t.didChange),e.didMeasureUserScrollAnchorResetItem||(e.didMeasureUserScrollAnchorResetItem=t.didMeasureUserScrollAnchorResetItem),e.needsRecalculate||(e.needsRecalculate=t.needsRecalculate),e.shouldMaintainScrollAtEnd||(e.shouldMaintainScrollAtEnd=t.shouldMaintainScrollAtEnd)}function uV(e,t){var n;let o=e.state;t.needsRecalculate?(o.scrollForNextCalculateItemsInView=void 0,dV(e)):t.didMeasureUserScrollAnchorResetItem&&((n=o.userScrollAnchorReset)==null?void 0:n.keys.size)===0&&(o.userScrollAnchorReset=void 0),t.didChange&&Cg(e),t.didChange&&t.shouldMaintainScrollAtEnd&&yd(e)}function IN(e,t){if(Wa){let n=Wa.get(e);n?n.push(t):Wa.set(e,[t])}else $C(e,[t])}function $C(e,t){var n;let o=e.state,r={};for(let a of t)if(a.containerId===void 0||le(e,`containerItemKey${a.containerId}`)===a.itemKey){let s=o.indexByKey.get(a.itemKey),l=s===void 0||(n=o.props.data)==null?void 0:n[s],d=a.containerId!==void 0&&s!==void 0&&l!==void 0?S4(o,a.containerId,s,l):void 0,c=fV(e,a.itemKey,a.size,d);cV(r,c)}uV(e,r)}function fV(e,t,n,o){var r,a;let i=e.state,s=i.userScrollAnchorReset,l=!!s?.keys.delete(t),{didContainersLayout:d,sizesKnown:c,props:{getFixedItemSize:f,getItemType:p,horizontal:m,onItemSizeChanged:h,data:g,maintainScrollAtEnd:v}}=i;if(!g)return{didMeasureUserScrollAnchorResetItem:l};let x=i.indexByKey.get(t);if(f){if(x===void 0)return{didMeasureUserScrollAnchorResetItem:l};let I=i.props.data[x];if(I===void 0)return{didMeasureUserScrollAnchorResetItem:l};if(!o?.didResolveFixedItemSize){let E=(a=o?.itemType)!=null?a:p&&(r=p(I,x))!=null?r:"";o={didResolveFixedItemSize:!0,fixedItemSize:f(I,x,E),itemType:E}}let T=o.fixedItemSize;if(T!==void 0&&T===c.get(t))return yR(e,n,m),{didMeasureUserScrollAnchorResetItem:l}}let y=!d,C=!1,S,L=i.sizesKnown.get(t),w=pV(e,t,n,o),k=_u(m?n.width:n.height);if(w!==0){S=S!==void 0?Math.min(S,x):x;let{startBuffered:I,endBuffered:T}=i;y||(y=x>=I&&x<=T),!y&&i.containerItemKeys.has(t)&&(y=!0),(L===void 0||Math.abs(L-k)>5)&&(C=!0),h?.({index:x,itemData:i.props.data[x],itemKey:t,previous:k-w,size:k})}if(S!==void 0&&(i.minIndexSizeChanged=i.minIndexSizeChanged!==void 0?Math.min(i.minIndexSizeChanged,S):S),yR(e,n,m),d||Ru(i,i.startBuffered,i.endBuffered)){let I=C&&!!v?.onItemLayout;return{didChange:w!==0,didMeasureUserScrollAnchorResetItem:l,needsRecalculate:y,shouldMaintainScrollAtEnd:I}}return{didChange:w!==0,didMeasureUserScrollAnchorResetItem:l}}function pV(e,t,n,o){var r,a;let i=e.state,{indexByKey:s,sizesKnown:l,averageSizes:d,props:{data:c,horizontal:f,getItemType:p,getFixedItemSize:m}}=i;if(!c)return 0;let h=s.get(t),g=c[h],v=o?.itemType,x=o?.fixedItemSize;m&&!o?.didResolveFixedItemSize&&(v=p&&(r=p(g,h))!=null?r:"",x=m(g,h,v));let y=o?.didResolveFixedItemSize||v!==void 0||x!==void 0?{didResolveFixedItemSize:o?.didResolveFixedItemSize,fixedItemSize:x,itemType:v}:void 0,C=vo(e,t,h,g,void 0,void 0,void 0,y),S=f?n.width:n.height,L=l.get(t),w=Math.round(S);if(l.set(t,w),x===void 0&&w>0){v??(v=p&&(a=p(g,h))!=null?a:"");let k=d[v];k||(k=d[v]={avg:0,num:0}),k.num===0?(k.avg=w,k.num++):L!==void 0&&L>0?k.avg+=(w-L)/k.num:(k.avg=(k.avg*k.num+w)/(k.num+1),k.num++)}return!C||Math.abs(C-w)>.1?(gC(e,t,w),w-C):0}function mV(e,t=null){let n=[],o=t??e.viewRefs.keys();for(let r of o){let a=e.viewRefs.get(r),i=le(e,`containerItemKey${r}`),s=a?.current;if(i!==void 0&&s){let l=s.getBoundingClientRect();uq(s,l),n.push({containerId:r,itemKey:i,size:{height:l.height,width:l.width}})}}n.length>0&&$C(e,n)}var SN=qn,pa=de,gV=pa(function({children:t}){let n=Hr(),[o]=Jo(["containerLayoutEpoch"]);return xe(()=>{{let r=F4(n);r!==void 0&&mV(n,r)}},[n,o]),t}),mg=e=>fh(e)?e:e?we(e,null):null,hV=typeof document<"u"&&!!document.getElementById("react-native-stylesheet"),yC={contain:"paint layout style",...hV?{display:"flex",flexDirection:"column"}:{}},vV=pa(function({id:t,horizontal:n,style:o,refView:r,...a}){let[i=hd]=Jo([`containerPosition${t}`]),s=Lg(o)?Object.assign({},...o):o,l=n?{...yC,...s,left:i}:{...yC,...s,top:i},{animatedScrollY:d,onLayout:c,onLayoutChange:f,stickyHeaderConfig:p,...m}=a;return we("div",{ref:r,...m,style:l})}),xV=pa(function({id:t,horizontal:n,style:o,refView:r,animatedScrollY:a,stickyHeaderConfig:i,onLayout:s,onLayoutChange:l,children:d,...c}){let[f=hd,p,m]=Jo([`containerPosition${t}`,"activeStickyIndex",`containerItemIndex${t}`]),h=z(()=>{var x;return(x=Lg(o)?Object.assign({},...o):o)!=null?x:{}},[o]),g=z(()=>{var x;let y={...yC,...h};delete y.transform;let C=(x=i?.offset)!=null?x:0,S=p===m;return y.position=S?"sticky":"absolute",y.zIndex=m+1e3,n?y.left=S?C:f:y.top=S?C:f,y},[h,n,f,m,p,i?.offset]),v=z(()=>i?.backdropComponent?we("div",{style:{inset:0,pointerEvents:"none",position:"absolute"}},mg(i.backdropComponent)):null,[i?.backdropComponent]);return we("div",{ref:r,style:g,...c},v,d)}),yV=vV;function CV(e){G(()=>e())}var wN=Ut(null),bV=-1;function IV(){return ln(wN)}function SV(){var e;let t=IV(),n=(e=t?.containerId)!=null?e:bV,[o]=Jo([`containerItemKey${n}`]);return sq("lastItemKeys",a=>t&&!Mu(o)&&a?.includes(o)||!1)}function wV({ItemSeparatorComponent:e,leadingItem:t}){return SV()?null:we(e,{leadingItem:t})}var cC=null;function TV(){return cC||(cC=new ResizeObserver(e=>{bN(()=>{for(let t of e){let n=gg.get(t.target);if(n)for(let o of n)o(t)}})})),cC}var gg=new WeakMap;function kV(e,t){var n;if(typeof ResizeObserver>"u"||!e)return()=>{};let o=TV(),r=(n=gg.get(e))!=null?n:new Set;return r.size===0&&(gg.set(e,r),o.observe(e,{box:"border-box"})),r.add(t),()=>{r.delete(t),r.size===0&&(gg.delete(e),o.unobserve(e))}}function HC({ref:e,measureInLayoutEffect:t=!0,onLayoutProp:n,onLayoutChange:o,webLayoutResync:r},a){return xe(()=>{var i,s;let l=e.current,c=((s=(i=l?.getScrollableNode)==null?void 0:i.call(l))!=null?s:null)||l;if(!c)return;let f=(m,h)=>{m.height===0&&m.width===0||(o(m,h),n?.({nativeEvent:{layout:m}}))},p;if(t){let m=c.getBoundingClientRect();f(CR(m),!0),p=m}return kV(c,m=>{var h;let g=m.target instanceof HTMLElement?m.target:void 0,v=Array.isArray(m.borderBoxSize)?m.borderBoxSize[0]:m.borderBoxSize,x=v?{height:v.blockSize,left:m.contentRect.left,top:m.contentRect.top,width:v.inlineSize}:(h=g?.getBoundingClientRect())!=null?h:m.contentRect,y=p??cq(c),C=y===void 0||x.width!==y.width||x.height!==y.height;p=x;let S=!!r?.();(C||S)&&f(CR(x),!1)})},[t,...a||[]]),{}}function CR(e){return e?{height:e.height,width:e.width,x:e.left,y:e.top}:{height:0,width:0,x:0,y:0}}var hg=new Map,uC;function TN(e){hg.delete(e)}function LV(e,t){hg.set(e,t),uC===void 0&&(uC=requestAnimationFrame(()=>{let n=Array.from(hg.values());hg.clear(),uC=void 0,bN(()=>{for(let o of n)o()})}))}function PV({containerId:e,ctx:t,rectangle:n,ref:o,state:r}){let a=t.state,i=r.itemKey;r.didLayout=!0;let s=n,l=r.horizontal?"width":"height",d=_u(n[l]);r.lastSize&&_u(r.lastSize[l]);let f=a.sizesKnown.get(i),p=()=>{r.lastSize=s,IN(t,{containerId:e,itemKey:i,size:s})};!$u(a)&&f!==void 0&&d+1<f?LV(r,()=>{var h;if(r.itemKey===i){let g=o.current,v=(h=g?.getBoundingClientRect)==null?void 0:h.call(g);v&&(s={height:v.height,width:v.width}),p()}}):(TN(r),p())}function AV({containerId:e,ctx:t,horizontal:n,itemKey:o,ref:r}){let a=D({didLayout:!1,horizontal:n,itemKey:o});a.current.horizontal=n,a.current.itemKey=o;let[i,s]=G(0),l=B(f=>{PV({containerId:e,ctx:t,rectangle:f,ref:r,state:a.current})},[e,t,r]),d=B(()=>{yg(t,e)},[e,t]);xe(()=>(t.containerLayoutTriggers.set(e,d),()=>{TN(a.current),t.containerLayoutTriggers.get(e)===d&&t.containerLayoutTriggers.delete(e)}),[e,t,d]),xe(()=>{yg(t,e)});let{onLayout:c}=HC({measureInLayoutEffect:!AC,onLayoutChange:l,ref:r,webLayoutResync:()=>$u(t.state)},[o,i]);return K(()=>{},[e,t,o]),{onLayout:c,triggerLayout:d}}function EV({columnWrapperStyle:e,contentContainerAlignItems:t,horizontal:n,hasItemSeparator:o,isHorizontalRTLList:r,numColumns:a,otherAxisPos:i,otherAxisSize:s}){let l;if(e){let{columnGap:d,rowGap:c,gap:f}=e;n?l={paddingBottom:a>1?(c||f||0)/2:void 0,paddingRight:d||f||void 0,paddingTop:a>1?(c||f||0)/2:void 0}:l={paddingBottom:c||f||void 0,paddingLeft:a>1?(d||f||0)/2:void 0,paddingRight:a>1?(d||f||0)/2:void 0}}return n?{bottom:t==="flex-end"&&a===1?0:void 0,boxSizing:l?"border-box":void 0,direction:r&&Qa.OS==="web"?"ltr":void 0,flexDirection:o?"row":void 0,height:s,left:0,position:"absolute",top:t==="flex-end"&&a===1?void 0:i,...l||{}}:{boxSizing:l?"border-box":void 0,left:i,position:"absolute",right:a>1?null:0,top:0,width:s,...l||{}}}var MV=pa(function({id:t,itemKey:n,recycleItems:o,horizontal:r,getRenderedItem:a,ItemSeparatorComponent:i,stickyHeaderConfig:s}){let l=Hr(),{columnWrapperStyle:d,animatedScrollY:c}=l,f=Ya(l.state),p=l.state.props.positionComponentInternal,m=l.state.props.stickyPositionComponentInternal,[h=0,g=1,v,x=1,y,C]=Jo([`containerColumn${t}`,`containerSpan${t}`,`containerItemData${t}`,"numColumns","extraData",`containerSticky${t}`]),S=D(null),{onLayout:L,triggerLayout:w}=AV({containerId:t,ctx:l,horizontal:r,itemKey:n,ref:S}),k=h>0?h:1,I=Math.min(Math.max(g||1,1),x),T=x>1?`${(k-1)/x*100}%`:0,E=x>1?`${I/x*100}%`:void 0,A=z(()=>EV({columnWrapperStyle:d,contentContainerAlignItems:l.state.props.contentContainerAlignItems,hasItemSeparator:!!i,horizontal:r,isHorizontalRTLList:f,numColumns:x,otherAxisPos:T,otherAxisSize:E}),[r,f,T,E,d,l.state.props.contentContainerAlignItems,x,i]),N=z(()=>n!==void 0?a(n):null,[n,v,y]),{renderedItem:R}=N||{},$=z(()=>(l.viewRefs.set(t,S),{containerId:t,triggerLayout:w}),[t,w]);return we(C?m||xV:p||yV,{animatedScrollY:C?c:void 0,horizontal:r,id:t,key:o?void 0:n,onLayout:L,refView:S,stickyHeaderConfig:s,style:A},we(wN.Provider,{value:$},R,N&&i&&we(wV,{ItemSeparatorComponent:i,leadingItem:N.item})))});function RV({id:e,horizontal:t,recycleItems:n,ItemSeparatorComponent:o,getRenderedItem:r,stickyHeaderConfig:a,ContainerComponent:i=MV}){let[s]=Jo([`containerItemKey${e}`]);return s===void 0?null:we(i,{getRenderedItem:r,horizontal:t,ItemSeparatorComponent:o,id:e,itemKey:s,recycleItems:n,stickyHeaderConfig:a})}var NV=pa(function(t){return we(RV,{...t})});function _V(e,t){let n=Array.from(e.children);if(n.length<=1)return n;let o=n.map(l=>{var d;return[l,(d=t.get(l))!=null?d:null]});o.sort((l,d)=>{let c=l[1],f=d[1];return c===null?1:f===null?-1:c-f});let r=new Map;o.forEach((l,d)=>{r.set(l[0],d)});let a=n.map(l=>r.get(l)),i=DV(a),s=new Set(i);for(let l=0;l<o.length;l++){let d=o[l][0],c=n.indexOf(d);if(!s.has(c)){let f=null;for(let p=l+1;p<o.length;p++){let m=o[p][0],h=n.indexOf(m);if(s.has(h)){f=m;break}}f?e.insertBefore(d,f):e.appendChild(d)}}}function DV(e){let t=e.length,n=[],o=new Array(t).fill(-1),r=[];for(let s=0;s<t;s++){let l=e[s],d=0,c=n.length;for(;d<c;){let f=Math.floor((d+c)/2);e[r[f]]<l?d=f+1:c=f}d===n.length?(n.push(l),r.push(s)):(n[d]=l,r[d]=s),d>0&&(o[s]=r[d-1])}let a=[],i=r[r.length-1];for(;i!==-1;)a.unshift(i),i=o[i];return a}function OV(e){let t=Hr(),n=D(void 0);K(()=>{let o=Ga(t,"lastPositionUpdate",()=>{n.current!==void 0&&clearTimeout(n.current),n.current=setTimeout(()=>{let r=e.current;if(r){let a=new Map;for(let[i,s]of t.viewRefs){let l=s.current,d=le(t,`containerItemIndex${i}`);l&&d!==void 0&&a.set(l,d)}_V(r,a)}n.current=void 0},500)});return()=>{o(),n.current!==void 0&&clearTimeout(n.current)}},[t])}function FV(e,t){let[n,o]=G(t),r=n!==t;return xe(()=>{o(t)},[t]),e&&!r}var BV=pa(function({freshDataTransitionEpoch:t,horizontal:n,numColumns:o,children:r}){let a=D(null),i=Hr(),s=i.columnWrapperStyle,l=Ya(i.state),[d,c,f]=Jo(["otherAxisSize","readyToRender","totalSize"]),p=FV(!!c,t);OV(a);let m=n?{direction:l?"ltr":void 0,flexShrink:0,minHeight:d,opacity:p?1:0,position:"relative",width:f}:{height:f,minWidth:d,opacity:p?1:0,position:"relative"};if(p||(m.pointerEvents="none"),s&&o>1){let{columnGap:h,rowGap:g,gap:v}=s,x=h||v||0,y=g||v||0;n?(y&&(m.marginTop=m.marginBottom=-y/2),x&&(m.marginRight=-x)):y&&(m.marginBottom=-y)}return we("div",{ref:a,style:m},we(gV,null,r))}),zV=pa(function({freshDataTransitionEpoch:t,horizontal:n,recycleItems:o,ItemSeparatorComponent:r,getRenderedItem:a,stickyHeaderConfig:i}){let[s,l]=Jo(["numContainersPooled","numColumns"]),d=[];for(let c=0;c<s;c++)d.push(we(NV,{getRenderedItem:a,horizontal:n,ItemSeparatorComponent:r,id:c,key:c,recycleItems:o,stickyHeaderConfig:i}));return we(BV,{freshDataTransitionEpoch:t,horizontal:n,numColumns:l},d)});function $V(e){return Lg(e)?Object.assign({},...e.filter(Boolean)):e}var zu={create:e=>e,flatten:e=>$V(e)};function CC(e){let t=D(e);return t.current=e,t}function HV(e){let t=CC(e),n=D(void 0),o=z(()=>({cancel(){n.current!==void 0&&(cancelAnimationFrame(n.current),n.current=void 0)},flush(){o.cancel(),t.current()},schedule(){if(n.current!==void 0)return!1;let r=requestAnimationFrame(()=>{n.current===r&&(n.current=void 0,t.current())});return n.current=r,!0}}),[]);return K(()=>()=>{o.cancel()},[o]),o}var bC="legend-list-content-container",kN="legend-list-scrollbar-x-hidden",LN="legend-list-scrollbar-y-hidden";function UV(){return typeof document>"u"?null:document.scrollingElement||document.documentElement||document.body}function IC(){var e,t,n,o;return typeof window>"u"?{x:0,y:0}:{x:(t=(e=window.scrollX)!=null?e:window.pageXOffset)!=null?t:0,y:(o=(n=window.scrollY)!=null?n:window.pageYOffset)!=null?o:0}}function bR(e,t){var n,o;let r=e?.getBoundingClientRect();return{left:((n=r?.left)!=null?n:0)+t.x,top:((o=r?.top)!=null?o:0)+t.y}}function PN(e){var t,n;return{height:(t=e?.scrollHeight)!=null?t:0,width:(n=e?.scrollWidth)!=null?n:0}}function KV(e,t,n){return PN(n?t:e)}function IR(e,t,n){var o,r,a,i,s,l;if(t&&typeof window<"u"){let d=e?.getBoundingClientRect();return{height:n&&(r=(o=d?.height)!=null?o:e?.clientHeight)!=null?r:window.innerHeight,width:n?window.innerWidth:(i=(a=d?.width)!=null?a:e?.clientWidth)!=null?i:window.innerWidth}}return{height:(s=e?.clientHeight)!=null?s:0,width:(l=e?.clientWidth)!=null?l:0}}function SR(e,t){return Math.max(0,Math.min(e,t))}function wR(e,t){return t?e.width:e.height}function qV(e,t,n){return Math.max(0,wR(e,n)-wR(t,n))}function TR(e,t){return t&&UV()||e}function VV(e,t){return t&&typeof window<"u"?window:e}function WV(e,t,n){let o=e.getBoundingClientRect(),r=IC();return{height:t&&typeof window<"u"&&!n?window.innerHeight:o.height,width:t&&typeof window<"u"&&n?window.innerWidth:o.width,x:t?o.left+r.x:o.left,y:t?o.top+r.y:o.top}}function GV({clampedOffset:e,horizontal:t,listPos:n,scroll:o}){return{left:t?n.left+e:o.x,top:t?o.y:n.top+e}}var kR="legend-list-scrollbar-axis-hidden-style",jV=200,QV=`.${LN}::-webkit-scrollbar:vertical{width:0;display:none;}.${kN}::-webkit-scrollbar:horizontal{height:0;display:none;}`;function XV(){if(typeof document>"u"||document.getElementById(kR))return;let e=document.createElement("style");e.id=kR,e.textContent=QV,document.head.appendChild(e)}function YV(e){var t,n;let o=(n=(t=e.state)==null?void 0:t.props)==null?void 0:n.contentInsetEndAdjustment;return Math.max(0,o??0)}function JV(e){if(!e?.length)return[];let t=[],n=new Set;for(let o of e)Number.isFinite(o)&&!n.has(o)&&(n.add(o),t.push(o));return t}function ZV(e,t){return{height:t?"100%":1,left:t?e:0,pointerEvents:"none",position:"absolute",scrollSnapAlign:"start",top:t?0:e,width:t?1:"100%"}}var LR=qn(function({children:t,style:n,contentContainerClassName:o,contentContainerStyle:r,horizontal:a=!1,contentOffset:i,maintainVisibleContentPosition:s,onScroll:l,onInternalScrollEnd:d,onMomentumScrollEnd:c,showsHorizontalScrollIndicator:f=!0,showsVerticalScrollIndicator:p=!0,refreshControl:m,useWindowScroll:h=!1,onLayout:g,...v},x){var y,C,S;let L=Hr(),[w]=Jo(["anchoredEndSpaceSize"]),k=D(null),I=D(null),T=h,E=B(()=>VV(k.current,T),[T]),A=B(()=>{let _e=k.current,He=KV(_e,I.current,T),qe=IR(_e,T,a);return qV(He,qe,a)},[a,T]),N=B(()=>{let _e=k.current;if(T){let He=A(),qe=IC(),Be=bR(_e,qe),Vt=a?qe.x-Be.left:qe.y-Be.top;return SR(Vt,He)}return _e?a?_e.scrollLeft:_e.scrollTop:0},[A,a,T]),R=B((_e,He)=>{let qe=k.current,Be=E();if(!Be||typeof Be.scrollTo!="function")return;let Vt=A(),he=SR(_e,Vt),Re={behavior:He?"smooth":"auto"};if(T){let Jn=IC(),lt=bR(qe,Jn),{left:kt,top:Nt}=GV({clampedOffset:he,horizontal:a,listPos:lt,scroll:Jn});Re.left=kt,Re.top=Nt}else a?Re.left=he:Re.top=he;Be.scrollTo(Re)},[A,E,a,T]);Yr(x,()=>({getBoundingClientRect:()=>{var He;return(He=k.current)==null?void 0:He.getBoundingClientRect()},getCurrentScrollOffset:N,getScrollableNode:()=>TR(k.current,T),getScrollEventTarget:()=>E(),getScrollResponder:()=>TR(k.current,T),isWindowScroll:()=>T,scrollBy:(He,qe)=>{let Be=E();!Be||typeof Be.scrollBy!="function"||Be.scrollBy({behavior:"auto",left:He,top:qe})},scrollTo:He=>{let{x:qe=0,y:Be=0,animated:Vt=!0}=He;R(a?qe:Be,Vt)},scrollToEnd:(He={})=>{let{animated:qe=!0}=He,Be=A();R(Be,qe)},scrollToOffset:He=>{let{offset:qe,animated:Be=!0}=He;R(qe,Be)}}),[N,A,E,a,T,R]);let $=B(()=>{if(!l||!k.current)return;let _e=PN(I.current),He=IR(k.current,T,a),qe=N(),Be={nativeEvent:{contentOffset:{x:a?qe:0,y:a?0:qe},contentSize:{height:_e.height,width:_e.width},layoutMeasurement:{height:He.height,width:He.width}}};l(Be)},[N,a,T,l]),U=HV($),H=D(void 0),F=B(()=>{let _e=H.current;_e!==void 0&&(clearTimeout(_e),H.current=void 0),U.flush(),d?.()},[d,U]),oe=B(_e=>{if(!l)return;let He=L.state;if(!!He?.scrollingTo||!!He?.initialScrollSession&&!He.didFinishInitialScroll||!!He?.initialScroll&&!He.didFinishInitialScroll||!!He&&$u(He)?U.flush():U.schedule(),d){let Be=H.current;Be!==void 0&&clearTimeout(Be),H.current=setTimeout(F,jV)}},[L.state,F,d,l,U]);xe(()=>{let _e=E();if(_e)return _e.addEventListener("scroll",oe,{passive:!0}),"onscrollend"in _e&&_e.addEventListener("scrollend",F),()=>{_e.removeEventListener("scroll",oe),"onscrollend"in _e&&_e.removeEventListener("scrollend",F);let He=H.current;He!==void 0&&(clearTimeout(He),H.current=void 0),U.cancel()}},[F,E,oe,U]),K(()=>{let _e=()=>{i&&R(a?i.x||0:i.y||0,!1)};_e(),requestAnimationFrame(_e)},[i?.x,i?.y,a,R]),xe(()=>{if(!g||!k.current)return;let _e=k.current,He=()=>{g({nativeEvent:{layout:WV(_e,T,a)}})};He();let qe=new ResizeObserver(()=>{He()});qe.observe(_e);let Be=()=>{He()};return T&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("resize",Be),()=>{qe.disconnect(),T&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",Be)}},[T,g]);let ee=!T&&(a?!f&&kN:!p&&LN);xe(()=>{ee&&XV()},[ee]);let W={...T?{}:{overflow:"auto",overflowX:a||f?"auto":"hidden",overflowY:a?p?"auto":"hidden":"auto",WebkitOverflowScrolling:"touch"},...zu.flatten(n),...s?{overflowAnchor:"none"}:{}},Ze=YV(L),ue=(C=(y=L.state)==null?void 0:y.props)!=null&&C.anchoredEndSpace&&w?w:0,pe=Math.max(0,Ze-ue),Fe=pe?a?{flexShrink:0,width:pe}:{height:pe}:void 0,Le={display:a?"flex":"block",flexDirection:a?"row":void 0,minHeight:a?void 0:"100%",minWidth:a?"100%":void 0,...zu.flatten(r),...s?{overflowAnchor:"none"}:{}},ie=o?`${bC} ${o}`:bC,{contentContainerClassName:Ie,contentInset:ve,scrollEventThrottle:re,ScrollComponent:be,snapToOffsets:rt,useWindowScroll:dt,className:st,...ct}=v,Zt=T?[]:JV(rt);Zt.length>0&&(W.scrollSnapType=a?"x mandatory":"y mandatory",Le.position=(S=Le.position)!=null?S:"relative");let at=ee?st?`${st} ${ee}`:ee:st;return Yo&&/(?:^|\s)(?:[a-z0-9_-]+:)*gap(?:-[xy])?-(?:\[[^\]]+\]|[^\s]+)/.test(`${o??""} ${st??""}`)&&qs("className-gap","className/contentContainerClassName gap classes are not supported in LegendList because it needs to use exact values internally. Use contentContainerStyle={{ gap: ... }} or columnWrapperStyle instead."),we("div",{className:at,ref:k,...ct,style:W},m,we("div",{className:ie,ref:I,style:Le},Zt.map(_e=>we("div",{"aria-hidden":!0,"data-legend-list-snap-anchor":_e,key:`snap-${_e}`,style:ZV(_e,a)})),t,Fe?we("div",{"aria-hidden":!0,style:Fe}):null))});function eW({horizontal:e,needsOtherAxisSize:t,otherAxisSize:n}){if(!(!t||!n||n<=0))return e?{height:n}:{width:n}}function PR(e,t){let n=Hr();xe(()=>Ga(n,e,r=>{t(r)}),[t,n,e])}function tW(e){return e?{contentSizeKey:"scrollWidth",paddingEndProp:"paddingRight",viewportSizeKey:"clientWidth",x:1,y:0}:{contentSizeKey:"scrollHeight",paddingEndProp:"paddingBottom",viewportSizeKey:"clientHeight",x:0,y:1}}function nW(e,t){var n,o,r;let a=(n=e.state)==null?void 0:n.refScroller.current,i=(r=(o=a?.getScrollableNode)==null?void 0:o.call(a))!=null?r:null,s=null;return i&&(s=t?.isConnected&&t.parentElement===i?t:i.querySelector(`:scope > .${bC}`)),i?{contentNode:s,scrollElement:i}:null}function oW(e,t,n){e.scrollBy({behavior:"auto",left:t,top:n})}function rW(){let e=Hr(),t=D(0),n=D(0),o=D(void 0),r=D(void 0),a=D(null),i=B(()=>{let s=le(e,"scrollAdjust"),l=le(e,"scrollAdjustUserOffset"),d=(s||0)+(l||0);if(d-t.current!==0){let f=nW(e,a.current);if(f){let p=!!e.state.props.horizontal,m=tW(p),{contentNode:h,scrollElement:g}=f,v=p?g.scrollLeft:g.scrollTop,x=(l||0)-n.current,C=(x!==0?v+x:e.state.scroll)-v,S=Math.abs(C)>.01,L=()=>oW(g,m.x*C,m.y*C);if(a.current=h,S&&h){let w=h[m.contentSizeKey],k=g[m.viewportSizeKey],I=v+C;if(C>0&&!e.state.adjustingFromInitialMount&&w<I+k){let E=h.style[m.paddingEndProp],A=r.current,N=A?.value===E?A.baseline:E,R=(I+k-w)*2,U=`${(Number.parseFloat(window.getComputedStyle(h)[m.paddingEndProp])||0)+R}px`;h.style[m.paddingEndProp]=U,r.current={baseline:N,value:h.style[m.paddingEndProp]},h.offsetHeight,L(),o.current!==void 0&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{let H=r.current;o.current=void 0,r.current=void 0,h.style[m.paddingEndProp]===H?.value&&(h.style[m.paddingEndProp]=H.baseline)})}else L()}else S&&L()}t.current=d,n.current=l||0}},[e]);return PR("scrollAdjust",i),PR("scrollAdjustUserOffset",i),null}var aW=qn(function({ScrollComponent:t,...n},o){let[r]=Jo(["snapToOffsets"]);return we(t,{...n,ref:o,snapToOffsets:r})}),SC=.1;function iW(e,t,n){let o=le(e,t)!==n;return o&&(Ae(e,t,n),Qs(e)),o}function sW(e,t,n){let{didContainersLayout:o,didFinishInitialScroll:r,props:a,scroll:i,scrollingTo:s}=e.state,l=n-t,c=((a.horizontal?a.stylePaddingLeft:a.stylePaddingTop)||0)+t;return a.maintainVisibleContentPosition.size&&o&&r&&!s&&i>=c-SC&&Math.abs(l)>SC}function AR(e,t){let{state:n}=e,o=le(e,"headerSize")||0,r=o!==t,a=n.didMeasureHeader||o>SC;r&&(Ae(e,"headerSize",t),Qs(e),a&&sW(e,o,t)&&Xs(e,t-o)),n.didMeasureHeader=!0}function lW(e,t){let n=iW(e,"footerSize",t);return n&&Cg(e),n}function dW(e,t){var n,o,r,a,i,s,l,d;return((n=e?.top)!=null?n:0)===((o=t?.top)!=null?o:0)&&((r=e?.bottom)!=null?r:0)===((a=t?.bottom)!=null?a:0)&&((i=e?.left)!=null?i:0)===((s=t?.left)!=null?s:0)&&((l=e?.right)!=null?l:0)===((d=t?.right)!=null?d:0)}function cW(e,t){let{state:n}=e,o=n.contentInsetOverride,r=t??void 0,a=!dW(o,r);return n.contentInsetOverride=r,a&&Qs(e),a}function uW(e,t){let n=CC(e),o=CC(t);return z(()=>qn((r,a)=>{var i,s;return(s=(i=n.current)==null?void 0:i.call(n,o.current(r,a)))!=null?s:null}),[o,n])}var ER=({onLayoutChange:e,refView:t,children:n,...o})=>{let r=D(null),a=t??r;return HC({onLayoutChange:e,ref:a}),we("div",{...o,ref:a},n)},fW=pa(function({horizontal:t}){let[n=0]=Jo(["alignItemsAtEndPadding"]);return n<=0?null:we(bg,{style:t?{flexShrink:0,width:n}:{flexShrink:0,height:n}},null)}),pW=pa(function({canRender:t,freshDataTransitionEpoch:n,style:o,contentContainerStyle:r,horizontal:a,initialContentOffset:i,recycleItems:s,ItemSeparatorComponent:l,alignItemsAtEnd:d,onScroll:c,onLayout:f,ListHeaderComponent:p,ListHeaderComponentStyle:m,ListFooterComponent:h,ListFooterComponentStyle:g,ListEmptyComponent:v,getRenderedItem:x,refScrollView:y,renderScrollComponent:C,onLayoutFooter:S,onInternalScrollBeginDrag:L,onInternalScrollEnd:w,scrollAdjustHandler:k,snapToIndices:I,stickyHeaderConfig:T,stickyHeaderIndices:E,useWindowScroll:A=!1,...N}){let R=Hr(),$=R.state.props.maintainVisibleContentPosition,[U=0,H=0]=Jo(["anchoredEndSpaceSize","otherAxisSize"]),F=R.state.props.alignItemsAtEndPaddingEnabled,oe=!!R.state.props.anchoredEndSpace&&R.state.props.anchoredEndSpaceOwner==="list"&&U>0,ee;if(oe){let Ie=a?Ya(R.state)?"Left":"Right":"Bottom",ve=zu.flatten(r);ee={[`padding${Ie}`]:Pu({},ve||{},Ie)+U}}let W=eW({horizontal:a,needsOtherAxisSize:R.state.needsOtherAxisSize,otherAxisSize:H}),Ze=uW(C,(Ie,ve)=>({...Ie,ref:ve})),ue=C?Ze:LR,pe=I?aW:ue,Fe=B((Ie,ve)=>{var re;let be=lW(R,Ie);ve?.(),be&&((re=R.state.props.maintainScrollAtEnd)!=null&&re.onFooterLayout)&&yd(R)},[R]);xe(()=>{p||AR(R,0),h||Fe(0)},[p,h,R,Fe]);let Le=B(Ie=>{let ve=Ie[a?"width":"height"];AR(R,ve)},[R,a]),ie=B((Ie,ve)=>{let re=Ie[a?"width":"height"];Fe(re,()=>{S?.(Ie,ve)})},[a,S,Fe]);return we(pe,{...N,...ue===LR?{onInternalScrollEnd:w,useWindowScroll:A}:{},contentContainerStyle:[a?{height:"100%"}:{},r,ee,{boxSizing:"border-box"}],contentOffset:i!==void 0?a?{x:i,y:0}:{x:0,y:i}:void 0,horizontal:a,maintainVisibleContentPosition:$.size||$.data?{minIndexForVisible:0}:void 0,onLayout:f,onScroll:c,ref:y,ScrollComponent:I?ue:void 0,style:W?[W,o]:o},we(rW,null),p&&we(ER,{onLayoutChange:Le,style:m},mg(p)),v&&mg(v),F&&we(fW,{horizontal:a}),t&&!v&&we(zV,{freshDataTransitionEpoch:n,getRenderedItem:x,horizontal:a,ItemSeparatorComponent:l,recycleItems:s,stickyHeaderConfig:T}),h&&we(ER,{onLayoutChange:ie,style:g},mg(h)),Yo&&pq)}),mW=100,gW=.9,hW=.9;function vW(e){let t=Hr(),{anchoredEndSpace:n,childrenMode:o,keyExtractor:r,numColumns:a,renderScrollComponent:i,useWindowScroll:s}=e,l=!!n;K(()=>{l&&(a??1)>1&&qs("anchoredEndSpaceNumColumns","anchoredEndSpace is only supported when numColumns is 1. Using it with multiple columns may produce incorrect anchored spacing.")},[l,a]),K(()=>{s&&i&&qs("useWindowScrollRenderScrollComponent","useWindowScroll is not supported when renderScrollComponent is provided.")},[i,s]),K(()=>{!r&&!t.state.isFirst&&t.state.didDataChange&&!o&&qs("keyExtractor","Changing data without a keyExtractor can cause slow performance and resetting scroll. If your list data can change you should use a keyExtractor with a unique id for best performance and behavior.")},[o,t,r]),K(()=>{let d=t.state,c=d.props.data.length;if(d.props.useWindowScroll||c<mW)return;let p=()=>{let h=le(t,"readyToRender"),g=le(t,"numContainers")||0,v=le(t,"totalSize")||0,x=t.state.scrollLength||0;if(!h||v<=0||x<=0)return;let y=g>=Math.ceil(c*gW),C=x>=v*hW;y&&C&&qs("webUnboundedOuterSize","LegendList appears to have an unbounded outer height on web, so virtualization is effectively disabled. Set a bounded height or flex: 1 on the list container, or use useWindowScroll.")};p();let m=[Ga(t,"numContainers",p),Ga(t,"readyToRender",p),Ga(t,"totalSize",p)];return()=>{for(let h of m)h()}},[t])}function xW(e){}var yW=Yo?vW:xW;function CW(e,t,{didColumnsChange:n=!1}={}){let o=e.state,{previousData:r}=o,{maintainScrollAtEnd:a}=o.props;if(n){o.sizes.clear(),o.sizesKnown.clear(),dN(o);for(let l in o.averageSizes)delete o.averageSizes[l];o.minIndexSizeChanged=0,o.scrollForNextCalculateItemsInView=void 0}ja(e,{dataChanged:!0,doMVCP:!0});let s=!n&&a?.onDataChange&&yd(e);!s&&r&&t.length>r.length&&(o.isEndReached=!1),s||Tg(e),delete o.previousData}function bW(e,t,n){var o;if(e.pendingDataComparison=void 0,!n||!t||t.length!==n.length)return!0;let{idCache:r,props:{itemsAreEqual:a,keyExtractor:i}}=e,s;for(let l=0;l<t.length;l++){if(t[l]===n[l])continue;if(!i)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;let d=(o=r[l])!=null?o:i(n[l],l),c=i(t[l],l);if(d!==c)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;if(!a)return s&&(e.pendingDataComparison={byIndex:s,nextData:t,previousData:n}),!0;let f=a(n[l],t[l],l,t);if(s??(s=[]),s[l]=f?1:2,!f)return e.pendingDataComparison={byIndex:s,nextData:t,previousData:n},!0}return!1}function AN(e){var t,n;let o=e.state,{scrollLength:r,props:{data:a,getFixedItemSize:i,getItemType:s,numColumns:l,estimatedItemSize:d}}=o,c=jR(e),f=le(e,"numContainers");if(r>0&&a.length>0&&!f){let p;if(i){let h=0,g=Math.min(20,a.length);for(let v=0;v<g;v++){let x=a[v];if(x!==void 0){let y=(t=s?.(x,v))!=null?t:"";h+=((n=i(x,v,y))!=null?n:d)+e.scrollAxisGap}}p=h/g}else p=d+e.scrollAxisGap;let m=Math.max(1,Math.ceil((r+c*2)/p*l));for(let h=0;h<m;h++)Ae(e,`containerPosition${h}`,hd),Ae(e,`containerColumn${h}`,-1),Ae(e,`containerSpan${h}`,1);return Ae(e,"numContainers",m),Ae(e,"numContainersPooled",j4(a.length,m)),o.lastLayout&&(o.initialScroll?requestAnimationFrame(()=>{ja(e,{dataChanged:!0,doMVCP:!0})}):ja(e,{dataChanged:!0,doMVCP:!0})),!0}}function IW(){return typeof window>"u"?{height:0,width:0}:{height:window.innerHeight,width:window.innerWidth}}function SW(e,t,n){let o=e.state,{maintainScrollAtEnd:r,useWindowScroll:a}=o.props,i=o.props.horizontal?"width":"height",s=o.props.horizontal?"height":"width",l=t;if(a){let v=IW()[i];l=v>0?{...t,[i]:v}:t}let d=l[i],c=o.scrollLength,f=d>0?d:c,p=l[s],m=!o.lastLayout||f>o.scrollLength||o.lastLayout.x!==l.x||o.lastLayout.y!==l.y;o.lastLayout=l;let h=o.otherAxisSize,g=f!==o.scrollLength||p!==h;if(g){if(o.scrollLength=f,o.otherAxisSize=p,Qs(e),o.lastBatchingAction=Date.now(),o.scrollForNextCalculateItemsInView=void 0,f>0&&AN(e),m&&ja(e,{doMVCP:!0}),(g||p!==h)&&Ae(e,"scrollSize",{height:l.height,width:l.width}),r?.onLayout&&yd(e),Tg(e),o){let v=o.props.horizontal?(o.props.stylePaddingTop||0)+(o.props.stylePaddingBottom||0):(o.props.stylePaddingLeft||0)+(o.props.stylePaddingRight||0);o.needsOtherAxisSize=p-v<10}Yo&&d===0&&qs("height0",`List ${o.props.horizontal?"width":"height"} is 0. You may need to set a style or \`flex: \` for the list, because children are absolutely positioned.`)}n(!0)}function wW(e,t){let n=ao.get(e);if(!!n&&ao.didReachTarget(t,n)){ao.clear(e);return}n&&(e.hasScrolled=!1,ao.set(e,{startScroll:n.startScroll,targetOffset:n.targetOffset}))}function TW(e){var t;return!!e.initialScroll&&((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"&&!e.didFinishInitialScroll}function kW(e){return{...e,nativeEvent:{...e.nativeEvent}}}function LW(e,t){var n,o,r,a,i,s;let l=e.state,{scrollProcessingEnabled:d}=l;if(d===!1||((o=(n=t.nativeEvent)==null?void 0:n.contentSize)==null?void 0:o.height)===0&&((r=t.nativeEvent.contentSize)==null?void 0:r.width)===0)return;let c=!1;if((a=t.nativeEvent)!=null&&a.contentInset){let{contentInset:p}=t.nativeEvent,m=l.nativeContentInset;(!m||m.top!==p.top||m.bottom!==p.bottom||m.left!==p.left||m.right!==p.right)&&(l.nativeContentInset=p,c=!0)}let f=t.nativeEvent.contentOffset[l.props.horizontal?"x":"y"];if(l.props.horizontal&&(f=ZK(l,f,(i=t.nativeEvent.contentSize)==null?void 0:i.width)),l.didFinishInitialScroll&&((s=l.initialScroll)==null?void 0:s.viewPosition)===1&&l.scroll>l.scrollLength,l.lastNativeScroll=f,l.lastNativeScrollTime=Date.now(),l.scrollingTo&&l.scrollingTo.offset>=f){let p=zi(e,f,l.scrollingTo);if(f!==p&&Math.abs(f-p)>1){f=p,Eg(e,{forceScroll:!0,isInitialScroll:!0,noScrollingTo:!0,offset:f});return}}l.scrollPending=f,Ws(e,f,c,{fromNativeScrollEvent:!0}),wW(l,f),g4(e),l.scrollingTo&&BC(e),l.props.onScroll&&(TW(l)?l.deferredPublicOnScrollEvent=kW(t):l.props.onScroll(t))}var PW=class{constructor(){this.work=new Map}timeout(e,t,n){n&&this.cancel(n);let o=[void 0,clearTimeout],r=setTimeout(()=>{let a=n??r;this.work.get(a)===o&&(this.work.delete(a),e())},t);o[0]=r,this.work.set(n??r,o)}frame(e,t){this.cancel(t);let n=[void 0,cancelAnimationFrame];this.work.set(t,n),n[0]=requestAnimationFrame(()=>{this.work.get(t)===n&&(this.work.delete(t),e())})}register(e,t){this.cancel(e),this.work.set(e,[void 0,t])}cancel(e){let t=this.work.get(e);if(t){this.work.delete(e);let[n,o]=t;o(n)}}has(e){return this.work.has(e)}dispose(){for(let[e,t]of this.work.values())t(e);this.work.clear()}},AW=class{constructor(e){this.appliedAdjust=0,this.pendingAdjust=0,this.ctx=e}requestAdjust(e){let t=this.ctx.state.scrollingTo;t?.animated&&!t.isInitialScroll?(this.pendingAdjust+=e,Ae(this.ctx,"scrollAdjustPending",this.pendingAdjust)):(this.appliedAdjust+=e,Ae(this.ctx,"scrollAdjust",this.appliedAdjust)),this.ctx.state.scrollingTo&&BC(this.ctx)}getAdjust(){return this.appliedAdjust}commitPendingAdjust(e){{let t=this.ctx.state,n=this.pendingAdjust;if(this.pendingAdjust=0,n!==0){let o;if(e?.index!==void 0){let a=kg(this.ctx,e.index);o=Pg(this.ctx,a,e),o=zi(this.ctx,o,e)}else o=zi(this.ctx,t.scroll+n);let r=o-t.scroll;(Math.abs(r)>.1||Math.abs(n)>.1)&&(this.appliedAdjust+=r,t.scroll=o,t.scrollForNextCalculateItemsInView=void 0,Ae(this.ctx,"scrollAdjust",this.appliedAdjust)),Ae(this.ctx,"scrollAdjustPending",0),ja(this.ctx)}}}};function EW(e,t){let n=e.state,o=Vs(e,t),a=Vs(e)-o;if(a!==0){let i=!!le(e,"isWithinMaintainScrollAtEndThreshold");Ws(e,n.scroll,!0,{markHasScrolled:!1}),!fN(e)&&i&&a>0&&Xs(e,a)}}function fC(e){return z(()=>e?(t,n,o)=>t!==void 0&&n!==void 0?e(t,n,o):void 0:void 0,[e])}var MW=(...e)=>B(n=>{for(let o of e)o&&(YR(o)?o(n):o.current=n)},e);function RW(e){return null}function NW(e,t,n,o){return o}function _W(e){let{gap:t,columnGap:n,rowGap:o}=e;if(t||n||o)return e.gap=void 0,e.columnGap=void 0,e.rowGap=void 0,{columnGap:n,gap:t,rowGap:o}}function DW(e,t){let n=e.state,r=n.props.data.length-1;if(r===-1)return!1;let a=n.props.stylePaddingBottom||0,i=le(e,"footerSize")||0;return pg(e,{...t,index:r,viewOffset:-a-i+(t?.viewOffset||0),viewPosition:1}),!0}var OW="default";function FW(e){let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];o&&(t[n||OW]={average:o.avg,count:o.num})}return t}function BW(e){yg(e)}function zW(e,t){let n=e.state,o=800,r=2,a=0,i=()=>!!n.didDataChange||!!n.didColumnsChange||n.scheduledWork.has("mvcpRecalculate")||n.ignoreScrollFromMVCP!==void 0,s=(g,v=!1)=>{var x;let y=n.props,C=y.data.length,S=(x=y.anchoredEndSpace)==null?void 0:x.anchorIndex;return g<0?v:g>=C?!1:S===void 0||S<0||S>=C||g<S?!0:Mq(e,S,C-1)},l=(g,v,x)=>{let y=Date.now(),C=0,S=()=>{if(g!==a)return;i()||!x()?C=0:C+=1;let L=Date.now()-y>=o;if(C>=r||L){v();return}n.scheduledWork.frame(S,"imperativeScrollReady")};n.scheduledWork.frame(S,"imperativeScrollReady")},d=(g,v,x,y=()=>!0)=>{let C=()=>{if(g!==a)return;(!x()||!n.scrollingTo)&&(n.pendingScrollResolve===v&&(n.pendingScrollResolve=void 0),v())};i()||!y()?l(g,C,y):C()},c=g=>{n.scheduledWork.cancel("imperativeScrollReady");let v=++a;return $R(n),n.pendingScrollResolve=g,v},f=(g,v=()=>!0)=>new Promise(x=>{let y=c(x);sR(e),d(y,x,g,v)});n.runPendingScrollToEnd=()=>{let g=n.pendingScrollToEnd;g&&(n.pendingScrollToEnd=void 0,g.token===a&&d(g.token,g.resolve,()=>DW(e,g.options),()=>s(n.props.data.length-1,!0)))};let p=g=>{if(n){let{index:v,...x}=g,{startNoBuffer:y,endNoBuffer:C}=n;if(v<y||v>C){let S=v<y?0:1;return pg(e,{...x,index:v,viewPosition:S}),!0}}return!1},m=n.refScroller;return{clearCaches:g=>{var v,x;let y=(v=g?.mode)!=null?v:"sizes";n.sizes.clear(),n.sizesKnown.clear(),dN(n);for(let C in n.averageSizes)delete n.averageSizes[C];n.minIndexSizeChanged=0,n.scrollForNextCalculateItemsInView=void 0,n.pendingTotalSize=void 0,n.totalSize=0,Ae(e,"totalSize",0),y==="full"&&(n.indexByKey.clear(),n.idCache.length=0,n.positions.length=0,n.columns.length=0,n.columnSpans.length=0),BW(e),(x=n.triggerCalculateItemsInView)==null||x.call(n,{forceFullItemPositions:!0})},flashScrollIndicators:()=>m.current.flashScrollIndicators(),getAnimatableRef:()=>{var g,v,x;return(x=(v=(g=m.current).getNativeScrollRef)==null?void 0:v.call(g))!=null?x:m.current},getNativeScrollRef:()=>m.current,getScrollableNode:()=>m.current.getScrollableNode(),getScrollResponder:()=>m.current.getScrollResponder(),getState:()=>({activeStickyIndex:le(e,"activeStickyIndex"),contentLength:ho(e),data:n.props.data,elementAtIndex:g=>{var v;return(v=e.viewRefs.get(hC(e,Bt(n,g))))==null?void 0:v.current},end:n.endNoBuffer,endBuffered:n.endBuffered,getAverageItemSizes:()=>FW(n),indexByKey:g=>n.indexByKey.get(g),isAtEnd:le(e,"isAtEnd"),isAtStart:le(e,"isAtStart"),isEndReached:n.isEndReached,isNearEnd:le(e,"isNearEnd"),isNearStart:le(e,"isNearStart"),isStartReached:n.isStartReached,isWithinMaintainScrollAtEndThreshold:le(e,"isWithinMaintainScrollAtEndThreshold"),listen:(g,v)=>Ga(e,g,v),listenToPosition:(g,v)=>aq(e,g,v),positionAtIndex:g=>n.positions[g],positionByKey:g=>{let v=n.indexByKey.get(g);return v===void 0?void 0:n.positions[v]},scroll:n.scroll,scrollLength:n.scrollLength,scrollVelocity:Ag(n),sizeAtIndex:g=>n.sizesKnown.get(Bt(n,g)),sizes:n.sizesKnown,start:n.startNoBuffer,startBuffered:n.startBuffered}),reportContentInset:g=>{let v=cW(e,g);Ws(e,n.scroll,!0,{markHasScrolled:!1}),v&&fN(e)},scrollIndexIntoView:g=>f(()=>p(g)),scrollItemIntoView:({item:g,...v})=>f(()=>{let y=n.props.data.indexOf(g);return y!==-1?(p({index:y,...v}),!0):!1}),scrollToEnd:g=>new Promise(v=>{var x;let y=c(v);n.pendingScrollToEnd={options:g,resolve:v,token:y},t?.(),sR(e),t||(x=n.runPendingScrollToEnd)==null||x.call(n)}),scrollToIndex:g=>f(()=>(pg(e,g),!0),g.index>=0?()=>s(g.index):void 0),scrollToItem:({item:g,...v})=>f(()=>{let y=n.props.data.indexOf(g);return y!==-1?(pg(e,{index:y,...v}),!0):!1}),scrollToOffset:g=>f(()=>(Eg(e,g),!0)),setItemSize:(g,v)=>{IN(e,{itemKey:g,size:v})},setScrollProcessingEnabled:g=>{n.scrollProcessingEnabled=g},setVisibleContentAnchorOffset:g=>{let v=YR(g)?g(le(e,"scrollAdjustUserOffset")||0):g;Ae(e,"scrollAdjustUserOffset",v)}}}var $W=(e,t)=>e-t,MR=e=>typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):0,Lu=(e,t,n)=>{n>=0&&n<t&&e.add(n)};function HW(e,t,n,o){var r,a;if(t.length===0)return[];let i=new Set,s=t.length,l=MR(e?.top);if(l>0)for(let f=0;f<Math.min(l,s);f++)Lu(i,s,f);let d=MR(e?.bottom);if(d>0)for(let f=Math.max(0,s-d);f<s;f++)Lu(i,s,f);if((r=e?.indices)!=null&&r.length)for(let f of e.indices)Number.isFinite(f)&&Lu(i,s,Math.floor(f));if((a=e?.keys)!=null&&a.length){let f=new Set(e.keys);for(let p=0;p<s&&f.size>0;p++){let m=n(t[p],p);f.has(m)&&(Lu(i,s,p),f.delete(m))}}if(o!==void 0&&Number.isFinite(o)){let f=Math.floor(o);for(let p=f>=0?f:s;p<s;p++)Lu(i,s,p)}let c=Array.from(i);return c.sort($W),c}function UW(e,t){var n;let o=e.state;if(!o)return null;let{indexByKey:r,props:{data:a,getItemType:i,renderItem:s}}=o,l=r.get(t);if(l===void 0)return null;let d=null,c=le(e,"extraData"),f=a[l];if(s&&!Mu(f)){let p={data:a,extraData:c,index:l,item:f,type:i&&(n=i(f,l))!=null?n:""};d=s(p)}return{index:l,item:a[l],renderedItem:d}}function RR(e,t){var n,o,r,a;return{animated:!1,onDataChange:t?(n=e?.dataChange)!=null?n:!1:!0,onFooterLayout:t?(o=e?.footerLayout)!=null?o:!1:!0,onItemLayout:t?(r=e?.itemLayout)!=null?r:!1:!0,onLayout:t?(a=e?.layout)!=null?a:!1:!0}}function KW(e){var t;return e?e===!0?{...RR(void 0,!1),animated:!1}:{...RR(e.on,"on"in e),animated:(t=e.animated)!=null?t:!1}:void 0}function qW(e){var t,n;return e===!0?{data:!0,size:!0}:e&&typeof e=="object"?{data:(t=e.data)!=null?t:!1,shouldRestorePosition:e.shouldRestorePosition,size:(n=e.size)!=null?n:!0}:e===!1?{data:!1,size:!1}:{data:!1,size:!0}}function VW(e,{stylePaddingTop:t}){let n=e.state;if(t!==void 0){let o=le(e,"stylePaddingTop")||0;if(t<o){let r=le(e,"totalSize")||0;Ae(e,"totalSize",r+o),n.timeoutSetPaddingTop=setTimeout(()=>{r=le(e,"totalSize")||0,Ae(e,"totalSize",r-o)},16)}Ae(e,"stylePaddingTop",t)}}function WW(e){let t=D(null),n=D(0),o=D(null),r=()=>{t.current&&(clearTimeout(t.current),t.current=null)};return B((i,s,...l)=>{{let d=Date.now();o.current=l,d-n.current>=s?(n.current=d,i(...l),r()):(r(),t.current=setTimeout(()=>{o.current&&(n.current=Date.now(),i(...o.current),t.current=null,o.current=null)},s-(d-n.current)))}},[e])}function GW(e,t){let n=WW("throttle");return o=>n(e,t,{nativeEvent:o.nativeEvent})}var jW=pa(SN(function(t,n){let{children:o,data:r,renderItem:a,...i}=t,l=o!==void 0&&r===void 0?{...i,childrenMode:!0,data:(Lg(o)?o:ch.toArray(o)).flat(1),renderItem:({item:d})=>d}:{...i,data:r||[],renderItem:a};return we(nq,null,we(QW,{...l,ref:n}))})),QW=SN(function(t,n){var o,r,a,i,s,l,d,c,f,p,m,h,g,v,x,y,C,S,L;let w=B(Ke=>{},[]);t.recycleItems===void 0&&qs("recycleItems-omitted","recycleItems was not provided, so it defaults to false. Set recycleItems explicitly to true for better performance with recycling-aware rows, or false to preserve remount-on-reuse behavior.");let{alignItemsAtEnd:k=!1,anchoredEndSpace:I,alwaysRender:T,columnWrapperStyle:E,contentContainerStyle:A,contentInset:N,data:R=[],dataKey:$,dataVersion:U,drawDistance:H=250,contentInsetEndAdjustment:F,estimatedItemSize:oe=100,estimatedListSize:ee,extraData:W,getFixedItemSize:Ze,getItemType:ue,horizontal:pe,rtl:Fe,estimatedHeaderSize:Le,initialScrollAtEnd:ie=!1,initialScrollIndex:Ie,initialScrollOffset:ve,experimental_adaptiveRender:re,itemsAreEqual:be,keyExtractor:rt,ListEmptyComponent:dt,ListFooterComponent:st,ListFooterComponentStyle:ct,ListHeaderComponent:Zt,maintainScrollAtEnd:at=!1,maintainScrollAtEndThreshold:_e=.1,maintainVisibleContentPosition:He,numColumns:qe=1,overrideItemLayout:Be,onEndReached:Vt,onEndReachedThreshold:he=.5,onItemSizeChanged:sn,onMetricsChange:Re,onLayout:Jn,onLoad:lt,onMomentumScrollEnd:kt,onRefresh:Nt,onScroll:en,onScrollBeginDrag:gn,onStartReached:Pn,onStartReachedThreshold:An=.5,onStickyHeaderChange:hn,onFirstVisibleItemChanged:cn,onViewableItemsChanged:Yt,progressViewOffset:Hn,recycleItems:io=!1,refreshControl:It,refreshing:Eo,refScrollView:_,renderScrollComponent:Z,renderItem:X,scrollEventThrottle:ae,snapToIndices:fe,stickyHeaderIndices:ft,style:ut,useWindowScroll:vt=!1,viewabilityConfig:_t,viewabilityConfigCallbackPairs:Jt,...xt}=t,vn=t.animatedPropsInternal,tn=(o=t.anchoredEndSpaceOwnerInternal)!=null?o:"list",un=t.positionComponentInternal,Zn=t.stickyPositionComponentInternal,{anchoredEndSpaceOwnerInternal:me,positionComponentInternal:St,stickyPositionComponentInternal:yt,...zt}=xt,Oe=zu.flatten(A),gt=k&&!pe&&Oe?.minHeight==null&&R.length>0,Zo=k&&!gt&&(pe?Oe?.minWidth==null:Oe?.minHeight==null),Lt={...Oe,...k&&!gt?{display:"flex",flexDirection:pe?"row":"column",...Zo?{flexGrow:1}:{},justifyContent:"flex-end"}:{}},Dn={...zu.flatten(ut)},nn=Pu(Dn,Lt,"Top"),xn=Pu(Dn,Lt,"Bottom"),te=Pu(Dn,Lt,"Left"),et=Pu(Dn,Lt,"Right"),Ct=LC({horizontal:pe,rtl:Fe,stylePaddingBottom:xn,stylePaddingLeft:te,stylePaddingRight:et}),ze=KW(at),on=qW(He),yn=Ie!=null,Cn=ve!=null,Pt=!ie&&!yn&&!Cn&&kC({horizontal:pe,rtl:Fe}),Un=!ie&&!yn&&(Cn||Pt),Wt=ie||yn,so=ie?{index:Math.max(0,R.length-1),preserveForBottomPadding:!0,viewOffset:-Ct,viewPosition:1}:yn?typeof Ie=="object"?{index:(r=Ie.index)!=null?r:0,preserveForBottomPadding:Ie.viewOffset===void 0&&Ie.viewPosition===1?!0:void 0,viewOffset:(a=Ie.viewOffset)!=null?a:Ie.viewPosition===1?-Ct:0,viewPosition:(i=Ie.viewPosition)!=null?i:0}:{index:Ie??0,viewOffset:ve??0}:Un?{contentOffset:ve??0,index:0,viewOffset:0}:void 0,[ma,ei]=G(!AC),[,Zs]=si(Ke=>Ke+1,0),Ne=Hr();Ne.columnWrapperStyle=E||(Lt?_W(Lt):void 0);let Kr=pe?(d=(s=Ne.columnWrapperStyle)==null?void 0:s.columnGap)!=null?d:(l=Ne.columnWrapperStyle)==null?void 0:l.gap:(p=(c=Ne.columnWrapperStyle)==null?void 0:c.rowGap)!=null?p:(f=Ne.columnWrapperStyle)==null?void 0:f.gap,rn=typeof Kr=="number"&&Number.isFinite(Kr)?Kr:0,ga=D(null),Td=MW(ga,_),el=rt??((Ke,ht)=>ht.toString()),Ho=ft,Mo=F,lo=D(Mo),$t=z(()=>{let Ke=HW(T,R,el,I?.anchorIndex);return{arr:Ke,set:new Set(Ke)}},[I?.anchorIndex,T?.top,T?.bottom,(m=T?.indices)==null?void 0:m.join(","),(h=T?.keys)==null?void 0:h.join(","),R,$,U,el]),er=!!vt&&!Z,At=D(void 0),vr=!!Be,Gt=D(vr);if(!At.current){if(!Ne.state){let Ke=(ee??{height:0,width:0})[pe?"width":"height"];Ne.values.set("adaptiveRender",(g=re?.initialMode)!=null?g:"normal"),Ne.state={averageSizes:{},columnSpans:[],columns:[],containerItemGenerations:[],containerItemKeys:new Map,containerItemMetadata:new Map,contentInsetOverride:void 0,dataChangeEpoch:0,dataChangeNeedsScrollUpdate:!1,didColumnsChange:!1,didDataChange:!1,didLoad:!1,enableScrollForNextCalculateItemsInView:!0,endBuffered:-1,endNoBuffer:-1,endReachedSnapshot:void 0,firstFullyOnScreenIndex:-1,freshDataTransitionEpoch:0,hasHadNonEmptyData:R.length>0,idCache:[],idsInView:[],indexByKey:new Map,initialScroll:so,initialScrollSession:so?{kind:Un?"offset":"bootstrap",previousDataLength:R.length}:void 0,isEndReached:null,isFirst:!0,isStartReached:null,lastBatchingAction:Date.now(),lastLayout:void 0,lastScrollDelta:0,loadStartTime:Date.now(),minIndexSizeChanged:0,nativeContentInset:void 0,nativeMarginTop:0,pendingDataComparison:void 0,pendingNativeMVCPAdjust:void 0,positions:[],props:{},queuedCalculateItemsInView:0,refScroller:{current:null},scheduledWork:new PW,scroll:0,scrollAdjustHandler:new AW(Ne),scrollForNextCalculateItemsInView:void 0,scrollHistory:[],scrollLength:Ke,scrollPending:0,scrollPrev:0,scrollPrevTime:0,scrollProcessingEnabled:!0,scrollTime:0,sizes:new Map,sizesKnown:new Map,startBuffered:-1,startNoBuffer:-1,startReachedSnapshot:void 0,stickyContainerPool:new Set,stickyContainers:new Map,totalSize:0,viewabilityConfigCallbackPairs:void 0};let ht=Ne.state;ht.triggerCalculateItemsInView=bn=>ja(Ne,bn),ht.reprocessCurrentScroll=()=>Ws(Ne,ht.scroll,!0),Ae(Ne,"maintainVisibleContentPosition",on),Ae(Ne,"extraData",W),Le!==void 0&&Ae(Ne,"headerSize",Le)}At.current=Ne.state}let Pe=At.current,Ht=Pe.isFirst,$i=Pe.props.adaptiveRender,On=Pe.props.numColumns,Uo=!Ht&&Ne.scrollAxisGap!==rn;Ne.scrollAxisGap=rn,Pe.didColumnsChange=qe!==On||Uo;let yo=(x=(v=Pe.props.data)==null?void 0:v.length)!=null?x:0,ha=Pe.props.data!==R,Ro=Pe.props.dataKey!==$,va=Pe.props.dataVersion!==U,co=Ro||va||ha&&bW(Pe,R,Pe.props.data),tr=!Ht&&co&&Pe.hasHadNonEmptyData&&(Ro||yo===0)&&R.length>0;co&&!ie&&Pe.didFinishInitialScroll&&((y=Pe.initialScroll)==null?void 0:y.viewPosition)===1&&Pe.props.data.length>0&&vd(Pe),co&&(Pe.dataChangeEpoch+=1,Pe.dataChangeNeedsScrollUpdate=!0,Pe.didDataChange=!0,Pe.previousData=Pe.props.data),tr&&(Pe.freshDataTransitionEpoch+=1);let xr=GW(en??w,ae??0),ti=ae&&en?xr:en,Tn=!Ht&&!co&&((C=Pe.props.anchoredEndSpace)==null?void 0:C.anchorIndex)!==I?.anchorIndex;Pe.props={adaptiveRender:re,alignItemsAtEnd:k,alignItemsAtEndPaddingEnabled:gt,alwaysRender:T,alwaysRenderIndicesArr:$t.arr,alwaysRenderIndicesSet:$t.set,anchoredEndSpace:I,anchoredEndSpaceOwner:tn,animatedProps:vn,contentContainerAlignItems:Lt.alignItems,contentInset:N,contentInsetEndAdjustment:Mo,data:R,dataKey:$,dataVersion:U,drawDistance:H,estimatedItemSize:oe,getFixedItemSize:fC(Ze),getItemType:fC(ue),horizontal:!!pe,itemsAreEqual:be,keyExtractor:fC(el),maintainScrollAtEnd:ze,maintainScrollAtEndThreshold:_e,maintainVisibleContentPosition:on,numColumns:qe,onEndReached:Vt,onEndReachedThreshold:he,onFirstVisibleItemChanged:cn,onItemSizeChanged:sn,onLoad:lt,onMomentumScrollEnd:kt,onScroll:ti,onScrollBeginDrag:gn,onStartReached:Pn,onStartReachedThreshold:An,onStickyHeaderChange:hn,overrideItemLayout:Be,positionComponentInternal:un,recycleItems:!!io,renderItem:X,rtl:Fe,snapToIndices:fe,stickyHeaderIndicesArr:Ho??[],stickyHeaderIndicesSet:z(()=>new Set(Ho??[]),[Ho?.join(",")]),stickyPositionComponentInternal:Zn,stylePaddingBottom:xn,stylePaddingLeft:te,stylePaddingRight:et,stylePaddingTop:nn,useWindowScroll:er},Pe.refScroller=ga,!Ht&&$i&&!re&&EC(Ne);let qr=z(()=>R.length?Array.from({length:Math.min(qe,R.length)},(Ke,ht)=>Bt(Pe,R.length-1-ht)):[],[R,$,U,qe]),Vr=Ke=>{Ae(Ne,"lastItemKeys",qr),Ae(Ne,"numColumns",qe);let ht=le(Ne,"stylePaddingTop");VW(Ne,{stylePaddingTop:nn}),At.current.props.stylePaddingBottom=xn,Qs(Ne);let bn=nn-ht;Ke&&on.size&&bn&&ht!==void 0&&Qa.OS};Ht&&(Vr(!1),pN(Pe),gN(Ne,!0));let ni=z(()=>{var Ke,ht;let bn=Pe.initialScroll;if(!bn)return;let fn=(Ke=bn.contentOffset)!=null?Ke:$r(Ne,bn);return Wt&&((ht=Pe.initialScrollSession)==null?void 0:ht.kind)==="bootstrap"&&Qa.OS==="web"?void 0:fn},[Wt]);xe(()=>{D4(Ne,{alwaysDispatchInitialScroll:Pt,dataLength:R.length,hasFooterComponent:!!st,initialContentOffset:ni,initialScrollAtEnd:ie,useBootstrapInitialScroll:Wt})},[]),(Ht||co||Pe.didColumnsChange)&&(At.current.lastBatchingAction=Date.now(),!rt&&!Ht&&co&&(At.current.sizes.clear(),At.current.positions.length=0,At.current.totalSize=0,Ae(Ne,"totalSize",0))),Yo&&yW(t),xe(()=>{tr&&RC(Ne,{resetInitialScroll:!!so,resetLayout:!0}),O4(Ne,{dataLength:R.length,didDataChange:co,didStartFreshData:tr,initialScrollAtEnd:ie,latestInitialScroll:so,latestInitialScrollSessionKind:Un?"offset":"bootstrap",stylePaddingEnd:Ct,useBootstrapInitialScroll:Wt})},[R.length,$,co,tr,ie,Ct,Wt]),xe(()=>{var Ke;Tn&&(Pe.scrollForNextCalculateItemsInView=void 0,(Ke=Pe.triggerCalculateItemsInView)==null||Ke.call(Pe)),Cg(Ne)},[Ne,R,U,I?.anchorIndex,I?.anchorMaxSize,I?.anchorOffset,Tn,pe,qe,Fe,xn,te,et]),xe(()=>{let Ke=lo.current;lo.current=Mo,EW(Ne,Ke)},[Ne,Mo]);let eo=B(Ke=>{Wt&&x4(Ne,{dataLength:R.length,footerSize:Ke[pe?"width":"height"],initialScrollAtEnd:ie,stylePaddingEnd:Ct})},[R.length,ie,pe,Ct,Wt]),yr=B((Ke,ht)=>{let bn=Pe.scrollLength,fn=Pe.otherAxisSize;SW(Ne,Ke,ei),Cg(Ne);let Wr=bn!==Pe.scrollLength||fn!==Pe.otherAxisSize;Wt&&!ht&&Wr&&y4(Ne),!Wt&&Ou(Ne)},[R.length,ie,Ct,Wt]),{onLayout:xa}=HC({onLayoutChange:yr,onLayoutProp:Jn,ref:ga});xe(()=>{fe&&mN(Ne)},[fe]),xe(()=>Vr(!0),[$,U,qr.join(","),qe,rn,xn,nn,gt]),xe(()=>{let{didColumnsChange:Ke,didDataChange:ht,isFirst:bn,props:{data:fn}}=Pe;!(fn.length>0&&AN(Ne))&&!bn&&(ht||Ke)&&CW(Ne,fn,{didColumnsChange:Ke}),ht&&(Pe.pendingDataComparison=void 0),Pe.didColumnsChange=!1,Pe.didDataChange=!1,Pe.isFirst=!1},[R,$,U,qe,rn]),xe(()=>{var Ke;Ae(Ne,"extraData",W);let ht=Gt.current!==vr;Gt.current=vr,(vr||ht)&&qe>1&&((Ke=Pe.triggerCalculateItemsInView)==null||Ke.call(Pe,{forceFullItemPositions:!0}))},[W,vr,qe]),K(()=>{if(!Re)return;let Ke,ht=()=>{let fn={footerSize:le(Ne,"footerSize")||0,headerSize:le(Ne,"headerSize")||0};(!Ke||fn.headerSize!==Ke.headerSize||fn.footerSize!==Ke.footerSize)&&(Ke=fn,Re(fn))};ht();let bn=[Ga(Ne,"headerSize",ht),Ga(Ne,"footerSize",ht)];return()=>{for(let fn of bn)fn()}},[Ne,Re]),K(()=>{let Ke=U4({onViewableItemsChanged:Yt,viewabilityConfig:_t,viewabilityConfigCallbackPairs:Jt});Pe.viewabilityConfigCallbackPairs=Ke,Pe.enableScrollForNextCalculateItemsInView=!0,Ke&&(Pe.scrollForNextCalculateItemsInView=void 0)},[_t,Jt,Yt]),CV(()=>{}),Yr(n,()=>zW(Ne,Zs),[]),K(()=>()=>{gq(Pe),Pe.scheduledWork.dispose()},[Pe]),xe(()=>{var Ke;(Ke=Pe.runPendingScrollToEnd)==null||Ke.call(Pe)}),K(()=>{Wt||Ou(Ne)},[Ne,Wt]);let Ko=z(()=>({getRenderedItem:Ke=>UW(Ne,Ke),onMomentumScrollEnd:Ke=>{N4(Ne),Pe.props.onMomentumScrollEnd&&Pe.props.onMomentumScrollEnd(Ke)},onScroll:Ke=>LW(Ne,Ke),onScrollBeginDrag:Ke=>{var ht,bn;rR(Ne),(bn=(ht=Pe.props).onScrollBeginDrag)==null||bn.call(ht,Ke)},onScrollEnd:()=>rR(Ne)}),[]),Cr=NW(Ho,pe,Ne,Ko.onScroll),to=It;return we(ii,null,we(pW,{...zt,alignItemsAtEnd:k,canRender:ma,contentContainerStyle:Lt,contentInset:N,freshDataTransitionEpoch:Pe.freshDataTransitionEpoch,getRenderedItem:Ko.getRenderedItem,horizontal:pe,initialContentOffset:ni,ListEmptyComponent:R.length===0?dt:void 0,ListFooterComponent:st,ListFooterComponentStyle:ct,ListHeaderComponent:Zt,onInternalScrollBeginDrag:Ko.onScrollBeginDrag,onInternalScrollEnd:Ko.onScrollEnd,onLayout:xa,onLayoutFooter:eo,onMomentumScrollEnd:Ko.onMomentumScrollEnd,onScroll:Cr,recycleItems:io,refreshControl:to?nn>0?xf(to,{progressViewOffset:((S=to.props.progressViewOffset)!=null?S:0)+nn}):to:Nt&&we(RW,{onRefresh:Nt,progressViewOffset:(Hn||0)+nn,refreshing:!!Eo}),refScrollView:Td,renderScrollComponent:Z,scrollAdjustHandler:(L=At.current)==null?void 0:L.scrollAdjustHandler,scrollEventThrottle:0,snapToIndices:fe,stickyHeaderIndices:Ho,style:Dn,useWindowScroll:er}),Yo&&mq)});var XW=jW;var EN=XW;ge();ge();function YW(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function JW(e,t){let n=t?.trim();if(!n)return e;let o=new RegExp(`^${YW(n)}(?:\\s*[.:/-]\\s*|\\s+)`,"iu");return e.replace(o,"").trim()||e}function UC(e,t){let n=t?.preferShortName&&e.shortName?e.shortName:e.name;return JW(n,e.subProvider)}function Cd(e){return UC(e,{preferShortName:!0})}var KC="model:",qC="legacy-models:",VC="action:",bd="pluginActions:manage";function Hu(e,t){return`${KC}${e.length}:${e}${t}`}function GC(e){if(!e.startsWith(KC))return null;let t=e.slice(KC.length),n=t.indexOf(":");if(n===-1)return null;let o=t.slice(0,n);if(!/^\d+$/.test(o))return null;let r=Number(o),a=t.slice(n+1);return!Number.isSafeInteger(r)||r>a.length?null:{instanceId:a.slice(0,r),slug:a.slice(r)}}function jC(e){return`${qC}${e}`}function MN(e){return e.startsWith(qC)?e.slice(qC.length):null}function Uu(e){return`${VC}${e}`}function RN(e){if(!e.startsWith(VC))return null;let t=e.slice(VC.length);return t.length>0?t:null}var WC="choice:";function QC(e){return`${WC}${JSON.stringify([e.environmentId,e.runtimeId,e.sourceId,e.profileId,e.endpointId??""])}`}function NN(e){if(!e.startsWith(WC))return null;try{let t=JSON.parse(e.slice(WC.length));if(!Array.isArray(t)||t.length!==5)return null;let[n,o,r,a,i]=t;return typeof n!="string"||typeof o!="string"||typeof r!="string"||typeof a!="string"||typeof i!="string"?null:{environmentId:n,runtimeId:o,sourceId:r,profileId:a,...i.length>0?{endpointId:i}:{}}}catch{return null}}var _N=de(function(t){let{t:n}=De(),o=t.isFavorite?n("modelPicker.removeFromFavorites"):n("modelPicker.addToFavorites"),r=[t.providerDisplayName,t.sourceLabel,t.model.subProvider,t.providerAccountEmail].filter(s=>typeof s=="string"&&s.length>0).join(" \xB7 "),a=b(Sl,{hideIndicator:!0,index:t.index,value:t.itemKey??Hu(t.instanceId,t.model.slug),disabled:!!t.disabledReason,contentClassName:"flex w-full items-center gap-3",className:O("group relative w-full !min-w-0 max-w-full cursor-pointer rounded-md px-2 py-2 transition-colors duration-(--control-duration)","hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-highlighted:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-selected:bg-foreground/[0.08] data-selected:text-foreground data-selected:ring-0 [&[data-highlighted][data-selected]]:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]",t.disabledReason&&"data-disabled:pointer-events-auto data-disabled:cursor-not-allowed data-disabled:hover:bg-transparent"),children:[b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"flex min-w-0 items-center gap-2",children:u("div",{className:"min-w-0 truncate text-xs font-medium leading-snug",children:t.useTriggerLabel?Cd(t.model):UC(t.model,t.preferShortName?{preferShortName:!0}:void 0)})}),t.showProvider&&b("div",{className:"mt-1 flex items-center gap-1.5",children:[u(Ir,{providerId:t.providerId,displayName:t.providerDisplayName,accentColor:t.providerAccentColor,className:"size-icon-2",iconClassName:"size-3",indicatorBackground:"var(--popover)"}),u("span",{className:"truncate text-xs font-normal leading-snug text-muted-foreground/70",children:r})]})]}),b("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jumpLabel?u(Ff,{className:"h-4 min-w-0 rounded-sm px-1.5 text-[10px]",children:t.jumpLabel}):null,b(Ve,{children:[u(Ge,{render:u(ne,{size:"icon-xs",variant:"ghost",className:O("-mr-1 shrink-0 text-muted-foreground/70 opacity-64 transition-[color,opacity] hover:text-foreground hover:opacity-100 group-hover:opacity-100",t.isFavorite&&"text-foreground opacity-100"),onClick:s=>{s.stopPropagation(),t.onToggleFavorite()},onKeyDown:s=>{s.stopPropagation()},softDisabled:!!t.disabledReason,"aria-label":o,children:u(is,{className:O("size-icon-1",t.isFavorite&&"fill-current text-yellow-500")})})}),u(We,{side:"top",align:"center",children:o})]})]})]}),i=t.disabledReason??t.actionLabel;return i?b(Ve,{children:[u(Ge,{render:a}),u(We,{side:"left",align:"center",className:"max-w-64 text-balance leading-snug",children:i})]}):a});ge();function ZW(e,t){let n=e.displayName,o=e.enabled?e.readiness:"disabled";if(lg(o))return n;let r=KM(o,t),a=e.snapshot.readiness.detail?.trim();return a?t("instance.statusWithDetail",{name:n,status:r,detail:a}):t("instance.status",{name:n,status:r})}var eG="pointer-events-none absolute -right-1 top-1/2 z-10 h-5 w-0.75 -translate-y-1/2 rounded-l-full bg-primary",tG="pointer-events-none absolute -right-0.5 top-0.5 z-10 flex size-3.5 items-center justify-center rounded-full bg-transparent shadow-sm ",nG=`${tG} text-update-foreground`,DN="left",ON=8,FN="max-w-64 text-balance font-normal leading-snug",BN=de(function(t){let{t:n}=De(),{t:o}=De(),r=Ot().model.isProviderUpdateInFlight,a=p=>{t.onSelectInstance(p)},i=t.showFavorites??!0,[s,l]=G(null),d=D(null),[c,f]=G(null);return xe(()=>{let p=d.current;if(!p)return;let m=Array.from(p.querySelectorAll("[data-model-picker-provider]")).find(h=>h.dataset.modelPickerProvider===t.selectedInstanceId);if(!m){f(null);return}f(m.offsetTop+m.offsetHeight/2-10)},[t.instanceEntries,t.selectedInstanceId,i]),u("div",{className:"w-11 shrink-0 overflow-hidden bg-muted/30","data-model-picker-sidebar":"true",children:u("div",{className:"h-full overflow-y-auto overscroll-contain [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:b("div",{ref:d,className:"relative flex min-h-full flex-col gap-1 p-1",children:[c!==null?u("div",{"data-model-picker-selected-indicator":"true",className:O(eG,"right-0 translate-y-0 transition-[top] duration-200 ease-out"),style:{top:c}}):null,i?b(Ce,{children:[u("div",{className:"relative w-full","data-model-picker-provider":"favorites",children:b(Ve,{children:[u(Ge,{render:u("button",{className:O("relative isolate flex w-full cursor-pointer aspect-square items-center justify-center rounded-md transition-colors hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] focus-visible:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]"),onClick:()=>a("favorites"),type:"button","aria-label":n("modelPicker.favorites"),children:u(is,{className:"size-5 fill-current shrink-0","aria-hidden":!0})})}),u(We,{side:DN,sideOffset:ON,align:"center",className:FN,children:"Favorites"})]})}),u("div",{className:"border-b border-border/70","aria-hidden":"true"})]}):null,t.instanceEntries.map(p=>{let m=!ku(p),h=t.disabledInstanceIds?.has(p.instanceId)??!1,g=m||h,v=t.selectedInstanceId===p.instanceId,x=s===p.instanceId,y=r(p.snapshot),C=p.snapshot.versionAdvisory?.latestVersion!=null?o("updates.rail.updatingToVersion",{version:p.snapshot.versionAdvisory.latestVersion}):o("updates.rail.updating"),S=m?ZW(p,o):h?t.getDisabledInstanceTooltip?.(p)??p.displayName:y?`${p.displayName} \u2014 ${C}`:p.displayName,L=b("button",{className:O("relative isolate flex w-full cursor-pointer aspect-square items-center justify-center rounded-md transition-colors hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] focus-visible:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]",g&&"opacity-50 cursor-not-allowed hover:bg-transparent"),"data-provider-accent-color":p.accentColor,onClick:()=>!g&&a(p.instanceId),onMouseEnter:()=>l(p.instanceId),onMouseLeave:()=>l(k=>k===p.instanceId?null:k),onFocus:()=>l(p.instanceId),onBlur:()=>l(k=>k===p.instanceId?null:k),disabled:g,type:"button","aria-label":g?S:p.displayName,children:[u(Ir,{providerId:p.providerId,displayName:p.displayName,accentColor:p.accentColor,className:"size-6",iconClassName:"size-5",indicatorBackground:x&&!g?"var(--muted)":v?"var(--background)":"color-mix(in oklab, var(--muted) 30%, transparent)"}),y?u("span",{className:nG,"aria-hidden":!0,children:u(Pf,{className:"size-2.5"})}):null]}),w=g?u("span",{className:"relative block w-full",children:L}):L;return u("div",{className:"relative w-full","data-model-picker-provider":p.instanceId,children:b(Ve,{children:[u(Ge,{render:w}),b(We,{side:DN,sideOffset:ON,align:"center",className:FN,children:[S,p.accountEmail?u("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:p.accountEmail}):null]})]})},p.instanceId)})]})})})});function xo(e,t){let n=e.trim();return n?t?.trimLeadingPattern?n.replace(t.trimLeadingPattern,"").toLowerCase():n.toLowerCase():""}function oG(e,t){if(!t)return 0;let n=0,o=-1,r=-1,a=0;for(let i=0;i<e.length;i+=1)if(e[i]===t[n]&&(o===-1&&(o=i),r!==-1&&(a+=i-r-1),r=i,n+=1,n===t.length)){let s=i-o+1-t.length,l=Math.min(64,e.length-t.length);return o*2+a*3+s+l}return null}function XC(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function rG(e,t,n){let o=null;for(let r of n){let a=e.indexOf(`${r}${t}`);if(a===-1)continue;let i=a+r.length;(o===null||i<o)&&(o=i)}return o}function Ur(e){let{value:t,query:n}=e;if(!t||!n)return null;if(t===n)return e.exactBase;if(e.prefixBase!==void 0&&t.startsWith(n))return e.prefixBase+XC(t,n);if(e.boundaryBase!==void 0){let o=rG(t,n,e.boundaryMarkers??[" ","-","_","/"]);if(o!==null)return e.boundaryBase+o*2+XC(t,n)}if(e.includesBase!==void 0){let o=t.indexOf(n);if(o!==-1)return e.includesBase+o*2+XC(t,n)}if(e.fuzzyBase!==void 0){let o=oG(t,n);if(o!==null)return e.fuzzyBase+o}return null}function aG(e,t){let n=e.score-t.score;return n!==0?n:e.tieBreaker.localeCompare(t.tieBreaker)}function iG(e,t){let n=0,o=e.length;for(;n<o;){let r=n+Math.floor((o-n)/2),a=e[r];if(!a)break;aG(t,a)<0?o=r:n=r+1}return n}function Ng(e,t,n){if(n<=0)return;let o=iG(e,t);if(e.length<n){e.splice(o,0,t);return}o>=n||(e.splice(o,0,t),e.pop())}var sG=24;function lG(e){return[xo(e.name),...e.shortName?[xo(e.shortName)]:[],...e.subProvider?[xo(e.subProvider)]:[],xo(e.driverKind),xo(e.providerDisplayName),...e.providerAccountEmail?[xo(e.providerAccountEmail)]:[],YC(e),...e.slug?[xo(e.slug)]:[]]}function dG(e,t,n){return Ur({value:e,query:t,exactBase:n,prefixBase:n+2,boundaryBase:n+4,includesBase:n+6,...t.length>=3?{fuzzyBase:n+100}:{}})}function YC(e){return xo([e.name,e.shortName,e.subProvider,e.driverKind,e.providerDisplayName,e.providerAccountEmail,e.slug].filter(t=>typeof t=="string"&&t.length>0).join(" "))}function zN(e,t){let n=xo(t).split(/\s+/u).filter(r=>r.length>0);if(n.length===0)return 0;let o=0;for(let r of n){let a=[];for(let i=0;i<e.length;i+=1){let s=dG(e[i],r,i*10);s!==null&&a.push(s)}if(a.length===0)return null;o+=Math.min(...a)}return o}function $N(e,t){let n=zN(lG(e),t);return n===null?null:e.isFavorite?n-sG:n}function HN(e,t){return zN([xo(e.title),xo(e.description??"")],t)}function UN({top:e,bottom:t}){if(!(!e&&!t))return O("virtualized-scroll-fade [--fade-size:1.5rem]",e&&t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,transparent,black_var(--fade-size),black_calc(100%-var(--fade-size)),transparent)]",e&&!t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,transparent,black_var(--fade-size))]",!e&&t&&"[--virtualized-scroll-fade-mask:linear-gradient(to_bottom,black_calc(100%-var(--fade-size)),transparent)]")}function _g(e,t){return`${e}:${t}`}var KN=new Map,qN=[],cG=[],uG=[];function Ku(e){return e.choiceKey??Hu(e.instanceId,e.slug)}function VN(e,t,n){return t.environmentId!==n||t.instanceId!==e.instanceId?!1:t.sourceId&&t.profileId?t.sourceId===e.sourceId&&t.profileId===e.profileId&&t.model===e.slug:e.sourceId&&e.profileId?!1:t.model===e.slug}function fG(){return u("div",{className:"h-0.5"})}function JC(e){return e?.trim()||null}function WN({label:e}){return u("div",{className:"px-2 pt-2 pb-1 text-[10px] font-medium uppercase leading-none tracking-wide text-muted-foreground/70",children:e})}var pG=de(function({index:t,itemKey:n,action:o,showSectionHeader:r}){let{t:a}=De(),i=JC(o.description);return b(Ce,{children:[r?u(WN,{label:a("modelPicker.plugins")}):null,b(Sl,{hideIndicator:!0,index:t,value:n,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(os,{className:"size-4 shrink-0 text-muted-foreground/70"}),b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"truncate text-xs font-medium leading-snug",children:o.title}),u("div",{className:"mt-1 truncate text-xs font-normal leading-snug text-muted-foreground/70",children:i})]})]})]})}),mG=de(function({index:t,showSectionHeader:n}){let{t:o}=De();return b(Ce,{children:[n?u(WN,{label:o("modelPicker.plugins")}):null,b(Sl,{hideIndicator:!0,index:t,value:bd,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(Od,{className:"size-4 shrink-0 text-muted-foreground/70"}),u("span",{className:"min-w-0 flex-1 truncate text-left text-xs font-normal leading-snug text-muted-foreground",children:o("modelPicker.managePlugins")})]})]})}),GN=de(function(t){let{keybindings:n,modelOptionsByInstance:o,instanceEntries:r,hideInstanceRail:a=!1,getModelDisabledReason:i,getModelContinuationLabel:s,onContinueInModel:l,onInstanceModelChange:d,onChooseExecution:c,composerChoices:f,selectedExecutionSelection:p,onManagePlugins:m,onSelectPluginAction:h}=t,g=t.pluginActions??qN,v=t.selectedPluginActionKey??null,{t:x}=De(),{t:y}=De(),C=Ot(),[S,L]=G(""),[w,k]=G(!1),[I,T]=G(!1),E=D(null),A=D(null),N=D(null),R=C.environment.useActiveEnvironmentId(),$=C.settings.useClientSettings(_=>_.favorites??[]),U=z(()=>R===null?uG:$.filter(_=>_.environmentId===R),[R,$]),[H,F]=G(()=>t.lockedProvider!==null?t.activeInstanceId:U.length>0?"favorites":t.activeInstanceId),[oe,ee]=G(()=>new Set(o.get(t.activeInstanceId)?.some(_=>_.slug===t.model&&_.isLegacy)?[t.activeInstanceId]:[])),W=z(()=>n??[],[n]),Ze=C.settings.useUpdateClientSettings(),ue=B(()=>{E.current?.focus({preventScroll:!0})},[]),pe=B(_=>{F(_),window.requestAnimationFrame(()=>{ue()})},[ue]);xe(()=>{ue();let _=window.requestAnimationFrame(()=>{ue()}),Z=window.setTimeout(()=>{ue()},0);return()=>{window.cancelAnimationFrame(_),window.clearTimeout(Z)}},[ue]);let Fe=z(()=>new Set(U.map(_=>_g(_.instanceId,_.model))),[U]),Le=B(_=>R===null?!1:U.some(Z=>VN(_,Z,R)),[R,U]),ie=z(()=>new Map(r.map(_=>[_.instanceId,_])),[r]),Ie=B(_=>t.lockedProvider===null?!0:_.driverKind!==t.lockedProvider?!1:t.lockedContinuationGroupKey?_.continuationGroupKey===t.lockedContinuationGroupKey:!0,[t.lockedContinuationGroupKey,t.lockedProvider]),ve=z(()=>{let _=new Set;for(let Z of r)ku(Z)&&_.add(Z.instanceId);return _},[r]),re=z(()=>{let _=[];for(let[Z,X]of o){let ae=ie.get(Z);if(ae&&ve.has(Z))for(let fe of X)_.push({slug:fe.slug,name:fe.name,...fe.shortName?{shortName:fe.shortName}:{},...fe.subProvider?{subProvider:fe.subProvider}:{},...fe.isLegacy?{isLegacy:!0}:{},instanceId:Z,driverKind:ae.driverKind,providerId:ae.providerId,instanceDisplayName:ae.displayName,...ae.accentColor?{instanceAccentColor:ae.accentColor}:{},...ae.accountEmail?{instanceAccountEmail:ae.accountEmail}:{},...ae.continuationGroupKey?{continuationGroupKey:ae.continuationGroupKey}:{}})}if(f&&f.length>0){let Z=new Set,X=[];for(let fe of f){let ft=fe.legacyInstanceId;if(!ft||!ve.has(ft))continue;let ut=ie.get(ft);if(!ut)continue;let _t=o.get(ft)?.find(xt=>xt.slug===fe.modelId),Jt=QC({environmentId:fe.selection.environmentId,runtimeId:fe.runtimeId,sourceId:fe.sourceId,profileId:fe.profileId,endpointId:fe.endpointId});Z.add(_g(ft,fe.modelId)),X.push({slug:fe.modelId,name:_t?.name??fe.modelLabel,..._t?.shortName?{shortName:_t.shortName}:{},instanceId:ft,driverKind:ut.driverKind,providerId:ut.providerId,instanceDisplayName:ut.displayName,...ut.accentColor?{instanceAccentColor:ut.accentColor}:{},...ut.accountEmail?{instanceAccountEmail:ut.accountEmail}:{},...ut.continuationGroupKey?{continuationGroupKey:ut.continuationGroupKey}:{},runtimeId:fe.runtimeId,sourceId:fe.sourceId,sourceLabel:fe.sourceLabel,profileId:fe.profileId,ready:fe.ready,...fe.reasonCode?{reasonCode:fe.reasonCode}:{},choiceKey:Jt})}let ae=_.filter(fe=>!Z.has(_g(fe.instanceId,fe.slug)));return[...X,...ae]}return _},[f,o,ie,ve]),be=t.lockedProvider!==null,rt=S.trim().length>0,dt=z(()=>{if(!be)return;let _=new Set;for(let Z of r)Ie(Z)||_.add(Z.instanceId);return _},[r,be,Ie]),st=z(()=>{let _=r.filter(cg);if(!be)return _;let Z=[],X=[];for(let ae of _)Ie(ae)?Z.push(ae):X.push(ae);return[...Z,...X]},[r,be,Ie]),ct=!a&&!rt&&st.length>0,Zt=z(()=>r.map(_=>_.instanceId),[r]),at=z(()=>{let _=re;if(S.trim()){let Z=_.map(X=>({model:X,score:$N({name:X.name,...X.shortName?{shortName:X.shortName}:{},...X.subProvider?{subProvider:X.subProvider}:{},driverKind:X.driverKind,providerDisplayName:X.instanceDisplayName,...X.instanceAccountEmail?{providerAccountEmail:X.instanceAccountEmail}:{},isFavorite:Le(X)},S),isFavorite:Le(X),tieBreaker:YC({name:X.name,...X.shortName?{shortName:X.shortName}:{},...X.subProvider?{subProvider:X.subProvider}:{},driverKind:X.driverKind,providerDisplayName:X.instanceDisplayName,...X.instanceAccountEmail?{providerAccountEmail:X.instanceAccountEmail}:{}})})).filter(X=>X.score!==null);if(t.lockedProvider!==null){let X=[];for(let ae of Z)Ie(ae.model)&&X.push(ae);return X.toSorted((ae,fe)=>{let ft=ae.score-fe.score;return ft!==0?ft:ae.isFavorite!==fe.isFavorite?ae.isFavorite?-1:1:ae.tieBreaker.localeCompare(fe.tieBreaker)}).map(ae=>ae.model)}return Z.toSorted((X,ae)=>{let fe=X.score-ae.score;return fe!==0?fe:X.isFavorite!==ae.isFavorite?X.isFavorite?-1:1:X.tieBreaker.localeCompare(ae.tieBreaker)}).map(X=>X.model)}return t.lockedProvider!==null?(_=_.filter(Z=>Ie(Z)),H==="favorites"?_=_.filter(Z=>Le(Z)):_=_.filter(Z=>Z.instanceId===H)):H==="favorites"?_=_.filter(Z=>Le(Z)):_=_.filter(Z=>Z.instanceId===H),C.model.sortProviderModelItems(_,{favoriteModelKeys:Fe,groupFavorites:H!=="favorites",instanceOrder:H==="favorites"?Zt:[]})},[Fe,re,Zt,Ie,t.lockedProvider,S,H,Le]),_e=z(()=>{if(rt||H==="favorites")return null;let _=at.filter(X=>!X.isLegacy),Z=at.filter(X=>X.isLegacy);return Z.length===0?null:{key:jC(H),currentModels:_,legacyModels:Z,isExpanded:oe.has(H)}},[oe,at,rt,H]),He=z(()=>_e?[..._e.currentModels,..._e.isExpanded?_e.legacyModels:[]]:at,[at,_e]),qe=h!==void 0,Be=z(()=>{if(!qe)return qN;let _=S.trim();return _.length===0?g:g.map(Z=>({action:Z,score:HN(Z,_)})).filter(Z=>Z.score!==null).toSorted((Z,X)=>Z.score-X.score||Z.action.title.localeCompare(X.action.title)).map(Z=>Z.action)},[S,g,qe]),Vt=qe&&(!rt||Be.length>0),he=z(()=>Vt?[...Be.map(_=>Uu(_.id)),bd]:cG,[Vt,Be]),sn=z(()=>new Map(Be.map(_=>[Uu(_.id),_])),[Be]),Re=he[0]??null,Jn=B(_=>{ee(Z=>{let X=new Set(Z);return X.has(_)?X.delete(_):X.add(_),X})},[]),lt=B((_,Z)=>C.model.resolvePickerRowAction({disabledReason:i?.(_,Z)??null,continuationLabel:l?s?.(_,Z)??null:null}),[s,i,l]),kt=B((_,Z)=>{let X=lt(Z,_);if(X.kind==="blocked")return;if(X.kind==="continue"){l?.(Z,_);return}let ae=o.get(Z);if(!ae)return;let fe=ie.get(Z);if(!fe)return;let ft=C.model.resolveSelectableModel(fe.driverKind,_,ae);ft&&d(Z,ft)},[ie,o,l,d,lt]),Nt=B(_=>{let Z=MN(_);if(Z){Jn(Z);return}if(_===bd){m?.();return}let X=RN(_);if(X!==null){h?.(X);return}let ae=NN(_);if(ae){let ft=f?.find(ut=>ut.selection.environmentId===ae.environmentId&&ut.runtimeId===ae.runtimeId&&ut.sourceId===ae.sourceId&&ut.profileId===ae.profileId&&(ut.endpointId??void 0)===(ae.endpointId??void 0));if(!ft||!ft.legacyInstanceId)return;if(c){c(ft);return}kt(ft.modelId,ft.legacyInstanceId);return}let fe=GC(_);fe&&kt(fe.slug,fe.instanceId)},[f,kt,c,m,h,Jn]),en=B(_=>{if(R===null)return;let Z=$.findIndex(ae=>VN(_,ae,R)),X=[...$];Z>=0?X.splice(Z,1):X.push({environmentId:R,instanceId:_.instanceId,model:_.slug,..._.runtimeId?{runtimeId:_.runtimeId}:{},..._.sourceId?{sourceId:_.sourceId}:{},..._.profileId?{profileId:_.profileId}:{}}),Ze({favorites:X})},[R,$,Ze]),gn=z(()=>{let _=new Map,Z=0;for(let X of He){if(X.ready===!1||lt(X.instanceId,X.slug).kind==="blocked")continue;let ae=C.keybindings.modelPickerJumpCommandForIndex(Z);if(!ae)return _;_.set(Ku(X),ae),Z+=1}return _},[lt,He]),Pn=z(()=>[...gn.keys()],[gn]),An=z(()=>[...re.map(_=>Ku(_)),...new Set(re.filter(_=>_.isLegacy).map(_=>jC(_.instanceId))),...qe?[...g.map(_=>Uu(_.id)),bd]:[]],[re,g,qe]),hn=z(()=>{let _=He.map(Z=>Ku(Z));return _e&&_.splice(_e.currentModels.length,0,_e.key),he.length>0?[..._,...he]:_},[_e,he,He]),cn=z(()=>new Map(He.map(_=>[Ku(_),_])),[He]),Yt=B(()=>{let _=A.current?.getScrollableNode();if(!(_ instanceof HTMLElement))return;let Z=Math.max(0,_.scrollHeight-_.clientHeight);k(_.scrollTop>1),T(Z-_.scrollTop>1)},[]),Hn=z(()=>({terminalFocus:!1,terminalOpen:t.terminalOpen,modelPickerOpen:!0}),[t.terminalOpen]),io=z(()=>{if(gn.size===0)return KN;let _={platform:navigator.platform,context:Hn},Z=new Map;for(let[X,ae]of gn){let fe=C.keybindings.shortcutLabelForCommand(W,ae,_);fe&&Z.set(X,fe)}return Z.size>0?Z:KN},[W,gn,Hn]),It=v===null?p?QC(p):Hu(t.activeInstanceId,t.model):Uu(v),Eo=z(()=>({favoritesSet:Fe,modelJumpLabelByKey:io,selectedItemKey:It}),[Fe,io,It]);return C.pane.useKeydown(_=>{if(_.defaultPrevented||_.repeat)return;let Z=C.keybindings.resolveShortcutCommand(_,W,{platform:navigator.platform,context:Hn}),X=C.keybindings.modelPickerJumpIndexFromCommand(Z??"");if(X===null)return;let ae=Pn[X];if(!ae)return;let fe=GC(ae);fe&&(_.preventDefault(),_.stopPropagation(),kt(fe.slug,fe.instanceId))},{capture:!0}),xe(()=>{k(!1),T(hn.length>5);let _=0,Z=window.requestAnimationFrame(()=>{Yt(),_=window.requestAnimationFrame(Yt)});return()=>{window.cancelAnimationFrame(Z),window.cancelAnimationFrame(_)}},[hn,Yt]),u(dS,{delay:0,children:b("div",{className:"relative flex h-screen max-h-86.5 w-screen max-w-90 flex-row overflow-hidden","data-model-picker-content":"true",children:[ct&&u(BN,{selectedInstanceId:H,onSelectInstance:pe,instanceEntries:st,showFavorites:!0,...dt?{disabledInstanceIds:dt,getDisabledInstanceTooltip:_=>y("instance.lockedToThread",{name:_.displayName})}:{}}),u(aS,{inline:!0,items:An,filteredItems:hn,filter:null,autoHighlight:!0,open:!0,virtualized:!0,value:It,onItemHighlighted:(_,Z)=>{N.current=typeof _=="string"?_:null,Z.reason==="keyboard"&&Z.index>=0&&A.current?.scrollIndexIntoView?.({index:Z.index,animated:!1})},onValueChange:_=>{typeof _=="string"&&Nt(_)},children:b("div",{className:O("flex min-h-0 flex-1 flex-col overflow-hidden bg-muted/40",ct&&"border-l border-border/70"),children:[p&&t.onClearExecutionSelection?u("div",{className:"shrink-0 border-b border-border/70 px-2 py-1",children:u(ne,{size:"sm",variant:"ghost-muted",className:"w-full justify-start",onClick:t.onClearExecutionSelection,children:x("modelPicker.useExecutorAccount")})}):null,u("div",{className:"px-2 pt-2",children:u("div",{className:"border-b border-border/70 pb-2.5 transition-colors focus-within:border-ring",children:u(sS,{ref:E,className:"[&_input]:h-control-3 [&_input]:font-sans [&_input]:leading-control-3",inputClassName:"rounded-none bg-transparent text-sm",placeholder:x("modelPicker.searchPlaceholder"),showTrigger:!1,startAddon:u(as,{className:"-translate-x-0.5 size-4 shrink-0 text-muted-foreground opacity-70"}),value:S,onChange:_=>L(_.target.value),onKeyDown:_=>{if(_.key==="Escape"){_.preventDefault(),_.stopPropagation(),t.onRequestClose?.();return}if(_.key==="Enter"&&N.current){_.preventBaseUIHandler?.(),_.preventDefault(),_.stopPropagation(),Nt(N.current);return}_.stopPropagation()},onMouseDown:_=>_.stopPropagation(),onTouchStart:_=>_.stopPropagation(),size:"sm",unstyled:!0})})}),u("div",{className:"relative min-h-0 flex-1 overflow-hidden pr-px",children:u(lS,{className:"size-full min-w-0 p-0 not-empty:p-0",children:u(EN,{ref:A,data:hn,extraData:Eo,keyExtractor:_=>_,renderItem:({item:_,index:Z})=>{if(_e?.key===_)return b(Sl,{hideIndicator:!0,index:Z,value:_,"aria-expanded":_e.isExpanded,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-3",children:[b("div",{className:"min-w-0 flex-1 text-left",children:[u("div",{className:"text-xs font-medium leading-snug",children:x("modelPicker.legacyModels")}),u("div",{className:"mt-1 text-xs font-normal leading-snug text-muted-foreground/70",children:x("modelPicker.legacyModelCount",{count:_e.legacyModels.length})})]}),u(Go,{className:O("size-4 transition-transform",_e.isExpanded&&"rotate-90")})]});let X=sn.get(_);if(X)return u(pG,{index:Z,itemKey:_,action:X,showSectionHeader:_===Re});if(_===bd)return u(mG,{index:Z,showSectionHeader:_===Re});let ae=cn.get(_);if(!ae)return null;let fe=ae.ready===!1?{kind:"blocked",reason:x("modelPicker.notReady")}:lt(ae.instanceId,ae.slug);return u(_N,{index:Z,model:ae,instanceId:ae.instanceId,itemKey:Ku(ae),sourceLabel:ae.sourceLabel,providerId:ae.providerId,providerDisplayName:ae.instanceDisplayName,providerAccentColor:ae.instanceAccentColor,providerAccountEmail:ae.instanceAccountEmail,isFavorite:Le(ae),isSelected:_===It,showProvider:!0,preferShortName:!be,useTriggerLabel:!1,jumpLabel:io.get(_)??null,disabledReason:fe.kind==="blocked"?fe.reason:null,actionLabel:fe.kind==="continue"?fe.label:null,onToggleFavorite:()=>en(ae)},_)},estimatedItemSize:52,drawDistance:480,recycleItems:!0,contentContainerClassName:"pl-2 pr-px",ItemSeparatorComponent:fG,onLayout:Yt,onScroll:Yt,className:O("scrollbar-gutter-stable h-full overflow-x-hidden overscroll-y-contain py-1.5 [&::-webkit-scrollbar-track]:my-2",UN({top:w,bottom:I}))})})}),u(iS,{className:"not-empty:py-6 empty:h-0 text-xs font-normal leading-snug",children:x("modelPicker.noModelsFound")})]})})]})})});function gG(e){let t=e.profileLabel?.trim();if(t)return t;let n=e.profileModelId?.trim();if(n)return n;let o=e.catalogOptions.find(r=>r.slug===e.model);return o?Cd(o):e.model}function hG(e,t){return!e?.length||!t?null:e.find(n=>n.runtimeId===t.runtimeId&&n.sourceId===t.sourceId&&n.profileId===t.profileId&&(n.endpointId??void 0)===(t.endpointId??void 0))??null}var ZC=de(function(t){let{t:n}=De(),[o,r]=G(!1),i=ci()&&(t.open??o),s=z(()=>t.instanceEntries.find(C=>C.instanceId===t.activeInstanceId)??null,[t.activeInstanceId,t.instanceEntries]),l=t.activeInstanceId,d=t.modelOptionsByInstance.get(l)??[],c=hG(t.composerChoices,t.selectedExecutionSelection),f=gG({model:t.model,catalogOptions:d,profileLabel:c?.modelLabel,profileModelId:c?.modelId}),p=C=>{t.onOpenChange?.(C),t.open===void 0&&r(C)};K(()=>{if(!i)return;let{documentElement:C,body:S}=document,L=C.style.overscrollBehavior,w=S.style.overflow,k=S.style.paddingRight,I=window.innerWidth-C.clientWidth;C.style.overscrollBehavior="contain",S.style.overflow="hidden",I>0&&(S.style.paddingRight=`${I}px`);let T=N=>N instanceof Element&&N.closest("[data-model-picker-content]"),E=N=>{T(N.target)||N.preventDefault()},A=N=>{T(N.target)||N.preventDefault()};return document.addEventListener("wheel",E,{capture:!0,passive:!1}),document.addEventListener("touchmove",A,{capture:!0,passive:!1}),()=>{document.removeEventListener("wheel",E,{capture:!0}),document.removeEventListener("touchmove",A,{capture:!0}),C.style.overscrollBehavior=L,S.style.overflow=w,S.style.paddingRight=k}},[i]);let m=(C,S)=>{t.disabled||(t.onInstanceModelChange(C,S),p(!1))},h=(C,S)=>{t.disabled||(t.onContinueInModel?.(C,S),p(!1))},g=C=>{t.disabled||(t.onSelectPluginAction?.(C),p(!1))},v=()=>{t.onManagePlugins?.(),p(!1)},x=t.selectedPluginActionKey==null?null:t.pluginActions?.find(C=>C.id===t.selectedPluginActionKey)??null,y=x?JC(x.description):null;return b(Cl,{open:i,onOpenChange:C=>{if(t.disabled){p(!1);return}p(C)},children:[b(Il,{render:u(Po,{"aria-label":t.triggerAriaLabel,variant:t.triggerVariant??"ghost","data-chat-provider-model-picker":"true",className:O("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-42 shrink-0":"max-w-48 shrink sm:max-w-56",t.triggerClassName),disabled:t.disabled}),children:[u("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:x?b(Ce,{children:[u(os,{className:"size-4 shrink-0"}),b(Ve,{children:[b(Ge,{render:u("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 truncate"}),children:[u("span",{className:"shrink-0",children:x.title}),y?b("span",{className:"min-w-0 truncate text-muted-foreground/80",children:["\xB7 ",y]}):null]}),u(We,{side:"top",children:y?`${x.title} \xB7 ${y}`:x.title})]})]}):b(Ce,{children:[t.showInstanceOnTrigger!==!1&&s?u(Ir,{providerId:s.providerId,displayName:s.displayName,accentColor:s.accentColor,className:O("size-4",t.activeProviderIconClassName),iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,b(Ve,{children:[u(Ge,{render:u("span",{className:"min-w-0 flex-1 overflow-hidden truncate"}),children:t.sourceLabel?`${t.sourceLabel} \xB7 ${f}`:f}),u(We,{side:"top",children:t.executionAppliesTo==="next-message"?`${n("modelPicker.nextMessage")}: ${t.sourceLabel?`${t.sourceLabel} \xB7 ${f}`:f}`:t.sourceLabel?`${t.sourceLabel} \xB7 ${f}`:f})]}),t.executionAppliesTo==="next-message"?u("span",{className:"shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/80",children:n("modelPicker.nextMessage")}):null]})}),u("span",{"aria-hidden":"true",className:"flex items-center",children:u(fa,{})})]}),u(bl,{align:"start",className:"before:hidden [--viewport-inline-padding:0]",viewportClassName:"!overflow-hidden rounded-[calc(var(--radius-lg)-1px)] p-0 [clip-path:inset(0_round_calc(var(--radius-lg)-1px))]",children:u(GN,{activeInstanceId:l,model:t.model,lockedProvider:t.lockedProvider,lockedContinuationGroupKey:t.lockedContinuationGroupKey??null,instanceEntries:t.instanceEntries,...t.hideInstanceRail?{hideInstanceRail:!0}:{},...t.keybindings?{keybindings:t.keybindings}:{},modelOptionsByInstance:t.modelOptionsByInstance,terminalOpen:t.terminalOpen??!1,onRequestClose:()=>p(!1),...t.getModelDisabledReason?{getModelDisabledReason:t.getModelDisabledReason}:{},...t.getModelContinuationLabel?{getModelContinuationLabel:t.getModelContinuationLabel}:{},...t.onContinueInModel?{onContinueInModel:h}:{},onInstanceModelChange:m,...t.composerChoices?{composerChoices:t.composerChoices}:{},selectedExecutionSelection:t.selectedExecutionSelection??null,...t.onClearExecutionSelection?{onClearExecutionSelection:()=>{t.onClearExecutionSelection?.(),p(!1)}}:{},...t.onChooseExecution?{onChooseExecution:C=>{t.disabled||(t.onChooseExecution?.(C),p(!1))}}:{},...t.pluginActions?{pluginActions:t.pluginActions}:{},selectedPluginActionKey:t.selectedPluginActionKey??null,...t.onSelectPluginAction?{onSelectPluginAction:g}:{},...t.onManagePlugins?{onManagePlugins:v}:{}})})]})});function jN(e){let{slots:t,...n}=e,o=t?.renderSlot("conversation.input.model",n);return u("span",{"data-conversation-slot":"conversation.input.model",children:o??u(ZC,{...n,hideInstanceRail:!0,showInstanceOnTrigger:!1})})}function QN(e){return u(ZC,{...e,hideInstanceRail:!0,showInstanceOnTrigger:!1})}function eb(e){if(!e.showInteractionModeToggle)return null;let t=e.interactionMode==="plan",n=t?"Plan mode \u2014 click to return to normal build mode":"Default mode \u2014 click to enter plan mode";return b(Ve,{children:[b(Ge,{render:u(Po,{"data-composer-plan-toggle":"true",className:O("shrink-0 whitespace-nowrap",t?"bg-accent text-accent-foreground hover:bg-accent/90":"text-secondary-label hover:text-foreground"),type:"button",onClick:e.onToggleInteractionMode,"aria-label":n}),children:[t?u(ro,{icon:ns,className:"text-current opacity-100"}):u(ro,{icon:Pa,opticalSize:"large"}),u("span",{className:"sr-only sm:not-sr-only",children:t?"Plan":"Build"})]}),u(We,{side:"top",children:n})]})}function XN(e){return u(eb,{...e})}ge();var Id=["approval-required","auto-accept-edits","auto","full-access"];var vG={"approval-required":Yd,"auto-accept-edits":ea,auto:pi,"full-access":fi},xG={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function Sd(){let{t:e}=De();return B(t=>{let n=xG[t];return{mode:t,label:e(`runtimeMode.${n}`),description:e(`runtimeMode.${n}Description`),icon:vG[t]}},[e])}ge();function YN(e,t){let n=e?.nativeModes??[];if(n.length===0)return null;let o=n.find(r=>r.id===t)??n.find(r=>r.id===e?.currentNativeModeId);return o?{modes:n,current:o}:null}function JN(e){return e.description??e.name}var Dg=de(function(t){let{current:n,modes:o}=t.nativeMode,r=JN(n);return!t.canSwitch||o.length<2?b(Ve,{children:[b(Ge,{render:u(Po,{className:"shrink-0 cursor-default whitespace-nowrap font-medium",type:"button",disabled:!0,"data-composer-native-mode":n.id,"aria-label":`Agent mode: ${n.name}`}),children:[u(ro,{icon:ml}),u("span",{children:n.name})]}),b(We,{side:"top",children:[u("span",{className:"block font-medium",children:r}),o.length>1?b("span",{className:"mt-1 block text-muted-foreground text-xs",children:["Agent modes: ",o.map(a=>a.name).join(", ")]}):null]})]}):b(Ve,{children:[b(hl,{value:n.id,onValueChange:a=>t.onNativeModeChange(a),children:[b(Ge,{render:u(pd,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":n.id,"aria-label":`Agent mode: ${n.name}`}),children:[u(ro,{icon:ml}),u(yl,{children:n.name})]}),u(xl,{alignItemWithTrigger:!1,children:o.map(a=>u(vl,{value:a.id,hideIndicator:!0,className:"min-w-56 py-2",children:b("div",{className:"grid min-w-0 gap-0.5",children:[u("span",{className:"font-medium text-foreground",children:a.name}),a.description?u("span",{className:"text-muted-foreground text-xs leading-4",children:a.description}):null]})},a.id))})]}),u(We,{side:"top",children:r})]})});function tb(e){let{t}=De(),n=Sd();if(e.nativeMode)return u(Dg,{nativeMode:e.nativeMode,canSwitch:e.canSwitchNativeMode,onNativeModeChange:e.onNativeModeChange});let o=n(e.runtimeMode),r=o.icon;return b(Ve,{children:[b(hl,{value:e.runtimeMode,onValueChange:a=>e.onRuntimeModeChange(a),children:[b(Ge,{render:u(pd,{"data-composer-permission":"true",className:"font-medium","aria-label":"Runtime mode"}),children:[u(ro,{icon:r}),u(yl,{children:o.label})]}),u(xl,{alignItemWithTrigger:!1,children:Id.map(a=>{let i=n(a),s=i.icon;return u(vl,{value:a,hideIndicator:!0,className:"min-w-64 py-2",children:b("span",{className:"flex items-center gap-2",children:[u(s,{className:"size-4"}),i.label]})},a)})})]}),u(We,{side:"top",children:e.runtimeModeSwitch==="next-turn"?t("runtimeMode.appliesNextTurnHint"):o.label})]})}function ZN(e){return u(tb,{...e})}function qu(e){let t=e.slots?.renderSlot(e.name,e.owner??{});return u("span",{"data-conversation-slot":e.name,children:t??e.fallback})}ge();var e_=de(function(t){let{t:n}=De(),o=Sd();return b(Oo,{children:[u(Bo,{render:u(ne,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground/70 hover:text-foreground/80","aria-label":"More composer controls"}),children:u(or,{"aria-hidden":"true",className:"size-4"})}),b(Fo,{align:"start",children:[t.traitsMenuContent?b(Ce,{children:[t.traitsMenuContent,u(mi,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?b(Ce,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Mode"}),b(Sr,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[u(jo,{value:"default",children:"Chat"}),u(jo,{value:"plan",children:"Plan"})]}),u(mi,{})]}):null,t.nativeMode===null?b(Ce,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Access"}),u(Sr,{value:t.runtimeMode,onValueChange:r=>{!r||r===t.runtimeMode||t.onRuntimeModeChange(r)},children:Id.map(r=>u(jo,{value:r,children:o(r).label},r))}),t.runtimeModeSwitch==="next-turn"?u("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]}):b(Ce,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Access"}),t.canSwitchNativeMode&&t.nativeMode.modes.length>1?u(Sr,{value:t.nativeMode.current.id,onValueChange:r=>{t.onNativeModeChange(String(r))},children:t.nativeMode.modes.map(r=>u(jo,{value:r.id,children:r.name},r.id))}):u("div",{className:"px-2 pb-1.5 text-foreground text-sm","data-composer-native-mode":t.nativeMode.current.id,children:t.nativeMode.current.name})]})]})]})});ge();var t_=de(function(t){let n=D(null);return xe(()=>{if(!t.activeItemId||!n.current)return;n.current.querySelector(`[data-composer-item-id="${CSS.escape(t.activeItemId)}"]`)?.scrollIntoView({block:"nearest"})},[t.activeItemId]),u(Bf,{autoHighlight:!1,mode:"none",onItemHighlighted:o=>{t.onHighlightedItemChange(typeof o=="string"?o:null)},children:u("div",{ref:n,className:"chat-composer-drawer-surface chat-composer-drawer-attached relative w-full overflow-hidden **:data-[slot=scroll-area-scrollbar]:data-[orientation=vertical]:my-4","data-composer-command-drawer":"true",children:t.items.length>0?u(Hf,{className:"max-h-72 scroll-pb-6",children:u(zf,{children:t.items.map(o=>u(yG,{item:o,triggerKind:t.triggerKind,resolvedTheme:t.resolvedTheme,isActive:t.activeItemId===o.id,onHighlight:t.onHighlightedItemChange,onSelect:t.onSelect},o.id))})}):u("div",{className:"px-5 pt-3.5 pb-7",children:u("p",{className:"text-secondary-label text-xs",children:t.isLoading?t.triggerKind==="skill"?"Searching workspace skills...":"Searching workspace files...":t.emptyStateText??(t.triggerKind==="skill"?"No skills found. Try / to browse provider commands.":t.triggerKind==="path"?"No matching files or folders.":"No matching command.")})})})})}),yG=de(function(t){let n=t.item.type==="skill"?LM(t.item.skill):null,o=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return b($f,{value:t.item.id,"data-composer-item-id":t.item.id,className:O("cursor-pointer select-none gap-3 rounded-lg px-3 py-2! hover:bg-transparent hover:text-inherit data-highlighted:bg-transparent data-highlighted:text-inherit",t.isActive&&"bg-accent! text-accent-foreground!"),onMouseMove:()=>{t.isActive||t.onHighlight(t.item.id)},onMouseDown:r=>{r.preventDefault()},onClick:()=>{t.onSelect(t.item)},children:[t.item.type==="path"?u(eg,{pathValue:t.item.path,kind:t.item.pathKind,theme:t.resolvedTheme}):null,b("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[u("span",{className:"min-w-0 max-w-[45%] shrink-0 truncate font-sans text-xs font-medium",children:o?b(Ce,{children:[u("span",{className:"text-secondary-label",children:"/skill:"}),ua(o)]}):t.item.label}),u("span",{className:"min-w-0 max-w-[48ch] flex-1 truncate text-left text-secondary-label text-xs",children:t.item.description}),n?u(IG,{kind:n,showSkillSuffix:t.triggerKind==="skill"}):null]})]})}),CG={app:Bd,repo:ui,project:ui,personal:ta,system:nc,other:Zd},bG={app:"App",repo:"Repo",project:"Project",personal:"Personal",system:"System",other:"Provider"};function IG(e){let t=CG[e.kind];return b(gl,{className:"ms-auto",variant:"secondary",children:[u(t,{"aria-hidden":"true",className:"text-current"}),bG[e.kind],e.showSkillSuffix?" Skill":null]})}ge();var SG=(e,t)=>t.isResponding?e("primaryActions.submitting"):t.compact?t.isLastQuestion?e("primaryActions.submit"):e("primaryActions.next"):t.isLastQuestion?t.questionIndex>0?e("primaryActions.submitAnswers"):e("primaryActions.submitAnswer"):e("primaryActions.nextQuestion"),wG=e=>{e.preventDefault()},Vu=de(function({compact:t,pendingAction:n,isRunning:o,showPlanFollowUpPrompt:r,promptHasText:a,isSendBusy:i,sendDisabledReason:s,isConnecting:l,isEnvironmentUnavailable:d,isPreparingWorktree:c,hasSendableContent:f,preserveComposerFocusOnPointerDown:p=!1,showSendWhileRunning:m=!1,onPreviousPendingQuestion:h,onInterrupt:g,onImplementPlanInNewThread:v}){let{t:x}=De(),y=Ot(),C=p?{onPointerDown:wG}:void 0,S=y.settings.useEnvironmentIdentificationMode(),L=s!==null,w=y.devBackdrop.useVisible(S==="artwork"),k=T=>u("button",{type:"button",className:O("flex cursor-pointer items-center justify-center rounded-full bg-destructive/90 text-white shadow-xs shadow-destructive/24 inset-shadow-[0_1px_--theme(--color-white/16%)] transition-[background-color,scale] duration-(--control-duration) hover:bg-destructive hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none",T?"size-8 sm:size-7":m&&f?"size-9 sm:size-8":"size-8 sm:h-8 sm:w-8"),...C,onClick:g,"aria-label":x("primaryActions.stopGeneration"),children:u("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":"true",children:u("rect",{x:"2",y:"2",width:"8",height:"8",rx:"1.5"})})});if(n)return b("div",{className:O("flex items-center justify-end",t?"gap-1.5":"gap-2"),children:[o?k(!0):null,n.questionIndex>0?t?u(ne,{size:"icon-sm",variant:"outline",className:"rounded-full",...C,onClick:h,disabled:n.isResponding,"aria-label":x("primaryActions.previousQuestion"),children:u(Gi,{})}):u(ne,{size:"sm",variant:"outline",className:"rounded-full",...C,onClick:h,disabled:n.isResponding,children:x("primaryActions.previous")}):null,u(ne,{type:"submit",size:"sm",className:O("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"px-3":"px-4"),...C,disabled:d||n.isResponding||(n.isLastQuestion?!n.isComplete:!n.canAdvance),children:SG(x,{compact:t,isLastQuestion:n.isLastQuestion,isResponding:n.isResponding,questionIndex:n.questionIndex})})]});if(r)return a?u(ne,{type:"submit",size:"sm",className:O("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"h-9 px-3 sm:h-8":"h-9 px-4 sm:h-8"),...C,disabled:i||L||l||d,children:x(l||i?"primaryActions.sendingButtonLabel":"primaryActions.refine")}):b("div",{"data-chat-composer-implement-actions":"true",className:"flex items-center justify-end",children:[u(ne,{type:"submit",size:"sm",className:"h-9 rounded-l-full rounded-r-none bg-message-action px-4 text-message-action-foreground hover:bg-message-action-hover sm:h-8",...C,disabled:i||L||l||d,children:x(l||i?"primaryActions.sendingButtonLabel":"primaryActions.implement")}),b(Oo,{children:[u(Bo,{render:u(ne,{size:"sm",variant:"default",className:"h-9 rounded-l-none rounded-r-full border-l-message-action-foreground/20 bg-message-action px-2 text-message-action-foreground hover:bg-message-action-hover sm:h-8","aria-label":x("primaryActions.implementationActions"),...C,disabled:i||L||l||d}),children:u(dn,{})}),u(Fo,{align:"end",side:"top",children:u(rr,{disabled:i||L||l||d,onClick:()=>{v()},children:x("primaryActions.implementInNewThread")})})]})]});let I=b("button",{type:"submit",className:O("relative isolate flex h-9 w-9 items-center justify-center overflow-hidden rounded-full shadow-xs transition-[background-color,filter,opacity,scale] duration-(--control-duration) enabled:cursor-pointer enabled:inset-shadow-[0_1px_--theme(--color-white/16%)] hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none disabled:pointer-events-none disabled:opacity-64 disabled:shadow-none disabled:hover:scale-100 sm:h-8 sm:w-8",w?"bg-transparent text-white enabled:shadow-black/24 enabled:hover:brightness-110":"bg-message-action text-message-action-foreground enabled:shadow-message-action/24 hover:bg-message-action-hover"),...C,disabled:i||L||l||d||!f,"aria-label":d?x("primaryActions.environmentDisconnected"):s||x(l?"primaryActions.connecting":c?"primaryActions.preparingWorktree":i?"primaryActions.sendingAriaLabel":"primaryActions.sendMessage"),children:[w?u("span",{className:"absolute inset-0 -z-10","aria-hidden":"true",children:u(uS,{compact:!0})}):null,l||i?u(Pf,{className:"size-3.5","aria-hidden":"true"}):u("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:u("path",{d:"M7 11.5V2.5M7 2.5L3 6.5M7 2.5L11 6.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})]});return o?b(Ce,{children:[k(!1),m&&f?I:null]}):I});function n_(e){let t=e.activePendingProgress?.activeQuestion?.multiSelect??!1;return u("div",{className:"px-3 pb-3 sm:px-4",children:b("div",{"data-chat-composer-mobile-pending-compact":"true",className:O("flex min-w-0 items-center gap-2 rounded-lg border border-border/55 bg-background/55 p-1.5 pl-3 transition-colors hover:bg-background/90",!t&&"p-0"),children:[e.isPendingUserInputChoiceOnly?null:u("button",{type:"button",className:O("min-w-0 flex-1 truncate bg-transparent py-1.5 text-left text-sm",e.activePendingProgress?.customAnswer?"text-foreground":"text-placeholder",!t&&"px-3 py-2"),onPointerDown:n=>n.preventDefault(),onClick:e.expandMobileComposer,"aria-label":"Write custom answer",children:e.activePendingProgress?.customAnswer||"Write custom answer"}),e.inlineTasksBadge,e.inlineStashBadge,t?u(Vu,{compact:!0,pendingAction:e.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:e.isSendBusy,sendDisabledReason:e.sendDisabledReason,isConnecting:e.isConnecting,isEnvironmentUnavailable:e.isEnvironmentUnavailable,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:e.onPreviousActivePendingUserInputQuestion,onInterrupt:e.handleInterruptPrimaryAction,onImplementPlanInNewThread:e.handleImplementPlanInNewThreadPrimaryAction}):null]})})}function o_(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}ge();function TG(e){return e!==null&&"tagName"in e&&"closest"in e}function Og(e){return TG(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function nb(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function r_(e,t){let n=e.findIndex(o=>o.decision===t);return n===-1?null:{type:"respond",index:n}}function a_(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return r_(t,"accept");case"Escape":return r_(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let n=nb(e.key,t.length);return n===null?null:{type:"respond",index:n}}}}var kG=2e3,LG="min-h-8 max-w-full py-1.5 font-normal whitespace-normal text-start",PG=[{decision:"cancel",label:"Cancel"},{decision:"decline",label:"Decline"},{decision:"acceptForSession",label:"Always allow this session"},{decision:"accept",label:"Approve"}];function AG(e,t){let n=[];return t<9&&n.push(String(t+1)),e==="accept"&&n.push("Enter"),e==="cancel"&&n.push("Escape"),n.length>0?n.join(" "):void 0}var i_=de(function({requestId:t,isResponding:n,options:o=PG,keybindings:r,declineReasonRelay:a,onRespondToApproval:i}){let{t:s}=De(),l=Ot(),d=a==="native"||a==="queued",[c,f]=G(""),p=D([]);K(()=>{f("")},[t]);let m=B(g=>{let v=g==="decline"?c.trim():"";i(t,g,v.length>0?v:void 0)},[c,i,t]),h=B(g=>{let v=p.current.filter(C=>C!==null);if(v.length===0)return;let x=v.findIndex(C=>C===document.activeElement),y=x===-1?g===1?0:v.length-1:(x+g+v.length)%v.length;v[y]?.focus()},[]);return l.pane.useKeydown(g=>{if(n||l.terminalFocus.getOwner()!==null||g.isComposing||g.keyCode===229)return;let v=Og(g.target);if(r&&(!v||g.metaKey||g.ctrlKey||g.altKey)){let C=l.keybindings.approvalDecisionFromCommand(l.keybindings.resolveShortcutCommand(g,r));if(C!==null&&o.some(S=>S.decision===C)){g.preventDefault(),m(C);return}}if(v)return;let x=a_(g,o);if(x===null)return;if(g.preventDefault(),x.type==="move"){h(x.delta);return}let y=o[x.index];y&&m(y.decision)},{target:"document"}),u(Ce,{children:o.map((g,v)=>{let x=v<9?v+1:null,y=b(ne,{ref:C=>{p.current[v]=C},size:"xs",variant:g.decision==="accept"?"default":"outline",style:{height:"auto"},"aria-keyshortcuts":AG(g.decision,v),className:`${LG}${g.decision==="decline"?" text-destructive-foreground [:hover,[data-pressed]]:text-destructive-foreground":""}`,disabled:n,onClick:()=>m(g.decision),children:[u("span",{className:"min-w-0 break-words",children:g.label}),x===null?null:u(Ff,{className:"h-3.5 min-w-3.5 rounded-[3px] bg-transparent px-0 text-[10px] tabular-nums opacity-70",children:x})]},g.decision);return g.decision!=="decline"||!d?y:b(ii,{children:[u(kf,{type:"text",value:c,disabled:n,maxLength:kG,placeholder:s(a==="queued"?"approval.declineReasonQueuedPlaceholder":"approval.declineReasonPlaceholder"),"aria-label":s("approval.declineReasonLabel"),"data-approval-decline-reason":"true",className:"h-8 min-w-24 max-w-56 flex-1",onChange:C=>f(C.target.value),onKeyDown:C=>{if(C.key==="Enter"){C.preventDefault(),m("decline");return}C.key==="Escape"&&(C.preventDefault(),c.length>0?f(""):C.currentTarget.blur())}}),y]},g.decision)})})});ge();var EG=["command","cmd"],MG=["file_path","filePath","path","notebook_path","notebookPath"],RG=["url"],NG=["query","q"],_G=["name","skill","skill_name","skillName"],s_=["toolName","tool_name"],l_=["description"],DG=[],OG=[];function Ja(e,t,n){for(let o of t){let a=e.find(i=>i.name===o)?.value.trim();if(!(a===void 0||a.length===0))return n.add(o),a}return null}function FG(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t>=0?e.slice(t+1):e;return n.length>0?n:e}function BG(e){let t=e[0];return t===void 0?null:e.every(n=>n.path===t.path)?t.path:null}function c_(e){let t=e.args??DG,n=e.fileChanges??OG,o=new Set,r=e.detail?.trim()??"",a=r.length>0?{shape:"text",text:r}:{shape:"none"},i=null,s=a,l=null;switch(e.requestKind){case"command":{let d=Ja(t,EG,o);d!==null&&(s={shape:"command",command:d});break}case"file-read":case"file-change":{let d=Ja(t,MG,o)??BG(n);d!==null&&(i=FG(d),s=n.some(c=>c.path===d)?{shape:"none"}:{shape:"path",path:d});break}case"web-fetch":{let d=Ja(t,RG,o);d!==null&&(s={shape:"url",url:d});break}case"web-search":{let d=Ja(t,NG,o);d!==null&&(s={shape:"query",query:d});break}case"skill":{i=Ja(t,_G,o)??Ja(t,s_,o),l=Ja(t,l_,o),t.length>0&&(s={shape:"none"});break}case"mcp-tool":case"tool":{i=Ja(t,s_,o),l=Ja(t,l_,o),t.length>0&&(s={shape:"none"});break}case"mcp-elicitation":{i=e.appName?.trim()||null;break}}return{kind:e.requestKind,subject:i,body:s,description:l,args:t.filter(d=>!o.has(d.name)),fileChanges:n}}var zG={"file-read":"approval.title.fileRead","file-change":"approval.title.fileChange",skill:"approval.title.skill","mcp-tool":"approval.title.tool",tool:"approval.title.tool","mcp-elicitation":"approval.title.appAccess"},$G={command:"approval.title.command","file-read":"approval.title.fileReadGeneric","file-change":"approval.title.fileChangeGeneric","web-fetch":"approval.title.webFetch","web-search":"approval.title.webSearch",skill:"approval.title.skillGeneric","mcp-tool":"approval.title.toolGeneric",tool:"approval.title.toolGeneric","mcp-elicitation":"approval.title.appAccessGeneric"},HG={command:"approval.commandLabel","file-read":"approval.fileReadLabel","file-change":"approval.fileChangeLabel","web-fetch":"approval.webFetchLabel","web-search":"approval.webSearchLabel",skill:"approval.skillLabel","mcp-tool":"approval.mcpToolLabel",tool:"approval.toolLabel","mcp-elicitation":"approval.appAccessLabel"},UG={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function u_(e,t){let n=e.subject!==null?zG[e.kind]:void 0;return n!==void 0?t(n,{name:e.subject}):t($G[e.kind])}function f_(e,t){return t(HG[e])}function p_(e,t){return t(UG[e])}function m_(e){let t=e.content;if(t===void 0)return null;if(t.kind==="unified")return t.diff.length>0?t.diff:null;let n=d_(t.oldText??""),o=d_(t.newText);if(n.length===0&&o.length===0)return null;let r=`--- a/${e.path}
3716
3719
  +++ b/${e.path}
3717
3720
  `,a=`@@ -${n.length===0?"0,0":`1,${n.length}`} +${o.length===0?"0,0":`1,${o.length}`} @@
3718
3721
  `,i=[...n.map(s=>`-${s}`),...o.map(s=>`+${s}`)];return`${r}${a}${i.join(`
3719
3722
  `)}
3720
- `}function jN(e){if(e.length===0)return[];let t=e.split(`
3721
- `);return t.at(-1)===""?t.slice(0,-1):t}function e_(e){let t=new Map;return e.map(n=>{let o=t.get(n.path)??0;return t.set(n.path,o+1),o===0?n.path:`${n.path}#${o}`})}function t_(e){return{additions:e.additions??0,deletions:e.deletions??0}}me();me();var Yde=(()=>{try{return!1}catch{return!1}})(),n_=/(?=^From [a-f0-9]+ .+$)/m,jC=/(?=^diff --git)/gm;var o_=/^(---|\+\+\+)\s+([^\t\r\n]+)/,r_=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,a_=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,i_=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;var EG={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Jde={...EG,hunkLineCount:1};var Zde=Object.freeze({fromStart:0,fromEnd:0});function QC(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var MG=new TextEncoder,RG=new TextDecoder("utf-8",{ignoreBOM:!0}),NG=/[\uD800-\uDFFF]/,XC=1024,pd=new Uint8Array(XC);function s_(){pd.length!==XC&&(pd=new Uint8Array(XC))}function Rn(e){if(e.length===0)return e;if(NG.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;pd.length<t&&(pd=new Uint8Array(t));let{written:n}=MG.encodeInto(e,pd);return RG.decode(pd.subarray(0,n))}function d_(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let o=t.hunkContent[n];if(o.type!=="change")continue;let r=DG(e,o);r!=null&&(t.hunkContent.splice(n,1,...r),n+=r.length-1)}_G(t,e)}}function _G(e,t){let{hunkContent:n}=e;for(let o=1;o<n.length;o++){let r=n[o],a=n[o-1];if(r.type!=="change"||r.additions>0&&r.deletions>0||a.type!=="context")continue;let i=r.additions>0,s=i?t.additionLines:t.deletionLines,l=i?r.additionLineIndex:r.deletionLineIndex,d=i?r.additions:r.deletions,c=s[l]??"";if(c.trim()!=="")continue;let f=!0;for(let v=1;v<d;v++)if(s[l+v]!==c){f=!1;break}if(!f)continue;let p=0;for(;p<a.lines&&t.additionLines[a.additionLineIndex+a.lines-1-p]===c;)p++;if(p===0)continue;r.additionLineIndex-=p,r.deletionLineIndex-=p;let m=r.additionLineIndex+r.additions,h=r.deletionLineIndex+r.deletions,g=n[o+1];g?.type==="context"?(g.lines+=p,g.additionLineIndex=m,g.deletionLineIndex=h):n.splice(o+1,0,{type:"context",lines:p,additionLineIndex:m,deletionLineIndex:h}),a.lines-=p,a.lines===0&&(n.splice(o-1,1),o--)}}function DG(e,t){let{deletions:n,additions:o,deletionLineIndex:r,additionLineIndex:a}=t,i=Math.min(n,o),s=Math.abs(o-n);if(i===0||s===0||i*(s+1)>4096)return null;let l=[];for(let g=0;g<n;g++)l.push(l_(e.deletionLines[r+g]??""));let d=[];for(let g=0;g<o;g++)d.push(l_(e.additionLines[a+g]??""));let c=o>n,f=0,p=-1;for(let g=0;g<=s;g++){let v=0;for(let x=0;x<i;x++)v+=FG(l[x+(c?0:g)],d[x+(c?g:0)]);g===0?p=v+i*.5:v>p&&(p=v,f=g)}if(f===0)return null;let m=[],h=(g,v,x,y)=>{(g>0||v>0)&&m.push({type:"change",deletions:g,additions:v,deletionLineIndex:x,additionLineIndex:y})};return c?(h(0,f,r,a),h(i,i,r,a+f),h(0,o-i-f,r+i,a+f+i)):(h(f,0,r,a),h(i,i,r+f,a),h(n-i-f,0,r+f+i,a+i)),m}var OG=/\s+/g;function l_(e){return e.replace(OG,"")}function FG(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),o=Math.min(e.length,t.length);if(o===0)return 0;let r=0;for(;r<o&&e[r]===t[r];)r++;let a=0;for(;a<o-r&&e[e.length-1-a]===t[t.length-1-a];)a++;return(r+a)/n}function BG(e,t,n){try{return zG(e,t,n)}finally{s_()}}function zG(e,t,n=!1){let o=jG(e),r=o?UG(e):KG(e),a,i=[];for(let s of r){if(o&&!jC.test(s)){if(a==null)a=Rn(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}else if(!o&&!qG(s)){if(a==null)a=Rn(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}let l=$G(s,{cacheKey:t!=null?`${t}-${i.length}`:void 0,isGitDiff:o,throwOnError:n});l!=null&&i.push(l)}return{patchMetadata:a,files:i}}function $G(e,{cacheKey:t,isGitDiff:n=jC.test(e),oldFile:o,newFile:r,throwOnError:a=!1}={}){let i=0,s=x_(e,"@@ "),l,d=o==null||r==null,c=0,f=0;for(let p of s){let m=g_(p),h=m[0];if(h==null){if(a)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",p);continue}let g=v_(h),v=0,x=0;if(g==null||l==null){if(l!=null){if(a)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",p);continue}l={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:d,additionLines:!d&&o!=null&&r!=null?c_(r.contents):[],deletionLines:!d&&o!=null&&r!=null?c_(o.contents):[],cacheKey:p_(t)},l.additionLines.length===1&&r?.contents===""&&(l.additionLines.length=0),l.deletionLines.length===1&&o?.contents===""&&(l.deletionLines.length=0);for(let T of m){if(T.startsWith("diff --git")){let A=T.trim().match(a_),N=A?.[1]??A?.[2],R=A?.[3]??A?.[4];if(N==null||R==null){if(a)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",T);continue}l.name=Rn(R.trim()),N!==R&&(l.prevName=Rn(N.trim()));continue}let E=T.startsWith("---")||T.startsWith("+++")?T.match(n?r_:o_):null;if(E!=null){let[,A,N]=E;if(A==="---"&&N!=="/dev/null"){let R=Rn(N.trim());l.prevName=R,l.name=R}else A==="+++"&&N!=="/dev/null"&&(l.name=Rn(N.trim()))}else if(n){if(T.startsWith("new mode ")&&(l.mode=Rn(T.slice(8).trim())),T.startsWith("old mode ")&&(l.prevMode=Rn(T.slice(8).trim())),T.startsWith("new file mode")&&(l.type="new",l.mode=Rn(T.slice(13).trim())),T.startsWith("deleted file mode")&&(l.type="deleted",l.mode=Rn(T.slice(17).trim())),T.startsWith("similarity index")&&(T.startsWith("similarity index 100%")?l.type="rename-pure":l.type="rename-changed"),T.startsWith("index ")){let[,A,N,R]=T.trim().match(i_)??[];A!=null&&(l.prevObjectId=Rn(A)),N!=null&&(l.newObjectId=Rn(N)),R!=null&&(l.mode=Rn(R))}T.startsWith("rename from ")&&(l.prevName=Rn(T.slice(12).trim())),T.startsWith("rename to ")&&(l.name=Rn(T.slice(10).trim()))}}continue}let y,C;for(;m.length>0&&(m[m.length-1]===`
3723
+ `}function d_(e){if(e.length===0)return[];let t=e.split(`
3724
+ `);return t.at(-1)===""?t.slice(0,-1):t}function g_(e){let t=new Map;return e.map(n=>{let o=t.get(n.path)??0;return t.set(n.path,o+1),o===0?n.path:`${n.path}#${o}`})}function h_(e){return{additions:e.additions??0,deletions:e.deletions??0}}ge();ge();var Yce=(()=>{try{return!1}catch{return!1}})(),v_=/(?=^From [a-f0-9]+ .+$)/m,ob=/(?=^diff --git)/gm;var x_=/^(---|\+\+\+)\s+([^\t\r\n]+)/,y_=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,C_=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,b_=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i;var KG={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},Jce={...KG,hunkLineCount:1};var Zce=Object.freeze({fromStart:0,fromEnd:0});function rb(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var qG=new TextEncoder,VG=new TextDecoder("utf-8",{ignoreBOM:!0}),WG=/[\uD800-\uDFFF]/,ab=1024,wd=new Uint8Array(ab);function I_(){wd.length!==ab&&(wd=new Uint8Array(ab))}function _n(e){if(e.length===0)return e;if(WG.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;wd.length<t&&(wd=new Uint8Array(t));let{written:n}=qG.encodeInto(e,wd);return VG.decode(wd.subarray(0,n))}function w_(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let o=t.hunkContent[n];if(o.type!=="change")continue;let r=jG(e,o);r!=null&&(t.hunkContent.splice(n,1,...r),n+=r.length-1)}GG(t,e)}}function GG(e,t){let{hunkContent:n}=e;for(let o=1;o<n.length;o++){let r=n[o],a=n[o-1];if(r.type!=="change"||r.additions>0&&r.deletions>0||a.type!=="context")continue;let i=r.additions>0,s=i?t.additionLines:t.deletionLines,l=i?r.additionLineIndex:r.deletionLineIndex,d=i?r.additions:r.deletions,c=s[l]??"";if(c.trim()!=="")continue;let f=!0;for(let v=1;v<d;v++)if(s[l+v]!==c){f=!1;break}if(!f)continue;let p=0;for(;p<a.lines&&t.additionLines[a.additionLineIndex+a.lines-1-p]===c;)p++;if(p===0)continue;r.additionLineIndex-=p,r.deletionLineIndex-=p;let m=r.additionLineIndex+r.additions,h=r.deletionLineIndex+r.deletions,g=n[o+1];g?.type==="context"?(g.lines+=p,g.additionLineIndex=m,g.deletionLineIndex=h):n.splice(o+1,0,{type:"context",lines:p,additionLineIndex:m,deletionLineIndex:h}),a.lines-=p,a.lines===0&&(n.splice(o-1,1),o--)}}function jG(e,t){let{deletions:n,additions:o,deletionLineIndex:r,additionLineIndex:a}=t,i=Math.min(n,o),s=Math.abs(o-n);if(i===0||s===0||i*(s+1)>4096)return null;let l=[];for(let g=0;g<n;g++)l.push(S_(e.deletionLines[r+g]??""));let d=[];for(let g=0;g<o;g++)d.push(S_(e.additionLines[a+g]??""));let c=o>n,f=0,p=-1;for(let g=0;g<=s;g++){let v=0;for(let x=0;x<i;x++)v+=XG(l[x+(c?0:g)],d[x+(c?g:0)]);g===0?p=v+i*.5:v>p&&(p=v,f=g)}if(f===0)return null;let m=[],h=(g,v,x,y)=>{(g>0||v>0)&&m.push({type:"change",deletions:g,additions:v,deletionLineIndex:x,additionLineIndex:y})};return c?(h(0,f,r,a),h(i,i,r,a+f),h(0,o-i-f,r+i,a+f+i)):(h(f,0,r,a),h(i,i,r+f,a),h(n-i-f,0,r+f+i,a+i)),m}var QG=/\s+/g;function S_(e){return e.replace(QG,"")}function XG(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),o=Math.min(e.length,t.length);if(o===0)return 0;let r=0;for(;r<o&&e[r]===t[r];)r++;let a=0;for(;a<o-r&&e[e.length-1-a]===t[t.length-1-a];)a++;return(r+a)/n}function YG(e,t,n){try{return JG(e,t,n)}finally{I_()}}function JG(e,t,n=!1){let o=s6(e),r=o?t6(e):n6(e),a,i=[];for(let s of r){if(o&&!ob.test(s)){if(a==null)a=_n(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}else if(!o&&!o6(s)){if(a==null)a=_n(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}let l=ZG(s,{cacheKey:t!=null?`${t}-${i.length}`:void 0,isGitDiff:o,throwOnError:n});l!=null&&i.push(l)}return{patchMetadata:a,files:i}}function ZG(e,{cacheKey:t,isGitDiff:n=ob.test(e),oldFile:o,newFile:r,throwOnError:a=!1}={}){let i=0,s=N_(e,"@@ "),l,d=o==null||r==null,c=0,f=0;for(let p of s){let m=E_(p),h=m[0];if(h==null){if(a)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",p);continue}let g=R_(h),v=0,x=0;if(g==null||l==null){if(l!=null){if(a)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",p);continue}l={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:d,additionLines:!d&&o!=null&&r!=null?T_(r.contents):[],deletionLines:!d&&o!=null&&r!=null?T_(o.contents):[],cacheKey:P_(t)},l.additionLines.length===1&&r?.contents===""&&(l.additionLines.length=0),l.deletionLines.length===1&&o?.contents===""&&(l.deletionLines.length=0);for(let T of m){if(T.startsWith("diff --git")){let A=T.trim().match(C_),N=A?.[1]??A?.[2],R=A?.[3]??A?.[4];if(N==null||R==null){if(a)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",T);continue}l.name=_n(R.trim()),N!==R&&(l.prevName=_n(N.trim()));continue}let E=T.startsWith("---")||T.startsWith("+++")?T.match(n?y_:x_):null;if(E!=null){let[,A,N]=E;if(A==="---"&&N!=="/dev/null"){let R=_n(N.trim());l.prevName=R,l.name=R}else A==="+++"&&N!=="/dev/null"&&(l.name=_n(N.trim()))}else if(n){if(T.startsWith("new mode ")&&(l.mode=_n(T.slice(8).trim())),T.startsWith("old mode ")&&(l.prevMode=_n(T.slice(8).trim())),T.startsWith("new file mode")&&(l.type="new",l.mode=_n(T.slice(13).trim())),T.startsWith("deleted file mode")&&(l.type="deleted",l.mode=_n(T.slice(17).trim())),T.startsWith("similarity index")&&(T.startsWith("similarity index 100%")?l.type="rename-pure":l.type="rename-changed"),T.startsWith("index ")){let[,A,N,R]=T.trim().match(b_)??[];A!=null&&(l.prevObjectId=_n(A)),N!=null&&(l.newObjectId=_n(N)),R!=null&&(l.mode=_n(R))}T.startsWith("rename from ")&&(l.prevName=_n(T.slice(12).trim())),T.startsWith("rename to ")&&(l.name=_n(T.slice(10).trim()))}}continue}let y,C;for(;m.length>0&&(m[m.length-1]===`
3722
3725
  `||m[m.length-1]==="\r"||m[m.length-1]===`\r
3723
- `||m[m.length-1]==="");)m.pop();let{additionStart:w,deletionStart:k}=g;c=d?c:k-1,f=d?f:w-1;let S={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:g.additionCount,additionStart:w,additionLines:v,deletionCount:g.deletionCount,deletionStart:k,deletionLines:x,deletionLineIndex:c,additionLineIndex:f,hunkContent:[],hunkContext:p_(g.hunkContext),hunkSpecs:Rn(h),noEOFCRAdditions:!1,noEOFCRDeletions:!1},L=0,I=0;for(let T=1;T<m.length;T++){let E=m[T];if(L>=S.additionCount&&I>=S.deletionCount&&!E.startsWith("\\")){if(a&&VG(E)&&!WG(E))throw Error("parsePatchContent: hunk has more lines than expected");break}let A=E[0];if(A!=="+"&&A!=="-"&&A!==" "&&A!=="\\"){if(a)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${A}", full line: "${E}"`),console.error("processFile: invalid rawLine:",E);continue}let N=QG(A);if(N==="addition"){if(a&&L>=S.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let R=YC(E);(y==null||y.type!=="change")&&(y=JC("change",c,f),S.hunkContent.push(y)),f++,L++,d&&l.additionLines.push(R),y.additions++,v++,C="addition"}else if(N==="deletion"){if(a&&I>=S.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");let R=YC(E);(y==null||y.type!=="change")&&(y=JC("change",c,f),S.hunkContent.push(y)),c++,I++,d&&l.deletionLines.push(R),y.deletions++,x++,C="deletion"}else if(N==="context"){if(a&&(I>=S.deletionCount||L>=S.additionCount))throw Error("parsePatchContent: hunk has too many context lines");let R=YC(E);(y==null||y.type!=="context")&&(y=JC("context",c,f),S.hunkContent.push(y)),f++,c++,L++,I++,d&&(l.deletionLines.push(R),l.additionLines.push(R)),y.lines++,C="context"}else if(N==="metadata"&&y!=null){if(y.type==="context"?(S.noEOFCRAdditions=!0,S.noEOFCRDeletions=!0):C==="deletion"?S.noEOFCRDeletions=!0:C==="addition"&&(S.noEOFCRAdditions=!0),d&&(C==="addition"||C==="context")){let R=l.additionLines.length-1;R>=0&&(l.additionLines[R]=QC(l.additionLines[R]))}if(d&&(C==="deletion"||C==="context")){let R=l.deletionLines.length-1;R>=0&&(l.deletionLines[R]=QC(l.deletionLines[R]))}}}if(a&&(L!==S.additionCount||I!==S.deletionCount))throw Error("parsePatchContent: hunk line count mismatch");S.additionLines=v,S.deletionLines=x,S.collapsedBefore=Math.max(S.additionStart-1-i,0),l.hunks.push(S),i=S.additionStart+S.additionCount-1;for(let T of S.hunkContent)T.type==="context"?(S.splitLineCount+=T.lines,S.unifiedLineCount+=T.lines):(S.splitLineCount+=Math.max(T.additions,T.deletions),S.unifiedLineCount+=T.deletions+T.additions);S.splitLineStart=l.splitLineCount+S.collapsedBefore,S.unifiedLineStart=l.unifiedLineCount+S.collapsedBefore,l.splitLineCount+=S.collapsedBefore+S.splitLineCount,l.unifiedLineCount+=S.collapsedBefore+S.unifiedLineCount}if(l!=null){if(a&&d&&!n&&l.hunks.length===0)throw Error("parsePatchContent: unified file has no hunks");if(l.hunks.length>0&&!d&&l.additionLines.length>0&&l.deletionLines.length>0){let p=l.hunks[l.hunks.length-1],m=p.additionStart+p.additionCount-1,h=l.additionLines.length,g=Math.max(h-m,0);l.splitLineCount+=g,l.unifiedLineCount+=g}return n||(l.prevName!=null&&l.name!==l.prevName?l.hunks.length>0?l.type="rename-changed":l.type="rename-pure":(o==null||o.contents==="")&&r!=null&&r.contents!==""?l.type="new":o!=null&&o.contents!==""&&(r==null||r.contents==="")&&(l.type="deleted")),l.type!=="rename-pure"&&l.type!=="rename-changed"&&(l.prevName=void 0),d_(l),l}}function m_(e,t,n=!1){let o=[],r=HG(e)?e.split(n_):[e];for(let a of r)try{o.push(BG(a,t!=null?`${t}-${o.length}`:void 0,n))}catch(i){if(n)throw i;console.error(i)}return o}function HG(e){return e.startsWith("From ")||e.includes(`
3724
- From `)}function c_(e){let t=g_(e);for(let n=0;n<t.length;n++)t[n]=Rn(t[n]);return t}function g_(e){if(e.length===0)return[""];let t=[],n=0;for(;;){let o=e.indexOf(`
3725
- `,n);if(o===-1)break;t.push(e.slice(n,o+1)),n=o+1}return n<e.length&&t.push(e.slice(n)),t}function UG(e){return x_(e,"diff --git")}function KG(e){if(e.length===0)return[""];let t=[],n=0,o=0,r=0,a=0,i=!1;for(;o<e.length;){let s=ZC(e,o);if(r<=0&&a<=0){if(h_(e,o)){o>n&&t.push(e.slice(n,o)),n=o,i=!0,o=ZC(e,s);continue}if(i&&e.startsWith("@@ -",o)){let d=v_(e.slice(o,s));d!=null&&(r=d.deletionCount,a=d.additionCount)}o=s;continue}let l=e[o];if(l==="\\"){o=s;continue}l===" "?(r=Math.max(r-1,0),a=Math.max(a-1,0)):l==="-"?r=Math.max(r-1,0):l==="+"&&(a=Math.max(a-1,0)),o=s}return t.push(e.slice(n)),t}function qG(e){return h_(e,0)}function h_(e,t){let n=ZC(e,t);return u_(e,t,"---")&&u_(e,n,"+++")}function u_(e,t,n){if(!e.startsWith(n,t))return!1;let o=e[t+n.length];if(o!==" "&&o!==" ")return!1;for(let r=t+n.length+1;r<e.length;r++){let a=e[r];if(a===`
3726
- `||a==="\r")break;if(a!==" "&&a!==" ")return!0}return!1}function ZC(e,t){let n=e.indexOf(`
3727
- `,t);return n===-1?e.length:n+1}function VG(e){let t=e[0];return t==="+"||t==="-"||t===" "}function WG(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==" "&&n!==" "&&n!==`
3728
- `&&n!=="\r")return!1}return!0}function v_(e){if(!e.startsWith("@@ -"))return;let t=4,n=Ag(e,t);if(n==null)return;let o=n.value;t=n.endIndex;let r=1;if(e[t]===","){let c=Ag(e,t+1);if(c==null)return;r=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="+")return;t+=2;let a=Ag(e,t);if(a==null)return;let i=a.value;t=a.endIndex;let s=1;if(e[t]===","){let c=Ag(e,t+1);if(c==null)return;s=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="@"||e[t+2]!=="@")return;let l,d=t+3;return e[d]===" "&&(l=GG(e.slice(d+1))),{additionCount:s,additionStart:i,deletionCount:r,deletionStart:o,hunkContext:l}}function Ag(e,t){let n=t,o=0;for(;n<e.length;n++){let r=e.charCodeAt(n)-48;if(r<0||r>9)break;o=o*10+r}if(n!==t)return{value:o,endIndex:n}}function GG(e){return e.endsWith(`\r
3726
+ `||m[m.length-1]==="");)m.pop();let{additionStart:S,deletionStart:L}=g;c=d?c:L-1,f=d?f:S-1;let w={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:g.additionCount,additionStart:S,additionLines:v,deletionCount:g.deletionCount,deletionStart:L,deletionLines:x,deletionLineIndex:c,additionLineIndex:f,hunkContent:[],hunkContext:P_(g.hunkContext),hunkSpecs:_n(h),noEOFCRAdditions:!1,noEOFCRDeletions:!1},k=0,I=0;for(let T=1;T<m.length;T++){let E=m[T];if(k>=w.additionCount&&I>=w.deletionCount&&!E.startsWith("\\")){if(a&&r6(E)&&!a6(E))throw Error("parsePatchContent: hunk has more lines than expected");break}let A=E[0];if(A!=="+"&&A!=="-"&&A!==" "&&A!=="\\"){if(a)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${A}", full line: "${E}"`),console.error("processFile: invalid rawLine:",E);continue}let N=l6(A);if(N==="addition"){if(a&&k>=w.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");let R=ib(E);(y==null||y.type!=="change")&&(y=sb("change",c,f),w.hunkContent.push(y)),f++,k++,d&&l.additionLines.push(R),y.additions++,v++,C="addition"}else if(N==="deletion"){if(a&&I>=w.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");let R=ib(E);(y==null||y.type!=="change")&&(y=sb("change",c,f),w.hunkContent.push(y)),c++,I++,d&&l.deletionLines.push(R),y.deletions++,x++,C="deletion"}else if(N==="context"){if(a&&(I>=w.deletionCount||k>=w.additionCount))throw Error("parsePatchContent: hunk has too many context lines");let R=ib(E);(y==null||y.type!=="context")&&(y=sb("context",c,f),w.hunkContent.push(y)),f++,c++,k++,I++,d&&(l.deletionLines.push(R),l.additionLines.push(R)),y.lines++,C="context"}else if(N==="metadata"&&y!=null){if(y.type==="context"?(w.noEOFCRAdditions=!0,w.noEOFCRDeletions=!0):C==="deletion"?w.noEOFCRDeletions=!0:C==="addition"&&(w.noEOFCRAdditions=!0),d&&(C==="addition"||C==="context")){let R=l.additionLines.length-1;R>=0&&(l.additionLines[R]=rb(l.additionLines[R]))}if(d&&(C==="deletion"||C==="context")){let R=l.deletionLines.length-1;R>=0&&(l.deletionLines[R]=rb(l.deletionLines[R]))}}}if(a&&(k!==w.additionCount||I!==w.deletionCount))throw Error("parsePatchContent: hunk line count mismatch");w.additionLines=v,w.deletionLines=x,w.collapsedBefore=Math.max(w.additionStart-1-i,0),l.hunks.push(w),i=w.additionStart+w.additionCount-1;for(let T of w.hunkContent)T.type==="context"?(w.splitLineCount+=T.lines,w.unifiedLineCount+=T.lines):(w.splitLineCount+=Math.max(T.additions,T.deletions),w.unifiedLineCount+=T.deletions+T.additions);w.splitLineStart=l.splitLineCount+w.collapsedBefore,w.unifiedLineStart=l.unifiedLineCount+w.collapsedBefore,l.splitLineCount+=w.collapsedBefore+w.splitLineCount,l.unifiedLineCount+=w.collapsedBefore+w.unifiedLineCount}if(l!=null){if(a&&d&&!n&&l.hunks.length===0)throw Error("parsePatchContent: unified file has no hunks");if(l.hunks.length>0&&!d&&l.additionLines.length>0&&l.deletionLines.length>0){let p=l.hunks[l.hunks.length-1],m=p.additionStart+p.additionCount-1,h=l.additionLines.length,g=Math.max(h-m,0);l.splitLineCount+=g,l.unifiedLineCount+=g}return n||(l.prevName!=null&&l.name!==l.prevName?l.hunks.length>0?l.type="rename-changed":l.type="rename-pure":(o==null||o.contents==="")&&r!=null&&r.contents!==""?l.type="new":o!=null&&o.contents!==""&&(r==null||r.contents==="")&&(l.type="deleted")),l.type!=="rename-pure"&&l.type!=="rename-changed"&&(l.prevName=void 0),w_(l),l}}function A_(e,t,n=!1){let o=[],r=e6(e)?e.split(v_):[e];for(let a of r)try{o.push(YG(a,t!=null?`${t}-${o.length}`:void 0,n))}catch(i){if(n)throw i;console.error(i)}return o}function e6(e){return e.startsWith("From ")||e.includes(`
3727
+ From `)}function T_(e){let t=E_(e);for(let n=0;n<t.length;n++)t[n]=_n(t[n]);return t}function E_(e){if(e.length===0)return[""];let t=[],n=0;for(;;){let o=e.indexOf(`
3728
+ `,n);if(o===-1)break;t.push(e.slice(n,o+1)),n=o+1}return n<e.length&&t.push(e.slice(n)),t}function t6(e){return N_(e,"diff --git")}function n6(e){if(e.length===0)return[""];let t=[],n=0,o=0,r=0,a=0,i=!1;for(;o<e.length;){let s=lb(e,o);if(r<=0&&a<=0){if(M_(e,o)){o>n&&t.push(e.slice(n,o)),n=o,i=!0,o=lb(e,s);continue}if(i&&e.startsWith("@@ -",o)){let d=R_(e.slice(o,s));d!=null&&(r=d.deletionCount,a=d.additionCount)}o=s;continue}let l=e[o];if(l==="\\"){o=s;continue}l===" "?(r=Math.max(r-1,0),a=Math.max(a-1,0)):l==="-"?r=Math.max(r-1,0):l==="+"&&(a=Math.max(a-1,0)),o=s}return t.push(e.slice(n)),t}function o6(e){return M_(e,0)}function M_(e,t){let n=lb(e,t);return k_(e,t,"---")&&k_(e,n,"+++")}function k_(e,t,n){if(!e.startsWith(n,t))return!1;let o=e[t+n.length];if(o!==" "&&o!==" ")return!1;for(let r=t+n.length+1;r<e.length;r++){let a=e[r];if(a===`
3729
+ `||a==="\r")break;if(a!==" "&&a!==" ")return!0}return!1}function lb(e,t){let n=e.indexOf(`
3730
+ `,t);return n===-1?e.length:n+1}function r6(e){let t=e[0];return t==="+"||t==="-"||t===" "}function a6(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==" "&&n!==" "&&n!==`
3731
+ `&&n!=="\r")return!1}return!0}function R_(e){if(!e.startsWith("@@ -"))return;let t=4,n=Fg(e,t);if(n==null)return;let o=n.value;t=n.endIndex;let r=1;if(e[t]===","){let c=Fg(e,t+1);if(c==null)return;r=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="+")return;t+=2;let a=Fg(e,t);if(a==null)return;let i=a.value;t=a.endIndex;let s=1;if(e[t]===","){let c=Fg(e,t+1);if(c==null)return;s=c.value,t=c.endIndex}if(e[t]!==" "||e[t+1]!=="@"||e[t+2]!=="@")return;let l,d=t+3;return e[d]===" "&&(l=i6(e.slice(d+1))),{additionCount:s,additionStart:i,deletionCount:r,deletionStart:o,hunkContext:l}}function Fg(e,t){let n=t,o=0;for(;n<e.length;n++){let r=e.charCodeAt(n)-48;if(r<0||r>9)break;o=o*10+r}if(n!==t)return{value:o,endIndex:n}}function i6(e){return e.endsWith(`\r
3729
3732
  `)?e.slice(0,-2):e.endsWith(`
3730
- `)?e.slice(0,-1):e}function jG(e){return e.startsWith("diff --git")||e.includes(`
3731
- diff --git`)}function x_(e,t){if(e.length===0)return[""];let n=`
3732
- ${t}`,o=e.startsWith(t)?0:f_(e,n,0);if(o===-1)return[e];let r=[];o>0&&r.push(e.slice(0,o));let a=o;for(;;){let i=f_(e,n,a+1);if(i===-1)break;r.push(e.slice(a,i)),a=i}return r.push(e.slice(a)),r}function f_(e,t,n){let o=e.indexOf(t,n);return o===-1?-1:o+1}function p_(e){return e==null?e:Rn(e)}function QG(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function YC(e){let t=e.slice(1);return Rn(t===""?`
3733
- `:t)}function JC(e,t,n){return e==="change"?{type:"change",additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:n,deletionLineIndex:t}}var y_={light:"vscode-light-modern",dark:"vscode-dark-modern"};function b_(e){return e==="dark"?y_.dark:y_.light}var I_=2166136261,S_=16777619,XG=2654435769,YG=2246822507;function C_(e,t=I_,n=S_){let o=t>>>0;for(let r=0;r<e.length;r+=1)o^=e.charCodeAt(r),o=Math.imul(o,n)>>>0;return o>>>0}function JG(e,t="diff-panel"){let n=e.trim(),o=C_(n,I_,S_).toString(36),r=C_(n,XG,YG).toString(36);return`${t}:${n.length}:${o}:${r}`}function eb(e){if(!e.isPartial)return e;let t=0,n=0,o=e.hunks.map(r=>{let a={...r,splitLineStart:t,unifiedLineStart:n};return t+=r.splitLineCount,n+=r.unifiedLineCount,a});return{...e,hunks:o,splitLineCount:t,unifiedLineCount:n,...e.cacheKey?{cacheKey:`${e.cacheKey}:compact-partial`}:{}}}function w_(e,t="diff-panel",n={}){if(!e)return null;let o=e.trim();if(o.length===0)return null;try{let a=m_(o,JG(o,t)).flatMap(i=>n.compactPartialHunkOffsets?i.files.map(eb):i.files);return a.length>0?{kind:"files",files:a}:{kind:"raw",text:o,reason:"Unsupported diff format. Showing raw patch."}}catch{return{kind:"raw",text:o,reason:"Failed to parse patch. Showing raw patch."}}}function T_(e){let t=e.cacheKey;return t?t.endsWith(":hydrated")?t.slice(0,-9):t:`${e.prevName??"none"}:${e.name}`}function L_({fileChange:e,onOpenDiff:t}){let{t:n}=De(),[o,r]=G(!1),a=z(()=>ZN(e),[e]),i=t_(e);return b("div",{className:"min-w-0",children:[b("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[u("span",{className:"min-w-0 shrink truncate font-mono text-[11px] text-foreground/85",children:e.path}),u("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:n("approval.diff.stat",{additions:i.additions,deletions:i.deletions})}),a===null?u("span",{className:"text-[11px] text-muted-foreground",children:e.omitted==="too-large"?n("approval.diff.tooLarge"):n("approval.diff.unavailable")}):b(te,{size:"micro",variant:"ghost-muted",className:"font-normal","aria-expanded":o,onClick:()=>r(s=>!s),children:[o?u(pn,{className:"size-3 shrink-0"}):u(Uo,{className:"size-3 shrink-0"}),u("span",{children:n(o?"approval.diff.hide":"approval.diff.show")})]}),t?u(te,{size:"micro",variant:"ghost-muted",className:"font-normal",onClick:()=>t(e.path),children:n("approval.diff.open")}):null]}),o&&a!==null?u(ZG,{path:e.path,unifiedDiff:a}):null]})}function ZG({path:e,unifiedDiff:t}){let n=Ot().theme.useResolvedTheme(),o=z(()=>{let r=w_(t,`approval:${n}`,{compactPartialHunkOffsets:!0});return r?.kind==="files"?r.files.map(a=>({id:T_(eb(a)),type:"diff",fileDiff:a,collapsed:!1})):[]},[n,t]);return o.length===0?u("pre",{"aria-label":e,className:"mt-1 max-h-56 overflow-auto rounded-md border border-border/60 bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-muted-foreground/90 [scrollbar-width:thin]",tabIndex:0,children:t}):u("div",{className:"mt-1 overflow-hidden rounded-md border border-border/60",children:u(tS,{className:"max-h-56 overflow-auto [scrollbar-gutter:stable]",items:o,options:{diffStyle:"unified",lineDiffType:"none",overflow:"wrap",theme:b_(n),themeType:n,stickyHeaders:!1}})})}var e6="block max-h-20 min-w-0 overflow-auto whitespace-pre font-mono text-[11px] text-foreground/85 [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5",k_=ue(function({approval:t,pendingCount:n,onOpenDiff:o,className:r}){let{t:a}=De(),i=QN(t),{body:s}=i,l=e_(i.fileChanges);return b("div",{"aria-label":YN(i.kind,a),className:F("flex min-w-0 flex-1 flex-col gap-1",r),role:"group",children:[b("div",{className:"flex min-w-0 items-baseline gap-2",children:[u("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:XN(i,a)}),n>1?b("span",{className:"shrink-0 text-[10px] font-medium text-muted-foreground tabular-nums",children:["1/",n]}):null]}),s.shape==="none"?null:u("code",{"aria-label":JN(s.shape,a),className:F(e6,s.shape==="path"||s.shape==="url"?"truncate":null),"data-approval-detail":"complete",tabIndex:0,children:s.shape==="command"?s.command:s.shape==="path"?s.path:s.shape==="url"?s.url:s.shape==="query"?s.query:s.text}),i.description===null?null:u("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:i.description}),i.fileChanges.map((d,c)=>u(L_,{fileChange:d,onOpenDiff:o},l[c])),i.args.length===0?null:b("details",{className:"min-w-0","data-approval-args":"true",children:[u("summary",{className:"cursor-pointer text-[11px] text-muted-foreground",children:a("approval.body.detailsSummary")}),u("dl",{"aria-label":a("approval.body.argumentsLabel"),className:"mt-1 grid max-h-32 min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5 overflow-auto rounded-md border border-border/60 bg-background/60 p-2 text-[11px] [scrollbar-width:thin]",tabIndex:0,children:i.args.map(d=>b("div",{className:"col-span-2 grid grid-cols-subgrid",children:[u("dt",{className:"font-mono text-muted-foreground",children:d.name}),u("dd",{className:"min-w-0 font-mono whitespace-pre-wrap wrap-break-word text-foreground/85",children:d.value})]},d.name))})]})]})});var tb=ue(function(t){return u(k_,{...t})});me();var nb=ue(function(t){let{t:n}=De(),[o,r]=G(!1),[a,i]=G(!1),s=t.decision,l=s.requestId;if(l===null)return null;let d=f=>f.key===void 0?f.text:n(f.key,{...f.params,defaultValue:f.text}),c=s.askedBy.kind==="plugin"?s.askedBy.pluginId:null;return b("div",{className:F("flex min-w-0 flex-col gap-1 px-3 py-1.5 sm:px-4",t.className),"data-composer-pending-decision":"true",children:[b("div",{className:"flex min-w-0 items-baseline gap-2",children:[u("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:d(s.title)}),c===null?null:u("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:c})]}),s.body.map((f,p)=>u("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:d(f)},`${String(p)}:${f.key??f.text}`)),s.detail===null?null:u("button",{type:"button",className:"min-w-0 truncate text-left font-mono text-[11px] text-muted-foreground",onClick:()=>r(f=>!f),children:o?s.detail.text.slice(0,4e3):s.detail.text.split(`
3734
- `)[0]}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-1 pt-0.5",children:s.options.map(f=>u(te,{size:"xs",variant:f.tone==="primary"?"default":f.tone==="danger"?"destructive":"outline",disabled:a,onClick:()=>{i(!0),t.onRespond(l,f.id)},children:d(f.label)},f.id))})]})});function Eg(e){return e.id??e.label}function ob(e,t){return Array.from(new Set((t??[]).flatMap(n=>{let o=e.options.find(r=>r.id!==void 0?r.id===n:r.label===n.trim());return o?[Eg(o)]:[]})))}function t6(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function rb(e,t){let n=t6(t?.customAnswer);if(e.allowFreeform!==!1&&n)return n;let o=ob(e,t?.selectedOptionLabels);return e.multiSelect?o.length>0?o:null:o[0]??null}function n6(e,t){let n={};for(let o of e){let r=rb(o,t[o.id]);if(!r)return null;n[o.id]=r}return n}function o6(e,t){return e.reduce((n,o)=>rb(o,t[o.id])?n+1:n,0)}function P_(e,t,n){let o=e.length===0?0:Math.max(0,Math.min(n,e.length-1)),r=e[o]??null,a=r?t[r.id]:void 0,i=r?rb(r,a):null,s=r?.allowFreeform===!1?"":a?.customAnswer??"",l=o6(e,t),d=e.length===0?!0:o>=e.length-1;return{questionIndex:o,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?ob(r,a?.selectedOptionLabels):[],customAnswer:s,resolvedAnswer:i,usingCustomAnswer:s.trim().length>0,answeredQuestionCount:l,isLastQuestion:d,isComplete:n6(e,t)!==null,canAdvance:!!i}}me();var A_=ue(function({pendingUserInputs:t,respondingRequestIds:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){if(t.length===0)return null;let s=t[0];return s?u(r6,{prompt:s,isResponding:n.includes(s.requestId),answers:o,questionIndex:r,onToggleOption:a,onAdvance:i},s.requestId):null}),r6=ue(function({prompt:t,isResponding:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){let{t:s}=De(),l=Ot(),d=P_(t.questions,o,r),c=d.activeQuestion,f=_(null),p=_(i),[m,h]=G(null),[g,v]=G(null),x=g!==null&&g===c?.id;q(()=>{p.current=i},[i]),q(()=>{if(!(!c||c.multiSelect||!m)){if(m.questionId!==c.id){h(null);return}d.customAnswer.trim().length===0&&d.selectedOptionLabels.includes(m.optionLabel)&&h(null)}},[c,m,d.customAnswer,d.selectedOptionLabels]),q(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);let y=B((w,k)=>{if(c?.multiSelect){a(w,k);return}h({questionId:w,optionLabel:k}),a(w,k),f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{f.current=null,p.current()},200)},[c,a]);if(l.pane.useKeydown(w=>{if(!c||n||x||w.metaKey||w.ctrlKey||w.altKey||w.isComposing||w.keyCode===229||Pg(w.target))return;let k=GC(w.key,c.options.length);if(k===null)return;let S=c.options[k];S&&(w.preventDefault(),y(c.id,Eg(S)))},{target:"document"}),!c)return null;let C=d.customAnswer.trim().length>0;return b(GI,{className:"py-2",open:!x,onOpenChange:w=>{v(w?null:c.id)},children:[u("div",{className:"flex items-center gap-1 px-1 sm:px-2",children:b(QI,{title:s(x?"pendingUserInput.showQuestion":"pendingUserInput.hideQuestion"),"data-pending-user-input-toggle":x?"collapsed":"expanded",className:"group -my-1 flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors duration-(--control-duration) hover:bg-muted/40",children:[u("span",{className:"text-xs font-medium text-muted-foreground group-hover:text-foreground/85",children:c.header}),t.questions.length>1?b("span",{className:"text-[10px] font-medium text-muted-foreground tabular-nums",children:[r+1,"/",t.questions.length]}):null,x?u("span",{className:"min-w-0 flex-1 truncate text-secondary-label text-xs",children:c.question}):null,u(pn,{"aria-hidden":"true",className:F("ml-auto size-icon-2 shrink-0 text-secondary-label transition-transform duration-(--control-duration) group-hover:text-foreground",x&&"rotate-180")})]})}),u(jI,{className:"px-3 sm:px-4",children:b("div",{className:"pt-2 pb-0.5",children:[u("div",{className:"max-h-[min(45vh,28rem)] overflow-y-auto overscroll-contain break-words text-sm text-foreground/85","data-pending-user-input-body":c.kind??"question",tabIndex:0,children:c.kind==="plan"?u(nr,{text:c.question,cwd:void 0,isStreaming:!1}):u("p",{className:"whitespace-pre-wrap",children:c.question})}),c.multiSelect?u("p",{className:"mt-1 text-secondary-label text-xs",children:s("pendingUserInput.selectOneOrMore")}):null,u("div",{className:"mt-2 space-y-0.5",children:c.options.map((w,k)=>{let S=Eg(w),I=m?.questionId===c.id&&m.optionLabel===S||!C&&d.selectedOptionLabels.includes(S),T=k<9?k+1:null,E=F("group relative flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left transition-colors duration-(--control-duration) pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",I?"bg-muted/55 text-foreground":"bg-transparent text-foreground/85 hover:bg-muted/40",n&&"opacity-50 cursor-not-allowed",!n&&"cursor-pointer"),A=b(be,{children:[b("div",{className:"min-w-0 flex-1 flex flex-col gap-0.5",children:[u("span",{className:"text-sm font-medium",children:w.label}),w.description&&w.description!==w.label?u("span",{className:"text-secondary-label text-[11px]",children:w.description}):null]}),I?u(Io,{className:"size-icon-2 shrink-0 text-primary"}):T!==null?u("kbd",{className:F("flex size-5 shrink-0 items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums"),children:T}):null]});return u("button",{type:"button","aria-pressed":I,disabled:n,onClick:()=>{y(c.id,S)},className:E,children:A},`${c.id}:${S}`)})})]})})]})});me();var E_=ue(function({planTitle:t}){let{t:n}=De();return u("div",{className:"px-3 py-2 sm:px-4",children:b("div",{className:"flex flex-wrap items-center gap-2",children:[u("span",{className:"text-xs font-medium text-muted-foreground",children:n("plan.ready")}),t?u("span",{className:"min-w-0 flex-1 truncate text-xs text-foreground/85",children:t}):null]})})});function M_(e){if(e.occupant.kind!=="approval")return null;let{approval:t}=e.occupant;return u(VN,{requestId:t.requestId,isResponding:e.respondingRequestIds.includes(t.requestId),options:t.options,keybindings:e.keybindings,declineReasonRelay:t.declineReasonRelay,onRespondToApproval:e.onRespondToApproval})}function R_(e){return e.occupant.kind!=="user-input"?null:u(A_,{pendingUserInputs:[e.occupant.userInput],respondingRequestIds:e.respondingRequestIds,answers:e.activePendingDraftAnswers,questionIndex:e.activePendingQuestionIndex,onToggleOption:e.onSelectActivePendingUserInputOption,onAdvance:e.onAdvanceActivePendingUserInput})}var N_={approval:{expanded:e=>e.occupant.kind!=="approval"?null:b("div",{className:"flex min-w-0 flex-wrap items-start gap-1 px-3 py-1.5 sm:px-4",children:[u(tb,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-0.5",children:M_(e)})]}),collapsed:e=>e.occupant.kind!=="approval"?null:b("div",{"data-chat-composer-collapsed-controls":"true",children:[u(tb,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,className:"px-3 pt-2 sm:px-4"}),u("div",{className:"flex flex-wrap items-center justify-end gap-1 px-3 pt-2 pb-3 sm:px-4",children:M_(e)})]})},decision:{expanded:e=>e.occupant.kind!=="decision"?null:u(nb,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision}),collapsed:e=>e.occupant.kind!=="decision"?null:u("div",{"data-chat-composer-collapsed-controls":"true",children:u(nb,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision,className:"pt-2 pb-3"})})},"user-input":{expanded:R_,collapsed:e=>b("div",{"data-chat-composer-collapsed-controls":"true",children:[R_(e),e.collapsedPendingRow]})},"plan-follow-up":{expanded:e=>e.activeProposedPlan===null?null:u(E_,{planTitle:UN(e.activeProposedPlan.planMarkdown)??null},e.activeProposedPlan.id),collapsed:null}};function __(e,t){let n=N_[e.occupant.kind],o=t?n.collapsed:n.expanded;return o===null?null:o(e)}var sue=Object.keys(N_);me();me();var Mg=["approval-required","auto-accept-edits","auto","full-access"];var a6={"approval-required":Ud,"auto-accept-edits":Xr,auto:ai,"full-access":ri},i6={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function Rg(){let{t:e}=De();return B(t=>{let n=i6[t];return{mode:t,label:e(`runtimeMode.${n}`),description:e(`runtimeMode.${n}Description`),icon:a6[t]}},[e])}var D_=ue(function(t){let{t:n}=De(),o=Rg();return b(Jo,{children:[u(tr,{render:u(te,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground/70 hover:text-foreground/80","aria-label":"More composer controls"}),children:u(Yo,{"aria-hidden":"true",className:"size-4"})}),b(er,{align:"start",children:[t.traitsMenuContent?b(be,{children:[t.traitsMenuContent,u(ii,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?b(be,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Mode"}),b(Sa,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[u(Cr,{value:"default",children:"Chat"}),u(Cr,{value:"plan",children:"Plan"})]}),u(ii,{})]}):null,t.nativeMode===null?b(be,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Access"}),u(Sa,{value:t.runtimeMode,onValueChange:r=>{!r||r===t.runtimeMode||t.onRuntimeModeChange(r)},children:Mg.map(r=>u(Cr,{value:r,children:o(r).label},r))}),t.runtimeModeSwitch==="next-turn"?u("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]}):b(be,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:"Access"}),t.canSwitchNativeMode&&t.nativeMode.modes.length>1?u(Sa,{value:t.nativeMode.current.id,onValueChange:r=>{t.onNativeModeChange(String(r))},children:t.nativeMode.modes.map(r=>u(Cr,{value:r.id,children:r.name},r.id))}):u("div",{className:"px-2 pb-1.5 text-foreground text-sm","data-composer-native-mode":t.nativeMode.current.id,children:t.nativeMode.current.name})]})]})]})});me();function O_(e,t){let n=e?.nativeModes??[];if(n.length===0)return null;let o=n.find(r=>r.id===t)??n.find(r=>r.id===e?.currentNativeModeId);return o?{modes:n,current:o}:null}function F_(e){return e.description??e.name}var B_=ue(function(t){let{current:n,modes:o}=t.nativeMode,r=F_(n);return!t.canSwitch||o.length<2?b(Qe,{children:[b(Ye,{render:u($r,{className:"shrink-0 cursor-default whitespace-nowrap font-medium",type:"button",disabled:!0,"data-composer-native-mode":n.id,"aria-label":`Agent mode: ${n.name}`}),children:[u(mr,{icon:cl}),u("span",{children:n.name})]}),b(Xe,{side:"top",children:[u("span",{className:"block font-medium",children:r}),o.length>1?b("span",{className:"mt-1 block text-muted-foreground text-xs",children:["Agent modes: ",o.map(a=>a.name).join(", ")]}):null]})]}):b(Qe,{children:[b(xf,{value:n.id,onValueChange:a=>t.onNativeModeChange(a),children:[b(Ye,{render:u(kg,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":n.id,"aria-label":`Agent mode: ${n.name}`}),children:[u(mr,{icon:cl}),u(bf,{children:n.name})]}),u(Cf,{alignItemWithTrigger:!1,children:o.map(a=>u(yf,{value:a.id,hideIndicator:!0,className:"min-w-56 py-2",children:b("div",{className:"grid min-w-0 gap-0.5",children:[u("span",{className:"font-medium text-foreground",children:a.name}),a.description?u("span",{className:"text-muted-foreground text-xs leading-4",children:a.description}):null]})},a.id))})]}),u(Xe,{side:"top",children:r})]})});function ab(e){return e.items.length===0?null:e.currentSearchKey===e.highlightedSearchKey&&e.highlightedItemId&&e.items.some(t=>t.id===e.highlightedItemId)?e.highlightedItemId:e.items[0]?.id??null}function ib(e,t){let n=e.name.toLowerCase(),o=sa(e).toLowerCase(),r=e.shortDescription?.toLowerCase()??"",a=e.description?.toLowerCase()??"",i=e.scope?.toLowerCase()??"",s=[zr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),zr({value:o,query:t,exactBase:1,prefixBase:3,boundaryBase:5,includesBase:7,fuzzyBase:110}),zr({value:r,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26}),zr({value:a,query:t,exactBase:30,prefixBase:32,boundaryBase:34,includesBase:36}),zr({value:i,query:t,exactBase:40,prefixBase:42,includesBase:44})].filter(l=>l!==null);return s.length===0?null:Math.min(...s)}function z_(e,t,n=Number.POSITIVE_INFINITY){let o=e.filter(i=>i.enabled),r=go(t,{trimLeadingPattern:/^\$+/});if(!r)return o;let a=[];for(let i of o){let s=ib(i,r);s!==null&&Tg(a,{item:i,score:s,tieBreaker:`${sa(i).toLowerCase()}\0${i.name}`},n)}return a.map(i=>i.item)}function s6(e,t){if(e.type==="skill"){if(t==="skill")return 0;let a=t.startsWith("skill:")?t.slice(6):t,i=a?ib(e.skill,a):0;return i!==null?i:"skill".startsWith(t)?Number.MAX_SAFE_INTEGER:null}let n=e.type==="slash-command"?e.command.toLowerCase():e.command.name.toLowerCase(),o=e.description.toLowerCase(),r=[zr({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),zr({value:o,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26})].filter(a=>a!==null);return r.length===0?null:Math.min(...r)}function $_(e,t){let n=go(t,{trimLeadingPattern:/^\/+/});if(!n)return[...e];let o=[];for(let r of e){let a=s6(r,n);a!==null&&Tg(o,{item:r,score:a,tieBreaker:r.type==="slash-command"?`0\0${r.command}`:r.type==="provider-slash-command"?`1\0${r.command.name}\0${r.provider}`:`2\0${r.skill.name}\0${r.provider}`},Number.POSITIVE_INFINITY)}return o.map(r=>r.item)}function l6(e){return typeof e!="string"?null:e.trim()||null}function d6(e){return e.type==="select"?{...e,options:[...e.options],...e.promptInjectedValues?{promptInjectedValues:[...e.promptInjectedValues]}:{}}:{...e}}function c6(e,t){return e?.find(o=>o.id===t)?.value}function H_(e,t){let n=l6(t);return n?e.options.length===0?n:e.promptInjectedValues?.includes(n)&&e.options.some(o=>o.id===n)?e.options.find(o=>o.isDefault)?.id:e.options.some(o=>o.id===n)?n:e.currentValue??e.options.find(o=>o.isDefault)?.id:e.currentValue??e.options.find(o=>o.isDefault)?.id}function u6(e,t){if(e.type==="boolean")return typeof t=="boolean"?{...e,currentValue:t}:e;let n=typeof t=="string"?H_(e,t):H_(e,e.currentValue);if(!n){let{currentValue:o,...r}=e;return r}return{...e,currentValue:n}}function Ng(e){let{caps:t,selections:n}=e;return(t.optionDescriptors??[]).map(d6).map(r=>u6(r,c6(n,r.id)??r.currentValue))}function Xs(e){if(e)return e.type==="boolean"||e.currentValue?e.currentValue:e.options.find(t=>t.isDefault)?.id}function sb(e){if(!e)return;if(e.type==="boolean")return typeof e.currentValue=="boolean"?e.currentValue?"On":"Off":void 0;let t=Xs(e);if(typeof t=="string")return e.options.find(n=>n.id===t)?.label}function _g(e){if(!e||e.length===0)return;let t=[];for(let n of e){let o=Xs(n);(typeof o=="string"||typeof o=="boolean")&&t.push({id:n.id,value:o})}return t.length>0?t:void 0}function Bu(e){return typeof e=="string"&&/\bultrathink\b/i.test(e)}function U_(e,t){let n=e.trim();return!n||t!=="ultrathink"||/^\/[^\s/]+(?:\s|$)/u.test(n)||n.startsWith("Ultrathink:")?n:`Ultrathink:
3735
- ${n}`}me();var f6=`Ultrathink:
3736
- `;function p6(){let{t:e}=De();return u(ul,{variant:"outline",className:"inline-flex h-4 w-fit min-w-0 items-center justify-center gap-0 border-border/70 bg-muted/60 px-1.5 py-0 font-semibold text-[10px] text-muted-foreground leading-none sm:h-4",children:e("traits.default")})}function K_(e,t,n){return e.map(o=>o.id!==t?o:o.type==="boolean"?{...o,...typeof n=="boolean"?{currentValue:n}:{}}:{...o,...typeof n=="string"?{currentValue:n}:{}})}function Dg(e){if(!e)return null;let t=Xs(e);return typeof t=="string"?t:null}function m6(e,t,n,o,r,a,i,s){let l=e.getModelCapabilities(n,o,t,s),d=Ng({caps:l,selections:a}),c=d.filter(I=>I.type==="select"),f=d.filter(I=>I.type==="boolean"),p=c[0]??null,m=c.find(I=>I.id==="contextWindow")??null,h=c.find(I=>I.id==="agent")??null,g=f.find(I=>I.id==="fastMode")??null,v=f.find(I=>I.id==="thinking")??null,x=i&&(p?.promptInjectedValues?.length??0)>0&&Bu(r),y=x&&Bu(r.replace(/^Ultrathink:\s*/i,"")),C=(x?"ultrathink":Dg(p))??null,w=typeof v?.currentValue=="boolean"?v.currentValue:null,k=Dg(m),S=Dg(h),L=h?sb(h):null;return{caps:l,descriptors:d,selectDescriptors:c,booleanDescriptors:f,primarySelectDescriptor:p,contextWindowDescriptor:m,agentDescriptor:h,fastModeDescriptor:g,thinkingDescriptor:v,effort:C,thinkingEnabled:w,contextWindow:k,ultrathinkPromptControlled:x,ultrathinkInBodyText:y,selectedAgent:S,selectedAgentLabel:L}}function lb(e){let t=m6(e.modelApi,e.provider,e.models,e.model,e.prompt,e.modelOptions,e.allowPromptInjectedEffort??!0,e.planModeEnabled),n=t.primarySelectDescriptor!==null,o=t.thinkingDescriptor!==null,r=t.fastModeDescriptor!==null,a=t.contextWindowDescriptor!==null,i=t.agentDescriptor!==null;return{...t,showEffort:n,showThinking:o,showFastMode:r,showContextWindow:a,showAgent:i,hasAnyControls:n||o||r||a||i}}function db(e){return lb(e).hasAnyControls}var cb=ue(function({provider:t,instanceId:n,models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,...c}){let{t:f}=De(),p=Ot(),m=p.draft.useStore(I=>I.setProviderModelOptions),h=B(I=>{if("onModelOptionsChange"in c){c.onModelOptionsChange(I);return}let T=c.threadRef??c.draftId;T&&m(T,t,I,{...n?{instanceId:n}:{},model:r,persistSticky:!0})},[n,r,c,t,m]),{descriptors:g,selectDescriptors:v,booleanDescriptors:x,primarySelectDescriptor:y,ultrathinkPromptControlled:C,ultrathinkInBodyText:w,hasAnyControls:k}=lb({modelApi:p.model,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}),S=I=>{h(_g(I))},L=(I,T)=>{if(T){if(I.promptInjectedValues?.includes(T)){let E=a.trim().length===0?f6:U_(a,"ultrathink");i(E);return}if(!(w&&I.id===y?.id)){if(C&&I.id===y?.id){let E=a.replace(/^Ultrathink:\s*/i,"");i(E)}S(K_(g,I.id,T))}}};return k?b(be,{children:[v.map((I,T)=>{let E=C&&I.id===y?.id?"ultrathink":Dg(I)??"";return b("div",{children:[T>0?u(ii,{}):null,b(ec,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:I.label}),w&&I.id===y?.id?u("div",{className:"px-2 pb-1.5 text-muted-foreground/80 text-xs",children:f("traits.ultrathinkInBodyNotice")}):null,u(Sa,{value:E,onValueChange:A=>L(I,A),children:I.options.map(A=>u(Cr,{value:A.id,hideIndicator:!0,closeOnClick:!0,disabled:w&&I.id===y?.id,children:b("span",{className:"flex w-full min-w-0 flex-col",children:[u("span",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:b("span",{className:"min-w-0 truncate",children:[A.label,A.isDefault?b(be,{children:[" ",u(p6,{})]}):null]})}),A.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:A.description}):null]})},A.id))})]})]},I.id)}),x.map((I,T)=>{let E=I.currentValue===!0?"on":"off";return b("div",{children:[T>0||v.length>0?u(ii,{}):null,b(ec,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:I.label}),u(Sa,{value:E,onValueChange:A=>{S(K_(g,I.id,A==="on"))},children:["on","off"].map(A=>u(Cr,{value:A,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:u("span",{children:f(A==="on"?"traits.on":"traits.off")})})},A))})]})]},I.id)})]}):null});function g6(e,t){let n=null,o=!1,r=[];for(let a of t.descriptors){if(a.id==="fastMode"&&a.type==="boolean"){o=a.currentValue===!0,n=e(o?"traits.fast":"traits.normal");continue}if(t.provider==="codex"&&a.id==="serviceTier"&&a.type==="select"){let s=Xs(a),l=a.options.find(({label:d})=>d==="Fast");if(l&&(s==="default"||s===l.id)){o=s===l.id,n=a.options.find(({id:d})=>d===s)?.label??e(o?"traits.fast":"traits.normal");continue}}let i=t.ultrathinkPromptControlled&&a.id===t.primarySelectDescriptorId?e("traits.ultrathink"):a.type==="boolean"?e("traits.labelWithState",{label:a.label,state:e(a.currentValue===!0?"traits.on":"traits.off")}):sb(a);typeof i=="string"&&i.length>0&&r.push(i)}return r.length===0&&n!==null?{label:n,showFastModeIcon:!1}:{label:r.join(" \xB7 "),showFastModeIcon:o}}var q_=ue(function({provider:t,instanceId:n,models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,triggerVariant:c,triggerClassName:f,...p}){let[m,h]=G(!1),{t:g}=De(),v=Ot().model,{descriptors:x,primarySelectDescriptor:y,ultrathinkPromptControlled:C}=lb({modelApi:v,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d});if(!db({modelApi:v,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}))return null;let{label:w,showFastModeIcon:k}=g6(g,{provider:t,descriptors:x,primarySelectDescriptorId:y?.id??null,ultrathinkPromptControlled:C}),S=k?b(be,{children:[u(mr,{icon:as,className:F("fill-current opacity-80",t==="claudeAgent"?"text-[#d97757]":"text-foreground")}),u("span",{className:"sr-only",children:g("traits.fastModeOn")})]}):null,L=t==="codex";return b(Jo,{open:m,onOpenChange:I=>{h(I)},children:[u(tr,{render:u($r,{variant:c??"ghost",className:F(L?"min-w-0 max-w-40 shrink justify-start overflow-hidden whitespace-nowrap sm:max-w-48":"shrink-0 whitespace-nowrap",f)}),children:L?b("span",{className:"flex min-w-0 w-full items-center gap-1.5 overflow-hidden",children:[S,u("span",{className:"min-w-0 truncate",children:w}),u(Ri,{})]}):b(be,{children:[S,u("span",{children:w}),u(Ri,{})]})}),u(er,{align:"start",children:u(cb,{provider:t,...n?{instanceId:n}:{},models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,...p})})]})});function V_(e){return Bu(e)?"ultrathink":"none"}function W_(e,t){let{provider:n,model:o,models:r,modelOptions:a,promptInjectionState:i="none",planModeEnabled:s}=e,l=t.getModelCapabilities(r,o,n,s),d=Ng({caps:l,selections:a}),c=d.find(h=>h.type==="select"),f=Xs(c??null),p=typeof f=="string"?f:null,m=(c?.promptInjectedValues?.length??0)>0&&i==="ultrathink";return{provider:n,promptEffort:p,modelOptionsForDispatch:_g(d),...m?{composerFrameClassName:"ultrathink-frame",composerSurfaceClassName:"shadow-[0_0_0_1px_rgba(255,255,255,0.07)_inset]",modelPickerIconClassName:"ultrathink-chroma"}:{}}}function G_(e,t){let{provider:n,instanceId:o,threadRef:r,draftId:a,model:i,models:s,modelOptions:l,prompt:d,onPromptChange:c,planModeEnabled:f}=t;return!(r!==void 0||a!==void 0)||!db({modelApi:t.modelApi,provider:n,models:s,model:i,modelOptions:l,prompt:d,planModeEnabled:f})?null:u(e,{provider:n,...o?{instanceId:o}:{},models:s,...r?{threadRef:r}:{},...a?{draftId:a}:{},model:i,modelOptions:l,prompt:d,onPromptChange:c,planModeEnabled:f})}function j_(e){return G_(cb,e)}function Q_(e){return G_(q_,e)}me();var X_=e=>{let t,n=new Set,o=(d,c)=>{let f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){let p=t;t=c??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,p))}},r=()=>t,s={setState:o,getState:r,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d))},l=t=e(o,r,s);return s},Y_=(e=>e?X_(e):X_);me();var h6=e=>e;function v6(e,t=h6){let n=hn.useSyncExternalStore(e.subscribe,hn.useCallback(()=>t(e.getState()),[e,t]),hn.useCallback(()=>t(e.getInitialState()),[e,t]));return hn.useDebugValue(n),n}var J_=e=>{let t=Y_(e),n=o=>v6(t,o);return Object.assign(n,t),n},Z_=(e=>e?J_(e):J_);var ub=Z_(e=>({presetIdByDraftId:{},setDraftPresetId:(t,n)=>{e(o=>{if((o.presetIdByDraftId[t]??null)===n)return o;let r={...o.presetIdByDraftId};return n===null?delete r[t]:r[t]=n,{presetIdByDraftId:r}})},clearDraftPresetId:t=>{e(n=>{if(n.presetIdByDraftId[t]===void 0)return n;let o={...n.presetIdByDraftId};return delete o[t],{presetIdByDraftId:o}})}}));function eD(e){return ub(t=>e===null?null:t.presetIdByDraftId[e]??null)}function fb(e,t){return t==null?void 0:e.find(n=>n.presetId===t)}var pb="__none__",tD=ue(function({environmentId:t,draftId:n,threadPresetId:o,compact:r}){let{t:a}=De(),i=Ot().presets.useThreadPresets(t),s=eD(n),l=ub(c=>c.setDraftPresetId);if(n===null){let f=fb(i,o)?.displayName??o;return f===null?null:b($r,{variant:"ghost",disabled:!0,"aria-label":a("preset.appliedLabel",{name:f}),className:"shrink-0 whitespace-nowrap",children:[u(mr,{icon:Ca}),u("span",{className:"min-w-0 truncate",children:f})]})}if(i.length===0)return null;let d=fb(i,s);return b(Jo,{children:[u(tr,{render:u($r,{variant:"ghost","aria-label":a("preset.triggerLabel"),className:"min-w-0 max-w-40 shrink whitespace-nowrap sm:max-w-48"}),children:b("span",{className:"flex w-full min-w-0 items-center gap-1.5 overflow-hidden",children:[u(mr,{icon:Ca}),r?null:u("span",{className:"min-w-0 truncate",children:d?.displayName??a("preset.none")}),u(Ri,{})]})}),u(er,{align:"start",children:b(ec,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:a("preset.menuTitle")}),b(Sa,{value:s??pb,onValueChange:c=>{l(n,c===pb?null:c)},children:[u(Cr,{value:pb,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"min-w-0 truncate",children:a("preset.none")})}),i.map(c=>u(Cr,{value:c.presetId,hideIndicator:!0,closeOnClick:!0,children:b("span",{className:"flex w-full min-w-0 flex-col",children:[u("span",{className:"min-w-0 truncate",children:c.displayName}),c.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:c.description}):null]})},c.presetId))]})]})})]})});me();function nD(e){let t=e.credentialIdentity,n=e.selection.expectedRevisions;return[e.queryKey,e.selection.environmentId,e.selection.runtimeId,e.selection.sourceId,e.selection.profileId,e.selection.endpointId??"",String(n.runtime),String(n.source),String(n.profile),String(n.endpoint??""),String(e.sourceConfigRevision),t===null?"":t.id,t===null?"":String(t.revision)].join("\0")}function x6(e,t){let n=t.credentialIdentity;return n===null?!1:e.environmentId===t.environmentId&&e.sourceId===t.sourceId&&e.sourceConfigRevision===t.sourceConfigRevision&&e.credentialIdentity.id===n.id&&e.credentialIdentity.revision===n.revision}function oD(e){return e.capability.status!=="unsupported"&&e.credentialIdentity!==null}function y6(e){let{scope:t}=e;return`${t.kind}\0${t.quotaPoolId??""}\0${t.identity??""}`}function mb(e,t){return e===null||!Number.isFinite(e)?null:t.kind==="money"?e.toFixed(t.precision):(Number.isInteger(e),String(e))}function gb(e){if(e==null||!Number.isFinite(e)||e<=0)return null;let t=864e5,n=36e5,o=6e4,r=1e3;return e%t===0?{unit:"days",count:e/t}:e%n===0?{unit:"hours",count:e/n}:e%o===0?{unit:"minutes",count:e/o}:e%r===0?{unit:"seconds",count:e/r}:null}function hb(e,t){return e.freshness==="stale"||e.status==="error"||e.errorReason!==null||t!==null}function C6(e){if(e.unlimited===!0)return{kind:"unlimited"};let t=e.kind==="spend-cap"?e.used??e.remaining:e.remaining??e.used,n=mb(t,e.unit);return n===null?null:e.unit.kind==="money"?{kind:"money",amount:n,currency:e.unit.currency}:e.unit.kind==="percent"?{kind:"percent",amount:n,direction:e.unit.direction}:{kind:"quantity",amount:n,nativeUnit:e.unit.nativeUnit}}function rD(e,t){let n=[];for(let o of e){if(o.provenance==="estimated")continue;let r=C6(o);r!==null&&n.push({metricId:o.metricId,kind:o.kind,poolKey:y6(o),display:r,nativeLabel:o.nativeLabel,durationMs:o.window?.durationMs??null,resetsAt:o.resetsAt,fetchedAt:o.fetchedAt,stale:hb(o,t)})}return n}function aD(e){return e.snapshot===null||e.credentialIdentity===null?null:x6(e.snapshot,e)?e.snapshot:null}function iD(e){for(let t of e)if(t.resetsAt!==null)return t.resetsAt;return null}function sD(e){let t=null;for(let n of e)n.fetchedAt!==null&&(t===null||n.fetchedAt<t)&&(t=n.fetchedAt);return t}me();function lD(e,t){let n=_(e),o=_(0),r=_(!1),[a,i]=G(e),[s,l]=G(null),[d,c]=G(!1);a!==e&&(i(e),n.current=e,o.current+=1,r.current=!1,l(null),c(!1));let f=B(async()=>{if(r.current)return;let p=o.current+1;o.current=p;let m=e;r.current=!0,c(!0);try{let h=await t();if(o.current!==p||n.current!==m)return;l(h)}catch{if(o.current!==p||n.current!==m)return;l({outcome:"error",retryAt:null})}finally{o.current===p&&n.current===m&&(r.current=!1,c(!1))}},[e,t]);return{feedback:s,refreshing:d,refresh:f}}function dD(e,t){switch(e.unit){case"days":return t("sourceMetrics.windowDays",{count:e.count});case"hours":return t("sourceMetrics.windowHours",{count:e.count});case"minutes":return t("sourceMetrics.windowMinutes",{count:e.count});case"seconds":return t("sourceMetrics.windowSeconds",{count:e.count})}}function cD(e,t){let n=e.nativeLabel?.trim()??"";if(n.length>0)return n;let o=gb(e.durationMs);return o!==null?dD(o,t):S6(e.kind,t)}function b6(e,t){switch(e.kind){case"unlimited":return t("sourceMetrics.unlimited");case"money":return`${e.currency} ${e.amount}`;case"quantity":return`${e.amount} ${e.nativeUnit}`;case"percent":return e.direction==="used"?t("sourceMetrics.percentUsed",{value:e.amount}):t("sourceMetrics.percentRemaining",{value:e.amount})}}function I6(e,t){let n=b6(e.display,t);if(e.kind==="quota-window")return`${cD(e,t)} ${n}`;let o=e.nativeLabel?.trim()??"";return o.length>0?`${o} ${n}`:n}function S6(e,t){switch(e){case"balance":return t("sourceMetrics.kindBalance");case"credits":return t("sourceMetrics.kindCredits");case"quota-window":return t("sourceMetrics.kindQuotaWindow");case"spend-cap":return t("sourceMetrics.kindSpendCap");case"rate-limit":return t("sourceMetrics.kindRateLimit")}}function w6(e,t){switch(e){case"account":return t("sourceMetrics.scopeAccount");case"org":return t("sourceMetrics.scopeOrg");case"project":return t("sourceMetrics.scopeProject");case"key":return t("sourceMetrics.scopeKey");case"endpoint":return t("sourceMetrics.scopeEndpoint");case"model-group":return t("sourceMetrics.scopeModelGroup");case"model":return t("sourceMetrics.scopeModel");case"unknown":return t("sourceMetrics.scopeUnknown")}}function zu(e){return Jr(e,"locale")||e}function T6(e,t){switch(e.outcome){case"fresh":return t("sourceMetrics.outcomeFresh");case"partial":return t("sourceMetrics.outcomePartial");case"joined-inflight":return t("sourceMetrics.outcomeJoinedInflight");case"rate-limited":return e.retryAt===null?t("sourceMetrics.outcomeRateLimited"):t("sourceMetrics.outcomeRateLimitedUntil",{time:zu(e.retryAt)});case"offline":return t("sourceMetrics.outcomeOffline");case"unsupported":return t("sourceMetrics.outcomeUnsupported");case"error":return t("sourceMetrics.outcomeError")}}function L6(e,t,n){return e.capability.status==="unsupported"?n("sourceMetrics.unsupported"):e.credentialIdentity===null||e.capability.status==="unknown"?n("sourceMetrics.unknown"):t.length>0?null:e.loading?n("sourceMetrics.loading"):e.error!==null?n("sourceMetrics.outcomeError"):n("sourceMetrics.noData")}function vb(e,t){let n=mb(t,e.unit);return n===null?null:e.unit.kind==="money"?`${e.unit.currency} ${n}`:e.unit.kind==="percent"?`${n}%`:`${n} ${e.unit.nativeUnit}`}function uD(e){let[t,n]=G(!1);return u(k6,{...e,expanded:t,onToggleExpanded:()=>n(o=>!o)})}function k6(e){let{expanded:t,onToggleExpanded:n,onRefresh:o,...r}=e,{t:a}=De(),i=nD(r),{feedback:s,refreshing:l,refresh:d}=lD(i,o),c=r.capability.status==="supported"&&r.credentialIdentity!==null?aD(r):null,f=c?.metrics??[],p=rD(f,r.error),m=p.some(S=>S.stale)||r.error!==null&&c!==null,h=iD(p),g=sD(f),v=l,x=L6(r,p,a),y=oD(r),w=`${Wr()}-source-metrics-details`,k=[...p.map(S=>({key:`${S.metricId}\0${S.poolKey}`,text:I6(S,a)})),...h===null?[]:[{key:"resets-at",text:a("sourceMetrics.resetsAt",{time:zu(h)})}]];return b("div",{className:"min-w-0 px-3 pt-1 sm:px-4","data-composer-source-metrics":"true","data-source-id":r.sourceId,"data-next-message":r.isNextMessage?"true":"false","data-refresh-outcome":s?.outcome??"",children:[b("div",{className:"flex min-w-0 items-start gap-1.5",children:[u(te,{type:"button",variant:"ghost",size:"sm",className:"h-auto min-h-control-3 min-w-0 flex-1 justify-start px-1 py-1 text-left whitespace-normal","aria-expanded":t,"aria-controls":w,"aria-label":a(t?"sourceMetrics.hideDetails":"sourceMetrics.showDetails"),onClick:n,children:b("div",{className:"flex min-w-0 flex-1 flex-col items-stretch gap-0.5",children:[b("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:r.sourceLabel}),r.isNextMessage?u("span",{className:"text-[11px] text-muted-foreground",children:a("modelPicker.nextMessage")}):null,m?u("span",{className:"text-[11px] text-muted-foreground","data-composer-source-metrics-stale":"true",children:a("sourceMetrics.stale")}):null,u(pn,{"aria-hidden":"true",className:F("ml-auto size-icon-2 shrink-0 text-secondary-label",t?"rotate-180":"rotate-0")})]}),u("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5 text-[11px] tabular-nums text-secondary-label",children:k.length>0?k.map((S,L)=>b("span",{children:[L>0?u("span",{"aria-hidden":"true",children:" \xB7 "}):null,S.text]},S.key)):x})]})}),y?u(te,{type:"button",size:"xs",variant:"ghost",className:"mt-0.5 shrink-0 text-secondary-label","aria-label":a("sourceMetrics.refreshAria",{source:r.sourceLabel}),disabled:v,onClick:()=>{d()},children:a(v?"sourceMetrics.refreshing":"sourceMetrics.refresh")}):null]}),t?b("div",{id:w,className:"max-h-36 space-y-2 overflow-y-auto overscroll-contain px-1 pb-1 pt-1.5","data-composer-source-metrics-details":"true",children:[f.length===0?u("p",{className:"text-[11px] text-secondary-label",children:x??a("sourceMetrics.noData")}):f.map(S=>u(P6,{metric:S,queryError:r.error,t:a},S.metricId)),g!==null?u("p",{className:"text-[11px] text-secondary-label",children:a("sourceMetrics.collectedAt",{time:zu(g)})}):null]}):null,s!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:T6(s,a)}):r.error!==null&&c!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:a("sourceMetrics.errorKeepLast")}):null]})}function P6({metric:e,queryError:t,t:n}){let o=vb(e,e.used),r=e.unlimited===!0?n("sourceMetrics.unlimited"):vb(e,e.remaining),a=vb(e,e.limit),i=n("sourceMetrics.sharedScope",{scope:w6(e.scope.kind,n)}),s=e.scope.quotaPoolId===null?null:n("sourceMetrics.pool",{id:e.scope.quotaPoolId}),l=hb(e,t),d=e.window?.durationMs??null,c=gb(d),f=cD({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:d},n);return b("div",{className:"text-[11px] text-secondary-label","data-metric-id":e.metricId,"data-metric-kind":e.kind,"data-quota-pool":e.scope.quotaPoolId??"","data-window-ms":d===null?void 0:String(d),children:[b("div",{className:"font-medium text-foreground",children:[f,e.provenance==="estimated"?u("span",{className:"ms-2 font-normal text-muted-foreground",children:n("sourceMetrics.estimated")}):null,l?u("span",{className:"ms-2 font-normal text-muted-foreground",children:n("sourceMetrics.stale")}):null]}),b("div",{className:"mt-0.5 flex flex-wrap gap-x-2 tabular-nums",children:[o!==null?b("span",{children:[o," ",n("sourceMetrics.used")]}):null,r!==null?b("span",{children:[r," ",e.unlimited===!0?null:n("sourceMetrics.remaining")]}):null,a!==null?b("span",{children:[a," ",n("sourceMetrics.limit")]}):null]}),b("div",{className:"mt-0.5",children:[i,e.scope.identity!==null?` \xB7 ${e.scope.identity}`:null,s!==null?` \xB7 ${s}`:null]}),e.fetchedAt!==null?u("div",{children:n("sourceMetrics.collectedAt",{time:zu(e.fetchedAt)})}):null,e.resetsAt!==null?u("div",{children:n("sourceMetrics.resetsAt",{time:zu(e.resetsAt)})}):null,c!==null?u("div",{children:dD(c,n)}):null,e.window?.nativePeriod!==null&&e.window?.nativePeriod!==void 0?u("div",{children:e.window.nativePeriod}):null]})}function md(e){return e===null||!Number.isFinite(e)?"0":e<1e3?`${Math.round(e)}`:e<1e4?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:e<1e6?`${Math.round(e/1e3)}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function fD(e,t){if(!e)return null;let n=t.get(e.instanceId)?.find(o=>o.slug===e.model);return n?ud(n):e.model}function pD(e,t,n){return typeof n=="number"&&n>0?e("contextWindow.compactsAtThreshold",{threshold:n.toLocaleString()}):t?e("contextWindow.compactsForModel",{model:t}):e("contextWindow.compactsWhenNeeded")}function A6(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function mD(e){let{t}=De(),{usage:n,modelDisplayName:o,onCompact:r,compactDisabled:a,compactDisabledReason:i}=e,s=A6(n.usedPercentage),l=Math.max(0,Math.min(100,n.usedPercentage??0)),d=9.75,c=2*Math.PI*d,f=c*(1-l/100),p=n.totalProcessedTokens??null,m=p!==null&&p>0,g=l>90?"var(--color-error)":"color-mix(in oklab, var(--color-muted-foreground) 72%, transparent)";return b(fl,{children:[u(ml,{openOnHover:!0,delay:150,closeDelay:r?150:0,render:u(te,{size:"icon-sm",variant:"ghost-muted",className:"size-7 rounded-full hover:text-muted-foreground data-pressed:text-muted-foreground","aria-label":n.maxTokens!==null&&s?`Context window ${s} used`:`Context window ${md(n.usedTokens)} tokens used`,children:u("span",{className:"relative flex size-5 items-center justify-center",children:b("svg",{viewBox:"0 0 24 24",className:"-rotate-90 absolute inset-0 size-full transform-gpu mx-0!","aria-hidden":"true",children:[u("circle",{cx:"12",cy:"12",r:d,fill:"none",stroke:"color-mix(in oklab, var(--color-muted-foreground) 24%, transparent)",strokeWidth:"3"}),u("circle",{cx:"12",cy:"12",r:d,fill:"none",stroke:g,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:f})]})})})}),u(pl,{tooltipStyle:!0,side:"top",align:"end",viewportClassName:"p-0",className:"w-64 max-w-none text-left whitespace-normal",children:b("div",{className:"flex flex-col gap-2 p-[var(--floating-content-inset)]",children:[b("div",{className:"flex items-center justify-between gap-3",children:[u("div",{className:"font-medium text-muted-foreground text-xs",children:t("contextWindow.title")}),n.maxTokens!==null&&s?b("div",{className:"text-secondary-label text-[11px] tabular-nums",children:[u("span",{children:s}),u("span",{className:"mx-1",children:"\xB7"}),b("span",{children:[md(n.usedTokens),"/",md(n.maxTokens??null)]})]}):u("div",{className:"text-secondary-label text-[11px] tabular-nums",children:md(n.usedTokens)})]}),n.maxTokens!==null?u("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-muted/60",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(l),"aria-label":t("contextWindow.usage"),children:u("div",{className:"h-full rounded-full transition-[width,background-color] duration-500 ease-out motion-reduce:transition-none",style:{width:`${l}%`,backgroundColor:g}})}):null,m?b("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.totalProcessed")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:md(p)})]}):null,n.compactsAutomatically?u("div",{className:"mt-1 text-pretty text-secondary-label text-[11px] font-medium",children:pD(t,o,n.autoCompactThreshold)}):null,r?b(be,{children:[b(te,{size:"xs",variant:"outline",className:"mt-1 w-full justify-center",disabled:a,onClick:r,children:[u(Kd,{"aria-hidden":"true"}),t("contextWindow.compactContext")]}),a&&i?u("div",{className:"text-pretty text-secondary-label text-[11px]",children:i}):null]}):null]})})]})}function xb(e,t){let n=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name}]:[]);if(n.length===0)return null;let o=n.findIndex(r=>r.id===t);return o<0?null:{images:n.map(r=>({src:r.src,name:r.name})),index:o}}function yb(e,t){let n=e.trim().length-t;if(n<=0)return null;let o=n===1?"character":"characters";return`Prompt is ${n.toLocaleString("en-US")} ${o} over the ${t.toLocaleString("en-US")}-character limit. Shorten or split it before sending.`}function Cb(e){return e.submissionTarget==="provider-turn"?yb(e.providerInput??e.prompt,e.maxInputChars):null}function gD(e){let t=e.disabledReason??Cb(e);return t?(e.event?.preventDefault(),{validationMessage:t,didDispatch:!1}):e.onSend(e.event)===!1?(e.event?.preventDefault(),{validationMessage:null,didDispatch:!1}):{validationMessage:null,didDispatch:!0}}function hD({message:e}){return e?u("p",{role:"alert",className:"px-3 pb-2 text-xs text-destructive sm:px-4","data-chat-composer-validation":"prompt-length",children:e}):null}function E6(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width}function vD(e){let t=Ot(),n=cf(),o=t.pane.useActive(),[r,a]=G(null);return ye(()=>{if(!o)return;let i=e.anchor;if(!i){a(null);return}let s=!0,l=()=>{if(!s)return;let c=i.closest('[data-chat-composer-form="true"]'),p=(c?.querySelector('[data-chat-composer-main-surface="true"]')??c??i).getBoundingClientRect(),m=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)||16,g=(Number.parseFloat(window.getComputedStyle(c??i).getPropertyValue("--chat-composer-drawer-inset"))||1.375)*m,v=m+1,x={bottom:window.innerHeight-p.top-v,left:p.left+g,maxHeight:Math.max(96,p.top-24+v),width:Math.max(0,p.width-g*2)};a(y=>y&&E6(y,x)?y:x)};l(),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0);let d=typeof ResizeObserver>"u"?null:new ResizeObserver(l);if(d){d.observe(i);for(let c=i.parentElement;c;c=c.parentElement)d.observe(c)}return()=>{s=!1,d?.disconnect(),window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0)}},[e.anchor,o]),!o||!r?null:t.createPortal(u("div",{className:F(n,"pointer-events-auto fixed z-[70]"),"data-composer-drawer-layer":"true",style:{bottom:r.bottom,left:r.left,maxHeight:r.maxHeight,width:r.width},children:e.children}),document.body)}var M6=['[data-composer-drawer-layer="true"]','[data-slot="popover-popup"]','[data-slot="menu-popup"]','[data-slot="select-popup"]','[data-slot="combobox-popup"]','[data-slot="autocomplete-popup"]'].join(","),bb=(e,t,n)=>n.endsWith(" ")&&e[t]===" "?t+1:t,R6=(e,t)=>{let n=new Map(e.map(o=>[o.id,o]));return t.flatMap(o=>{let r=n.get(o);return r?[r]:[]})},N6=(e,t)=>e.length===t.length&&e.every((n,o)=>n.id===t[o]);function _6(e){return e.closest(M6)!==null}var D6=ue(function(t){let{t:n}=De(),o=Rg(),r=o(t.runtimeMode),a=r.icon,i=t.runtimeModeSwitch==="next-turn",s=t.interactionMode==="plan"?"Plan mode \u2014 click to return to normal build mode":"Default mode \u2014 click to enter plan mode",l=t.nativeMode!==null,d=t.showInteractionModeToggle&&!l?b(be,{children:[u(Jd,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),b(Qe,{children:[b(Ye,{render:u($r,{className:F("shrink-0 whitespace-nowrap",t.interactionMode==="plan"?"bg-accent text-accent-foreground hover:bg-accent/90":"text-secondary-label hover:text-foreground"),type:"button",onClick:t.onToggleInteractionMode,"aria-label":s}),children:[t.interactionMode==="plan"?u(mr,{icon:Vd,className:"text-current opacity-100"}):u(mr,{icon:Vi,opticalSize:"large"}),u("span",{className:"sr-only sm:not-sr-only",children:t.interactionMode==="plan"?"Plan":"Build"})]}),u(Xe,{side:"top",children:s})]})]}):null,c=b(be,{children:[u(Jd,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),b(Qe,{children:[b(xf,{value:t.runtimeMode,onValueChange:f=>t.onRuntimeModeChange(f),children:[b(Ye,{render:u(kg,{className:"font-medium","aria-label":"Runtime mode"}),children:[u(mr,{icon:a}),u(bf,{children:r.label})]}),b(Cf,{alignItemWithTrigger:!1,children:[Mg.map(f=>{let p=o(f),m=p.icon;return u(yf,{value:f,hideIndicator:!0,className:"min-w-64 py-2",children:u("div",{className:"flex min-w-0 items-center gap-3",children:b("div",{className:"grid min-w-0 flex-1 gap-0.5",children:[b("span",{className:"inline-flex items-center gap-1.5 font-medium text-foreground",children:[u(m,{className:"size-icon-2 shrink-0 text-muted-foreground"}),p.label]}),u("span",{className:"text-muted-foreground text-xs leading-4",children:p.description})]})})},f)}),i?u("div",{className:"border-t px-2 py-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]})]}),u(Xe,{side:"top",children:i?`${r.description} ${n("runtimeMode.appliesNextTurnHint")}`:r.description})]}),i?u("span",{className:"hidden whitespace-nowrap text-muted-foreground text-xs sm:inline",children:n("runtimeMode.appliesNextTurn")}):null]});return b(be,{children:[t.nativeMode?b(be,{children:[u(Jd,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),u(B_,{nativeMode:t.nativeMode,canSwitch:t.canSwitchNativeMode,onNativeModeChange:t.onNativeModeChange})]}):c,d]})}),O6=ue(function(t){return b(be,{children:[t.activeContextWindow?u(mD,{usage:t.activeContextWindow,modelDisplayName:t.activeThreadModelDisplayName,onCompact:t.onCompactContext,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason}):null,t.isPreparingWorktree?u("span",{className:"text-secondary-label text-xs",children:"Preparing worktree..."}):null,u(Fu,{compact:t.compact,pendingAction:t.pendingAction,isRunning:t.isRunning,showPlanFollowUpPrompt:t.showPlanFollowUpPrompt,promptHasText:t.promptHasText,isSendBusy:t.isSendBusy,sendDisabledReason:t.sendDisabledReason,isConnecting:t.isConnecting,isEnvironmentUnavailable:t.isEnvironmentUnavailable,isPreparingWorktree:t.isPreparingWorktree,hasSendableContent:t.hasSendableContent,preserveComposerFocusOnPointerDown:t.preserveComposerFocusOnPointerDown??!1,showSendWhileRunning:t.showSendWhileRunning??!1,onPreviousPendingQuestion:t.onPreviousPendingQuestion,onInterrupt:t.onInterrupt,onImplementPlanInNewThread:t.onImplementPlanInNewThread})]})}),xD=ue(function(t){let{composerDraftTarget:n,environmentId:o,attachmentUploadsCapabilityKnown:r,supportsAttachmentUploads:a,routeKind:i,routeThreadRef:s,draftId:l,activeThreadId:d,activeThreadEnvironmentId:c,activeThread:f,isServerThread:p,isLocalDraftThread:m,forceExpandedOnMobile:h,projectSelectionRequired:g,phase:v,isConnecting:x,isSendBusy:y,sendDisabledReason:C,isPreparingWorktree:w,environmentUnavailable:k,activePendingApproval:S,onRespondToComposerDecision:L,pendingUserInputs:I,activePendingProgress:T,activePendingResolvedAnswers:E,activePendingIsResponding:A,activePendingDraftAnswers:N,activePendingQuestionIndex:R,respondingRequestIds:$,occupants:H,showPlanFollowUpPrompt:K,activeProposedPlan:O,activeTasksProgress:oe,activeTaskSteps:ee,runtimeMode:W,interactionMode:qe,lockedProvider:ve,providerStatuses:fe,activeProjectDefaultModelSelection:Ne,projectId:Ae=null,activeThreadModelSelection:ae,selectedExecutionSelection:Ee,composerChoices:xe,selectedExecutionReady:re,selectedModelOptionDescriptors:Ie,onModelPickerOpenChange:st,onClearExecutionSelection:dt,executionAppliesTo:lt,activeContextWindow:ct,compactDisabled:Et,compactDisabledReason:ot,resolvedTheme:He,settings:Se,keybindings:ze,terminalOpen:Je,gitCwd:qt,promptRef:X,composerRef:nn,composerImagesRef:xt,composerTerminalContextsRef:mn,composerElementContextsRef:Tt,sendContextRef:Yt,onSend:Jt,onInterrupt:Mt,onCompactContext:zn,onImplementPlanInNewThread:kn,onRespondToApproval:vn,onSelectActivePendingUserInputOption:$n,onAdvanceActivePendingUserInput:Vt,onPreviousActivePendingUserInputQuestion:Zt,onChangeActivePendingUserInputCustomAnswer:Sn,onProviderModelSelect:ho,onModelSelectionChosen:zt,onExecutionSelectionChosen:D,onSelectPluginAction:Y,onManagePlugins:ce,getModelDisabledReason:ie,getModelContinuationLabel:pe,onContinueInModel:Ze,toggleInteractionMode:pt,handleRuntimeModeChange:xn,handleInteractionModeChange:ht,handleNativeModeChange:en,focusComposer:tn,scheduleComposerFocus:bt,setThreadError:yn,onExpandImage:sn}=t,ge=t.api,{limits:Rt}=t.attachments,{t:rt}=De(),Lt=ge.draft.useThreadDraft(n),et=Lt.prompt,Nt=Lt.images,ut=z(()=>Nt.filter(P=>av(P)==="image"),[Nt]),ft=Lt.terminalContexts,eo=Lt.elementContexts,ln=Lt.previewAnnotations,Nn=Lt.reviewComments,Hn=Lt.nonPersistedImageIds,Un=ge.uploads.useStore(P=>P.uploadsByImageId),ne=a?mT({imageIds:Nt.map(P=>P.id),uploadsByImageId:Un,environmentId:o}):null,Fe=ge.draft.useStore,at=Fe(P=>P.setPrompt),je=Fe(P=>P.setNativeMode),wn=Fe(P=>P.addImage),dn=Fe(P=>P.addImages),Cn=Fe(P=>P.removeImage),$t=Fe(P=>P.insertTerminalContext),Kn=Fe(P=>P.removeTerminalContext),Wt=Fe(P=>P.setTerminalContexts),vo=Fe(P=>P.removeElementContext),Wa=Fe(P=>P.removePreviewAnnotation),Ga=Fe(P=>P.removeReviewComment),Ni=Fe(P=>P.clearComposerPromptAndImages);q(()=>{if(r){if(!a){for(let P of Nt)ge.uploads.release(P.id);return}ge.draft.restoreAttachments();for(let P of Nt)ge.uploads.start({environmentId:o,image:P})}},[r,Nt,o,a]);let he=z(()=>SN(ge.model.applyInstanceSettings(ge.model.deriveInstanceEntries(fe),Se)),[ge.model,fe,Se]),da=Lt.activeProvider??null,Go=f?.session?.providerInstanceId??ae?.instanceId??Ne?.instanceId??null,gd=wN(he,da??Go)??he[0]?.driverKind??ge.model.makeDriverKind("unconfigured"),ca=ve??gd,qn=z(()=>{if(!ve||!f)return null;let P=f.session?.providerInstanceId??ae?.instanceId;return P?he.find(V=>V.instanceId===P)?.continuationGroupKey??null:null},[f,ae?.instanceId,ve,he]),_t=z(()=>{let P=[Lt.activeProvider,f?.session?.providerInstanceId,ae?.instanceId,Ne?.instanceId];for(let Be of P){if(!Be)continue;let We=he.find(nt=>nt.instanceId===Be&&Sg(nt));if(We){if(ve&&We.driverKind!==ve||qn&&We.continuationGroupKey!==qn)continue;return We.instanceId}}let V=he.filter(Be=>(!ve||Be.driverKind===ve)&&(!qn||Be.continuationGroupKey===qn)),le=V.filter(Be=>Be.driverKind===ca);return wg(le,void 0)?.instanceId??wg(V,void 0)?.instanceId??ge.model.noProviderSelection.instanceId},[Ne?.instanceId,f?.session?.providerInstanceId,ae?.instanceId,Lt.activeProvider,qn,ve,he,ca]),ro=z(()=>he.find(P=>P.instanceId===_t),[he,_t]),on=ro===void 0,_i=ot??(on?"Compacting is unavailable right now":null),It=ro?.driverKind??ca,{modelOptions:xo,selectedModel:bn,executionSelection:_e}=ge.draft.useEffectiveModelState({threadRef:n,providers:fe,selectedProvider:It,selectedInstanceId:_t,threadModelSelection:ae,projectModelSelection:Ne,settings:Se}),Gt=Ee===void 0?_e:Ee,Eo=z(()=>ro?.snapshot??null,[ro]),gr=z(()=>{let P=ro?.models??[];if(!Gt||Ie===void 0)return P;let V=P.find(le=>le.slug===bn);return[...P.filter(le=>le.slug!==bn),{...V??{slug:bn,name:bn},capabilities:{...V?.capabilities,optionDescriptors:Ie}}]},[ro,Gt,Ie,bn]),Di=z(()=>V_(et),[et]),yo=z(()=>W_({provider:It,model:bn,models:gr,promptInjectionState:Di,modelOptions:xo?.[_t],planModeEnabled:Se.planModeEnabled},ge.model),[xo,Di,_t,bn,It,gr,Se.planModeEnabled]),Hr=yo.promptEffort,jo=Gt?xo?.[_t]??Gt.optionOverrides:yo.modelOptionsForDispatch,hr=Se.planModeEnabled,ao=z(()=>({showInteractionModeToggle:hr&&ge.model.getInteractionModeToggle(fe,It),runtimeModeSwitch:Vw(It)}),[hr,fe,It]),Ur=Eo?.supportsNativeModeSwitch===!0,ua=m&&Ur?Lt.nativeModeByProvider?.[_t]??null:null,Oi=z(()=>O_(Eo,m?ua:f?.session?.nativeModeId??f?.nativeModeId??null),[f?.session?.nativeModeId,f?.nativeModeId,Eo,m,ua]),_n=ua&&Oi?.current.id===ua?ua:void 0,Fi=B(P=>{m&&je(n,_t,P),en(P)},[m,je,n,_t,en]),Oo=z(()=>ge.model.createSelection(_t,bn,jo),[ge.model,_t,bn,jo]),Bi=z(()=>!Gt||!xe?.length?null:xe.find(P=>P.runtimeId===Gt.runtimeId&&P.sourceId===Gt.sourceId&&P.profileId===Gt.profileId&&(P.endpointId??void 0)===(Gt.endpointId??void 0))??null,[xe,Gt]),Fo=re??Bi?.ready===!0,vr=_(null);q(()=>{let P=f?.id??null,V=vr.current;vr.current={threadId:P,selection:Oo},!(V===null||V.threadId!==P||m)&&V.selection!==Oo&&zt?.(Oo)},[f?.id,m,zt,Oo]);let Qo=bn,io=z(()=>{let P=new Map;for(let V of he)P.set(V.instanceId,ge.model.getAppModelOptionsForInstance(Se,V));return P},[he,Se]),zi=z(()=>(io.get(_t)??[]).some(V=>V.slug===Qo)?Qo:ge.model.normalizeSlug(Qo,It)??Qo,[ge.model,io,_t,Qo,It]),Bo=m&&ve===null,$e=ge.pluginComposer.useOptions(Bo?o:null,Ae),vt=$e.options,cn=Bo?Lt.selectedPluginActionKey:null,rn=z(()=>cn===null?null:vt.find(P=>P.id===cn)??null,[cn,vt]),Qa=cn!==null,fa=Qa&&rn===null?rt($e.isKnown?"composer.pluginUnavailable":"composer.pluginLoading"):null,zo=C??fa??(T?null:ne),Kr=zo!==null,Og=z(()=>fD(ae,io),[ae,io]),un=`${String(o)}\0${String(n)}`,Fg=sr(et,et.length),Ys=Ba(un,et,{cursor:Fg,expandedCursor:et.length}),[$u,Bg]=G(()=>({documentKey:un,cursor:Ys.cursor})),pa=$u.documentKey===un?$u.cursor:Ys.cursor,U=B(P=>{Bg(V=>{let le=V.documentKey===un?V.cursor:Ba(un,X.current).cursor,Be=typeof P=="function"?P(le):P,We=X.current,nt=Ir(We,Be);return bM(un,We,Be,nt),V.documentKey===un&&V.cursor===Be?V:{documentKey:un,cursor:Be}})},[un,X]),[se,Re]=G(()=>lr(et,et.length)),[yt,gn]=G(null),[xr,Co]=G(null),[zg,Hu]=G(!1),[Uu,Ku]=G(!1);q(()=>{st?.(Uu)},[Uu,st]);let[ID,qu]=G(!1),[Vu,$g]=G(null),[SD,Hg]=G(null),[Ib,wD]=G(null),[Ug,ma]=G(!1),[hd,Js]=G(!1),[TD,Sb]=G(null),[Zs,Kg]=G({key:0,active:!1}),wb=_(un);ye(()=>{wb.current!==un&&(wb.current=un,Re(lr(et,Ys.expandedCursor)),gn(null),Co(null),Hu(!1),Ku(!1),$g(null),Hg(null),ma(!1),Js(!1),Sb(null),Kg({key:Zs.key,active:!1}))},[un,Ys.expandedCursor,et,Zs.key]);let yr=lp("max-sm"),so=yr&&!h&&!ID,ga=_(null),Tb=_(null),qg=_(null),Lb=_(null),Vg=_(!1),Wg=_(!1),kb=_(!1),Pb=_([]),Ab=_(null),bo=_(null),el=_(null),tl=_(null),Wu=_(!1),Eb=_(0),nl=_(null),Gg=_(new Set),$i=_(new Map),ol=z(()=>ge.chat.deriveComposerSendState({prompt:et,imageCount:Nt.length,terminalContexts:ft,elementContextCount:eo.length+ln.length+Nn.length}),[eo.length,Nt.length,ln.length,Nn.length,ft,et]),rl=se?.kind??null,Mb=se?.kind==="path"?se.query:"",Rb=rl==="path",jg=ge.pathSearch.useComposerPathSearch({environmentId:o,cwd:Rb?qt:null,query:Rb?Mb:null}),$o=z(()=>{if(!se)return[];if(se.kind==="path")return jg.entries.map(P=>({id:`path:${P.kind}:${P.path}`,type:"path",path:P.path,pathKind:P.kind,label:pu(P.path),description:P.path.slice(0,Math.max(0,P.path.lastIndexOf("/")))}));if(se.kind==="slash-command"){let P=[{id:"slash:model",type:"slash-command",command:"model",label:"/model",description:"Switch response model for this thread"},...hr?[{id:"slash:plan",type:"slash-command",command:"plan",label:"/plan",description:"Switch this thread into plan mode"},{id:"slash:default",type:"slash-command",command:"default",label:"/default",description:"Switch this thread back to normal build mode"}]:[]],V=hM(Eo?.skills??[],Se.showSkillsInSlashMenu),le=vM(Eo?.slashCommands??[],V).map(kt=>({id:`provider-slash-command:${It}:${kt.name}`,type:"provider-slash-command",provider:It,command:kt,label:`/${kt.name}`,description:kt.description??kt.input?.hint??"Run provider command"})),Be=se.query.trim().toLowerCase(),We=V.map(kt=>({id:`skill:${It}:${kt.name}`,type:"skill",provider:It,skill:kt,label:`/skill:${kt.name}`,description:kt.shortDescription??kt.description??(kt.scope?`${kt.scope} skill`:"")})),nt=[...P,...le,...We];return $_(nt,Be)}return se.kind==="skill"?z_(Eo?.skills??[],se.query).map(P=>({id:`skill:${It}:${P.name}`,type:"skill",provider:It,skill:P,label:sa(P),description:P.shortDescription??P.description??(P.scope?`${P.scope} skill`:"Run provider skill")})):[]},[se,hr,It,Eo,Se.showSkillsInSlashMenu,jg.entries]),Hi=!!se,Xa=se?`${se.kind}:${se.query.trim().toLowerCase()}`:null,Nb=z(()=>{let P=ab({items:$o,highlightedItemId:yt,currentSearchKey:Xa,highlightedSearchKey:xr});return $o.find(V=>V.id===P)??null},[yt,xr,$o,Xa]);kb.current=Hi,Pb.current=$o,Ab.current=Nb;let LD=z(()=>new Set(Hn),[Hn]),Vn=S!==null,Gu=I[0]??null,_b=T?.activeQuestion?.allowFreeform===!1,vd=H[0]??null,{showTopDrawer:ju,showCollapsedPromptRow:kD,hasBlocking:xd}=qw(vd?.kind??null,so),PD=K||T!==null,{isComposerFooterCompact:yd,isComposerPrimaryActionsCompact:Db}=LT(qg,PD),AD=rl==="path"&&Mb.length>0&&jg.isPending,ED=z(()=>rl==="skill"?"No skills found. Try / to browse provider commands.":rl==="path"?"No matching files or folders.":"No matching command.",[rl]),Ob=B(P=>{if(P===X.current){bt();return}X.current=P,at(n,P);let V=sr(P,P.length);U(V),Re(lr(P,P.length)),bt()},[n,X,bt,at]),MD=j_({modelApi:ge.model,provider:It,instanceId:_t,...i==="server"?{threadRef:s}:{},...i==="draft"&&l?{draftId:l}:{},model:bn,models:gr,modelOptions:xo?.[_t],prompt:et,onPromptChange:Ob,planModeEnabled:Se.planModeEnabled}),Fb=Q_({modelApi:ge.model,provider:It,instanceId:_t,...i==="server"?{threadRef:s}:{},...i==="draft"&&l?{draftId:l}:{},model:bn,models:gr,modelOptions:xo?.[_t],prompt:et,onPromptChange:Ob,planModeEnabled:Se.planModeEnabled}),Qu=z(()=>T?{questionIndex:T.questionIndex,isLastQuestion:T.isLastQuestion,canAdvance:T.canAdvance,isResponding:A,isComplete:!!E}:null,[A,T,E]),RD=v==="running"||y||Kr||x||on||g||k!==null||!ol.hasSendableContent,ND="Send message",Cd=yr&&!so&&Qu!==null,al=B(P=>{at(n,P)},[n,at]),_D=B(P=>{wn(n,P)},[n,wn]),DD=B(P=>{dn(n,P)},[n,dn]),OD=B(P=>{ge.uploads.release(P),Cn(n,P)},[ge.uploads,n,Cn]),FD=B(P=>{let V=ft.findIndex(We=>We.id===P);if(V<0)return;let le=ge.terminalContext.removeInlinePlaceholder(X.current,V);X.current=le.prompt,al(le.prompt),Kn(n,P);let Be=sr(le.prompt,le.cursor);U(Be),Re(lr(le.prompt,le.cursor))},[n,ft,X,Kn,al]);ye(()=>{X.current=et,U(P=>ir(et,P))},[un,et,X,U]),q(()=>{if(Vu===null)return;let P=yb(et,Rt.maxInputChars);P!==Vu&&$g(P)},[Vu,Rt.maxInputChars,et]),q(()=>{Hg(null)},[eo,ln,Nn,ft,et,bn,Hr,It]),ye(()=>{xt.current=Nt},[Nt,xt]),ye(()=>{mn.current=ft},[ft,mn]),ye(()=>{Tt.current=eo},[eo,Tt]),q(()=>{if(!Hi){gn(null),Co(null);return}let P=ab({items:$o,highlightedItemId:yt,currentSearchKey:Xa,highlightedSearchKey:xr});gn(V=>V===P?V:P),Co(V=>V===Xa?V:Xa)},[yt,xr,$o,Hi,Xa]);let Xu=_(null);q(()=>{let P=T?.customAnswer;if(typeof P!="string"){Xu.current=null;return}let V=Gu?.requestId??null,le=T?.activeQuestion?.id??null,Be=Xu.current?.requestId!==V||Xu.current?.questionId!==le,We=X.current!==P;if(Xu.current={requestId:V,questionId:le},!Be&&!We)return;X.current=P;let nt=sr(P,P.length);U(nt),Re(lr(P,Ir(P,nt))),gn(null)},[T?.customAnswer,T?.activeQuestion?.id,Gu?.requestId,X]);let BD=B((P,V,le,Be,We)=>{if(T?.activeQuestion&&I.length>0){if(T.activeQuestion.allowFreeform===!1)return;U(V),Re(Be?null:lr(P,le)),Sn(T.activeQuestion.id,P,V,le,Be);return}X.current=P,al(P),N6(ft,We)||Wt(n,R6(ft,We)),U(V),Re(Be?null:lr(P,le))},[T?.activeQuestion,I.length,Sn,X,al,n,ft,Wt]),Ya=B((P,V,le,Be)=>{let We=X.current,nt=Math.max(0,Math.min(We.length,P)),kt=Math.max(nt,Math.min(We.length,V));if(Be?.expectedText!==void 0&&We.slice(nt,kt)!==Be.expectedText)return!1;let wt=tT(X.current,P,V,le),Mo=sr(wt.text,wt.cursor),Pn=Ir(wt.text,Mo);X.current=wt.text;let va=T?.activeQuestion;return va&&Gu?Sn(va.id,wt.text,Mo,Pn,!1):al(wt.text),U(Mo),Re(lr(wt.text,Pn)),Be?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{ga.current?.focusAt(Mo)}),!0},[T?.activeQuestion,Gu,Sn,X,al]),Yu=B(()=>{let P=ga.current?.readSnapshot();return P||{value:X.current,cursor:pa,expandedCursor:Ir(X.current,pa),terminalContextIds:ft.map(V=>V.id)}},[pa,ft,X]),Qg=B(()=>{let P=Yu();return{snapshot:P,trigger:lr(P.value,P.expandedCursor)}},[Yu]),Bb=B(P=>{if(Wg.current)return;Wg.current=!0,window.requestAnimationFrame(()=>{Wg.current=!1});let{snapshot:V,trigger:le}=Qg();if(le){if(P.type==="path"){let Be=`${Sc(P.path)} `,We=bb(V.value,le.rangeEnd,Be);Ya(le.rangeStart,We,Be,{expectedText:V.value.slice(le.rangeStart,We)})&&gn(null);return}if(P.type==="slash-command"){if(P.command==="model"){Ya(le.rangeStart,le.rangeEnd,"",{expectedText:V.value.slice(le.rangeStart,le.rangeEnd),focusEditorAfterReplace:!1})&&(gn(null),Ku(!0));return}ht(P.command==="plan"?"plan":"default"),Ya(le.rangeStart,le.rangeEnd,"",{expectedText:V.value.slice(le.rangeStart,le.rangeEnd)})&&gn(null);return}if(P.type==="provider-slash-command"){let Be=`/${P.command.name} `,We=bb(V.value,le.rangeEnd,Be);Ya(le.rangeStart,We,Be,{expectedText:V.value.slice(le.rangeStart,We)})&&gn(null);return}if(P.type==="skill"){let Be=`$${P.skill.name} `,We=bb(V.value,le.rangeEnd,Be);Ya(le.rangeStart,We,Be,{expectedText:V.value.slice(le.rangeStart,We)})&&gn(null);return}}},[Ya,ht,Qg]),zD=B(P=>{gn(P),Co(Xa)},[Xa]),zb=B(P=>{if($o.length===0)return;let V=$o.findIndex(kt=>kt.id===yt),We=((V>=0?V:P==="ArrowDown"?-1:0)+(P==="ArrowDown"?1:-1)+$o.length)%$o.length,nt=$o[We];gn(nt?.id??null)},[yt,$o]),$b=B(()=>{if(!yr)return;bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null);let P=document.activeElement;P instanceof HTMLElement&&P.blur(),qu(!1)},[yr]),Hb=B(()=>!yr||y||Kr||x||on||k!==null||v==="running"?!1:T?T.isLastQuestion&&!!E:K||ol.hasSendableContent,[T,E,ol.hasSendableContent,k,x,yr,y,Kr,on,v,K]),Xg=B((P,V="foreground")=>{if(on||Kr){P?.preventDefault();return}if(d&&($i.current.get(un)??0)>0){P?.preventDefault(),ge.notify.info("Still compressing a pasted image.","Send again once its thumbnail appears.");return}let le=gD({prompt:X.current,submissionTarget:T?"pending-user-input":"provider-turn",maxInputChars:Rt.maxInputChars,disabledReason:zo,event:P,onSend:Be=>(Vg.current=!1,Jt(Be,V),!Vg.current)});$g(le.validationMessage),le.didDispatch&&Hb()&&$b()},[d,T,$b,un,Kr,Rt.maxInputChars,on,Jt,X,zo,Hb]),$D=B(()=>{if(!(Et||on||ol.hasSendableContent||S!==null||I.length>0||v==="running"||y||x||!d)){if(($i.current.get(un)??0)>0){ge.notify.info("Still compressing a pasted image.","Compact again once its thumbnail appears.");return}zn()}},[S,d,Et,un,ol.hasSendableContent,x,y,on,zn,I.length,v]),Ju=B(()=>{bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null),el.current!==null&&window.cancelAnimationFrame(el.current),tl.current!==null&&window.cancelAnimationFrame(tl.current),Wu.current=!0,qu(!0),el.current=window.requestAnimationFrame(()=>{el.current=null,ga.current?.focusAtEnd(),tl.current=window.requestAnimationFrame(()=>{tl.current=null,Wu.current=!1})})},[]),HD=(P,V)=>{if(P==="Tab"&&V.shiftKey)return hr?(pt(),!0):!1;let{trigger:le}=Qg();if(kb.current||le!==null){let nt=Pb.current,kt=Ab.current??nt[0];if(P==="ArrowDown"&&nt.length>0)return zb("ArrowDown"),!0;if(P==="ArrowUp"&&nt.length>0)return zb("ArrowUp"),!0;if((P==="Enter"||P==="Tab")&&kt)return Bb(kt),!0}let We=P==="Enter"?Jw({isMobileViewport:yr,shiftKey:V.shiftKey,modifierKey:V.metaKey||V.ctrlKey,isDraftThread:i==="draft"}):null;return We?(Xg(void 0,We),!0):!1},Zu=ge.stash.useStore,il=Zu(P=>P.entries),Ub=Zu(P=>P.stashEntry),ef=Zu(P=>P.takeEntry),Kb=Zu(P=>P.finalizeEntryImages);q(()=>()=>{nl.current!==null&&window.clearTimeout(nl.current)},[]);let qb=B(()=>{Eb.current+=1,Kg({key:Eb.current,active:!0}),nl.current!==null&&window.clearTimeout(nl.current),nl.current=window.setTimeout(()=>{nl.current=null,Kg(P=>({...P,active:!1}))},1200)},[]),UD=B(P=>{let{entry:V,durable:le}=ef(P.id);if(!V)return;le||ge.notify.warning("Restored prompt may reappear in the stash","Browser storage rejected the update, so this entry could still be there after a reload."),ma(!1);let Be=X.current,We=P.prompt.length===0?Be:Be.trim().length?`${Be.replace(/\s+$/,"")}
3733
+ `)?e.slice(0,-1):e}function s6(e){return e.startsWith("diff --git")||e.includes(`
3734
+ diff --git`)}function N_(e,t){if(e.length===0)return[""];let n=`
3735
+ ${t}`,o=e.startsWith(t)?0:L_(e,n,0);if(o===-1)return[e];let r=[];o>0&&r.push(e.slice(0,o));let a=o;for(;;){let i=L_(e,n,a+1);if(i===-1)break;r.push(e.slice(a,i)),a=i}return r.push(e.slice(a)),r}function L_(e,t,n){let o=e.indexOf(t,n);return o===-1?-1:o+1}function P_(e){return e==null?e:_n(e)}function l6(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function ib(e){let t=e.slice(1);return _n(t===""?`
3736
+ `:t)}function sb(e,t,n){return e==="change"?{type:"change",additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:n,deletionLineIndex:t}}var __={light:"vscode-light-modern",dark:"vscode-dark-modern"};function O_(e){return e==="dark"?__.dark:__.light}var F_=2166136261,B_=16777619,d6=2654435769,c6=2246822507;function D_(e,t=F_,n=B_){let o=t>>>0;for(let r=0;r<e.length;r+=1)o^=e.charCodeAt(r),o=Math.imul(o,n)>>>0;return o>>>0}function u6(e,t="diff-panel"){let n=e.trim(),o=D_(n,F_,B_).toString(36),r=D_(n,d6,c6).toString(36);return`${t}:${n.length}:${o}:${r}`}function db(e){if(!e.isPartial)return e;let t=0,n=0,o=e.hunks.map(r=>{let a={...r,splitLineStart:t,unifiedLineStart:n};return t+=r.splitLineCount,n+=r.unifiedLineCount,a});return{...e,hunks:o,splitLineCount:t,unifiedLineCount:n,...e.cacheKey?{cacheKey:`${e.cacheKey}:compact-partial`}:{}}}function z_(e,t="diff-panel",n={}){if(!e)return null;let o=e.trim();if(o.length===0)return null;try{let a=A_(o,u6(o,t)).flatMap(i=>n.compactPartialHunkOffsets?i.files.map(db):i.files);return a.length>0?{kind:"files",files:a}:{kind:"raw",text:o,reason:"Unsupported diff format. Showing raw patch."}}catch{return{kind:"raw",text:o,reason:"Failed to parse patch. Showing raw patch."}}}function $_(e){let t=e.cacheKey;return t?t.endsWith(":hydrated")?t.slice(0,-9):t:`${e.prevName??"none"}:${e.name}`}function H_({fileChange:e,onOpenDiff:t}){let{t:n}=De(),[o,r]=G(!1),a=z(()=>m_(e),[e]),i=h_(e);return b("div",{className:"min-w-0",children:[b("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[u("span",{className:"min-w-0 shrink truncate font-mono text-[11px] text-foreground/85",children:e.path}),u("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground tabular-nums",children:n("approval.diff.stat",{additions:i.additions,deletions:i.deletions})}),a===null?u("span",{className:"text-[11px] text-muted-foreground",children:e.omitted==="too-large"?n("approval.diff.tooLarge"):n("approval.diff.unavailable")}):b(ne,{size:"micro",variant:"ghost-muted",className:"font-normal","aria-expanded":o,onClick:()=>r(s=>!s),children:[o?u(dn,{className:"size-3 shrink-0"}):u(Go,{className:"size-3 shrink-0"}),u("span",{children:n(o?"approval.diff.hide":"approval.diff.show")})]}),t?u(ne,{size:"micro",variant:"ghost-muted",className:"font-normal",onClick:()=>t(e.path),children:n("approval.diff.open")}):null]}),o&&a!==null?u(f6,{path:e.path,unifiedDiff:a}):null]})}function f6({path:e,unifiedDiff:t}){let n=Ot().theme.useResolvedTheme(),o=z(()=>{let r=z_(t,`approval:${n}`,{compactPartialHunkOffsets:!0});return r?.kind==="files"?r.files.map(a=>({id:$_(db(a)),type:"diff",fileDiff:a,collapsed:!1})):[]},[n,t]);return o.length===0?u("pre",{"aria-label":e,className:"mt-1 max-h-56 overflow-auto rounded-md border border-border/60 bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-muted-foreground/90 [scrollbar-width:thin]",tabIndex:0,children:t}):u("div",{className:"mt-1 overflow-hidden rounded-md border border-border/60",children:u(cS,{className:"max-h-56 overflow-auto [scrollbar-gutter:stable]",items:o,options:{diffStyle:"unified",lineDiffType:"none",overflow:"wrap",theme:O_(n),themeType:n,stickyHeaders:!1}})})}var p6="block max-h-20 min-w-0 overflow-auto whitespace-pre font-mono text-[11px] text-foreground/85 [scrollbar-width:thin] [&::-webkit-scrollbar]:h-1.5",U_=de(function({approval:t,pendingCount:n,onOpenDiff:o,className:r}){let{t:a}=De(),i=c_(t),{body:s}=i,l=g_(i.fileChanges);return b("div",{"aria-label":f_(i.kind,a),className:O("flex min-w-0 flex-1 flex-col gap-1",r),role:"group",children:[b("div",{className:"flex min-w-0 items-baseline gap-2",children:[u("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:u_(i,a)}),n>1?b("span",{className:"shrink-0 text-[10px] font-medium text-muted-foreground tabular-nums",children:["1/",n]}):null]}),s.shape==="none"?null:u("code",{"aria-label":p_(s.shape,a),className:O(p6,s.shape==="path"||s.shape==="url"?"truncate":null),"data-approval-detail":"complete",tabIndex:0,children:s.shape==="command"?s.command:s.shape==="path"?s.path:s.shape==="url"?s.url:s.shape==="query"?s.query:s.text}),i.description===null?null:u("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:i.description}),i.fileChanges.map((d,c)=>u(H_,{fileChange:d,onOpenDiff:o},l[c])),i.args.length===0?null:b("details",{className:"min-w-0","data-approval-args":"true",children:[u("summary",{className:"cursor-pointer text-[11px] text-muted-foreground",children:a("approval.body.detailsSummary")}),u("dl",{"aria-label":a("approval.body.argumentsLabel"),className:"mt-1 grid max-h-32 min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5 overflow-auto rounded-md border border-border/60 bg-background/60 p-2 text-[11px] [scrollbar-width:thin]",tabIndex:0,children:i.args.map(d=>b("div",{className:"col-span-2 grid grid-cols-subgrid",children:[u("dt",{className:"font-mono text-muted-foreground",children:d.name}),u("dd",{className:"min-w-0 font-mono whitespace-pre-wrap wrap-break-word text-foreground/85",children:d.value})]},d.name))})]})]})});var cb=de(function(t){return u(U_,{...t})});ge();var ub=de(function(t){let{t:n}=De(),[o,r]=G(!1),[a,i]=G(!1),s=t.decision,l=s.requestId;if(l===null)return null;let d=f=>f.key===void 0?f.text:n(f.key,{...f.params,defaultValue:f.text}),c=s.askedBy.kind==="plugin"?s.askedBy.pluginId:null;return b("div",{className:O("flex min-w-0 flex-col gap-1 px-3 py-1.5 sm:px-4",t.className),"data-composer-pending-decision":"true",children:[b("div",{className:"flex min-w-0 items-baseline gap-2",children:[u("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:d(s.title)}),c===null?null:u("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:c})]}),s.body.map((f,p)=>u("span",{className:"min-w-0 text-[11px] text-muted-foreground",children:d(f)},`${String(p)}:${f.key??f.text}`)),s.detail===null?null:u("button",{type:"button",className:"min-w-0 truncate text-left font-mono text-[11px] text-muted-foreground",onClick:()=>r(f=>!f),children:o?s.detail.text.slice(0,4e3):s.detail.text.split(`
3737
+ `)[0]}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-1 pt-0.5",children:s.options.map(f=>u(ne,{size:"xs",variant:f.tone==="primary"?"default":f.tone==="danger"?"destructive":"outline",disabled:a,onClick:()=>{i(!0),t.onRespond(l,f.id)},children:d(f.label)},f.id))})]})});function Bg(e){return e.id??e.label}function fb(e,t){return Array.from(new Set((t??[]).flatMap(n=>{let o=e.options.find(r=>r.id!==void 0?r.id===n:r.label===n.trim());return o?[Bg(o)]:[]})))}function m6(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function pb(e,t){let n=m6(t?.customAnswer);if(e.allowFreeform!==!1&&n)return n;let o=fb(e,t?.selectedOptionLabels);return e.multiSelect?o.length>0?o:null:o[0]??null}function g6(e,t){let n={};for(let o of e){let r=pb(o,t[o.id]);if(!r)return null;n[o.id]=r}return n}function h6(e,t){return e.reduce((n,o)=>pb(o,t[o.id])?n+1:n,0)}function K_(e,t,n){let o=e.length===0?0:Math.max(0,Math.min(n,e.length-1)),r=e[o]??null,a=r?t[r.id]:void 0,i=r?pb(r,a):null,s=r?.allowFreeform===!1?"":a?.customAnswer??"",l=h6(e,t),d=e.length===0?!0:o>=e.length-1;return{questionIndex:o,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?fb(r,a?.selectedOptionLabels):[],customAnswer:s,resolvedAnswer:i,usingCustomAnswer:s.trim().length>0,answeredQuestionCount:l,isLastQuestion:d,isComplete:g6(e,t)!==null,canAdvance:!!i}}ge();var q_=de(function({pendingUserInputs:t,respondingRequestIds:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){if(t.length===0)return null;let s=t[0];return s?u(v6,{prompt:s,isResponding:n.includes(s.requestId),answers:o,questionIndex:r,onToggleOption:a,onAdvance:i},s.requestId):null}),v6=de(function({prompt:t,isResponding:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){let{t:s}=De(),l=Ot(),d=K_(t.questions,o,r),c=d.activeQuestion,f=D(null),p=D(i),[m,h]=G(null),[g,v]=G(null),x=g!==null&&g===c?.id;K(()=>{p.current=i},[i]),K(()=>{if(!(!c||c.multiSelect||!m)){if(m.questionId!==c.id){h(null);return}d.customAnswer.trim().length===0&&d.selectedOptionLabels.includes(m.optionLabel)&&h(null)}},[c,m,d.customAnswer,d.selectedOptionLabels]),K(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);let y=B((S,L)=>{if(c?.multiSelect){a(S,L);return}h({questionId:S,optionLabel:L}),a(S,L),f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{f.current=null,p.current()},200)},[c,a]);if(l.pane.useKeydown(S=>{if(!c||n||x||S.metaKey||S.ctrlKey||S.altKey||S.isComposing||S.keyCode===229||Og(S.target))return;let L=nb(S.key,c.options.length);if(L===null)return;let w=c.options[L];w&&(S.preventDefault(),y(c.id,Bg(w)))},{target:"document"}),!c)return null;let C=d.customAnswer.trim().length>0;return b(nS,{className:"py-2",open:!x,onOpenChange:S=>{v(S?null:c.id)},children:[u("div",{className:"flex items-center gap-1 px-1 sm:px-2",children:b(rS,{title:s(x?"pendingUserInput.showQuestion":"pendingUserInput.hideQuestion"),"data-pending-user-input-toggle":x?"collapsed":"expanded",className:"group -my-1 flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors duration-(--control-duration) hover:bg-muted/40",children:[u("span",{className:"text-xs font-medium text-muted-foreground group-hover:text-foreground/85",children:c.header}),t.questions.length>1?b("span",{className:"text-[10px] font-medium text-muted-foreground tabular-nums",children:[r+1,"/",t.questions.length]}):null,x?u("span",{className:"min-w-0 flex-1 truncate text-secondary-label text-xs",children:c.question}):null,u(dn,{"aria-hidden":"true",className:O("ml-auto size-icon-2 shrink-0 text-secondary-label transition-transform duration-(--control-duration) group-hover:text-foreground",x&&"rotate-180")})]})}),u(oS,{className:"px-3 sm:px-4",children:b("div",{className:"pt-2 pb-0.5",children:[u("div",{className:"max-h-[min(45vh,28rem)] overflow-y-auto overscroll-contain break-words text-sm text-foreground/85","data-pending-user-input-body":c.kind??"question",tabIndex:0,children:c.kind==="plan"?u(ar,{text:c.question,cwd:void 0,isStreaming:!1}):u("p",{className:"whitespace-pre-wrap",children:c.question})}),c.multiSelect?u("p",{className:"mt-1 text-secondary-label text-xs",children:s("pendingUserInput.selectOneOrMore")}):null,u("div",{className:"mt-2 space-y-0.5",children:c.options.map((S,L)=>{let w=Bg(S),I=m?.questionId===c.id&&m.optionLabel===w||!C&&d.selectedOptionLabels.includes(w),T=L<9?L+1:null,E=O("group relative flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left transition-colors duration-(--control-duration) pointer-coarse:after:absolute pointer-coarse:after:inset-0 pointer-coarse:after:min-h-11",I?"bg-muted/55 text-foreground":"bg-transparent text-foreground/85 hover:bg-muted/40",n&&"opacity-50 cursor-not-allowed",!n&&"cursor-pointer"),A=b(Ce,{children:[b("div",{className:"min-w-0 flex-1 flex flex-col gap-0.5",children:[u("span",{className:"text-sm font-medium",children:S.label}),S.description&&S.description!==S.label?u("span",{className:"text-secondary-label text-[11px]",children:S.description}):null]}),I?u(bo,{className:"size-icon-2 shrink-0 text-primary"}):T!==null?u("kbd",{className:O("flex size-5 shrink-0 items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums"),children:T}):null]});return u("button",{type:"button","aria-pressed":I,disabled:n,onClick:()=>{y(c.id,w)},className:E,children:A},`${c.id}:${w}`)})})]})})]})});ge();var V_=de(function({planTitle:t}){let{t:n}=De();return u("div",{className:"px-3 py-2 sm:px-4",children:b("div",{className:"flex flex-wrap items-center gap-2",children:[u("span",{className:"text-xs font-medium text-muted-foreground",children:n("plan.ready")}),t?u("span",{className:"min-w-0 flex-1 truncate text-xs text-foreground/85",children:t}):null]})})});function W_(e){if(e.occupant.kind!=="approval")return null;let{approval:t}=e.occupant;return u(i_,{requestId:t.requestId,isResponding:e.respondingRequestIds.includes(t.requestId),options:t.options,keybindings:e.keybindings,declineReasonRelay:t.declineReasonRelay,onRespondToApproval:e.onRespondToApproval})}function G_(e){return e.occupant.kind!=="user-input"?null:u(q_,{pendingUserInputs:[e.occupant.userInput],respondingRequestIds:e.respondingRequestIds,answers:e.activePendingDraftAnswers,questionIndex:e.activePendingQuestionIndex,onToggleOption:e.onSelectActivePendingUserInputOption,onAdvance:e.onAdvanceActivePendingUserInput})}var j_={approval:{expanded:e=>e.occupant.kind!=="approval"?null:b("div",{className:"flex min-w-0 flex-wrap items-start gap-1 px-3 py-1.5 sm:px-4",children:[u(cb,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-0.5",children:W_(e)})]}),collapsed:e=>e.occupant.kind!=="approval"?null:b("div",{"data-chat-composer-collapsed-controls":"true",children:[u(cb,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount,className:"px-3 pt-2 sm:px-4"}),u("div",{className:"flex flex-wrap items-center justify-end gap-1 px-3 pt-2 pb-3 sm:px-4",children:W_(e)})]})},decision:{expanded:e=>e.occupant.kind!=="decision"?null:u(ub,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision}),collapsed:e=>e.occupant.kind!=="decision"?null:u("div",{"data-chat-composer-collapsed-controls":"true",children:u(ub,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision,className:"pt-2 pb-3"})})},"user-input":{expanded:G_,collapsed:e=>b("div",{"data-chat-composer-collapsed-controls":"true",children:[G_(e),e.collapsedPendingRow]})},"plan-follow-up":{expanded:e=>e.activeProposedPlan===null?null:u(V_,{planTitle:o_(e.activeProposedPlan.planMarkdown)??null},e.activeProposedPlan.id),collapsed:null}};function Q_(e,t){let n=j_[e.occupant.kind],o=t?n.collapsed:n.expanded;return o===null?null:o(e)}var sfe=Object.keys(j_);function mb(e){return e.items.length===0?null:e.currentSearchKey===e.highlightedSearchKey&&e.highlightedItemId&&e.items.some(t=>t.id===e.highlightedItemId)?e.highlightedItemId:e.items[0]?.id??null}function gb(e,t){let n=e.name.toLowerCase(),o=ua(e).toLowerCase(),r=e.shortDescription?.toLowerCase()??"",a=e.description?.toLowerCase()??"",i=e.scope?.toLowerCase()??"",s=[Ur({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),Ur({value:o,query:t,exactBase:1,prefixBase:3,boundaryBase:5,includesBase:7,fuzzyBase:110}),Ur({value:r,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26}),Ur({value:a,query:t,exactBase:30,prefixBase:32,boundaryBase:34,includesBase:36}),Ur({value:i,query:t,exactBase:40,prefixBase:42,includesBase:44})].filter(l=>l!==null);return s.length===0?null:Math.min(...s)}function X_(e,t,n=Number.POSITIVE_INFINITY){let o=e.filter(i=>i.enabled),r=xo(t,{trimLeadingPattern:/^\$+/});if(!r)return o;let a=[];for(let i of o){let s=gb(i,r);s!==null&&Ng(a,{item:i,score:s,tieBreaker:`${ua(i).toLowerCase()}\0${i.name}`},n)}return a.map(i=>i.item)}function x6(e,t){if(e.type==="skill"){if(t==="skill")return 0;let a=t.startsWith("skill:")?t.slice(6):t,i=a?gb(e.skill,a):0;return i!==null?i:"skill".startsWith(t)?Number.MAX_SAFE_INTEGER:null}let n=e.type==="slash-command"?e.command.toLowerCase():e.command.name.toLowerCase(),o=e.description.toLowerCase(),r=[Ur({value:n,query:t,exactBase:0,prefixBase:2,boundaryBase:4,includesBase:6,fuzzyBase:100,boundaryMarkers:["-","_","/"]}),Ur({value:o,query:t,exactBase:20,prefixBase:22,boundaryBase:24,includesBase:26})].filter(a=>a!==null);return r.length===0?null:Math.min(...r)}function Y_(e,t){let n=xo(t,{trimLeadingPattern:/^\/+/});if(!n)return[...e];let o=[];for(let r of e){let a=x6(r,n);a!==null&&Ng(o,{item:r,score:a,tieBreaker:r.type==="slash-command"?`0\0${r.command}`:r.type==="provider-slash-command"?`1\0${r.command.name}\0${r.provider}`:`2\0${r.skill.name}\0${r.provider}`},Number.POSITIVE_INFINITY)}return o.map(r=>r.item)}function y6(e){return typeof e!="string"?null:e.trim()||null}function C6(e){return e.type==="select"?{...e,options:[...e.options],...e.promptInjectedValues?{promptInjectedValues:[...e.promptInjectedValues]}:{}}:{...e}}function b6(e,t){return e?.find(o=>o.id===t)?.value}function J_(e,t){let n=y6(t);return n?e.options.length===0?n:e.promptInjectedValues?.includes(n)&&e.options.some(o=>o.id===n)?e.options.find(o=>o.isDefault)?.id:e.options.some(o=>o.id===n)?n:e.currentValue??e.options.find(o=>o.isDefault)?.id:e.currentValue??e.options.find(o=>o.isDefault)?.id}function I6(e,t){if(e.type==="boolean")return typeof t=="boolean"?{...e,currentValue:t}:e;let n=typeof t=="string"?J_(e,t):J_(e,e.currentValue);if(!n){let{currentValue:o,...r}=e;return r}return{...e,currentValue:n}}function zg(e){let{caps:t,selections:n}=e;return(t.optionDescriptors??[]).map(C6).map(r=>I6(r,b6(n,r.id)??r.currentValue))}function Js(e){if(e)return e.type==="boolean"||e.currentValue?e.currentValue:e.options.find(t=>t.isDefault)?.id}function hb(e){if(!e)return;if(e.type==="boolean")return typeof e.currentValue=="boolean"?e.currentValue?"On":"Off":void 0;let t=Js(e);if(typeof t=="string")return e.options.find(n=>n.id===t)?.label}function $g(e){if(!e||e.length===0)return;let t=[];for(let n of e){let o=Js(n);(typeof o=="string"||typeof o=="boolean")&&t.push({id:n.id,value:o})}return t.length>0?t:void 0}function Wu(e){return typeof e=="string"&&/\bultrathink\b/i.test(e)}function Z_(e,t){let n=e.trim();return!n||t!=="ultrathink"||/^\/[^\s/]+(?:\s|$)/u.test(n)||n.startsWith("Ultrathink:")?n:`Ultrathink:
3738
+ ${n}`}ge();var S6=`Ultrathink:
3739
+ `;function w6(){let{t:e}=De();return u(gl,{variant:"outline",className:"inline-flex h-4 w-fit min-w-0 items-center justify-center gap-0 border-border/70 bg-muted/60 px-1.5 py-0 font-semibold text-[10px] text-muted-foreground leading-none sm:h-4",children:e("traits.default")})}function eD(e,t,n){return e.map(o=>o.id!==t?o:o.type==="boolean"?{...o,...typeof n=="boolean"?{currentValue:n}:{}}:{...o,...typeof n=="string"?{currentValue:n}:{}})}function Hg(e){if(!e)return null;let t=Js(e);return typeof t=="string"?t:null}function T6(e,t,n,o,r,a,i,s){let l=e.getModelCapabilities(n,o,t,s),d=zg({caps:l,selections:a}),c=d.filter(I=>I.type==="select"),f=d.filter(I=>I.type==="boolean"),p=c[0]??null,m=c.find(I=>I.id==="contextWindow")??null,h=c.find(I=>I.id==="agent")??null,g=f.find(I=>I.id==="fastMode")??null,v=f.find(I=>I.id==="thinking")??null,x=i&&(p?.promptInjectedValues?.length??0)>0&&Wu(r),y=x&&Wu(r.replace(/^Ultrathink:\s*/i,"")),C=(x?"ultrathink":Hg(p))??null,S=typeof v?.currentValue=="boolean"?v.currentValue:null,L=Hg(m),w=Hg(h),k=h?hb(h):null;return{caps:l,descriptors:d,selectDescriptors:c,booleanDescriptors:f,primarySelectDescriptor:p,contextWindowDescriptor:m,agentDescriptor:h,fastModeDescriptor:g,thinkingDescriptor:v,effort:C,thinkingEnabled:S,contextWindow:L,ultrathinkPromptControlled:x,ultrathinkInBodyText:y,selectedAgent:w,selectedAgentLabel:k}}function vb(e){let t=T6(e.modelApi,e.provider,e.models,e.model,e.prompt,e.modelOptions,e.allowPromptInjectedEffort??!0,e.planModeEnabled),n=t.primarySelectDescriptor!==null,o=t.thinkingDescriptor!==null,r=t.fastModeDescriptor!==null,a=t.contextWindowDescriptor!==null,i=t.agentDescriptor!==null;return{...t,showEffort:n,showThinking:o,showFastMode:r,showContextWindow:a,showAgent:i,hasAnyControls:n||o||r||a||i}}function xb(e){return vb(e).hasAnyControls}var yb=de(function({provider:t,instanceId:n,models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,...c}){let{t:f}=De(),p=Ot(),m=p.draft.useStore(I=>I.setProviderModelOptions),h=B(I=>{if("onModelOptionsChange"in c){c.onModelOptionsChange(I);return}let T=c.threadRef??c.draftId;T&&m(T,t,I,{...n?{instanceId:n}:{},model:r,persistSticky:!0})},[n,r,c,t,m]),{descriptors:g,selectDescriptors:v,booleanDescriptors:x,primarySelectDescriptor:y,ultrathinkPromptControlled:C,ultrathinkInBodyText:S,hasAnyControls:L}=vb({modelApi:p.model,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}),w=I=>{h($g(I))},k=(I,T)=>{if(T){if(I.promptInjectedValues?.includes(T)){let E=a.trim().length===0?S6:Z_(a,"ultrathink");i(E);return}if(!(S&&I.id===y?.id)){if(C&&I.id===y?.id){let E=a.replace(/^Ultrathink:\s*/i,"");i(E)}w(eD(g,I.id,T))}}};return L?b(Ce,{children:[v.map((I,T)=>{let E=C&&I.id===y?.id?"ultrathink":Hg(I)??"";return b("div",{children:[T>0?u(mi,{}):null,b(sc,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:I.label}),S&&I.id===y?.id?u("div",{className:"px-2 pb-1.5 text-muted-foreground/80 text-xs",children:f("traits.ultrathinkInBodyNotice")}):null,u(Sr,{value:E,onValueChange:A=>k(I,A),children:I.options.map(A=>u(jo,{value:A.id,hideIndicator:!0,closeOnClick:!0,disabled:S&&I.id===y?.id,children:b("span",{className:"flex w-full min-w-0 flex-col",children:[u("span",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:b("span",{className:"min-w-0 truncate",children:[A.label,A.isDefault?b(Ce,{children:[" ",u(w6,{})]}):null]})}),A.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:A.description}):null]})},A.id))})]})]},I.id)}),x.map((I,T)=>{let E=I.currentValue===!0?"on":"off";return b("div",{children:[T>0||v.length>0?u(mi,{}):null,b(sc,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:I.label}),u(Sr,{value:E,onValueChange:A=>{w(eD(g,I.id,A==="on"))},children:["on","off"].map(A=>u(jo,{value:A,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:u("span",{children:f(A==="on"?"traits.on":"traits.off")})})},A))})]})]},I.id)})]}):null});function k6(e,t){let n=null,o=!1,r=[];for(let a of t.descriptors){if(a.id==="fastMode"&&a.type==="boolean"){o=a.currentValue===!0,n=e(o?"traits.fast":"traits.normal");continue}if(t.provider==="codex"&&a.id==="serviceTier"&&a.type==="select"){let s=Js(a),l=a.options.find(({label:d})=>d==="Fast");if(l&&(s==="default"||s===l.id)){o=s===l.id,n=a.options.find(({id:d})=>d===s)?.label??e(o?"traits.fast":"traits.normal");continue}}let i=t.ultrathinkPromptControlled&&a.id===t.primarySelectDescriptorId?e("traits.ultrathink"):a.type==="boolean"?e("traits.labelWithState",{label:a.label,state:e(a.currentValue===!0?"traits.on":"traits.off")}):hb(a);typeof i=="string"&&i.length>0&&r.push(i)}return r.length===0&&n!==null?{label:n,showFastModeIcon:!1}:{label:r.join(" \xB7 "),showFastModeIcon:o}}var tD=de(function({provider:t,instanceId:n,models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,triggerVariant:c,triggerClassName:f,...p}){let[m,h]=G(!1),{t:g}=De(),v=Ot().model,{descriptors:x,primarySelectDescriptor:y,ultrathinkPromptControlled:C}=vb({modelApi:v,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d});if(!xb({modelApi:v,provider:t,models:o,model:r,prompt:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}))return null;let{label:S,showFastModeIcon:L}=k6(g,{provider:t,descriptors:x,primarySelectDescriptorId:y?.id??null,ultrathinkPromptControlled:C}),w=L?b(Ce,{children:[u(ro,{icon:ss,className:O("fill-current opacity-80",t==="claudeAgent"?"text-[#d97757]":"text-foreground")}),u("span",{className:"sr-only",children:g("traits.fastModeOn")})]}):null,k=t==="codex";return b(Oo,{open:m,onOpenChange:I=>{h(I)},children:[u(Bo,{render:u(Po,{variant:c??"ghost",className:O(k?"min-w-0 max-w-40 shrink justify-start overflow-hidden whitespace-nowrap sm:max-w-48":"shrink-0 whitespace-nowrap",f)}),children:k?b("span",{className:"flex min-w-0 w-full items-center gap-1.5 overflow-hidden",children:[w,u("span",{className:"min-w-0 truncate",children:S}),u(fa,{})]}):b(Ce,{children:[w,u("span",{children:S}),u(fa,{})]})}),u(Fo,{align:"start",children:u(yb,{provider:t,...n?{instanceId:n}:{},models:o,model:r,prompt:a,onPromptChange:i,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,...p})})]})});function nD(e){return Wu(e)?"ultrathink":"none"}function oD(e,t){let{provider:n,model:o,models:r,modelOptions:a,promptInjectionState:i="none",planModeEnabled:s}=e,l=t.getModelCapabilities(r,o,n,s),d=zg({caps:l,selections:a}),c=d.find(h=>h.type==="select"),f=Js(c??null),p=typeof f=="string"?f:null,m=(c?.promptInjectedValues?.length??0)>0&&i==="ultrathink";return{provider:n,promptEffort:p,modelOptionsForDispatch:$g(d),...m?{composerFrameClassName:"ultrathink-frame",composerSurfaceClassName:"shadow-[0_0_0_1px_rgba(255,255,255,0.07)_inset]",modelPickerIconClassName:"ultrathink-chroma"}:{}}}function rD(e,t){let{provider:n,instanceId:o,threadRef:r,draftId:a,model:i,models:s,modelOptions:l,prompt:d,onPromptChange:c,planModeEnabled:f}=t;return!(r!==void 0||a!==void 0)||!xb({modelApi:t.modelApi,provider:n,models:s,model:i,modelOptions:l,prompt:d,planModeEnabled:f})?null:u(e,{provider:n,...o?{instanceId:o}:{},models:s,...r?{threadRef:r}:{},...a?{draftId:a}:{},model:i,modelOptions:l,prompt:d,onPromptChange:c,planModeEnabled:f})}function aD(e){return rD(yb,e)}function iD(e){return rD(tD,e)}ge();var sD=e=>{let t,n=new Set,o=(d,c)=>{let f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){let p=t;t=c??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,p))}},r=()=>t,s={setState:o,getState:r,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d))},l=t=e(o,r,s);return s},lD=(e=>e?sD(e):sD);ge();var L6=e=>e;function P6(e,t=L6){let n=mn.useSyncExternalStore(e.subscribe,mn.useCallback(()=>t(e.getState()),[e,t]),mn.useCallback(()=>t(e.getInitialState()),[e,t]));return mn.useDebugValue(n),n}var dD=e=>{let t=lD(e),n=o=>P6(t,o);return Object.assign(n,t),n},cD=(e=>e?dD(e):dD);var Cb=cD(e=>({presetIdByDraftId:{},setDraftPresetId:(t,n)=>{e(o=>{if((o.presetIdByDraftId[t]??null)===n)return o;let r={...o.presetIdByDraftId};return n===null?delete r[t]:r[t]=n,{presetIdByDraftId:r}})},clearDraftPresetId:t=>{e(n=>{if(n.presetIdByDraftId[t]===void 0)return n;let o={...n.presetIdByDraftId};return delete o[t],{presetIdByDraftId:o}})}}));function uD(e){return Cb(t=>e===null?null:t.presetIdByDraftId[e]??null)}function bb(e,t){return t==null?void 0:e.find(n=>n.presetId===t)}var Ib="__none__",fD=de(function({environmentId:t,draftId:n,threadPresetId:o,compact:r}){let{t:a}=De(),i=Ot().presets.useThreadPresets(t),s=uD(n),l=Cb(c=>c.setDraftPresetId);if(n===null){let f=bb(i,o)?.displayName??o;return f===null?null:b(Po,{variant:"ghost",disabled:!0,"aria-label":a("preset.appliedLabel",{name:f}),className:"shrink-0 whitespace-nowrap",children:[u(ro,{icon:Aa}),u("span",{className:"min-w-0 truncate",children:f})]})}if(i.length===0)return null;let d=bb(i,s);return b(Oo,{children:[u(Bo,{render:u(Po,{variant:"ghost","aria-label":a("preset.triggerLabel"),className:"min-w-0 max-w-40 shrink whitespace-nowrap sm:max-w-48"}),children:b("span",{className:"flex w-full min-w-0 items-center gap-1.5 overflow-hidden",children:[u(ro,{icon:Aa}),r?null:u("span",{className:"min-w-0 truncate",children:d?.displayName??a("preset.none")}),u(fa,{})]})}),u(Fo,{align:"start",children:b(sc,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:a("preset.menuTitle")}),b(Sr,{value:s??Ib,onValueChange:c=>{l(n,c===Ib?null:c)},children:[u(jo,{value:Ib,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"min-w-0 truncate",children:a("preset.none")})}),i.map(c=>u(jo,{value:c.presetId,hideIndicator:!0,closeOnClick:!0,children:b("span",{className:"flex w-full min-w-0 flex-col",children:[u("span",{className:"min-w-0 truncate",children:c.displayName}),c.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:c.description}):null]})},c.presetId))]})]})})]})});ge();function pD(e){let t=e.credentialIdentity,n=e.selection.expectedRevisions;return[e.queryKey,e.selection.environmentId,e.selection.runtimeId,e.selection.sourceId,e.selection.profileId,e.selection.endpointId??"",String(n.runtime),String(n.source),String(n.profile),String(n.endpoint??""),String(e.sourceConfigRevision),t===null?"":t.id,t===null?"":String(t.revision)].join("\0")}function A6(e,t){let n=t.credentialIdentity;return n===null?!1:e.environmentId===t.environmentId&&e.sourceId===t.sourceId&&e.sourceConfigRevision===t.sourceConfigRevision&&e.credentialIdentity.id===n.id&&e.credentialIdentity.revision===n.revision}function mD(e){return e.capability.status!=="unsupported"&&e.credentialIdentity!==null}function E6(e){let{scope:t}=e;return`${t.kind}\0${t.quotaPoolId??""}\0${t.identity??""}`}function Sb(e,t){return e===null||!Number.isFinite(e)?null:t.kind==="money"?e.toFixed(t.precision):(Number.isInteger(e),String(e))}function wb(e){if(e==null||!Number.isFinite(e)||e<=0)return null;let t=864e5,n=36e5,o=6e4,r=1e3;return e%t===0?{unit:"days",count:e/t}:e%n===0?{unit:"hours",count:e/n}:e%o===0?{unit:"minutes",count:e/o}:e%r===0?{unit:"seconds",count:e/r}:null}function Tb(e,t){return e.freshness==="stale"||e.status==="error"||e.errorReason!==null||t!==null}function M6(e){if(e.unlimited===!0)return{kind:"unlimited"};let t=e.kind==="spend-cap"?e.used??e.remaining:e.remaining??e.used,n=Sb(t,e.unit);return n===null?null:e.unit.kind==="money"?{kind:"money",amount:n,currency:e.unit.currency}:e.unit.kind==="percent"?{kind:"percent",amount:n,direction:e.unit.direction}:{kind:"quantity",amount:n,nativeUnit:e.unit.nativeUnit}}function gD(e,t){let n=[];for(let o of e){if(o.provenance==="estimated")continue;let r=M6(o);r!==null&&n.push({metricId:o.metricId,kind:o.kind,poolKey:E6(o),display:r,nativeLabel:o.nativeLabel,durationMs:o.window?.durationMs??null,resetsAt:o.resetsAt,fetchedAt:o.fetchedAt,stale:Tb(o,t)})}return n}function hD(e){return e.snapshot===null||e.credentialIdentity===null?null:A6(e.snapshot,e)?e.snapshot:null}function vD(e){for(let t of e)if(t.resetsAt!==null)return t.resetsAt;return null}function xD(e){let t=null;for(let n of e)n.fetchedAt!==null&&(t===null||n.fetchedAt<t)&&(t=n.fetchedAt);return t}ge();function yD(e,t){let n=D(e),o=D(0),r=D(!1),[a,i]=G(e),[s,l]=G(null),[d,c]=G(!1);a!==e&&(i(e),n.current=e,o.current+=1,r.current=!1,l(null),c(!1));let f=B(async()=>{if(r.current)return;let p=o.current+1;o.current=p;let m=e;r.current=!0,c(!0);try{let h=await t();if(o.current!==p||n.current!==m)return;l(h)}catch{if(o.current!==p||n.current!==m)return;l({outcome:"error",retryAt:null})}finally{o.current===p&&n.current===m&&(r.current=!1,c(!1))}},[e,t]);return{feedback:s,refreshing:d,refresh:f}}function CD(e,t){switch(e.unit){case"days":return t("sourceMetrics.windowDays",{count:e.count});case"hours":return t("sourceMetrics.windowHours",{count:e.count});case"minutes":return t("sourceMetrics.windowMinutes",{count:e.count});case"seconds":return t("sourceMetrics.windowSeconds",{count:e.count})}}function bD(e,t){let n=e.nativeLabel?.trim()??"";if(n.length>0)return n;let o=wb(e.durationMs);return o!==null?CD(o,t):_6(e.kind,t)}function R6(e,t){switch(e.kind){case"unlimited":return t("sourceMetrics.unlimited");case"money":return`${e.currency} ${e.amount}`;case"quantity":return`${e.amount} ${e.nativeUnit}`;case"percent":return e.direction==="used"?t("sourceMetrics.percentUsed",{value:e.amount}):t("sourceMetrics.percentRemaining",{value:e.amount})}}function N6(e,t){let n=R6(e.display,t);if(e.kind==="quota-window")return`${bD(e,t)} ${n}`;let o=e.nativeLabel?.trim()??"";return o.length>0?`${o} ${n}`:n}function _6(e,t){switch(e){case"balance":return t("sourceMetrics.kindBalance");case"credits":return t("sourceMetrics.kindCredits");case"quota-window":return t("sourceMetrics.kindQuotaWindow");case"spend-cap":return t("sourceMetrics.kindSpendCap");case"rate-limit":return t("sourceMetrics.kindRateLimit")}}function D6(e,t){switch(e){case"account":return t("sourceMetrics.scopeAccount");case"org":return t("sourceMetrics.scopeOrg");case"project":return t("sourceMetrics.scopeProject");case"key":return t("sourceMetrics.scopeKey");case"endpoint":return t("sourceMetrics.scopeEndpoint");case"model-group":return t("sourceMetrics.scopeModelGroup");case"model":return t("sourceMetrics.scopeModel");case"unknown":return t("sourceMetrics.scopeUnknown")}}function Gu(e){return na(e,"locale")||e}function O6(e,t){switch(e.outcome){case"fresh":return t("sourceMetrics.outcomeFresh");case"partial":return t("sourceMetrics.outcomePartial");case"joined-inflight":return t("sourceMetrics.outcomeJoinedInflight");case"rate-limited":return e.retryAt===null?t("sourceMetrics.outcomeRateLimited"):t("sourceMetrics.outcomeRateLimitedUntil",{time:Gu(e.retryAt)});case"offline":return t("sourceMetrics.outcomeOffline");case"unsupported":return t("sourceMetrics.outcomeUnsupported");case"error":return t("sourceMetrics.outcomeError")}}function F6(e,t,n){return e.capability.status==="unsupported"?n("sourceMetrics.unsupported"):e.credentialIdentity===null||e.capability.status==="unknown"?n("sourceMetrics.unknown"):t.length>0?null:e.loading?n("sourceMetrics.loading"):e.error!==null?n("sourceMetrics.outcomeError"):n("sourceMetrics.noData")}function kb(e,t){let n=Sb(t,e.unit);return n===null?null:e.unit.kind==="money"?`${e.unit.currency} ${n}`:e.unit.kind==="percent"?`${n}%`:`${n} ${e.unit.nativeUnit}`}function ID(e){let[t,n]=G(!1);return u(B6,{...e,expanded:t,onToggleExpanded:()=>n(o=>!o)})}function B6(e){let{expanded:t,onToggleExpanded:n,onRefresh:o,...r}=e,{t:a}=De(),i=pD(r),{feedback:s,refreshing:l,refresh:d}=yD(i,o),c=r.capability.status==="supported"&&r.credentialIdentity!==null?hD(r):null,f=c?.metrics??[],p=gD(f,r.error),m=p.some(w=>w.stale)||r.error!==null&&c!==null,h=vD(p),g=xD(f),v=l,x=F6(r,p,a),y=mD(r),S=`${Xr()}-source-metrics-details`,L=[...p.map(w=>({key:`${w.metricId}\0${w.poolKey}`,text:N6(w,a)})),...h===null?[]:[{key:"resets-at",text:a("sourceMetrics.resetsAt",{time:Gu(h)})}]];return b("div",{className:"min-w-0 px-3 pt-1 sm:px-4","data-composer-source-metrics":"true","data-source-id":r.sourceId,"data-next-message":r.isNextMessage?"true":"false","data-refresh-outcome":s?.outcome??"",children:[b("div",{className:"flex min-w-0 items-start gap-1.5",children:[u(ne,{type:"button",variant:"ghost",size:"sm",className:"h-auto min-h-control-3 min-w-0 flex-1 justify-start px-1 py-1 text-left whitespace-normal","aria-expanded":t,"aria-controls":S,"aria-label":a(t?"sourceMetrics.hideDetails":"sourceMetrics.showDetails"),onClick:n,children:b("div",{className:"flex min-w-0 flex-1 flex-col items-stretch gap-0.5",children:[b("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:r.sourceLabel}),r.isNextMessage?u("span",{className:"text-[11px] text-muted-foreground",children:a("modelPicker.nextMessage")}):null,m?u("span",{className:"text-[11px] text-muted-foreground","data-composer-source-metrics-stale":"true",children:a("sourceMetrics.stale")}):null,u(dn,{"aria-hidden":"true",className:O("ml-auto size-icon-2 shrink-0 text-secondary-label",t?"rotate-180":"rotate-0")})]}),u("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5 text-[11px] tabular-nums text-secondary-label",children:L.length>0?L.map((w,k)=>b("span",{children:[k>0?u("span",{"aria-hidden":"true",children:" \xB7 "}):null,w.text]},w.key)):x})]})}),y?u(ne,{type:"button",size:"xs",variant:"ghost",className:"mt-0.5 shrink-0 text-secondary-label","aria-label":a("sourceMetrics.refreshAria",{source:r.sourceLabel}),disabled:v,onClick:()=>{d()},children:a(v?"sourceMetrics.refreshing":"sourceMetrics.refresh")}):null]}),t?b("div",{id:S,className:"max-h-36 space-y-2 overflow-y-auto overscroll-contain px-1 pb-1 pt-1.5","data-composer-source-metrics-details":"true",children:[f.length===0?u("p",{className:"text-[11px] text-secondary-label",children:x??a("sourceMetrics.noData")}):f.map(w=>u(z6,{metric:w,queryError:r.error,t:a},w.metricId)),g!==null?u("p",{className:"text-[11px] text-secondary-label",children:a("sourceMetrics.collectedAt",{time:Gu(g)})}):null]}):null,s!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:O6(s,a)}):r.error!==null&&c!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:a("sourceMetrics.errorKeepLast")}):null]})}function z6({metric:e,queryError:t,t:n}){let o=kb(e,e.used),r=e.unlimited===!0?n("sourceMetrics.unlimited"):kb(e,e.remaining),a=kb(e,e.limit),i=n("sourceMetrics.sharedScope",{scope:D6(e.scope.kind,n)}),s=e.scope.quotaPoolId===null?null:n("sourceMetrics.pool",{id:e.scope.quotaPoolId}),l=Tb(e,t),d=e.window?.durationMs??null,c=wb(d),f=bD({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:d},n);return b("div",{className:"text-[11px] text-secondary-label","data-metric-id":e.metricId,"data-metric-kind":e.kind,"data-quota-pool":e.scope.quotaPoolId??"","data-window-ms":d===null?void 0:String(d),children:[b("div",{className:"font-medium text-foreground",children:[f,e.provenance==="estimated"?u("span",{className:"ms-2 font-normal text-muted-foreground",children:n("sourceMetrics.estimated")}):null,l?u("span",{className:"ms-2 font-normal text-muted-foreground",children:n("sourceMetrics.stale")}):null]}),b("div",{className:"mt-0.5 flex flex-wrap gap-x-2 tabular-nums",children:[o!==null?b("span",{children:[o," ",n("sourceMetrics.used")]}):null,r!==null?b("span",{children:[r," ",e.unlimited===!0?null:n("sourceMetrics.remaining")]}):null,a!==null?b("span",{children:[a," ",n("sourceMetrics.limit")]}):null]}),b("div",{className:"mt-0.5",children:[i,e.scope.identity!==null?` \xB7 ${e.scope.identity}`:null,s!==null?` \xB7 ${s}`:null]}),e.fetchedAt!==null?u("div",{children:n("sourceMetrics.collectedAt",{time:Gu(e.fetchedAt)})}):null,e.resetsAt!==null?u("div",{children:n("sourceMetrics.resetsAt",{time:Gu(e.resetsAt)})}):null,c!==null?u("div",{children:CD(c,n)}):null,e.window?.nativePeriod!==null&&e.window?.nativePeriod!==void 0?u("div",{children:e.window.nativePeriod}):null]})}function Za(e){return e===null||!Number.isFinite(e)?"0":e<1e3?`${Math.round(e)}`:e<1e4?`${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:e<1e6?`${Math.round(e/1e3)}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,"")}m`}function SD(e,t){if(!e)return null;let n=t.get(e.instanceId)?.find(o=>o.slug===e.model);return n?Cd(n):e.model}function wD(e,t,n){return typeof n=="number"&&n>0?e("contextWindow.compactsAtThreshold",{threshold:n.toLocaleString()}):t?e("contextWindow.compactsForModel",{model:t}):e("contextWindow.compactsWhenNeeded")}function $6(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function TD(e){let{t}=De(),{usage:n,breakdown:o,modelDisplayName:r,onCompact:a,compactDisabled:i,compactDisabledReason:s}=e,l=$6(n.usedPercentage),d=Math.max(0,Math.min(100,n.usedPercentage??0)),c=9.75,f=2*Math.PI*c,p=f*(1-d/100),m=n.totalProcessedTokens??null,h=m!==null&&m>0,v=d>90?"var(--color-error)":"color-mix(in oklab, var(--color-muted-foreground) 72%, transparent)";return b(Cl,{children:[u(Il,{openOnHover:!0,delay:150,closeDelay:a?150:0,render:u(ne,{size:"icon-sm",variant:"ghost-muted","data-context-window-meter":"true",className:"size-7 rounded-full hover:text-muted-foreground data-pressed:text-muted-foreground","aria-label":n.maxTokens!==null&&l?`Context window ${l} used`:`Context window ${Za(n.usedTokens)} tokens used`,children:u("span",{className:"relative flex size-5 items-center justify-center",children:b("svg",{viewBox:"0 0 24 24",className:"-rotate-90 absolute inset-0 size-full transform-gpu mx-0!","aria-hidden":"true",children:[u("circle",{cx:"12",cy:"12",r:c,fill:"none",stroke:"color-mix(in oklab, var(--color-muted-foreground) 24%, transparent)",strokeWidth:"3"}),u("circle",{cx:"12",cy:"12",r:c,fill:"none",stroke:v,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:f,strokeDashoffset:p})]})})})}),u(bl,{tooltipStyle:!0,side:"top",align:"end",viewportClassName:"p-0",className:"w-64 max-w-none text-left whitespace-normal",children:b("div",{className:"flex flex-col gap-2 p-[var(--floating-content-inset)]",children:[b("div",{className:"flex items-center justify-between gap-3",children:[u("div",{className:"font-medium text-muted-foreground text-xs",children:t("contextWindow.title")}),n.maxTokens!==null&&l?b("div",{className:"text-secondary-label text-[11px] tabular-nums",children:[u("span",{children:l}),u("span",{className:"mx-1",children:"\xB7"}),b("span",{children:[Za(n.usedTokens),"/",Za(n.maxTokens??null)]})]}):u("div",{className:"text-secondary-label text-[11px] tabular-nums",children:Za(n.usedTokens)})]}),n.maxTokens!==null?u("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-muted/60",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(d),"aria-label":t("contextWindow.usage"),children:u("div",{className:"h-full rounded-full transition-[width,background-color] duration-500 ease-out motion-reduce:transition-none",style:{width:`${d}%`,backgroundColor:v}})}):null,o?b("div",{className:"flex flex-col gap-1","data-context-breakdown":"true",children:[b("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4","data-context-breakdown-row":"system",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.system")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Za(o.systemTokens)})]}),b("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4","data-context-breakdown-row":"tools",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.tools")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Za(o.toolsTokens)})]}),b("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4","data-context-breakdown-row":"messages",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.messages")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Za(o.messageTokens)})]})]}):null,h?b("div",{className:"flex items-center justify-between gap-3 text-[11px] leading-4",children:[u("span",{className:"text-secondary-label",children:t("contextWindow.totalProcessed")}),u("span",{className:"font-medium tabular-nums text-secondary-label",children:Za(m)})]}):null,n.compactsAutomatically?u("div",{className:"mt-1 text-pretty text-secondary-label text-[11px] font-medium",children:wD(t,r,n.autoCompactThreshold)}):null,a?b(Ce,{children:[b(ne,{size:"xs",variant:"outline",className:"mt-1 w-full justify-center",disabled:i,onClick:a,children:[u(Jd,{"aria-hidden":"true"}),t("contextWindow.compactContext")]}),i&&s?u("div",{className:"text-pretty text-secondary-label text-[11px]",children:s}):null]}):null]})})]})}function Lb(e,t){let n=e.flatMap(r=>r.previewUrl?[{id:r.id,src:r.previewUrl,name:r.name}]:[]);if(n.length===0)return null;let o=n.findIndex(r=>r.id===t);return o<0?null:{images:n.map(r=>({src:r.src,name:r.name})),index:o}}function Pb(e,t){let n=e.trim().length-t;if(n<=0)return null;let o=n===1?"character":"characters";return`Prompt is ${n.toLocaleString("en-US")} ${o} over the ${t.toLocaleString("en-US")}-character limit. Shorten or split it before sending.`}function Ab(e){return e.submissionTarget==="provider-turn"?Pb(e.providerInput??e.prompt,e.maxInputChars):null}function kD(e){let t=e.disabledReason??Ab(e);return t?(e.event?.preventDefault(),{validationMessage:t,didDispatch:!1}):e.onSend(e.event)===!1?(e.event?.preventDefault(),{validationMessage:null,didDispatch:!1}):{validationMessage:null,didDispatch:!0}}function LD({message:e}){return e?u("p",{role:"alert",className:"px-3 pb-2 text-xs text-destructive sm:px-4","data-chat-composer-validation":"prompt-length",children:e}):null}function H6(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width}function PD(e){let t=Ot(),n=Cf(),o=t.pane.useActive(),[r,a]=G(null);return xe(()=>{if(!o)return;let i=e.anchor;if(!i){a(null);return}let s=!0,l=()=>{if(!s)return;let c=i.closest('[data-chat-composer-form="true"]'),p=(c?.querySelector('[data-chat-composer-main-surface="true"]')??c??i).getBoundingClientRect(),m=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)||16,g=(Number.parseFloat(window.getComputedStyle(c??i).getPropertyValue("--chat-composer-drawer-inset"))||1.375)*m,v=m+1,x={bottom:window.innerHeight-p.top-v,left:p.left+g,maxHeight:Math.max(96,p.top-24+v),width:Math.max(0,p.width-g*2)};a(y=>y&&H6(y,x)?y:x)};l(),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0);let d=typeof ResizeObserver>"u"?null:new ResizeObserver(l);if(d){d.observe(i);for(let c=i.parentElement;c;c=c.parentElement)d.observe(c)}return()=>{s=!1,d?.disconnect(),window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0)}},[e.anchor,o]),!o||!r?null:t.createPortal(u("div",{className:O(n,"pointer-events-auto fixed z-[70]"),"data-composer-drawer-layer":"true",style:{bottom:r.bottom,left:r.left,maxHeight:r.maxHeight,width:r.width},children:e.children}),document.body)}var U6=['[data-composer-drawer-layer="true"]','[data-slot="popover-popup"]','[data-slot="menu-popup"]','[data-slot="select-popup"]','[data-slot="combobox-popup"]','[data-slot="autocomplete-popup"]'].join(","),Eb=(e,t,n)=>n.endsWith(" ")&&e[t]===" "?t+1:t,K6=(e,t)=>{let n=new Map(e.map(o=>[o.id,o]));return t.flatMap(o=>{let r=n.get(o);return r?[r]:[]})},q6=(e,t)=>e.length===t.length&&e.every((n,o)=>n.id===t[o]);function V6(e){return e.closest(U6)!==null}var kme=de(function(t){let{t:n}=De(),o=Sd(),r=o(t.runtimeMode),a=r.icon,i=t.runtimeModeSwitch==="next-turn",s=t.interactionMode==="plan"?"Plan mode \u2014 click to return to normal build mode":"Default mode \u2014 click to enter plan mode",l=t.nativeMode!==null,d=t.showInteractionModeToggle&&!l?b(Ce,{children:[u(Lf,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),b(Ve,{children:[b(Ge,{render:u(Po,{className:O("shrink-0 whitespace-nowrap",t.interactionMode==="plan"?"bg-accent text-accent-foreground hover:bg-accent/90":"text-secondary-label hover:text-foreground"),type:"button",onClick:t.onToggleInteractionMode,"aria-label":s}),children:[t.interactionMode==="plan"?u(ro,{icon:ns,className:"text-current opacity-100"}):u(ro,{icon:Pa,opticalSize:"large"}),u("span",{className:"sr-only sm:not-sr-only",children:t.interactionMode==="plan"?"Plan":"Build"})]}),u(We,{side:"top",children:s})]})]}):null,c=b(Ce,{children:[u(Lf,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),b(Ve,{children:[b(hl,{value:t.runtimeMode,onValueChange:f=>t.onRuntimeModeChange(f),children:[b(Ge,{render:u(pd,{className:"font-medium","aria-label":"Runtime mode"}),children:[u(ro,{icon:a}),u(yl,{children:r.label})]}),b(xl,{alignItemWithTrigger:!1,children:[Id.map(f=>{let p=o(f),m=p.icon;return u(vl,{value:f,hideIndicator:!0,className:"min-w-64 py-2",children:u("div",{className:"flex min-w-0 items-center gap-3",children:b("div",{className:"grid min-w-0 flex-1 gap-0.5",children:[b("span",{className:"inline-flex items-center gap-1.5 font-medium text-foreground",children:[u(m,{className:"size-icon-2 shrink-0 text-muted-foreground"}),p.label]}),u("span",{className:"text-muted-foreground text-xs leading-4",children:p.description})]})})},f)}),i?u("div",{className:"border-t px-2 py-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]})]}),u(We,{side:"top",children:i?`${r.description} ${n("runtimeMode.appliesNextTurnHint")}`:r.description})]}),i?u("span",{className:"hidden whitespace-nowrap text-muted-foreground text-xs sm:inline",children:n("runtimeMode.appliesNextTurn")}):null]});return b(Ce,{children:[t.nativeMode?b(Ce,{children:[u(Lf,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),u(Dg,{nativeMode:t.nativeMode,canSwitch:t.canSwitchNativeMode,onNativeModeChange:t.onNativeModeChange})]}):c,d]})}),W6=de(function(t){return b(Ce,{children:[t.activeContextWindow?u(TD,{usage:t.activeContextWindow,...t.breakdown===void 0?{}:{breakdown:t.breakdown},modelDisplayName:t.activeThreadModelDisplayName,onCompact:t.onCompactContext,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason}):null,t.isPreparingWorktree?u("span",{className:"text-secondary-label text-xs",children:"Preparing worktree..."}):null,u(Vu,{compact:t.compact,pendingAction:t.pendingAction,isRunning:t.isRunning,showPlanFollowUpPrompt:t.showPlanFollowUpPrompt,promptHasText:t.promptHasText,isSendBusy:t.isSendBusy,sendDisabledReason:t.sendDisabledReason,isConnecting:t.isConnecting,isEnvironmentUnavailable:t.isEnvironmentUnavailable,isPreparingWorktree:t.isPreparingWorktree,hasSendableContent:t.hasSendableContent,preserveComposerFocusOnPointerDown:t.preserveComposerFocusOnPointerDown??!1,showSendWhileRunning:t.showSendWhileRunning??!1,onPreviousPendingQuestion:t.onPreviousPendingQuestion,onInterrupt:t.onInterrupt,onImplementPlanInNewThread:t.onImplementPlanInNewThread})]})}),AD=de(function(t){let{composerDraftTarget:n,environmentId:o,attachmentUploadsCapabilityKnown:r,supportsAttachmentUploads:a,routeKind:i,routeThreadRef:s,draftId:l,activeThreadId:d,activeThreadEnvironmentId:c,activeThread:f,isServerThread:p,isLocalDraftThread:m,forceExpandedOnMobile:h,projectSelectionRequired:g,phase:v,isConnecting:x,isSendBusy:y,sendDisabledReason:C,isPreparingWorktree:S,environmentUnavailable:L,activePendingApproval:w,onRespondToComposerDecision:k,pendingUserInputs:I,activePendingProgress:T,activePendingResolvedAnswers:E,activePendingIsResponding:A,activePendingDraftAnswers:N,activePendingQuestionIndex:R,respondingRequestIds:$,occupants:U,showPlanFollowUpPrompt:H,activeProposedPlan:F,activeTasksProgress:oe,activeTaskSteps:ee,runtimeMode:W,interactionMode:Ze,lockedProvider:ue,providerStatuses:pe,activeProjectDefaultModelSelection:Fe,projectId:Le=null,activeThreadModelSelection:ie,selectedExecutionSelection:Ie,composerChoices:ve,selectedExecutionReady:re,selectedModelOptionDescriptors:be,onModelPickerOpenChange:rt,onClearExecutionSelection:dt,executionAppliesTo:st,activeContextWindow:ct,activeContextBreakdown:Zt=null,slots:at,compactDisabled:_e,compactDisabledReason:He,resolvedTheme:qe,settings:Be,keybindings:Vt,terminalOpen:he,gitCwd:sn,promptRef:Re,composerRef:Jn,composerImagesRef:lt,composerTerminalContextsRef:kt,composerElementContextsRef:Nt,sendContextRef:en,onSend:gn,onInterrupt:Pn,onCompactContext:An,onImplementPlanInNewThread:hn,onRespondToApproval:cn,onSelectActivePendingUserInputOption:Yt,onAdvanceActivePendingUserInput:Hn,onPreviousActivePendingUserInputQuestion:io,onChangeActivePendingUserInputCustomAnswer:It,onProviderModelSelect:Eo,onModelSelectionChosen:_,onExecutionSelectionChosen:Z,onSelectPluginAction:X,onManagePlugins:ae,getModelDisabledReason:fe,getModelContinuationLabel:ft,onContinueInModel:ut,toggleInteractionMode:vt,handleRuntimeModeChange:_t,handleInteractionModeChange:Jt,handleNativeModeChange:xt,focusComposer:vn,scheduleComposerFocus:tn,setThreadError:un,onExpandImage:Zn}=t,me=t.api,{limits:St}=t.attachments,{t:yt}=De(),zt=me.draft.useThreadDraft(n),Oe=zt.prompt,gt=zt.images,Zo=z(()=>gt.filter(P=>cv(P)==="image"),[gt]),Lt=zt.terminalContexts,Dn=zt.elementContexts,nn=zt.previewAnnotations,xn=zt.reviewComments,te=zt.nonPersistedImageIds,et=me.uploads.useStore(P=>P.uploadsByImageId),Ct=a?ST({imageIds:gt.map(P=>P.id),uploadsByImageId:et,environmentId:o}):null,ze=me.draft.useStore,on=ze(P=>P.setPrompt),yn=ze(P=>P.setNativeMode),Cn=ze(P=>P.addImage),Pt=ze(P=>P.addImages),Un=ze(P=>P.removeImage),Wt=ze(P=>P.insertTerminalContext),so=ze(P=>P.removeTerminalContext),ma=ze(P=>P.setTerminalContexts),ei=ze(P=>P.removeElementContext),Zs=ze(P=>P.removePreviewAnnotation),Ne=ze(P=>P.removeReviewComment),Kr=ze(P=>P.clearComposerPromptAndImages);K(()=>{if(r){if(!a){for(let P of gt)me.uploads.release(P.id);return}me.draft.restoreAttachments();for(let P of gt)me.uploads.start({environmentId:o,image:P})}},[r,gt,o,a]);let rn=z(()=>qM(me.model.applyInstanceSettings(me.model.deriveInstanceEntries(pe),Be)),[me.model,pe,Be]),ga=zt.activeProvider??null,Td=f?.session?.providerInstanceId??ie?.instanceId??Fe?.instanceId??null,Ho=VM(rn,ga??Td)??rn[0]?.driverKind??me.model.makeDriverKind("unconfigured"),Mo=ue??Ho,lo=z(()=>{if(!ue||!f)return null;let P=f.session?.providerInstanceId??ie?.instanceId;return P?rn.find(V=>V.instanceId===P)?.continuationGroupKey??null:null},[f,ie?.instanceId,ue,rn]),$t=z(()=>{let P=[zt.activeProvider,f?.session?.providerInstanceId,ie?.instanceId,Fe?.instanceId];for(let Ue of P){if(!Ue)continue;let Ye=rn.find(ot=>ot.instanceId===Ue&&dg(ot));if(Ye){if(ue&&Ye.driverKind!==ue||lo&&Ye.continuationGroupKey!==lo)continue;return Ye.instanceId}}let V=rn.filter(Ue=>(!ue||Ue.driverKind===ue)&&(!lo||Ue.continuationGroupKey===lo)),se=V.filter(Ue=>Ue.driverKind===Mo);return ug(se,void 0)?.instanceId??ug(V,void 0)?.instanceId??me.model.noProviderSelection.instanceId},[Fe?.instanceId,f?.session?.providerInstanceId,ie?.instanceId,zt.activeProvider,lo,ue,rn,Mo]),er=z(()=>rn.find(P=>P.instanceId===$t),[rn,$t]),At=er===void 0,vr=He??(At?"Compacting is unavailable right now":null),Gt=er?.driverKind??Mo,{modelOptions:Pe,selectedModel:Ht,executionSelection:$i}=me.draft.useEffectiveModelState({threadRef:n,providers:pe,selectedProvider:Gt,selectedInstanceId:$t,threadModelSelection:ie,projectModelSelection:Fe,settings:Be}),On=Ie===void 0?$i:Ie,Uo=z(()=>er?.snapshot??null,[er]),yo=z(()=>{let P=er?.models??[];if(!On||be===void 0)return P;let V=P.find(se=>se.slug===Ht);return[...P.filter(se=>se.slug!==Ht),{...V??{slug:Ht,name:Ht},capabilities:{...V?.capabilities,optionDescriptors:be}}]},[er,On,be,Ht]),ha=z(()=>nD(Oe),[Oe]),Ro=z(()=>oD({provider:Gt,model:Ht,models:yo,promptInjectionState:ha,modelOptions:Pe?.[$t],planModeEnabled:Be.planModeEnabled},me.model),[Pe,ha,$t,Ht,Gt,yo,Be.planModeEnabled]),va=Ro.promptEffort,co=On?Pe?.[$t]??On.optionOverrides:Ro.modelOptionsForDispatch,tr=Be.planModeEnabled,xr=z(()=>({showInteractionModeToggle:tr&&me.model.getInteractionModeToggle(pe,Gt),runtimeModeSwitch:eT(Gt)}),[tr,pe,Gt]),ti=Uo?.supportsNativeModeSwitch===!0,Tn=m&&ti?zt.nativeModeByProvider?.[$t]??null:null,qr=z(()=>YN(Uo,m?Tn:f?.session?.nativeModeId??f?.nativeModeId??null),[f?.session?.nativeModeId,f?.nativeModeId,Uo,m,Tn]),Vr=Tn&&qr?.current.id===Tn?Tn:void 0,ni=B(P=>{m&&yn(n,$t,P),xt(P)},[m,yn,n,$t,xt]),eo=z(()=>me.model.createSelection($t,Ht,co),[me.model,$t,Ht,co]),yr=z(()=>!On||!ve?.length?null:ve.find(P=>P.runtimeId===On.runtimeId&&P.sourceId===On.sourceId&&P.profileId===On.profileId&&(P.endpointId??void 0)===(On.endpointId??void 0))??null,[ve,On]),xa=re??yr?.ready===!0,Ko=D(null);K(()=>{let P=f?.id??null,V=Ko.current;Ko.current={threadId:P,selection:eo},!(V===null||V.threadId!==P||m)&&V.selection!==eo&&_?.(eo)},[f?.id,m,_,eo]);let Cr=Ht,to=z(()=>{let P=new Map;for(let V of rn)P.set(V.instanceId,me.model.getAppModelOptionsForInstance(Be,V));return P},[rn,Be]),Ke=z(()=>(to.get($t)??[]).some(V=>V.slug===Cr)?Cr:me.model.normalizeSlug(Cr,Gt)??Cr,[me.model,to,$t,Cr,Gt]),ht=m&&ue===null,bn=me.pluginComposer.useOptions(ht?o:null,Le),fn=bn.options,Wr=ht?zt.selectedPluginActionKey:null,ya=z(()=>Wr===null?null:fn.find(P=>P.id===Wr)??null,[Wr,fn]),Ca=Wr!==null,Gr=Ca&&ya===null?yt(bn.isKnown?"composer.pluginUnavailable":"composer.pluginLoading"):null,oi=C??Gr??(T?null:Ct),ba=oi!==null,Ug=z(()=>SD(ie,to),[ie,to]),In=`${String(o)}\0${String(n)}`,Kg=cr(Oe,Oe.length),tl=Va(In,Oe,{cursor:Kg,expandedCursor:Oe.length}),[ju,q]=G(()=>({documentKey:In,cursor:tl.cursor})),ce=ju.documentKey===In?ju.cursor:tl.cursor,Ee=B(P=>{q(V=>{let se=V.documentKey===In?V.cursor:Va(In,Re.current).cursor,Ue=typeof P=="function"?P(se):P,Ye=Re.current,ot=Tr(Ye,Ue);return EM(In,Ye,Ue,ot),V.documentKey===In&&V.cursor===Ue?V:{documentKey:In,cursor:Ue}})},[In,Re]),[tt,Sn]=G(()=>ur(Oe,Oe.length)),[qo,pn]=G(null),[Qu,Xu]=G(null),[qg,Yu]=G(!1),[Ju,Zu]=G(!1);K(()=>{rt?.(Ju)},[Ju,rt]);let[ND,ef]=G(!1),[tf,Vg]=G(null),[_D,Wg]=G(null),[Mb,DD]=G(null),[Gg,Ia]=G(!1),[kd,nl]=G(!1),[OD,Rb]=G(null),[ol,jg]=G({key:0,active:!1}),Nb=D(In);xe(()=>{Nb.current!==In&&(Nb.current=In,Sn(ur(Oe,tl.expandedCursor)),pn(null),Xu(null),Yu(!1),Zu(!1),Vg(null),Wg(null),Ia(!1),nl(!1),Rb(null),jg({key:ol.key,active:!1}))},[In,tl.expandedCursor,Oe,ol.key]);let br=gp("max-sm"),uo=br&&!h&&!ND,Sa=D(null),_b=D(null),Qg=D(null),Db=D(null),Xg=D(!1),Yg=D(!1),Ob=D(!1),Fb=D([]),Bb=D(null),Co=D(null),rl=D(null),al=D(null),nf=D(!1),zb=D(0),il=D(null),Jg=D(new Set),Hi=D(new Map),sl=z(()=>me.chat.deriveComposerSendState({prompt:Oe,imageCount:gt.length,terminalContexts:Lt,elementContextCount:Dn.length+nn.length+xn.length}),[Dn.length,gt.length,nn.length,xn.length,Lt,Oe]),ll=tt?.kind??null,$b=tt?.kind==="path"?tt.query:"",Hb=ll==="path",Zg=me.pathSearch.useComposerPathSearch({environmentId:o,cwd:Hb?sn:null,query:Hb?$b:null}),Vo=z(()=>{if(!tt)return[];if(tt.kind==="path")return Zg.entries.map(P=>({id:`path:${P.kind}:${P.path}`,type:"path",path:P.path,pathKind:P.kind,label:Cu(P.path),description:P.path.slice(0,Math.max(0,P.path.lastIndexOf("/")))}));if(tt.kind==="slash-command"){let P=[{id:"slash:model",type:"slash-command",command:"model",label:"/model",description:"Switch response model for this thread"},...tr?[{id:"slash:plan",type:"slash-command",command:"plan",label:"/plan",description:"Switch this thread into plan mode"},{id:"slash:default",type:"slash-command",command:"default",label:"/default",description:"Switch this thread back to normal build mode"}]:[]],V=TM(Uo?.skills??[],Be.showSkillsInSlashMenu),se=kM(Uo?.slashCommands??[],V).map(Et=>({id:`provider-slash-command:${Gt}:${Et.name}`,type:"provider-slash-command",provider:Gt,command:Et,label:`/${Et.name}`,description:Et.description??Et.input?.hint??"Run provider command"})),Ue=tt.query.trim().toLowerCase(),Ye=V.map(Et=>({id:`skill:${Gt}:${Et.name}`,type:"skill",provider:Gt,skill:Et,label:`/skill:${Et.name}`,description:Et.shortDescription??Et.description??(Et.scope?`${Et.scope} skill`:"")})),ot=[...P,...se,...Ye];return Y_(ot,Ue)}return tt.kind==="skill"?X_(Uo?.skills??[],tt.query).map(P=>({id:`skill:${Gt}:${P.name}`,type:"skill",provider:Gt,skill:P,label:ua(P),description:P.shortDescription??P.description??(P.scope?`${P.scope} skill`:"Run provider skill")})):[]},[tt,tr,Gt,Uo,Be.showSkillsInSlashMenu,Zg.entries]),Ui=!!tt,ri=tt?`${tt.kind}:${tt.query.trim().toLowerCase()}`:null,Ub=z(()=>{let P=mb({items:Vo,highlightedItemId:qo,currentSearchKey:ri,highlightedSearchKey:Qu});return Vo.find(V=>V.id===P)??null},[qo,Qu,Vo,ri]);Ob.current=Ui,Fb.current=Vo,Bb.current=Ub;let FD=z(()=>new Set(te),[te]),Kn=w!==null,of=I[0]??null,Kb=T?.activeQuestion?.allowFreeform===!1,Ld=U[0]??null,{showTopDrawer:rf,showCollapsedPromptRow:BD,hasBlocking:Pd}=Zw(Ld?.kind??null,uo),zD=H||T!==null,{isComposerFooterCompact:Ki,isComposerPrimaryActionsCompact:qb}=DT(Qg,zD),$D=ll==="path"&&$b.length>0&&Zg.isPending,HD=z(()=>ll==="skill"?"No skills found. Try / to browse provider commands.":ll==="path"?"No matching files or folders.":"No matching command.",[ll]),Vb=B(P=>{if(P===Re.current){tn();return}Re.current=P,on(n,P);let V=cr(P,P.length);Ee(V),Sn(ur(P,P.length)),tn()},[n,Re,tn,on]),UD=aD({modelApi:me.model,provider:Gt,instanceId:$t,...i==="server"?{threadRef:s}:{},...i==="draft"&&l?{draftId:l}:{},model:Ht,models:yo,modelOptions:Pe?.[$t],prompt:Oe,onPromptChange:Vb,planModeEnabled:Be.planModeEnabled}),Wb=iD({modelApi:me.model,provider:Gt,instanceId:$t,...i==="server"?{threadRef:s}:{},...i==="draft"&&l?{draftId:l}:{},model:Ht,models:yo,modelOptions:Pe?.[$t],prompt:Oe,onPromptChange:Vb,planModeEnabled:Be.planModeEnabled}),af=z(()=>T?{questionIndex:T.questionIndex,isLastQuestion:T.isLastQuestion,canAdvance:T.canAdvance,isResponding:A,isComplete:!!E}:null,[A,T,E]),KD=v==="running"||y||ba||x||At||g||L!==null||!sl.hasSendableContent,qD="Send message",Ad=br&&!uo&&af!==null,dl=B(P=>{on(n,P)},[n,on]),VD=B(P=>{Cn(n,P)},[n,Cn]),WD=B(P=>{Pt(n,P)},[n,Pt]),GD=B(P=>{me.uploads.release(P),Un(n,P)},[me.uploads,n,Un]),jD=B(P=>{let V=Lt.findIndex(Ye=>Ye.id===P);if(V<0)return;let se=me.terminalContext.removeInlinePlaceholder(Re.current,V);Re.current=se.prompt,dl(se.prompt),so(n,P);let Ue=cr(se.prompt,se.cursor);Ee(Ue),Sn(ur(se.prompt,se.cursor))},[n,Lt,Re,so,dl]);xe(()=>{Re.current=Oe,Ee(P=>dr(Oe,P))},[In,Oe,Re,Ee]),K(()=>{if(tf===null)return;let P=Pb(Oe,St.maxInputChars);P!==tf&&Vg(P)},[tf,St.maxInputChars,Oe]),K(()=>{Wg(null)},[Dn,nn,xn,Lt,Oe,Ht,va,Gt]),xe(()=>{lt.current=gt},[gt,lt]),xe(()=>{kt.current=Lt},[Lt,kt]),xe(()=>{Nt.current=Dn},[Dn,Nt]),K(()=>{if(!Ui){pn(null),Xu(null);return}let P=mb({items:Vo,highlightedItemId:qo,currentSearchKey:ri,highlightedSearchKey:Qu});pn(V=>V===P?V:P),Xu(V=>V===ri?V:ri)},[qo,Qu,Vo,Ui,ri]);let sf=D(null);K(()=>{let P=T?.customAnswer;if(typeof P!="string"){sf.current=null;return}let V=of?.requestId??null,se=T?.activeQuestion?.id??null,Ue=sf.current?.requestId!==V||sf.current?.questionId!==se,Ye=Re.current!==P;if(sf.current={requestId:V,questionId:se},!Ue&&!Ye)return;Re.current=P;let ot=cr(P,P.length);Ee(ot),Sn(ur(P,Tr(P,ot))),pn(null)},[T?.customAnswer,T?.activeQuestion?.id,of?.requestId,Re]);let QD=B((P,V,se,Ue,Ye)=>{if(T?.activeQuestion&&I.length>0){if(T.activeQuestion.allowFreeform===!1)return;Ee(V),Sn(Ue?null:ur(P,se)),It(T.activeQuestion.id,P,V,se,Ue);return}Re.current=P,dl(P),q6(Lt,Ye)||ma(n,K6(Lt,Ye)),Ee(V),Sn(Ue?null:ur(P,se))},[T?.activeQuestion,I.length,It,Re,dl,n,Lt,ma]),ai=B((P,V,se,Ue)=>{let Ye=Re.current,ot=Math.max(0,Math.min(Ye.length,P)),Et=Math.max(ot,Math.min(Ye.length,V));if(Ue?.expectedText!==void 0&&Ye.slice(ot,Et)!==Ue.expectedText)return!1;let Tt=cT(Re.current,P,V,se),No=cr(Tt.text,Tt.cursor),En=Tr(Tt.text,No);Re.current=Tt.text;let Ta=T?.activeQuestion;return Ta&&of?It(Ta.id,Tt.text,No,En,!1):dl(Tt.text),Ee(No),Sn(ur(Tt.text,En)),Ue?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{Sa.current?.focusAt(No)}),!0},[T?.activeQuestion,of,It,Re,dl]),lf=B(()=>{let P=Sa.current?.readSnapshot();return P||{value:Re.current,cursor:ce,expandedCursor:Tr(Re.current,ce),terminalContextIds:Lt.map(V=>V.id)}},[ce,Lt,Re]),eh=B(()=>{let P=lf();return{snapshot:P,trigger:ur(P.value,P.expandedCursor)}},[lf]),Gb=B(P=>{if(Yg.current)return;Yg.current=!0,window.requestAnimationFrame(()=>{Yg.current=!1});let{snapshot:V,trigger:se}=eh();if(se){if(P.type==="path"){let Ue=`${Ec(P.path)} `,Ye=Eb(V.value,se.rangeEnd,Ue);ai(se.rangeStart,Ye,Ue,{expectedText:V.value.slice(se.rangeStart,Ye)})&&pn(null);return}if(P.type==="slash-command"){if(P.command==="model"){ai(se.rangeStart,se.rangeEnd,"",{expectedText:V.value.slice(se.rangeStart,se.rangeEnd),focusEditorAfterReplace:!1})&&(pn(null),Zu(!0));return}Jt(P.command==="plan"?"plan":"default"),ai(se.rangeStart,se.rangeEnd,"",{expectedText:V.value.slice(se.rangeStart,se.rangeEnd)})&&pn(null);return}if(P.type==="provider-slash-command"){let Ue=`/${P.command.name} `,Ye=Eb(V.value,se.rangeEnd,Ue);ai(se.rangeStart,Ye,Ue,{expectedText:V.value.slice(se.rangeStart,Ye)})&&pn(null);return}if(P.type==="skill"){let Ue=`$${P.skill.name} `,Ye=Eb(V.value,se.rangeEnd,Ue);ai(se.rangeStart,Ye,Ue,{expectedText:V.value.slice(se.rangeStart,Ye)})&&pn(null);return}}},[ai,Jt,eh]),XD=B(P=>{pn(P),Xu(ri)},[ri]),jb=B(P=>{if(Vo.length===0)return;let V=Vo.findIndex(Et=>Et.id===qo),Ye=((V>=0?V:P==="ArrowDown"?-1:0)+(P==="ArrowDown"?1:-1)+Vo.length)%Vo.length,ot=Vo[Ye];pn(ot?.id??null)},[qo,Vo]),Qb=B(()=>{if(!br)return;Co.current!==null&&(window.cancelAnimationFrame(Co.current),Co.current=null);let P=document.activeElement;P instanceof HTMLElement&&P.blur(),ef(!1)},[br]),Xb=B(()=>!br||y||ba||x||At||L!==null||v==="running"?!1:T?T.isLastQuestion&&!!E:H||sl.hasSendableContent,[T,E,sl.hasSendableContent,L,x,br,y,ba,At,v,H]),th=B((P,V="foreground")=>{if(At||ba){P?.preventDefault();return}if(d&&(Hi.current.get(In)??0)>0){P?.preventDefault(),me.notify.info("Still compressing a pasted image.","Send again once its thumbnail appears.");return}let se=kD({prompt:Re.current,submissionTarget:T?"pending-user-input":"provider-turn",maxInputChars:St.maxInputChars,disabledReason:oi,event:P,onSend:Ue=>(Xg.current=!1,gn(Ue,V),!Xg.current)});Vg(se.validationMessage),se.didDispatch&&Xb()&&Qb()},[d,T,Qb,In,ba,St.maxInputChars,At,gn,Re,oi,Xb]),YD=B(()=>{if(!(_e||At||sl.hasSendableContent||w!==null||I.length>0||v==="running"||y||x||!d)){if((Hi.current.get(In)??0)>0){me.notify.info("Still compressing a pasted image.","Compact again once its thumbnail appears.");return}An()}},[w,d,_e,In,sl.hasSendableContent,x,y,At,An,I.length,v]),df=B(()=>{Co.current!==null&&(window.cancelAnimationFrame(Co.current),Co.current=null),rl.current!==null&&window.cancelAnimationFrame(rl.current),al.current!==null&&window.cancelAnimationFrame(al.current),nf.current=!0,ef(!0),rl.current=window.requestAnimationFrame(()=>{rl.current=null,Sa.current?.focusAtEnd(),al.current=window.requestAnimationFrame(()=>{al.current=null,nf.current=!1})})},[]),JD=(P,V)=>{if(P==="Tab"&&V.shiftKey)return tr?(vt(),!0):!1;let{trigger:se}=eh();if(Ob.current||se!==null){let ot=Fb.current,Et=Bb.current??ot[0];if(P==="ArrowDown"&&ot.length>0)return jb("ArrowDown"),!0;if(P==="ArrowUp"&&ot.length>0)return jb("ArrowUp"),!0;if((P==="Enter"||P==="Tab")&&Et)return Gb(Et),!0}let Ye=P==="Enter"?sT({isMobileViewport:br,shiftKey:V.shiftKey,modifierKey:V.metaKey||V.ctrlKey,isDraftThread:i==="draft"}):null;return Ye?(th(void 0,Ye),!0):!1},cf=me.stash.useStore,cl=cf(P=>P.entries),Yb=cf(P=>P.stashEntry),uf=cf(P=>P.takeEntry),Jb=cf(P=>P.finalizeEntryImages);K(()=>()=>{il.current!==null&&window.clearTimeout(il.current)},[]);let Zb=B(()=>{zb.current+=1,jg({key:zb.current,active:!0}),il.current!==null&&window.clearTimeout(il.current),il.current=window.setTimeout(()=>{il.current=null,jg(P=>({...P,active:!1}))},1200)},[]),ZD=B(P=>{let{entry:V,durable:se}=uf(P.id);if(!V)return;se||me.notify.warning("Restored prompt may reappear in the stash","Browser storage rejected the update, so this entry could still be there after a reload."),Ia(!1);let Ue=Re.current,Ye=P.prompt.length===0?Ue:Ue.trim().length?`${Ue.replace(/\s+$/,"")}
3737
3740
 
3738
- ${P.prompt}`:P.prompt,nt=We!==Be;nt&&(X.current=We,at(n,We),U(sr(We,We.length)),Re(null));let kt=[];if(P.attachments.length>0){let Mo=new Set(xt.current.map(lo=>lo.id)),Pn=new Set(xt.current.map(lo=>`${lo.mimeType}\0${lo.sizeBytes}\0${lo.name}`)),va=Math.max(0,Rt.maxAttachments-xt.current.length),Ho=P.attachments.filter(lo=>!Mo.has(lo.id)&&!Pn.has(`${lo.mimeType}\0${lo.sizeBytes}\0${lo.name}`));kt=Ho.slice(va).map(lo=>lo.name);let Vr=ge.draft.hydrateImagesFromPersisted(Ho.slice(0,va));Vr.length>0&&dn(n,Vr)}let wt=[];P.droppedImageNames.length>0&&wt.push(`${P.droppedImageNames.join(", ")} exceeded the stash size limit when this prompt was saved.`),P.unreadableImageNames&&P.unreadableImageNames.length>0&&wt.push(`${P.unreadableImageNames.join(", ")} could not be read when this prompt was saved.`),kt.length>0&&wt.push(`${kt.join(", ")} could not be restored: the composer is at its ${Rt.maxAttachments}-image limit.`),wt.length>0&&ge.notify.warning("Some images were not restored",wt.join(" ")),nt&&window.requestAnimationFrame(()=>{ga.current?.focusAtEnd()})},[dn,n,xt,Rt.maxAttachments,X,at,ef]),KD=B(P=>{let{durable:V}=ef(P.id);V||ge.notify.warning("Stash entry may come back","Browser storage rejected the delete, so this prompt could reappear after a reload.")},[ef]),qD=B(async()=>{let P=X.current.split("\uFFFC").join("").trim(),V=[...xt.current];if(P.length===0&&V.length===0){ma(nt=>!nt);return}let le=`${String(n)}\0${P}\0${V.map(nt=>nt.id).join(",")}`;if(Gg.current.has(le))return;Gg.current.add(le);let Be=n,We=fu();try{let{evicted:nt,written:kt,durable:wt}=Ub({id:We,createdAt:new Date().toISOString(),prompt:P,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:V.length});if(!kt){ge.notify.error("Could not stash this prompt","Browser storage rejected the write, so the composer was left as-is. Free up site data and try again.");return}wt||ge.notify.warning("Stashed prompt will not survive a reload","Browser storage is unavailable, so this stash is kept in memory only for this session."),X.current="",Ni(Be);for(let sl of V)ge.uploads.release(sl.id);U(0),Re(null),qb(),nt&&ge.notify.warning("Oldest stashed prompt discarded",`The stash holds ${ge.stash.maxEntries} prompts; the oldest was removed to make room.`);let Mo=[],Pn=[],va=[];for(let sl of V){let Id=await ge.imageCompression.compressForStash(sl.file);if(!Id.ok){(Id.reason==="too-large"?Pn:va).push(sl.name);continue}Mo.push({id:sl.id,name:sl.name,mimeType:Id.image.mimeType,sizeBytes:Id.image.sizeBytes,dataUrl:Id.image.dataUrl})}let{kept:Ho,droppedNames:Vr}=ge.stash.partitionAttachments(Mo),{attached:lo,durable:rf}=Kb(We,{attachments:Ho,droppedImageNames:[...Pn,...Vr],unreadableImageNames:va});lo?!rf&&wt&&V.length>0&&ge.notify.warning("Stashed images were not saved","The prompt was stashed, but browser storage rejected its images. They will be missing if you reload."):Ho.length>0&&ge.notify.warning("Stashed images did not attach",`That prompt was restored or deleted before ${Ho.length} image${Ho.length===1?"":"s"} finished saving. Re-attach ${Ho.length===1?"it":"them"} if you still need ${Ho.length===1?"it":"them"}.`)}finally{Gg.current.delete(le)}},[Ni,n,xt,Kb,X,qb,Ub]),Yg=B(()=>{ma(P=>!P)},[]),VD=B(()=>{if(so){Ju(),ma(!0);return}Yg()},[Ju,so,Yg]),Jg=B(()=>{Js(P=>!P)},[]),bd=f?.latestTurn?.turnId??null,Vb=bd!==null&&TD===bd,qr=Vb?null:oe,ha=Vb?null:ee,Zg=B(()=>{bd!==null&&Sb(bd),Js(!1)},[bd]),tf=il.length>0&&!Vn&&(t.externalDrawerAttached||ju||hd||so)?u(uv,{count:il.length,menuOpen:Ug,placement:"inline",pulseKey:Zs.key,pulsing:Zs.active,onToggleMenu:VD}):null,nf=qr!==null&&ha!==null&&!hd&&!xd&&(t.externalDrawerAttached||ju||so)?u(fv,{expanded:!1,onDismiss:Zg,onToggle:Jg,placement:"inline",progress:qr,steps:ha}):null,eh=!t.externalDrawerAttached&&!ju&&!hd&&!so,WD=eh&&(il.length>0||qr!==null&&ha!==null&&qr.totalSteps>0);q(()=>{(qr===null||ha===null)&&Js(!1)},[ha,qr]),q(()=>{xd&&Js(!1)},[xd]),q(()=>{Js(!1)},[d]),q(()=>{Hi&&ma(!1)},[Hi]),q(()=>{ma(!1)},[et]),ge.pane.useKeydown(P=>{if(ge.keybindings.resolveShortcutCommand(P,ze,{context:{terminalFocus:ge.terminalFocus.getOwner()!==null,terminalOpen:Je,modelPickerOpen:Uu}})==="composer.stash"&&(P.preventDefault(),P.stopPropagation(),!ge.commandPalette.isOpen())){if(I.length>0&&!Vn){ma(le=>!le);return}Vn||g||T!==null||qD()}},{capture:!0});let of=async P=>{if(!d||P.length===0)return;if(I.length>0){ge.notify.error(rt("attachments.answerQuestionsFirst"));return}let V=d,le=un,Be=$i.current.get(le)??0,We=xt.current.length+Be,nt=[],kt=null;for(let wt of P){if(We>=Rt.maxAttachments){kt=rt("attachments.limitReached",{count:Rt.maxAttachments});break}if(wt.size<=0){kt=rt("attachments.empty",{name:wt.name});continue}nt.push(wt),We+=1}if(yn(V,kt),nt.length!==0){$i.current.set(le,Be+nt.length);try{let wt=[],Mo=null;for(let Pn of nt){if(!(ge.imageCompression.isHeicFile(Pn)||rv(Pn.type))){let rf=a?Rt.maxFileBytes:Rt.maxImageBytes;if(Pn.size>rf){Mo=rt("attachments.tooLarge",{name:Pn.name,limit:iv(rf)});continue}wt.push({...sv({id:fu(),name:Pn.name||"file",mimeType:Pn.type||"application/octet-stream",sizeBytes:Pn.size}),previewUrl:URL.createObjectURL(Pn),file:Pn});continue}let Ho=await ge.imageCompression.prepareForAttachment(Pn,Rt.maxImageBytes);if(!Ho.ok){Mo=Ho.reason==="unreadable"?rt("attachments.unreadableImage",{name:Pn.name}):rt("attachments.imageTooLarge",{name:Pn.name});continue}let Vr=Ho.file,lo=URL.createObjectURL(Vr);wt.push({...sv({id:fu(),name:Vr.name||"image",mimeType:Vr.type,sizeBytes:Vr.size}),previewUrl:lo,file:Vr})}wt.length===1&&wt[0]?_D(wt[0]):wt.length>1&&DD(wt),Mo!==null&&yn(V,Mo)}finally{let wt=($i.current.get(le)??0)-nt.length;wt>0?$i.current.set(le,wt):$i.current.delete(le)}}},GD=P=>{OD(P)},jD=P=>{let V=Array.from(P.target.files??[]);P.target.value="",V.length!==0&&of(V)},QD=P=>{let V=Array.from(P.clipboardData.files);V.length!==0&&(P.preventDefault(),of(V))},Wb=(P,V)=>{if(P.length===0||x||Vn||I.length>0||g)return!1;let le=X.current,Be=(V?.ensureLeadingBoundary??!1)&&le.length>0&&!/\s$/.test(le);return Ya(le.length,le.length,Be?` ${P}`:P)},th=rT({insertMentionAtEnd:P=>Wb(P,{ensureLeadingBoundary:!0}),setDragActive:Hu,onInsertRejected:()=>{ge.notify.error("Unable to add to chat","The composer is busy; try again once it is ready.")}}),XD=P=>{if(!cv(P.dataTransfer.types))return;P.stopPropagation();let V=P.relatedTarget;V instanceof Node&&P.currentTarget.contains(V)||Hu(!1)};q(()=>{if(!zg)return;let P=()=>{Hu(!1)};return window.addEventListener("dragend",P),()=>window.removeEventListener("dragend",P)},[zg]);let nh=B(()=>{Mt()},[Mt]),oh=B(()=>{kn()},[kn]),YD=B(()=>{yr&&(Wu.current||(bo.current!==null&&window.cancelAnimationFrame(bo.current),bo.current=window.requestAnimationFrame(()=>{if(bo.current=null,Wu.current)return;let P=Lb.current,V=qg.current,le=document.activeElement;le instanceof Element&&_6(le)||le instanceof Node&&(P&&P.contains(le)||V&&V.contains(le))||qu(!1)})))},[yr]);q(()=>()=>{bo.current!==null&&window.cancelAnimationFrame(bo.current),el.current!==null&&window.cancelAnimationFrame(el.current),tl.current!==null&&window.cancelAnimationFrame(tl.current)},[]);let rh=()=>({prompt:X.current,images:xt.current,terminalContexts:mn.current,elementContexts:Tt.current,previewAnnotations:ln,reviewComments:Nn,selectedPromptEffort:Hr,selectedModelOptionsForDispatch:jo,selectedModelSelection:Oo,...Gt?{executionSelection:Gt}:{},executionReady:Fo,..._n?{selectedNativeModeId:_n}:{},providerAvailable:!on,selectedProvider:It,selectedModel:bn,selectedProviderModels:gr,selectedPluginAction:rn});return Yt.current=rh,Gr(nn,()=>({focusAtEnd:()=>{ga.current?.focusAtEnd()},focusAt:P=>{ga.current?.focusAt(P)},addDroppedFiles:P=>{of(P),tn()},insertTextAtEnd:Wb,toggleModelPicker:()=>{Ku(P=>!P)},readSnapshot:()=>Yu(),resetCursorState:P=>{let V=P?.prompt??X.current,le=ir(V,P?.cursor??0);gn(null),U(le),Re(P?.detectTrigger?lr(V,Ir(V,le)):null)},addTerminalContext:P=>{if(!f)return;let V=ga.current?.readSnapshot()??{value:X.current,cursor:pa,expandedCursor:Ir(X.current,pa),terminalContextIds:ft.map(nt=>nt.id)},le=ge.terminalContext.insertInlinePlaceholder(V.value,V.expandedCursor),Be=sr(le.prompt,le.cursor);$t(n,le.prompt,{id:fu(),threadId:f.id,createdAt:new Date().toISOString(),...P},le.contextIndex)&&(X.current=le.prompt,U(Be),Re(lr(le.prompt,le.cursor)),window.requestAnimationFrame(()=>{ga.current?.focusAt(Be)}))},readSendIdentity:()=>({pluginActionId:rn?.id??null,prompt:X.current}),getSendContext:rh,validateProviderInput:P=>{let V=fa??Cb({prompt:X.current,providerInput:P,submissionTarget:"provider-turn",maxInputChars:Rt.maxInputChars});return Vg.current=V!==null,Hg(V),V===null}}),[f,of,n,pa,ft,$t,X,xt,mn,Tt,ln,Nn,tn,x,Vn,I.length,g,Ya,Yu,bn,jo,Oo,Gt,Fo,_n,on,Hr,It,gr,rn,fa,rh,Yt,Rt.maxInputChars]),b("form",{ref:qg,onSubmit:Xg,onFocusCapture:P=>{let V=P.target;so&&V instanceof HTMLElement&&V.closest('[data-chat-composer-collapsed-controls="true"]')||(bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null),qu(!0))},onBlurCapture:()=>{YD()},onDragEnterCapture:th.onDragEnter,onDragOverCapture:th.onDragOver,onDragLeaveCapture:XD,onDropCapture:th.onDrop,className:F("mx-auto w-full min-w-0 max-w-3xl",WD&&"pt-7"),"data-chat-composer-form":"true",children:[ju&&(!hd||xd)?u("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-variant":vd?.kind==="approval"?"warning":"info","data-occupant":vd?.kind??"none",children:vd===null?null:__({occupant:vd,respondingRequestIds:$,keybindings:ze,onRespondToApproval:vn,onRespondToDecision:L,activePendingDraftAnswers:N,activePendingQuestionIndex:R,onSelectActivePendingUserInputOption:$n,onAdvanceActivePendingUserInput:Vt,activeProposedPlan:O,collapsedPendingRow:u(HN,{activePendingProgress:T,isPendingUserInputChoiceOnly:_b,expandMobileComposer:Ju,inlineTasksBadge:nf,inlineStashBadge:tf,pendingPrimaryAction:Qu,isSendBusy:y,sendDisabledReason:zo,isConnecting:x,isEnvironmentUnavailable:k!==null||on||g,onPreviousActivePendingUserInputQuestion:Zt,handleInterruptPrimaryAction:nh,handleImplementPlanInNewThreadPrimaryAction:oh})},so)}):null,hd&&!xd&&qr&&ha?u(pT,{onDismiss:Zg,onCollapse:Jg,progress:qr,steps:ha}):null,b("div",{className:"relative",children:[eh&&qr&&ha?u(fv,{expanded:!1,hasTrailingShoulder:il.length>0,onDismiss:Zg,onToggle:Jg,progress:qr,steps:ha}):null,eh?u(uv,{count:il.length,menuOpen:Ug,pulseKey:Zs.key,pulsing:Zs.active,onToggleMenu:Yg}):null,u("div",{"data-chat-composer-main-surface":"true",className:F("group relative z-10 rounded-[22px] p-px transition-colors duration-200",yo.composerFrameClassName),children:b("div",{ref:Lb,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":so?"true":"false",className:F("rounded-[20px] transition-[background-color] duration-200",zg?"bg-accent/45 ring-1 ring-primary/70":null,g?"opacity-75":null,yo.composerSurfaceClassName),children:[t.firstRow?u("div",{className:"flex items-center gap-2 px-3 pt-2 sm:px-4","data-conversation-card-first-row":!0,"data-chat-composer-collapsed-controls":"true",children:t.firstRow}):null,t.sourceMetrics&&!Vn?u(uD,{...t.sourceMetrics},t.sourceMetrics.queryKey):null,kD?b("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[u("button",{type:"button",className:F("min-w-0 flex-1 truncate bg-transparent p-0 text-left text-[14px]",(T?T.customAnswer:et.trim())?"text-foreground":"text-placeholder"),onPointerDown:P=>P.preventDefault(),onClick:Ju,"aria-label":"Expand composer",children:T?T.customAnswer||"Type your own answer, or leave this blank to use the selected option":et.trim()||(on?"Enable a provider in Settings":"Ask anything...")}),nf,tf,u("button",{type:"button",className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover disabled:opacity-64",disabled:RD,"aria-label":ND,onPointerDown:P=>P.preventDefault(),onClick:P=>{P.stopPropagation(),Xg()},children:u("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:u("path",{d:"M8 3L8 13M8 3L4 7M8 3L12 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}):null,b("div",{ref:wD,className:F("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",Vn&&"pb-3 sm:pb-4",so&&"hidden"),children:[Ug&&!Hi&&!Vn&&u(vD,{anchor:Ib,children:u(cT,{entries:il,onRestore:UD,onDelete:KD,onClose:()=>ma(!1)})}),Hi&&!Vn&&u(vD,{anchor:Ib,children:u($N,{items:$o,resolvedTheme:He,isLoading:AD,triggerKind:rl,emptyStateText:ED,activeItemId:Nb?.id??null,onHighlightedItemChange:zD,onSelect:Bb})}),!so&&!Vn&&I.length===0&&ln.length>0&&u(ST,{annotations:ln,images:Nt,...a?{uploadsByImageId:Un,onRetryUpload:P=>ge.uploads.retry({environmentId:o,image:P})}:{},onRemove:P=>{ge.uploads.release(P),Wa(n,P)},onExpandImage:P=>{let V=xb(ut,P);V&&sn(V)},className:"mb-3"}),!so&&!Vn&&I.length===0&&Nn.length>0&&u(IT,{comments:Nn,onRemove:P=>Ga(n,P),className:"mb-3"}),!so&&!Vn&&I.length===0&&eo.length>0&&u(bT,{contexts:eo,onRemove:P=>vo(n,P),className:"mb-3"}),!so&&!Vn&&I.length===0&&Nt.some(P=>!ln.some(V=>V.id===P.id))&&u("div",{className:"mb-3 flex flex-wrap gap-2",children:Nt.filter(P=>!ln.some(V=>V.id===P.id)).map(P=>{let V=a?Un[P.id]:void 0,le=av(P),Be=gT(le),We=le==="image"&&!!P.previewUrl;return b("div",{className:F("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",We?"w-16":"w-44 max-w-full"),children:[We?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":rt("attachments.preview",{name:P.name}),onClick:()=>{let nt=xb(ut,P.id);nt&&sn(nt)},children:u("img",{src:P.previewUrl,alt:P.name,className:"h-full w-full object-cover"})}):b("a",{href:P.previewUrl,target:"_blank",rel:"noreferrer",className:"flex h-full w-full items-center gap-2 px-2 pe-7 text-start","aria-label":rt("attachments.open",{name:P.name}),children:[u(Be,{className:"size-4 shrink-0 text-secondary-label"}),b("span",{className:"min-w-0",children:[u("span",{className:"block truncate text-[11px] text-foreground",children:P.name}),u("span",{className:"block text-[10px] text-secondary-label",children:iv(P.sizeBytes)})]})]}),LD.has(P.id)&&b(Qe,{children:[u(Ye,{render:u("span",{role:"img","aria-label":rt("attachments.draftMayNotPersist"),className:"absolute left-1 top-1 inline-flex items-center justify-center rounded bg-background/85 p-0.5 text-amber-600",children:u(So,{className:"size-3"})})}),u(Xe,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:rt("attachments.draftMayNotPersistDetail")})]}),V?.status==="uploading"&&u("span",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-background/85 px-1 text-center text-[10px] text-foreground",children:fp(V.progress)}),V?.status==="failed"&&b(Qe,{children:[u(Ye,{render:u(te,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>ge.uploads.retry({environmentId:o,image:P}),"aria-label":rt("attachments.retryUpload",{name:P.name})}),children:u(ns,{})}),u(Xe,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:V.reason})]}),u(te,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>GD(P.id),"aria-label":rt("attachments.remove",{name:P.name}),children:u(jt,{})})]},P.id)})}),b("div",{className:"relative",children:[_b?null:u(RM,{editorRef:ga,documentKey:un,value:Vn?"":T?T.customAnswer:et,cursor:pa,terminalContexts:!Vn&&I.length===0?ft:[],skills:Eo?.skills??[],...Cd?{className:"max-sm:pb-11"}:{},onRemoveTerminalContext:FD,onChange:BD,onCommandKeyDown:HD,onPaste:QD,placeholder:Vn?S?.detail??"Resolve this approval request to continue":T?"Type your own answer, or leave this blank to use the selected option":K&&O?"Add feedback to refine the plan, or leave this blank to implement it":g?"Choose a project above to start a thread":on?"Enable a provider in Settings to send a message":v==="disconnected"?nT:"Ask anything, @tag files/folders, $use skills, or / for commands",disabled:x||Vn||g}),Cd?b("div",{"data-chat-composer-mobile-pending-actions":"true",className:"absolute bottom-0 right-0 flex items-center justify-end gap-1",children:[nf,tf,u(Fu,{compact:!0,pendingAction:Qu,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:y,sendDisabledReason:zo,isConnecting:x,isEnvironmentUnavailable:k!==null||on||g,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:Zt,onInterrupt:nh,onImplementPlanInNewThread:oh})]}):null]})]}),u(hD,{message:SD??Vu}),fa===null?null:u("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-plugin-blocked":"true",children:fa}),so||Vn?null:b("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":yd?"true":"false",className:F("flex min-w-0 flex-nowrap items-center justify-between gap-2 overflow-visible px-3 pb-3 sm:px-4 sm:pb-4",I.length>0&&"pt-2",yd?"gap-1.5":"gap-2 sm:gap-0",Cd&&"hidden sm:flex"),children:[b("div",{className:"-m-1 -ms-3.5 flex min-w-0 flex-1 items-center gap-1 overflow-x-auto p-1 ps-3.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[u("input",{ref:Tb,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:jD}),b(Qe,{children:[u(Ye,{render:u(te,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:x||g||I.length>0,"aria-label":rt("attachments.add"),onClick:()=>Tb.current?.click()}),children:u(Ro,{})}),u(Xe,{side:"top",children:rt("attachments.add")})]}),on?b(te,{type:"button",size:"sm",variant:"ghost",disabled:!0,"data-chat-provider-unavailable":"true",className:"shrink-0 gap-2 px-2 text-secondary-label sm:px-3",children:[u(So,{className:"size-4"}),"No provider available"]}):u(zN,{compact:yd,activeInstanceId:_t,model:zi,lockedProvider:ve,lockedContinuationGroupKey:qn,instanceEntries:he,keybindings:ze,modelOptionsByInstance:io,triggerClassName:"-ms-2.5",terminalOpen:Je,open:Uu,...yo.modelPickerIconClassName?{activeProviderIconClassName:yo.modelPickerIconClassName}:{},onOpenChange:P=>{Ku(P)},getModelDisabledReason:ie,getModelContinuationLabel:pe,onContinueInModel:Ze,onInstanceModelChange:ho,...xe?{composerChoices:xe}:{},selectedExecutionSelection:Gt??null,onClearExecutionSelection:dt,executionAppliesTo:lt,sourceLabel:Bi?.sourceLabel,...D?{onChooseExecution:P=>{D(P.selection,P)}}:{},...Bo?{pluginActions:vt,selectedPluginActionKey:rn?.id??null,onSelectPluginAction:Y,onManagePlugins:ce}:{}}),Qa?null:b(be,{children:[u(tD,{environmentId:o,draftId:i==="draft"?l:null,threadPresetId:f?.presetId??null,compact:yd}),yd?u(D_,{interactionMode:qe,runtimeMode:W,runtimeModeSwitch:ao.runtimeModeSwitch,nativeMode:Oi,canSwitchNativeMode:Ur,showInteractionModeToggle:ao.showInteractionModeToggle,traitsMenuContent:MD,onToggleInteractionMode:pt,onRuntimeModeChange:xn,onNativeModeChange:Fi}):b(be,{children:[Fb?b(be,{children:[u(Jd,{orientation:"vertical",className:"mx-0.5 hidden h-4 sm:block"}),Fb]}):null,u(D6,{showInteractionModeToggle:ao.showInteractionModeToggle,interactionMode:qe,runtimeMode:W,runtimeModeSwitch:ao.runtimeModeSwitch,nativeMode:Oi,canSwitchNativeMode:Ur,onToggleInteractionMode:pt,onRuntimeModeChange:xn,onNativeModeChange:Fi})]})]})]}),b("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":Db?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[Cd?null:nf,Cd?null:tf,u(O6,{compact:Db,activeContextWindow:ct,activeThreadModelDisplayName:Og,pendingAction:Qu,isRunning:v==="running",showPlanFollowUpPrompt:I.length===0&&K,promptHasText:et.trim().length>0,isSendBusy:y,sendDisabledReason:zo,isConnecting:x,isEnvironmentUnavailable:k!==null||on||g,isPreparingWorktree:w,hasSendableContent:ol.hasSendableContent,preserveComposerFocusOnPointerDown:yr,showSendWhileRunning:yr,onPreviousPendingQuestion:Zt,onInterrupt:nh,onImplementPlanInNewThread:oh,compactDisabled:Et||on||y||x,compactDisabledReason:_i,onCompactContext:$D})]})]})]})})]})]})});function yD(e){let{composerRef:t,...n}=e,o=n;return u(sT,{value:o.api,children:u(xD,{...o,composerRef:t})})}function CD(e){return u(gh.Provider,{value:e.scope.active,children:u(F6,{...e})})}function F6(e){let{scope:t,mode:n,timeline:o,trajectory:r,queue:a,composer:i}=e,[s,l]=Ln("turn-navigator",t.threadKey,null),d=u(yD,{...i,attachments:e.attachments,firstRow:i.draftHero.active?null:b(be,{children:[u(rS,{mode:n.mode,onModeChange:n.onModeChange}),u("div",{className:"min-w-0 flex-1"}),s!==null?u(lS,{...s,placement:"inline",onSelect:c=>{n.onModeChange("chat"),s.onSelect(c)}}):null]})});return b("div",{className:F("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[u(aS,{chat:u(x0,{...o,paneActive:t.active,onTurnNavigatorChange:l}),mode:n.mode,trajectory:u(I0,{...r,inputKey:t.threadKey,paneVisible:t.visible&&n.mode==="trajectory"}),visible:t.visible}),u(Kw,{bannerItems:i.bannerItems,belowSlot:i.belowSlot,composer:d,draftHero:i.draftHero,onOverlayElementChange:i.onOverlayElementChange,queue:b(be,{children:[u(Bw,{inputKey:t.threadKey,actions:a.actions,attachments:e.attachments,entries:a.entries,environmentId:a.environmentId,onCancel:a.onCancel,unavailable:a.unavailable}),u(nv,{entries:a.entries,onCancel:a.onCancel,onResume:a.onResume,queue:a.state,unavailable:a.unavailable})]})})]})}var B6=".ycodium-conversation-ui";function z6(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function bD(e,t="conversation"){let n=z6(),o=e.replaceAll(B6,`.${n}`),r=0,a=null;return{scopeClass:n,retain(){return typeof document>"u"?()=>{}:(r===0&&(a=document.createElement("style"),a.setAttribute("data-ycodium-plugin-css",t),a.textContent=o,document.head.appendChild(a)),r+=1,()=>{r-=1,r===0&&a!==null&&(a.remove(),a=null)})}}}function $6(e){let t=bD(Qb);return{views:{[dh]:H6(t,e)},viewCapabilities:{[dh]:[tI]}}}function H6(e,t){return function(o){let a=o[ch]??t,i={...o};return delete i[ch],b(Jb,{value:a,children:[u(U6,{retain:e.retain}),u(eI,{value:e.scopeClass,children:u(CD,{...i,scopeClass:e.scopeClass})})]})}}function U6({retain:e}){return wd(()=>e(),[e]),null}export{$6 as default};
3741
+ ${P.prompt}`:P.prompt,ot=Ye!==Ue;ot&&(Re.current=Ye,on(n,Ye),Ee(cr(Ye,Ye.length)),Sn(null));let Et=[];if(P.attachments.length>0){let No=new Set(lt.current.map(fo=>fo.id)),En=new Set(lt.current.map(fo=>`${fo.mimeType}\0${fo.sizeBytes}\0${fo.name}`)),Ta=Math.max(0,St.maxAttachments-lt.current.length),Wo=P.attachments.filter(fo=>!No.has(fo.id)&&!En.has(`${fo.mimeType}\0${fo.sizeBytes}\0${fo.name}`));Et=Wo.slice(Ta).map(fo=>fo.name);let Qr=me.draft.hydrateImagesFromPersisted(Wo.slice(0,Ta));Qr.length>0&&Pt(n,Qr)}let Tt=[];P.droppedImageNames.length>0&&Tt.push(`${P.droppedImageNames.join(", ")} exceeded the stash size limit when this prompt was saved.`),P.unreadableImageNames&&P.unreadableImageNames.length>0&&Tt.push(`${P.unreadableImageNames.join(", ")} could not be read when this prompt was saved.`),Et.length>0&&Tt.push(`${Et.join(", ")} could not be restored: the composer is at its ${St.maxAttachments}-image limit.`),Tt.length>0&&me.notify.warning("Some images were not restored",Tt.join(" ")),ot&&window.requestAnimationFrame(()=>{Sa.current?.focusAtEnd()})},[Pt,n,lt,St.maxAttachments,Re,on,uf]),e1=B(P=>{let{durable:V}=uf(P.id);V||me.notify.warning("Stash entry may come back","Browser storage rejected the delete, so this prompt could reappear after a reload.")},[uf]),t1=B(async()=>{let P=Re.current.split("\uFFFC").join("").trim(),V=[...lt.current];if(P.length===0&&V.length===0){Ia(ot=>!ot);return}let se=`${String(n)}\0${P}\0${V.map(ot=>ot.id).join(",")}`;if(Jg.current.has(se))return;Jg.current.add(se);let Ue=n,Ye=yu();try{let{evicted:ot,written:Et,durable:Tt}=Yb({id:Ye,createdAt:new Date().toISOString(),prompt:P,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:V.length});if(!Et){me.notify.error("Could not stash this prompt","Browser storage rejected the write, so the composer was left as-is. Free up site data and try again.");return}Tt||me.notify.warning("Stashed prompt will not survive a reload","Browser storage is unavailable, so this stash is kept in memory only for this session."),Re.current="",Kr(Ue);for(let ul of V)me.uploads.release(ul.id);Ee(0),Sn(null),Zb(),ot&&me.notify.warning("Oldest stashed prompt discarded",`The stash holds ${me.stash.maxEntries} prompts; the oldest was removed to make room.`);let No=[],En=[],Ta=[];for(let ul of V){let Md=await me.imageCompression.compressForStash(ul.file);if(!Md.ok){(Md.reason==="too-large"?En:Ta).push(ul.name);continue}No.push({id:ul.id,name:ul.name,mimeType:Md.image.mimeType,sizeBytes:Md.image.sizeBytes,dataUrl:Md.image.dataUrl})}let{kept:Wo,droppedNames:Qr}=me.stash.partitionAttachments(No),{attached:fo,durable:gf}=Jb(Ye,{attachments:Wo,droppedImageNames:[...En,...Qr],unreadableImageNames:Ta});fo?!gf&&Tt&&V.length>0&&me.notify.warning("Stashed images were not saved","The prompt was stashed, but browser storage rejected its images. They will be missing if you reload."):Wo.length>0&&me.notify.warning("Stashed images did not attach",`That prompt was restored or deleted before ${Wo.length} image${Wo.length===1?"":"s"} finished saving. Re-attach ${Wo.length===1?"it":"them"} if you still need ${Wo.length===1?"it":"them"}.`)}finally{Jg.current.delete(se)}},[Kr,n,lt,Jb,Re,Zb,Yb]),nh=B(()=>{Ia(P=>!P)},[]),n1=B(()=>{if(uo){df(),Ia(!0);return}nh()},[df,uo,nh]),oh=B(()=>{nl(P=>!P)},[]),Ed=f?.latestTurn?.turnId??null,eI=Ed!==null&&OD===Ed,jr=eI?null:oe,wa=eI?null:ee,rh=B(()=>{Ed!==null&&Rb(Ed),nl(!1)},[Ed]),ff=cl.length>0&&!Kn&&(t.externalDrawerAttached||rf||kd||uo)?u(hv,{count:cl.length,menuOpen:Gg,placement:"inline",pulseKey:ol.key,pulsing:ol.active,onToggleMenu:n1}):null,pf=jr!==null&&wa!==null&&!kd&&!Pd&&(t.externalDrawerAttached||rf||uo)?u(vv,{expanded:!1,onDismiss:rh,onToggle:oh,placement:"inline",progress:jr,steps:wa}):null,ah=!t.externalDrawerAttached&&!rf&&!kd&&!uo,o1=ah&&(cl.length>0||jr!==null&&wa!==null&&jr.totalSteps>0);K(()=>{(jr===null||wa===null)&&nl(!1)},[wa,jr]),K(()=>{Pd&&nl(!1)},[Pd]),K(()=>{nl(!1)},[d]),K(()=>{Ui&&Ia(!1)},[Ui]),K(()=>{Ia(!1)},[Oe]),me.pane.useKeydown(P=>{if(me.keybindings.resolveShortcutCommand(P,Vt,{context:{terminalFocus:me.terminalFocus.getOwner()!==null,terminalOpen:he,modelPickerOpen:Ju}})==="composer.stash"&&(P.preventDefault(),P.stopPropagation(),!me.commandPalette.isOpen())){if(I.length>0&&!Kn){Ia(se=>!se);return}Kn||g||T!==null||t1()}},{capture:!0});let mf=async P=>{if(!d||P.length===0)return;if(I.length>0){me.notify.error(yt("attachments.answerQuestionsFirst"));return}let V=d,se=In,Ue=Hi.current.get(se)??0,Ye=lt.current.length+Ue,ot=[],Et=null;for(let Tt of P){if(Ye>=St.maxAttachments){Et=yt("attachments.limitReached",{count:St.maxAttachments});break}if(Tt.size<=0){Et=yt("attachments.empty",{name:Tt.name});continue}ot.push(Tt),Ye+=1}if(un(V,Et),ot.length!==0){Hi.current.set(se,Ue+ot.length);try{let Tt=[],No=null;for(let En of ot){if(!(me.imageCompression.isHeicFile(En)||dv(En.type))){let gf=a?St.maxFileBytes:St.maxImageBytes;if(En.size>gf){No=yt("attachments.tooLarge",{name:En.name,limit:uv(gf)});continue}Tt.push({...fv({id:yu(),name:En.name||"file",mimeType:En.type||"application/octet-stream",sizeBytes:En.size}),previewUrl:URL.createObjectURL(En),file:En});continue}let Wo=await me.imageCompression.prepareForAttachment(En,St.maxImageBytes);if(!Wo.ok){No=Wo.reason==="unreadable"?yt("attachments.unreadableImage",{name:En.name}):yt("attachments.imageTooLarge",{name:En.name});continue}let Qr=Wo.file,fo=URL.createObjectURL(Qr);Tt.push({...fv({id:yu(),name:Qr.name||"image",mimeType:Qr.type,sizeBytes:Qr.size}),previewUrl:fo,file:Qr})}Tt.length===1&&Tt[0]?VD(Tt[0]):Tt.length>1&&WD(Tt),No!==null&&un(V,No)}finally{let Tt=(Hi.current.get(se)??0)-ot.length;Tt>0?Hi.current.set(se,Tt):Hi.current.delete(se)}}},r1=P=>{GD(P)},a1=P=>{let V=Array.from(P.target.files??[]);P.target.value="",V.length!==0&&mf(V)},i1=P=>{let V=Array.from(P.clipboardData.files);V.length!==0&&(P.preventDefault(),mf(V))},tI=(P,V)=>{if(P.length===0||x||Kn||I.length>0||g)return!1;let se=Re.current,Ue=(V?.ensureLeadingBoundary??!1)&&se.length>0&&!/\s$/.test(se);return ai(se.length,se.length,Ue?` ${P}`:P)},ih=pT({insertMentionAtEnd:P=>tI(P,{ensureLeadingBoundary:!0}),setDragActive:Yu,onInsertRejected:()=>{me.notify.error("Unable to add to chat","The composer is busy; try again once it is ready.")}}),s1=P=>{if(!gv(P.dataTransfer.types))return;P.stopPropagation();let V=P.relatedTarget;V instanceof Node&&P.currentTarget.contains(V)||Yu(!1)};K(()=>{if(!qg)return;let P=()=>{Yu(!1)};return window.addEventListener("dragend",P),()=>window.removeEventListener("dragend",P)},[qg]);let sh=B(()=>{Pn()},[Pn]),lh=B(()=>{hn()},[hn]),l1=B(()=>{br&&(nf.current||(Co.current!==null&&window.cancelAnimationFrame(Co.current),Co.current=window.requestAnimationFrame(()=>{if(Co.current=null,nf.current)return;let P=Db.current,V=Qg.current,se=document.activeElement;se instanceof Element&&V6(se)||se instanceof Node&&(P&&P.contains(se)||V&&V.contains(se))||ef(!1)})))},[br]);K(()=>()=>{Co.current!==null&&window.cancelAnimationFrame(Co.current),rl.current!==null&&window.cancelAnimationFrame(rl.current),al.current!==null&&window.cancelAnimationFrame(al.current)},[]);let dh=()=>({prompt:Re.current,images:lt.current,terminalContexts:kt.current,elementContexts:Nt.current,previewAnnotations:nn,reviewComments:xn,selectedPromptEffort:va,selectedModelOptionsForDispatch:co,selectedModelSelection:eo,...On?{executionSelection:On}:{},executionReady:xa,...Vr?{selectedNativeModeId:Vr}:{},providerAvailable:!At,selectedProvider:Gt,selectedModel:Ht,selectedProviderModels:yo,selectedPluginAction:ya});return en.current=dh,Yr(Jn,()=>({focusAtEnd:()=>{Sa.current?.focusAtEnd()},focusAt:P=>{Sa.current?.focusAt(P)},addDroppedFiles:P=>{mf(P),vn()},insertTextAtEnd:tI,toggleModelPicker:()=>{Zu(P=>!P)},readSnapshot:()=>lf(),resetCursorState:P=>{let V=P?.prompt??Re.current,se=dr(V,P?.cursor??0);pn(null),Ee(se),Sn(P?.detectTrigger?ur(V,Tr(V,se)):null)},addTerminalContext:P=>{if(!f)return;let V=Sa.current?.readSnapshot()??{value:Re.current,cursor:ce,expandedCursor:Tr(Re.current,ce),terminalContextIds:Lt.map(ot=>ot.id)},se=me.terminalContext.insertInlinePlaceholder(V.value,V.expandedCursor),Ue=cr(se.prompt,se.cursor);Wt(n,se.prompt,{id:yu(),threadId:f.id,createdAt:new Date().toISOString(),...P},se.contextIndex)&&(Re.current=se.prompt,Ee(Ue),Sn(ur(se.prompt,se.cursor)),window.requestAnimationFrame(()=>{Sa.current?.focusAt(Ue)}))},readSendIdentity:()=>({pluginActionId:ya?.id??null,prompt:Re.current}),getSendContext:dh,validateProviderInput:P=>{let V=Gr??Ab({prompt:Re.current,providerInput:P,submissionTarget:"provider-turn",maxInputChars:St.maxInputChars});return Xg.current=V!==null,Wg(V),V===null}}),[f,mf,n,ce,Lt,Wt,Re,lt,kt,Nt,nn,xn,vn,x,Kn,I.length,g,ai,lf,Ht,co,eo,On,xa,Vr,At,va,Gt,yo,ya,Gr,dh,en,St.maxInputChars]),b("form",{ref:Qg,onSubmit:th,onFocusCapture:P=>{let V=P.target;uo&&V instanceof HTMLElement&&V.closest('[data-chat-composer-collapsed-controls="true"]')||(Co.current!==null&&(window.cancelAnimationFrame(Co.current),Co.current=null),ef(!0))},onBlurCapture:()=>{l1()},onDragEnterCapture:ih.onDragEnter,onDragOverCapture:ih.onDragOver,onDragLeaveCapture:s1,onDropCapture:ih.onDrop,className:O("mx-auto w-full min-w-0 max-w-3xl",o1&&"pt-7"),"data-chat-composer-form":"true",children:[rf&&(!kd||Pd)?u("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-variant":Ld?.kind==="approval"?"warning":"info","data-occupant":Ld?.kind??"none",children:Ld===null?null:Q_({occupant:Ld,respondingRequestIds:$,keybindings:Vt,onRespondToApproval:cn,onRespondToDecision:k,activePendingDraftAnswers:N,activePendingQuestionIndex:R,onSelectActivePendingUserInputOption:Yt,onAdvanceActivePendingUserInput:Hn,activeProposedPlan:F,collapsedPendingRow:u(n_,{activePendingProgress:T,isPendingUserInputChoiceOnly:Kb,expandMobileComposer:df,inlineTasksBadge:pf,inlineStashBadge:ff,pendingPrimaryAction:af,isSendBusy:y,sendDisabledReason:oi,isConnecting:x,isEnvironmentUnavailable:L!==null||At||g,onPreviousActivePendingUserInputQuestion:io,handleInterruptPrimaryAction:sh,handleImplementPlanInNewThreadPrimaryAction:lh})},uo)}):null,kd&&!Pd&&jr&&wa?u(IT,{onDismiss:rh,onCollapse:oh,progress:jr,steps:wa}):null,b("div",{className:"relative",children:[ah&&jr&&wa?u(vv,{expanded:!1,hasTrailingShoulder:cl.length>0,onDismiss:rh,onToggle:oh,progress:jr,steps:wa}):null,ah?u(hv,{count:cl.length,menuOpen:Gg,pulseKey:ol.key,pulsing:ol.active,onToggleMenu:nh}):null,u("div",{"data-chat-composer-main-surface":"true",className:O("group relative z-10 rounded-[22px] p-px transition-colors duration-200",Ro.composerFrameClassName),children:b("div",{ref:Db,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":uo?"true":"false",className:O("rounded-[20px] transition-[background-color] duration-200",qg?"bg-accent/45 ring-1 ring-primary/70":null,g?"opacity-75":null,Ro.composerSurfaceClassName),children:[t.firstRow?u("div",{className:"flex items-center gap-2 px-3 pt-2 sm:px-4","data-conversation-card-first-row":!0,"data-chat-composer-collapsed-controls":"true",children:t.firstRow}):null,t.sourceMetrics&&!Kn?u(ID,{...t.sourceMetrics},t.sourceMetrics.queryKey):null,BD?b("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[u("button",{type:"button",className:O("min-w-0 flex-1 truncate bg-transparent p-0 text-left text-[14px]",(T?T.customAnswer:Oe.trim())?"text-foreground":"text-placeholder"),onPointerDown:P=>P.preventDefault(),onClick:df,"aria-label":"Expand composer",children:T?T.customAnswer||"Type your own answer, or leave this blank to use the selected option":Oe.trim()||(At?"Enable a provider in Settings":"Ask anything...")}),pf,ff,u("button",{type:"button",className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover disabled:opacity-64",disabled:KD,"aria-label":qD,onPointerDown:P=>P.preventDefault(),onClick:P=>{P.stopPropagation(),th()},children:u("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:u("path",{d:"M8 3L8 13M8 3L4 7M8 3L12 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}):null,b("div",{ref:DD,className:O("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",Kn&&"pb-3 sm:pb-4",uo&&"hidden"),children:[Gg&&!Ui&&!Kn&&u(PD,{anchor:Mb,children:u(yT,{entries:cl,onRestore:ZD,onDelete:e1,onClose:()=>Ia(!1)})}),Ui&&!Kn&&u(PD,{anchor:Mb,children:u(t_,{items:Vo,resolvedTheme:qe,isLoading:$D,triggerKind:ll,emptyStateText:HD,activeItemId:Ub?.id??null,onHighlightedItemChange:XD,onSelect:Gb})}),!uo&&!Kn&&I.length===0&&nn.length>0&&u(RT,{annotations:nn,images:gt,...a?{uploadsByImageId:et,onRetryUpload:P=>me.uploads.retry({environmentId:o,image:P})}:{},onRemove:P=>{me.uploads.release(P),Zs(n,P)},onExpandImage:P=>{let V=Lb(Zo,P);V&&Zn(V)},className:"mb-3"}),!uo&&!Kn&&I.length===0&&xn.length>0&&u(MT,{comments:xn,onRemove:P=>Ne(n,P),className:"mb-3"}),!uo&&!Kn&&I.length===0&&Dn.length>0&&u(ET,{contexts:Dn,onRemove:P=>ei(n,P),className:"mb-3"}),!uo&&!Kn&&I.length===0&&gt.some(P=>!nn.some(V=>V.id===P.id))&&u("div",{className:"mb-3 flex flex-wrap gap-2",children:gt.filter(P=>!nn.some(V=>V.id===P.id)).map(P=>{let V=a?et[P.id]:void 0,se=cv(P),Ue=wT(se),Ye=se==="image"&&!!P.previewUrl;return b("div",{className:O("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",Ye?"w-16":"w-44 max-w-full"),children:[Ye?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":yt("attachments.preview",{name:P.name}),onClick:()=>{let ot=Lb(Zo,P.id);ot&&Zn(ot)},children:u("img",{src:P.previewUrl,alt:P.name,className:"h-full w-full object-cover"})}):b("a",{href:P.previewUrl,target:"_blank",rel:"noreferrer",className:"flex h-full w-full items-center gap-2 px-2 pe-7 text-start","aria-label":yt("attachments.open",{name:P.name}),children:[u(Ue,{className:"size-4 shrink-0 text-secondary-label"}),b("span",{className:"min-w-0",children:[u("span",{className:"block truncate text-[11px] text-foreground",children:P.name}),u("span",{className:"block text-[10px] text-secondary-label",children:uv(P.sizeBytes)})]})]}),FD.has(P.id)&&b(Ve,{children:[u(Ge,{render:u("span",{role:"img","aria-label":yt("attachments.draftMayNotPersist"),className:"absolute left-1 top-1 inline-flex items-center justify-center rounded bg-background/85 p-0.5 text-amber-600",children:u(Io,{className:"size-3"})})}),u(We,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:yt("attachments.draftMayNotPersistDetail")})]}),V?.status==="uploading"&&u("span",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-background/85 px-1 text-center text-[10px] text-foreground",children:yp(V.progress)}),V?.status==="failed"&&b(Ve,{children:[u(Ge,{render:u(ne,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>me.uploads.retry({environmentId:o,image:P}),"aria-label":yt("attachments.retryUpload",{name:P.name})}),children:u(rs,{})}),u(We,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:V.reason})]}),u(ne,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>r1(P.id),"aria-label":yt("attachments.remove",{name:P.name}),children:u(jt,{})})]},P.id)})}),b("div",{className:"relative",children:[Kb?null:u(HM,{editorRef:Sa,documentKey:In,value:Kn?"":T?T.customAnswer:Oe,cursor:ce,terminalContexts:!Kn&&I.length===0?Lt:[],skills:Uo?.skills??[],...Ad?{className:"max-sm:pb-11"}:{},onRemoveTerminalContext:jD,onChange:QD,onCommandKeyDown:JD,onPaste:i1,placeholder:Kn?w?.detail??"Resolve this approval request to continue":T?"Type your own answer, or leave this blank to use the selected option":H&&F?"Add feedback to refine the plan, or leave this blank to implement it":g?"Choose a project above to start a thread":At?"Enable a provider in Settings to send a message":v==="disconnected"?uT:"Ask anything, @tag files/folders, $use skills, or / for commands",disabled:x||Kn||g}),Ad?b("div",{"data-chat-composer-mobile-pending-actions":"true",className:"absolute bottom-0 right-0 flex items-center justify-end gap-1",children:[pf,ff,u(Vu,{compact:!0,pendingAction:af,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:y,sendDisabledReason:oi,isConnecting:x,isEnvironmentUnavailable:L!==null||At||g,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:io,onInterrupt:sh,onImplementPlanInNewThread:lh})]}):null]})]}),u(LD,{message:_D??tf}),Gr===null?null:u("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-plugin-blocked":"true",children:Gr}),uo||Kn?null:b("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":Ki?"true":"false",className:O("flex min-w-0 flex-nowrap items-center justify-between gap-2 overflow-visible px-3 pb-3 sm:px-4 sm:pb-4",I.length>0&&"pt-2",Ki?"gap-1.5":"gap-2 sm:gap-0",Ad&&"hidden sm:flex"),children:[b("div",{className:"-m-1 -ms-3.5 flex min-w-0 flex-1 items-center gap-1 overflow-x-auto p-1 ps-3.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[u("input",{ref:_b,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:a1}),b(Ve,{children:[u(Ge,{render:u(ne,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:x||g||I.length>0,"aria-label":yt("attachments.add"),onClick:()=>_b.current?.click()}),children:u(_o,{})}),u(We,{side:"top",children:yt("attachments.add")})]}),At?b(ne,{type:"button",size:"sm",variant:"ghost",disabled:!0,"data-chat-provider-unavailable":"true",className:"shrink-0 gap-2 px-2 text-secondary-label sm:px-3",children:[u(Io,{className:"size-4"}),"No provider available"]}):b(Ce,{children:[u(qu,{name:"conversation.input.agent",...at===void 0?{}:{slots:at},owner:{activeInstanceId:$t,model:Ke,instanceEntries:rn,modelOptionsByInstance:to,lockedProvider:ue,compact:Ki,onInstanceModelChange:Eo},fallback:u(aC,{activeInstanceId:$t,model:Ke,instanceEntries:rn,modelOptionsByInstance:to,lockedProvider:ue,compact:Ki,onInstanceModelChange:Eo})}),u(jN,{...at===void 0?{}:{slots:at},compact:Ki,hideInstanceRail:!0,showInstanceOnTrigger:!1,activeInstanceId:$t,model:Ke,lockedProvider:ue,lockedContinuationGroupKey:lo,instanceEntries:rn,keybindings:Vt,modelOptionsByInstance:to,terminalOpen:he,open:Ju,...Ro.modelPickerIconClassName?{activeProviderIconClassName:Ro.modelPickerIconClassName}:{},onOpenChange:P=>{Zu(P)},getModelDisabledReason:fe,getModelContinuationLabel:ft,onContinueInModel:ut,onInstanceModelChange:Eo,...ve?{composerChoices:ve}:{},selectedExecutionSelection:On??null,onClearExecutionSelection:dt,executionAppliesTo:st,sourceLabel:yr?.sourceLabel,...Z?{onChooseExecution:P=>{Z(P.selection,P)}}:{},...ht?{pluginActions:fn,selectedPluginActionKey:ya?.id??null,onSelectPluginAction:X,onManagePlugins:ae}:{}})]}),Ca?null:b(Ce,{children:[u(fD,{environmentId:o,draftId:i==="draft"?l:null,threadPresetId:f?.presetId??null,compact:Ki}),Ki?u(e_,{interactionMode:Ze,runtimeMode:W,runtimeModeSwitch:xr.runtimeModeSwitch,nativeMode:qr,canSwitchNativeMode:ti,showInteractionModeToggle:xr.showInteractionModeToggle,traitsMenuContent:UD,onToggleInteractionMode:vt,onRuntimeModeChange:_t,onNativeModeChange:ni}):b(Ce,{children:[Wb?u(qu,{name:"conversation.input.effort",...at===void 0?{}:{slots:at},fallback:Wb}):null,qr===null&&xr.showInteractionModeToggle?u(qu,{name:"conversation.input.plan",...at===void 0?{}:{slots:at},owner:{interactionMode:Ze,showInteractionModeToggle:xr.showInteractionModeToggle,onToggleInteractionMode:vt},fallback:u(eb,{interactionMode:Ze,showInteractionModeToggle:xr.showInteractionModeToggle,onToggleInteractionMode:vt})}):null,u(qu,{name:"conversation.input.permission",...at===void 0?{}:{slots:at},owner:{runtimeMode:W,runtimeModeSwitch:xr.runtimeModeSwitch,nativeMode:qr,canSwitchNativeMode:ti,onRuntimeModeChange:_t,onNativeModeChange:ni},fallback:u(tb,{runtimeMode:W,runtimeModeSwitch:xr.runtimeModeSwitch,nativeMode:qr,canSwitchNativeMode:ti,onRuntimeModeChange:_t,onNativeModeChange:ni})})]})]})]}),b("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":qb?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[Ad?null:pf,Ad?null:ff,u(W6,{compact:qb,activeContextWindow:ct,...Zt===void 0?{}:{breakdown:Zt},activeThreadModelDisplayName:Ug,pendingAction:af,isRunning:v==="running",showPlanFollowUpPrompt:I.length===0&&H,promptHasText:Oe.trim().length>0,isSendBusy:y,sendDisabledReason:oi,isConnecting:x,isEnvironmentUnavailable:L!==null||At||g,isPreparingWorktree:S,hasSendableContent:sl.hasSendableContent,preserveComposerFocusOnPointerDown:br,showSendWhileRunning:br,onPreviousPendingQuestion:io,onInterrupt:sh,onImplementPlanInNewThread:lh,compactDisabled:_e||At||y||x,compactDisabledReason:vr,onCompactContext:YD})]})]})]})})]})]})});function ED(e){let{composerRef:t,...n}=e,o=n;return u(hT,{value:o.api,children:u(AD,{...o,composerRef:t})})}function MD(e){return u(Ch.Provider,{value:e.scope.active,children:u(G6,{...e})})}function G6(e){let{scope:t,mode:n,timeline:o,trajectory:r,queue:a,composer:i}=e,[s,l]=Ln("turn-navigator",t.threadKey,null),d=u(ED,{...i,attachments:e.attachments,firstRow:i.draftHero.active?null:b(Ce,{children:[u(pS,{mode:n.mode,onModeChange:n.onModeChange}),u("div",{className:"min-w-0 flex-1"}),s!==null?u(vS,{...s,placement:"inline",onSelect:f=>{n.onModeChange("chat"),s.onSelect(f)}}):null]})}),c=i.slots?.renderSlotChain("conversation.composer",{occupants:i.occupants},d)??d;return b("div",{className:O("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[u(mS,{chat:u(L0,{...o,paneActive:t.active,onTurnNavigatorChange:l}),mode:n.mode,trajectory:u(M0,{...r,inputKey:t.threadKey,paneVisible:t.visible&&n.mode==="trajectory"}),visible:t.visible}),u(Jw,{bannerItems:i.bannerItems,belowSlot:i.belowSlot,composer:c,draftHero:i.draftHero,onOverlayElementChange:i.onOverlayElementChange,queue:b(Ce,{children:[u(Gw,{inputKey:t.threadKey,actions:a.actions,attachments:e.attachments,entries:a.entries,environmentId:a.environmentId,onCancel:a.onCancel,unavailable:a.unavailable}),u(sv,{entries:a.entries,onCancel:a.onCancel,onResume:a.onResume,queue:a.state,unavailable:a.unavailable})]})})]})}var j6=".ycodium-conversation-ui";function Q6(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function RD(e,t="conversation"){let n=Q6(),o=e.replaceAll(j6,`.${n}`),r=0,a=null;return{scopeClass:n,retain(){return typeof document>"u"?()=>{}:(r===0&&(a=document.createElement("style"),a.setAttribute("data-ycodium-plugin-css",t),a.textContent=o,document.head.appendChild(a)),r+=1,()=>{r-=1,r===0&&a!==null&&(a.remove(),a=null)})}}}function X6(e){let t=RD(rI);return{views:{[mh]:Y6(t,e)},viewCapabilities:{[mh]:[cI]},slots:[{name:"conversation.input.agent",order:0,component:GM},{name:"conversation.input.model",order:0,component:QN},{name:"conversation.input.plan",order:0,component:XN},{name:"conversation.input.permission",order:0,component:ZN}]}}function Y6(e,t){return function(o){let a=o[gh]??t,i={...o};return delete i[gh],b(sI,{value:a,children:[u(J6,{retain:e.retain}),u(dI,{value:e.scopeClass,children:u(MD,{...i,scopeClass:e.scopeClass})})]})}}function J6({retain:e}){return Nd(()=>e(),[e]),null}export{X6 as default};