@ycodium-ai/plugin-conversation 0.2.2672 → 0.2.2678

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 nF=Object.create;var Tf=Object.defineProperty;var oF=Object.getOwnPropertyDescriptor;var rF=Object.getOwnPropertyNames;var aF=Object.getPrototypeOf,iF=Object.prototype.hasOwnProperty;var sF=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var kf=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},En=(e,t)=>{for(var n in t)Tf(e,n,{get:t[n],enumerable:!0})},bw=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of rF(t))!iF.call(e,r)&&r!==n&&Tf(e,r,{get:()=>t[r],enumerable:!(o=oF(t,r))||o.enumerable});return e};var qd=(e,t,n)=>(n=e!=null?nF(aF(e)):{},bw(t||!e||!e.__esModule?Tf(n,"default",{value:e,enumerable:!0}):n,e)),ww=e=>bw(Tf({},"__esModule",{value:!0}),e);var Pf={};En(Pf,{Activity:()=>dF,Children:()=>Ah,Component:()=>Aa,Fragment:()=>mi,Profiler:()=>cF,PureComponent:()=>uF,StrictMode:()=>fF,Suspense:()=>Eh,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>pF,__COMPILER_RUNTIME:()=>mF,act:()=>gF,cache:()=>hF,cacheSignal:()=>vF,captureOwnerStack:()=>yF,cloneElement:()=>Lf,createContext:()=>bt,createElement:()=>De,createRef:()=>xF,default:()=>Tn,forwardRef:()=>Wn,isValidElement:()=>Rh,lazy:()=>CF,memo:()=>ve,startTransition:()=>bF,unstable_useCacheRefresh:()=>wF,use:()=>wt,useActionState:()=>SF,useCallback:()=>R,useContext:()=>Ut,useDebugValue:()=>IF,useDeferredValue:()=>TF,useEffect:()=>W,useEffectEvent:()=>Mh,useId:()=>Jr,useImperativeHandle:()=>rr,useInsertionEffect:()=>Vd,useLayoutEffect:()=>Ce,useMemo:()=>q,useOptimistic:()=>kF,useReducer:()=>Ea,useRef:()=>N,useState:()=>Q,useSyncExternalStore:()=>$o,useTransition:()=>LF,version:()=>PF});var Iw,Tn,dF,Ah,Aa,mi,cF,uF,fF,Eh,pF,mF,gF,hF,vF,yF,Lf,bt,De,xF,Wn,Rh,CF,ve,bF,wF,wt,SF,R,Ut,IF,TF,W,Mh,Jr,rr,Vd,Ce,q,kF,Ea,N,Q,$o,LF,PF,he=sF(()=>{Iw=window.__ycodiumPluginHost.react,Tn=Iw,{Activity:dF,Children:Ah,Component:Aa,Fragment:mi,Profiler:cF,PureComponent:uF,StrictMode:fF,Suspense:Eh,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:pF,__COMPILER_RUNTIME:mF,act:gF,cache:hF,cacheSignal:vF,captureOwnerStack:yF,cloneElement:Lf,createContext:bt,createElement:De,createRef:xF,forwardRef:Wn,isValidElement:Rh,lazy:CF,memo:ve,startTransition:bF,unstable_useCacheRefresh:wF,use:wt,useActionState:SF,useCallback:R,useContext:Ut,useDebugValue:IF,useDeferredValue:TF,useEffect:W,useEffectEvent:Mh,useId:Jr,useImperativeHandle:rr,useInsertionEffect:Vd,useLayoutEffect:Ce,useMemo:q,useOptimistic:kF,useReducer:Ea,useRef:N,useState:Q,useSyncExternalStore:$o,useTransition:LF,version:PF}=Iw});var K0=kf(Io=>{"use strict";var sH=(he(),ww(Pf));function $0(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 Ri(){}var So={d:{f:Ri,r:function(){throw Error($0(522))},D:Ri,C:Ri,L:Ri,m:Ri,X:Ri,S:Ri,M:Ri},p:0,findDOMNode:null},lH=Symbol.for("react.portal");function dH(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:lH,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}var Nc=sH.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Ip(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Io.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=So;Io.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($0(299));return dH(e,t,null,n)};Io.flushSync=function(e){var t=Nc.T,n=So.p;try{if(Nc.T=null,So.p=2,e)return e()}finally{Nc.T=t,So.p=n,So.d.f()}};Io.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))};Io.prefetchDNS=function(e){typeof e=="string"&&So.d.D(e)};Io.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,o=Ip(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})}};Io.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Ip(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)};Io.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,o=Ip(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})}};Io.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Ip(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)};Io.requestFormReset=function(e){So.d.r(e)};Io.unstable_batchedUpdates=function(e,t){return e(t)};Io.useFormState=function(e,t,n){return Nc.H.useFormState(e,t,n)};Io.useFormStatus=function(){return Nc.H.useHostTransitionStatus()};Io.version="19.2.6"});var _c=kf((xre,V0)=>{"use strict";function q0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(q0)}catch(e){console.error(e)}}q0(),V0.exports=K0()});var wN=kf(bN=>{"use strict";var kd=(he(),ww(Pf));function U4(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var H4=typeof Object.is=="function"?Object.is:U4,$4=kd.useState,K4=kd.useEffect,q4=kd.useLayoutEffect,V4=kd.useDebugValue;function W4(e,t){var n=t(),o=$4({inst:{value:n,getSnapshot:t}}),r=o[0].inst,a=o[1];return q4(function(){r.value=n,r.getSnapshot=t,BC(r)&&a({inst:r})},[e,n,t]),K4(function(){return BC(r)&&a({inst:r}),e(function(){BC(r)&&a({inst:r})})},[e]),V4(n),n}function BC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!H4(e,n)}catch{return!0}}function G4(e,t){return t()}var j4=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?G4:W4;bN.useSyncExternalStore=kd.useSyncExternalStore!==void 0?kd.useSyncExternalStore:j4});var IN=kf((Qme,SN)=>{"use strict";SN.exports=wN()});var Sw=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
1
+ var nF=Object.create;var Tf=Object.defineProperty;var oF=Object.getOwnPropertyDescriptor;var rF=Object.getOwnPropertyNames;var aF=Object.getPrototypeOf,iF=Object.prototype.hasOwnProperty;var sF=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var kf=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},En=(e,t)=>{for(var n in t)Tf(e,n,{get:t[n],enumerable:!0})},bw=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of rF(t))!iF.call(e,r)&&r!==n&&Tf(e,r,{get:()=>t[r],enumerable:!(o=oF(t,r))||o.enumerable});return e};var qd=(e,t,n)=>(n=e!=null?nF(aF(e)):{},bw(t||!e||!e.__esModule?Tf(n,"default",{value:e,enumerable:!0}):n,e)),ww=e=>bw(Tf({},"__esModule",{value:!0}),e);var Pf={};En(Pf,{Activity:()=>dF,Children:()=>Ah,Component:()=>Aa,Fragment:()=>mi,Profiler:()=>cF,PureComponent:()=>uF,StrictMode:()=>fF,Suspense:()=>Eh,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>pF,__COMPILER_RUNTIME:()=>mF,act:()=>gF,cache:()=>hF,cacheSignal:()=>vF,captureOwnerStack:()=>yF,cloneElement:()=>Lf,createContext:()=>bt,createElement:()=>De,createRef:()=>xF,default:()=>Tn,forwardRef:()=>Wn,isValidElement:()=>Rh,lazy:()=>CF,memo:()=>ve,startTransition:()=>bF,unstable_useCacheRefresh:()=>wF,use:()=>wt,useActionState:()=>SF,useCallback:()=>R,useContext:()=>Ut,useDebugValue:()=>IF,useDeferredValue:()=>TF,useEffect:()=>W,useEffectEvent:()=>Mh,useId:()=>Jr,useImperativeHandle:()=>or,useInsertionEffect:()=>Vd,useLayoutEffect:()=>Ce,useMemo:()=>q,useOptimistic:()=>kF,useReducer:()=>Ea,useRef:()=>N,useState:()=>Q,useSyncExternalStore:()=>$o,useTransition:()=>LF,version:()=>PF});var Iw,Tn,dF,Ah,Aa,mi,cF,uF,fF,Eh,pF,mF,gF,hF,vF,yF,Lf,bt,De,xF,Wn,Rh,CF,ve,bF,wF,wt,SF,R,Ut,IF,TF,W,Mh,Jr,or,Vd,Ce,q,kF,Ea,N,Q,$o,LF,PF,he=sF(()=>{Iw=window.__ycodiumPluginHost.react,Tn=Iw,{Activity:dF,Children:Ah,Component:Aa,Fragment:mi,Profiler:cF,PureComponent:uF,StrictMode:fF,Suspense:Eh,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:pF,__COMPILER_RUNTIME:mF,act:gF,cache:hF,cacheSignal:vF,captureOwnerStack:yF,cloneElement:Lf,createContext:bt,createElement:De,createRef:xF,forwardRef:Wn,isValidElement:Rh,lazy:CF,memo:ve,startTransition:bF,unstable_useCacheRefresh:wF,use:wt,useActionState:SF,useCallback:R,useContext:Ut,useDebugValue:IF,useDeferredValue:TF,useEffect:W,useEffectEvent:Mh,useId:Jr,useImperativeHandle:or,useInsertionEffect:Vd,useLayoutEffect:Ce,useMemo:q,useOptimistic:kF,useReducer:Ea,useRef:N,useState:Q,useSyncExternalStore:$o,useTransition:LF,version:PF}=Iw});var K0=kf(Io=>{"use strict";var sH=(he(),ww(Pf));function $0(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 Ri(){}var So={d:{f:Ri,r:function(){throw Error($0(522))},D:Ri,C:Ri,L:Ri,m:Ri,X:Ri,S:Ri,M:Ri},p:0,findDOMNode:null},lH=Symbol.for("react.portal");function dH(e,t,n){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:lH,key:o==null?null:""+o,children:e,containerInfo:t,implementation:n}}var Nc=sH.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Ip(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Io.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=So;Io.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($0(299));return dH(e,t,null,n)};Io.flushSync=function(e){var t=Nc.T,n=So.p;try{if(Nc.T=null,So.p=2,e)return e()}finally{Nc.T=t,So.p=n,So.d.f()}};Io.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))};Io.prefetchDNS=function(e){typeof e=="string"&&So.d.D(e)};Io.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,o=Ip(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})}};Io.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Ip(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)};Io.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,o=Ip(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})}};Io.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Ip(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)};Io.requestFormReset=function(e){So.d.r(e)};Io.unstable_batchedUpdates=function(e,t){return e(t)};Io.useFormState=function(e,t,n){return Nc.H.useFormState(e,t,n)};Io.useFormStatus=function(){return Nc.H.useHostTransitionStatus()};Io.version="19.2.6"});var _c=kf((xre,V0)=>{"use strict";function q0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(q0)}catch(e){console.error(e)}}q0(),V0.exports=K0()});var wN=kf(bN=>{"use strict";var kd=(he(),ww(Pf));function U4(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var H4=typeof Object.is=="function"?Object.is:U4,$4=kd.useState,K4=kd.useEffect,q4=kd.useLayoutEffect,V4=kd.useDebugValue;function W4(e,t){var n=t(),o=$4({inst:{value:n,getSnapshot:t}}),r=o[0].inst,a=o[1];return q4(function(){r.value=n,r.getSnapshot=t,BC(r)&&a({inst:r})},[e,n,t]),K4(function(){return BC(r)&&a({inst:r}),e(function(){BC(r)&&a({inst:r})})},[e]),V4(n),n}function BC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!H4(e,n)}catch{return!0}}function G4(e,t){return t()}var j4=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?G4:W4;bN.useSyncExternalStore=kd.useSyncExternalStore!==void 0?kd.useSyncExternalStore:j4});var IN=kf((Qme,SN)=>{"use strict";SN.exports=wN()});var Sw=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
2
2
  @layer properties, theme, base, components, utilities;
3
3
  @layer properties;
4
4
  :root, :host {
@@ -3797,9 +3797,9 @@ var nF=Object.create;var Tf=Object.defineProperty;var oF=Object.getOwnPropertyDe
3797
3797
  }
3798
3798
  }
3799
3799
  }
3800
- `;he();he();var Tw=bt(null),kw=Tw.Provider,Lw=bt(""),Pw=Lw.Provider;function Af(){return Ut(Lw)}function ar(){let e=Ut(Tw);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var Aw="ycodium.conversation.host-data.v16",Nh="ycodium:assistant-quote-open",_h="conversation";var Dh="__ycodiumConversationBridge",Ew="ycodium.conversation.rebindable-bridge.v1";he();function Rw(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=Rw(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Mw(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Rw(e))&&(o&&(o+=" "),o+=t);return o}var Nw=Mw;var AF=(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},EF=(e,t)=>({classGroupId:e,validator:t}),Hw=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var _w=[],RF="arbitrary..",MF=e=>{let t=_F(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return NF(i);let s=i.split("-"),l=s[0]===""&&s.length>1?1:0;return $w(s,l,t)},getConflictingClassGroupIds:(i,s)=>{if(s){let l=o[i],d=n[i];return l?d?AF(d,l):l:d||_w}return n[i]||_w}}},$w=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let d=$w(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}},NF=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?RF+o:void 0})(),_F=e=>{let{theme:t,classGroups:n}=e;return DF(n,t)},DF=(e,t)=>{let n=Hw();for(let o in e){let r=e[o];Bh(r,n,o,t)}return n},Bh=(e,t,n,o)=>{let r=e.length;for(let a=0;a<r;a++){let i=e[a];OF(i,t,n,o)}},OF=(e,t,n,o)=>{if(typeof e=="string"){FF(e,t,n);return}if(typeof e=="function"){BF(e,t,n,o);return}zF(e,t,n,o)},FF=(e,t,n)=>{let o=e===""?t:Kw(t,e);o.classGroupId=n},BF=(e,t,n,o)=>{if(UF(e)){Bh(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(EF(n,e))},zF=(e,t,n,o)=>{let r=Object.entries(e),a=r.length;for(let i=0;i<a;i++){let[s,l]=r[i];Bh(l,Kw(t,s),n,o)}},Kw=(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=Hw(),n.nextPart.set(i,s)),n=s}return n},UF=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,HF=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 $F=[],Dw=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),KF=e=>{let{prefix:t,experimentalParseClassName:n}=e,o=r=>{let a=[],i=0,s=0,l=0,d,c=r.length;for(let h=0;h<c;h++){let v=r[h];if(i===0&&s===0){if(v===":"){a.push(r.slice(l,h)),l=h+1;continue}if(v==="/"){d=h;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 g=d&&d>l?d-l:void 0;return Dw(a,m,p,g)};if(t){let r=t+":",a=o;o=i=>i.startsWith(r)?a(i.slice(r.length)):Dw($F,!1,i,void 0,!0)}if(n){let r=o;o=a=>n({className:a,parseClassName:r})}return o},qF=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}},VF=e=>({cache:HF(e.cacheSize),parseClassName:KF(e),sortModifiers:qF(e),postfixLookupClassGroupIds:WF(e),...MF(e)}),WF=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},GF=/\s+/,jF=(e,t)=>{let{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:i}=t,s=[],l=e.trim().split(GF),d="";for(let c=l.length-1;c>=0;c-=1){let f=l[c],{isExternal:p,modifiers:m,hasImportantModifier:g,baseClassName:h,maybePostfixModifierPosition:v}=n(f);if(p){d=f+(d.length>0?" "+d:d);continue}let y=!!v,x;if(y){let L=h.substring(0,v);x=o(L);let k=x&&i[x]?o(h):void 0;k&&k!==x&&(x=k,y=!1)}else x=o(h);if(!x){if(!y){d=f+(d.length>0?" "+d:d);continue}if(x=o(h),!x){d=f+(d.length>0?" "+d:d);continue}y=!1}let C=m.length===0?"":m.length===1?m[0]:a(m).join(":"),w=g?C+"!":C,T=w+x;if(s.indexOf(T)>-1)continue;s.push(T);let S=r(x,y);for(let L=0;L<S.length;++L){let k=S[L];s.push(w+k)}d=f+(d.length>0?" "+d:d)}return d},QF=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=qw(n))&&(r&&(r+=" "),r+=o);return r},qw=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=qw(e[o]))&&(n&&(n+=" "),n+=t);return n},Ow=(e,...t)=>{let n,o,r,a,i=l=>{let d=t.reduce((c,f)=>f(c),e());return n=VF(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=jF(l,n);return r(l,c),c};return a=i,(...l)=>a(QF(...l))},XF=[],Fn=e=>{let t=n=>n[e]||XF;return t.isThemeGetter=!0,t},Vw=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ww=/^\((?:(\w[\w-]*):)?(.+)\)$/i,YF=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,JF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ZF=/\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$/,e2=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,t2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,n2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,gi=e=>YF.test(e),ht=e=>!!e&&!Number.isNaN(Number(e)),Zr=e=>!!e&&Number.isInteger(Number(e)),Oh=e=>e.endsWith("%")&&ht(e.slice(0,-1)),Ra=e=>JF.test(e),Gw=()=>!0,o2=e=>ZF.test(e)&&!e2.test(e),zh=()=>!1,r2=e=>t2.test(e),a2=e=>n2.test(e),i2=e=>!Oe(e)&&!Fe(e),s2=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)),l2=e=>hi(e,Xw,zh),Oe=e=>Vw.test(e),rs=e=>hi(e,Yw,o2),Fw=e=>hi(e,h2,ht),d2=e=>hi(e,Zw,Gw),c2=e=>hi(e,Jw,zh),Bw=e=>hi(e,jw,zh),u2=e=>hi(e,Qw,a2),Ef=e=>hi(e,eS,r2),Fe=e=>Ww.test(e),Wd=e=>as(e,Yw),f2=e=>as(e,Jw),zw=e=>as(e,jw),p2=e=>as(e,Xw),m2=e=>as(e,Qw),Rf=e=>as(e,eS,!0),g2=e=>as(e,Zw,!0),hi=(e,t,n)=>{let o=Vw.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},as=(e,t,n=!1)=>{let o=Ww.exec(e);return o?o[1]?t(o[1]):n:!1},jw=e=>e==="position"||e==="percentage",Qw=e=>e==="image"||e==="url",Xw=e=>e==="length"||e==="size"||e==="bg-size",Yw=e=>e==="length",h2=e=>e==="number",Jw=e=>e==="family-name",Zw=e=>e==="number"||e==="weight",eS=e=>e==="shadow";var Uw=()=>{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"),g=Fn("blur"),h=Fn("perspective"),v=Fn("aspect"),y=Fn("ease"),x=Fn("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"],T=()=>[...w(),Fe,Oe],S=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],k=()=>[Fe,Oe,l],I=()=>[gi,"full","auto",...k()],P=()=>[Zr,"none","subgrid",Fe,Oe],E=()=>["auto",{span:["full",Zr,Fe,Oe]},Zr,Fe,Oe],_=()=>[Zr,"auto",Fe,Oe],A=()=>["auto","min","max","fr",Fe,Oe],H=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],J=()=>["auto",...k()],D=()=>[gi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],ne=()=>[gi,"screen","full","dvw","lvw","svw","min","max","fit",...k()],B=()=>[gi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],U=()=>[e,Fe,Oe],ee=()=>[...w(),zw,Bw,{position:[Fe,Oe]}],j=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Z=()=>["auto","cover","contain",p2,l2,{size:[Fe,Oe]}],de=()=>[Oh,Wd,rs],F=()=>["","none","full",d,Fe,Oe],X=()=>["",ht,Wd,rs],pe=()=>["solid","dashed","dotted","double"],le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[ht,Oh,zw,Bw],we=()=>["","none",g,Fe,Oe],Xe=()=>["none",ht,Fe,Oe],ot=()=>["none",ht,Fe,Oe],at=()=>[ht,Fe,Oe],je=()=>[gi,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ra],breakpoint:[Ra],color:[Gw],container:[Ra],"drop-shadow":[Ra],ease:["in","out","in-out"],font:[i2],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ra],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ra],shadow:[Ra],spacing:["px",ht],text:[Ra],"text-shadow":[Ra],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",gi,Oe,Fe,v]}],container:["container"],"container-type":[{"@container":["","normal","size",Fe,Oe]}],"container-named":[s2],columns:[{columns:[ht,Oe,Fe,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:T()}],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:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{"inset-s":I(),start:I()}],end:[{"inset-e":I(),end:I()}],"inset-bs":[{"inset-bs":I()}],"inset-be":[{"inset-be":I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[Zr,"auto",Fe,Oe]}],basis:[{basis:[gi,"full","auto",s,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ht,gi,"auto","initial","none",Oe]}],grow:[{grow:["",ht,Fe,Oe]}],shrink:[{shrink:["",ht,Fe,Oe]}],order:[{order:[Zr,"first","last","none",Fe,Oe]}],"grid-cols":[{"grid-cols":P()}],"col-start-end":[{col:E()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:E()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...H(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...H()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":H()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:J()}],mx:[{mx:J()}],my:[{my:J()}],ms:[{ms:J()}],me:[{me:J()}],mbs:[{mbs:J()}],mbe:[{mbe:J()}],mt:[{mt:J()}],mr:[{mr:J()}],mb:[{mb:J()}],ml:[{ml:J()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:D()}],"inline-size":[{inline:["auto",...ne()]}],"min-inline-size":[{"min-inline":["auto",...ne()]}],"max-inline-size":[{"max-inline":["none",...ne()]}],"block-size":[{block:["auto",...B()]}],"min-block-size":[{"min-block":["auto",...B()]}],"max-block-size":[{"max-block":["none",...B()]}],w:[{w:[s,"screen",...D()]}],"min-w":[{"min-w":[s,"screen","none",...D()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...D()]}],h:[{h:["screen","lh",...D()]}],"min-h":[{"min-h":["screen","lh","none",...D()]}],"max-h":[{"max-h":["screen","lh",...D()]}],"font-size":[{text:["base",n,Wd,rs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,g2,d2]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Oh,Oe]}],"font-family":[{font:[f2,c2,t]}],"font-features":[{"font-features":[Oe]}],"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,Fe,Oe]}],"line-clamp":[{"line-clamp":[ht,"none",Fe,Fw]}],leading:[{leading:[a,...k()]}],"list-image":[{"list-image":["none",Fe,Oe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Fe,Oe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...pe(),"wavy"]}],"text-decoration-thickness":[{decoration:[ht,"from-font","auto",Fe,rs]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[ht,"auto",Fe,Oe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"tab-size":[{tab:[Zr,Fe,Oe]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Fe,Oe]}],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",Fe,Oe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:j()}],"bg-size":[{bg:Z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zr,Fe,Oe],radial:["",Fe,Oe],conic:[Zr,Fe,Oe]},m2,u2]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:de()}],"gradient-via-pos":[{via:de()}],"gradient-to-pos":[{to:de()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:X()}],"border-w-x":[{"border-x":X()}],"border-w-y":[{"border-y":X()}],"border-w-s":[{"border-s":X()}],"border-w-e":[{"border-e":X()}],"border-w-bs":[{"border-bs":X()}],"border-w-be":[{"border-be":X()}],"border-w-t":[{"border-t":X()}],"border-w-r":[{"border-r":X()}],"border-w-b":[{"border-b":X()}],"border-w-l":[{"border-l":X()}],"divide-x":[{"divide-x":X()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":X()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...pe(),"hidden","none"]}],"divide-style":[{divide:[...pe(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...pe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ht,Fe,Oe]}],"outline-w":[{outline:["",ht,Wd,rs]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",c,Rf,Ef]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",f,Rf,Ef]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[ht,rs]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":X()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",p,Rf,Ef]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[ht,Fe,Oe]}],"mix-blend":[{"mix-blend":[...le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":le()}],"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":[ht]}],"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":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"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":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"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":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"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":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"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":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"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":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"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":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Fe,Oe]}],"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":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"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":[ht]}],"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":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:j()}],"mask-size":[{mask:Z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Fe,Oe]}],filter:[{filter:["","none",Fe,Oe]}],blur:[{blur:we()}],brightness:[{brightness:[ht,Fe,Oe]}],contrast:[{contrast:[ht,Fe,Oe]}],"drop-shadow":[{"drop-shadow":["","none",m,Rf,Ef]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",ht,Fe,Oe]}],"hue-rotate":[{"hue-rotate":[ht,Fe,Oe]}],invert:[{invert:["",ht,Fe,Oe]}],saturate:[{saturate:[ht,Fe,Oe]}],sepia:[{sepia:["",ht,Fe,Oe]}],"backdrop-filter":[{"backdrop-filter":["","none",Fe,Oe]}],"backdrop-blur":[{"backdrop-blur":we()}],"backdrop-brightness":[{"backdrop-brightness":[ht,Fe,Oe]}],"backdrop-contrast":[{"backdrop-contrast":[ht,Fe,Oe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ht,Fe,Oe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ht,Fe,Oe]}],"backdrop-invert":[{"backdrop-invert":["",ht,Fe,Oe]}],"backdrop-opacity":[{"backdrop-opacity":[ht,Fe,Oe]}],"backdrop-saturate":[{"backdrop-saturate":[ht,Fe,Oe]}],"backdrop-sepia":[{"backdrop-sepia":["",ht,Fe,Oe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Fe,Oe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ht,"initial",Fe,Oe]}],ease:[{ease:["linear","initial",y,Fe,Oe]}],delay:[{delay:[ht,Fe,Oe]}],animate:[{animate:["none",x,Fe,Oe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,Fe,Oe]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:Xe()}],"rotate-x":[{"rotate-x":Xe()}],"rotate-y":[{"rotate-y":Xe()}],"rotate-z":[{"rotate-z":Xe()}],scale:[{scale:ot()}],"scale-x":[{"scale-x":ot()}],"scale-y":[{"scale-y":ot()}],"scale-z":[{"scale-z":ot()}],"scale-3d":["scale-3d"],skew:[{skew:at()}],"skew-x":[{"skew-x":at()}],"skew-y":[{"skew-y":at()}],transform:[{transform:[Fe,Oe,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:je()}],"translate-x":[{"translate-x":je()}],"translate-y":[{"translate-y":je()}],"translate-z":[{"translate-z":je()}],"translate-none":["translate-none"],zoom:[{zoom:[Zr,Fe,Oe]}],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"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",Fe,Oe]}],"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":U()}],"scrollbar-track-color":[{"scrollbar-track":U()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",Fe,Oe]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[ht,Wd,rs,Fw]}],stroke:[{stroke:["none",...U()]}],"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"]}},v2=(e,{cacheSize:t,prefix:n,experimentalParseClassName:o,extend:r={},override:a={}})=>(wl(e,"cacheSize",t),wl(e,"prefix",n),wl(e,"experimentalParseClassName",o),Mf(e.theme,a.theme),Mf(e.classGroups,a.classGroups),Mf(e.conflictingClassGroups,a.conflictingClassGroups),Mf(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),wl(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),wl(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),Nf(e.theme,r.theme),Nf(e.classGroups,r.classGroups),Nf(e.conflictingClassGroups,r.conflictingClassGroups),Nf(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),Fh(e,r,"postfixLookupClassGroups"),Fh(e,r,"orderSensitiveModifiers"),e),wl=(e,t,n)=>{n!==void 0&&(e[t]=n)},Mf=(e,t)=>{if(t)for(let n in t)wl(e,n,t[n])},Nf=(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)},tS=(e,...t)=>typeof e=="function"?Ow(Uw,e,...t):Ow(()=>v2(Uw(),e),...t);var y2=tS({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 K(...e){return y2(Nw(e))}he();var _f=bt(!0);function nS(){return wt(_f)}var Uh=bt(void 0);function ea(){let e=wt(_f);return wt(Uh)??e}he();var Df=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();var oS=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var rS=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase());var Hh=e=>{let t=rS(e);return t.charAt(0).toUpperCase()+t.slice(1)};he();var aS={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 iS=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var sS=Wn(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:a,iconNode:i,...s},l)=>De("svg",{ref:l,...aS,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:Df("lucide",r),...!a&&!iS(s)&&{"aria-hidden":"true"},...s},[...i.map(([d,c])=>De(d,c)),...Array.isArray(a)?a:[a]]));var te=(e,t)=>{let n=Wn(({className:o,...r},a)=>De(sS,{ref:a,iconNode:t,className:Df(`lucide-${oS(Hh(e))}`,`lucide-${e}`,o),...r}));return n.displayName=Hh(e),n};var x2=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Gd=te("arrow-down",x2);var C2=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],jd=te("arrow-up-right",C2);var b2=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Qd=te("arrow-up",b2);var w2=[["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"}]],Xd=te("blocks",w2);var S2=[["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"}]],Sl=te("bookmark",S2);var I2=[["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"}]],is=te("bot",I2);var T2=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ro=te("check",T2);var k2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],rn=te("chevron-down",k2);var L2=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],ss=te("chevron-left",L2);var P2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ko=te("chevron-right",P2);var A2=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Yd=te("chevron-up",A2);var E2=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Jd=te("chevrons-left",E2);var R2=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Zd=te("chevrons-right",R2);var M2=[["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"}]],Pn=te("circle-alert",M2);var N2=[["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"}]],ls=te("copy",N2);var _2=[["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"}]],ir=te("ellipsis",_2);var D2=[["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"}]],ec=te("eye",D2);var O2=[["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"}]],ds=te("file-code",O2);var F2=[["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"}]],cs=te("file-text",F2);var B2=[["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"}]],tc=te("file",B2);var z2=[["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"}]],vi=te("folder",z2);var U2=[["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"}]],nc=te("frame",U2);var H2=[["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"}]],oc=te("git-branch-plus",H2);var $2=[["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"}]],rc=te("globe",$2);var K2=[["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"}]],ac=te("grip-vertical",K2);var q2=[["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"}]],ic=te("hammer",q2);var V2=[["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"}]],us=te("image",V2);var W2=[["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"}]],Ma=te("layers",W2);var G2=[["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"}]],sc=te("list-ordered",G2);var j2=[["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"}]],fs=te("list-todo",j2);var Q2=[["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"}]],lc=te("list",Q2);var X2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],yi=te("loader-circle",X2);var Y2=[["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"}]],xi=te("lock-open",Y2);var J2=[["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"}]],dc=te("lock",J2);var Z2=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ci=te("message-circle-question-mark",Z2);var eB=[["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"}]],ps=te("message-circle",eB);var tB=[["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"}]],ms=te("message-square",tB);var nB=[["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"}]],cc=te("minimize-2",nB);var oB=[["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"}]],ta=te("mouse-pointer-click",oB);var rB=[["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"}]],uc=te("package",rB);var aB=[["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"}]],gs=te("paintbrush",aB);var iB=[["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"}]],wo=te("paperclip",iB);var sB=[["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"}]],na=te("pen-line",sB);var lB=[["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"}]],fc=te("pencil-ruler",lB);var dB=[["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"}]],pc=te("pencil",dB);var cB=[["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"}]],hs=te("puzzle",cB);var uB=[["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"}]],vs=te("rotate-ccw",uB);var fB=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ys=te("search",fB);var pB=[["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"}]],mc=te("send",pB);var mB=[["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"}]],gc=te("settings",mB);var gB=[["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"}]],Il=te("sliders-horizontal",gB);var hB=[["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"}]],bi=te("sparkles",hB);var vB=[["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=te("square-pen",vB);var yB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],hc=te("square",yB);var xB=[["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"}]],xs=te("star",xB);var CB=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],qo=te("terminal",CB);var bB=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],Na=te("text-quote",bB);var wB=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],oa=te("user-round",wB);var SB=[["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"}]],vc=te("wrench",SB);var IB=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],en=te("x",IB);var TB=[["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"}]],Cs=te("zap",TB);he();function ye(){return{t:ar().i18n.usePluginTranslation()}}he();he();var Tl=bt(null),yc=bt(null);function Of(e,t){let n=wt(yc);Ce(()=>{if(!(!t||e===null||n===null))return n(e)},[n,t,e])}function xc(){let e=new Map;return{rows:()=>[...e.keys()],acquire:(t,n)=>{e.set(t,(e.get(t)??0)+1),n();let o=!0;return()=>{if(!o)return;o=!1;let r=e.get(t)??0;r>1?e.set(t,r-1):e.delete(t),n()}}}}var lS=new Set(["Select","AlertDialog","Dialog","DropdownMenu","Menu","Popover","Tooltip","Combobox"]);function ue(e){let t=lS.has(e),n=o=>{let r=ar(),a=Af(),i=ea(),s=r.ui[e],l={};if(t){let d=wt(Tl),[c,f]=Q(o.defaultOpen===!0),p=typeof o.open=="boolean"?o.open:c;Of(d,i&&p),Ce(()=>{i||f(!1)},[i]),l={open:i&&p,onOpenChange:(m,...g)=>{f(m),typeof o.onOpenChange=="function"&&o.onOpenChange(m,...g)}}}return De(s,{...o,...l,...lS.has(e)&&!i?{open:!1}:{},className:`${a} ${typeof o.className=="string"?o.className:""}`})};return n.displayName=e,n}var pJ=ue("useLinkContextMenu"),Sr=ue("ProviderInstanceIcon"),dS=ue("UserAvatar"),ra=ue("Badge"),ie=ue("Button"),mJ=ue("Label"),kl=ue("Input"),cS=ue("Textarea"),gJ=ue("Switch"),hJ=ue("Separator"),vJ=ue("Skeleton"),Ff=ue("Spinner"),yJ=ue("ScrollArea"),xJ=ue("Card"),CJ=ue("CardAction"),bJ=ue("CardContent"),wJ=ue("CardDescription"),SJ=ue("CardFooter"),IJ=ue("CardHeader"),TJ=ue("CardTitle"),kJ=ue("Empty"),LJ=ue("EmptyContent"),PJ=ue("EmptyDescription"),AJ=ue("EmptyHeader"),EJ=ue("EmptyMedia"),RJ=ue("EmptyTitle"),MJ=ue("InputGroup"),NJ=ue("InputGroupAddon"),_J=ue("InputGroupInput"),DJ=ue("DocumentPanel"),OJ=ue("MasterDetail"),Bf=ue("Select"),FJ=ue("SelectContent"),zf=ue("SelectItem"),Uf=ue("SelectPopup"),uS=ue("SelectTrigger"),Hf=ue("SelectValue"),Cc=ue("Toggle"),fS=ue("ToggleGroup"),pS=ue("AlertDialog"),mS=ue("AlertDialogClose"),gS=ue("AlertDialogDescription"),hS=ue("AlertDialogFooter"),vS=ue("AlertDialogHeader"),yS=ue("AlertDialogPopup"),xS=ue("AlertDialogTitle"),$f=ue("Dialog"),BJ=ue("DialogClose"),Kf=ue("DialogDescription"),qf=ue("DialogFooter"),Vf=ue("DialogHeader"),Wf=ue("DialogPopup"),CS=ue("DialogPanel"),Gf=ue("DialogTitle"),zJ=ue("DialogTrigger"),UJ=ue("DropdownMenu"),HJ=ue("DropdownMenuContent"),$J=ue("DropdownMenuItem"),KJ=ue("DropdownMenuTrigger"),_o=ue("Menu"),Ll=ue("MenuGroup"),bS=ue("MenuGroupLabel"),sr=ue("MenuItem"),Do=ue("MenuPopup"),Ir=ue("MenuRadioGroup"),Vo=ue("MenuRadioItem"),_a=ue("MenuSeparator"),Oo=ue("MenuTrigger"),wi=ue("Popover"),Si=ue("PopoverPopup"),Ii=ue("PopoverTrigger"),wS=ue("Table"),SS=ue("TableBody"),Ti=ue("TableCell"),bs=ue("TableHead"),IS=ue("TableHeader"),jf=ue("TableRow"),Je=ue("Tooltip"),Ze=ue("TooltipPopup"),et=ue("TooltipTrigger"),TS=ue("Collapsible"),kS=ue("CollapsiblePanel"),LS=ue("CollapsibleTrigger"),bc=ue("Alert"),wc=ue("AlertAction"),Qf=ue("AlertDescription"),$h=ue("AlertTitle"),Xf=ue("Kbd"),Yf=ue("Command"),Jf=ue("CommandGroup"),Zf=ue("CommandItem"),ep=ue("CommandList"),PS=ue("Combobox"),AS=ue("ComboboxEmpty"),ES=ue("ComboboxInput"),Pl=ue("ComboboxItem"),RS=ue("ComboboxListVirtualized"),MS=ue("TooltipProvider"),NS=ue("StyledDiffCodeView"),_S=ue("DevBackdropArt"),lr=ue("Markdown"),DS=ue("DiffView");var{jsx:u,jsxs:b,Fragment:ke}=window.__ycodiumPluginHost.jsxRuntime;function OS({mode:e,onModeChange:t}){let{t:n}=ye();return b(fS,{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(Cc,{value:"chat","aria-label":n("trajectory.toggleChat"),children:[u(ms,{"aria-hidden":!0}),n("trajectory.toggleChat")]}),b(Cc,{value:"trajectory","aria-label":n("trajectory.toggleTrajectory"),children:[u(sc,{"aria-hidden":!0}),n("trajectory.toggleTrajectory")]})]})}function FS({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(Uh,{value:t,children:r==="chat"?n:o})})}he();function ao(){return{t:ar().i18n.usePluginTranslation()}}function BS(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 zS(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 Sc(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 kB=ve(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:Sc(o.outputTokens)}):null]}):null]})]})});function LB({totals:e}){let{t}=ao();if(!e)return null;let n=BS(e),o=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:Sc(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:Sc(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:n===null?Sc(e.cachedInputTokens):`${Sc(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 PB=ve(function({getText:t,size:n="xs",variant:o="outline",className:r}){let{t:a}=ao(),i=ar().writeClipboard,[s,l]=Q(!1),d=a("turnNavigator.copyMarkdown");return b(Je,{children:[u(et,{render:u(ie,{"aria-label":d,disabled:s,onClick:()=>{i(t()).then(()=>{l(!0),window.setTimeout(()=>l(!1),1e3)})},type:"button",size:n,variant:o,className:K("text-muted-foreground hover:text-foreground",r)}),children:s?u(ro,{className:"size-3 text-primary"}):u(ls,{className:"size-3"})}),u(Ze,{children:u("p",{children:d})})]})});function US({items:e,totalTurnCount:t,bottomInset:n,usageByTurnId:o,onSelect:r,exportMarkdown:a,onDownload:i,placement:s="float"}){let{t:l}=ao(),[d,c]=Q(!1),f=q(()=>e.map((h,v)=>({item:h,ordinal:v+1})).reverse(),[e]),p=q(()=>zS(f.map(({item:h})=>h.turnId===null?void 0:o.get(h.turnId))),[f,o]);if(e.length===0)return null;let m=t??e.length,g=l("turnNavigator.open",{count:m});return b(wi,{onOpenChange:c,open:d,children:[b(Ii,{render:u(ie,{"aria-label":g,className:K("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:g,variant:"glass"}),children:[u(lc,{"aria-hidden":!0}),u("span",{className:"font-mono font-semibold text-[11px] tabular-nums",children:m})]}),u(Si,{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:K("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:f.map(({item:h,ordinal:v})=>u(kB,{item:h,onSelect:y=>{c(!1),r(y)},ordinal:v,usage:h.turnId===null?void 0:o.get(h.turnId)},h.sectionKey))}),u(LB,{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(PB,{size:"icon-xs",getText:a,variant:"ghost"}),u(ie,{"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(ie,{"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"})})]})]})})]})}he();function Ic(e){return e.replace(/\s+/g," ")}function AB(e,t){let n=e.slice(Math.max(0,e.length-t));return/^[\uDC00-\uDFFF]/.test(n)&&(n=n.slice(1)),n}function EB(e,t){let n=e.slice(0,t);return/[\uD800-\uDBFF]$/.test(n)&&(n=n.slice(0,-1)),n}function tp(e){let n=(e instanceof Element?e:e?.parentElement??null)?.closest("[data-assistant-quote-body]")??null;return n?.closest('[data-message-role="assistant"]')?n:null}function HS(e){if(!e||e.isCollapsed||e.rangeCount===0)return null;let t=e.getRangeAt(0),n=tp(t.startContainer);if(n===null||tp(t.endContainer)!==n)return null;let o=n.closest("[data-message-id]")?.dataset.messageId;if(!o)return null;let r=e.toString().trim();if(r.length===0)return null;let a=document.createRange();a.selectNodeContents(n),a.setEnd(t.startContainer,t.startOffset);let i=document.createRange();i.selectNodeContents(n),i.setStart(t.endContainer,t.endOffset);let s=Ic(t.toString()),l=s.length>s.trimStart().length?" ":"",d=s.length>s.trimEnd().length?" ":"",c=Ic(a.toString()+l),f=Ic(d+i.toString()),p=c.length,m=p+s.trim().length,g=t.getClientRects(),h=g[0]??t.getBoundingClientRect(),v=g[g.length-1]??h;return{messageId:o,text:r,start:p,end:m,prefix:AB(c,32),suffix:EB(f,32),anchor:{x:v.right,top:h.top,bottom:v.bottom}}}var np="assistant-quote-inserter",op="assistant-quote-open-comment";he();var KS=100,RB=new Map,$S=new Map,rp=e=>typeof e=="function"?e():e,qS=(e,t)=>typeof t=="function"?t(e):t;function MB(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 NB(e,t){let n=$S.get(e);return n===void 0&&(n={values:new Map,limit:Math.max(1,t)},$S.set(e,n)),n}function _B(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 Kh(e,t,n){e.values.get(t)===n&&(e.values.delete(t),e.values.set(t,n))}function VS(e,t,n){let o=e.values.get(t);return o===void 0&&(o={value:rp(n),subscribers:new Set,leases:0,alive:!0,committed:!1},e.values.set(t,o)),o}function Tc(e){queueMicrotask(()=>_B(e))}function Ht(e,t,n,o=KS){let r=Math.max(1,o),a=MB(RB,e,r),i=VS(a,t,n),s=R(f=>i.alive?(a.limit=r,i.committed=!0,Kh(a,t,i),i.leases+=1,i.subscribers.add(f),Tc(a),()=>{i.subscribers.delete(f),i.leases=Math.max(0,i.leases-1),Tc(a)}):()=>{},[r,i,a,t]),l=R(()=>i.value,[i]),d=$o(s,l,l),c=R(f=>{if(!i.alive||a.values.get(t)!==i)return;let p=i.value,m=qS(p,f);if(!Object.is(m,p)){i.value=m,Kh(a,t,i);for(let g of i.subscribers)g();Tc(a)}},[i,a,t]);return[d,c]}function WS(e,t){let n=N(null);(n.current===null||n.current.key!==e)&&(n.current={key:e,value:rp(t)});let[,o]=Ea(a=>a+1,0),r=R(a=>{let i=n.current;if(i===null||i.key!==e)return;let s=qS(i.value,a);Object.is(s,i.value)||(i.value=s,o())},[e]);return[n.current.value,r]}function St(e,t,n,o=KS){let r=Math.max(1,o),a=NB(e,r),i=VS(a,t,()=>({current:rp(n)}));return W(()=>{if(!(!i.alive||a.values.get(t)!==i))return a.limit=r,i.committed=!0,Kh(a,t,i),i.leases+=1,Tc(a),()=>{i.leases=Math.max(0,i.leases-1),Tc(a)}},[r,i,a,t]),i.value}function Tr(e,t){let n=N(null);return(n.current===null||n.current.key!==e)&&(n.current={key:e,ref:{current:rp(t)}}),n.current.ref}var DB=300;function GS(e){let{data:t,target:n,threadKey:o,surfaceRef:r}=e,{t:a}=ye(),i=St(np,o,null),[,s]=Ht(op,o,null),[l,d]=Q(null),c=N(null);if(W(()=>{let h,v=()=>{let S=r.current,L=document.getSelection(),k=L&&L.rangeCount>0?L.getRangeAt(0):null;if(!S||!k||!S.contains(k.commonAncestorContainer)){d(null);return}let I=HS(L);if(I===null){d(null);return}let P=t.assistantQuotes.serialize({version:1,environmentId:n.environmentId,threadId:n.threadId,messageId:I.messageId,text:I.text,start:I.start,end:I.end,prefix:I.prefix,suffix:I.suffix});d({source:P,...I.anchor})},y=S=>{c.current?.contains(S.target)||(clearTimeout(h),h=setTimeout(v,DB))},x=S=>{c.current?.contains(S.target)||(clearTimeout(h),d(null))},C=()=>d(null),w=S=>{S.key==="Escape"&&d(null)},T=()=>{(document.getSelection()?.isCollapsed??!0)&&d(null)};return document.addEventListener("pointerup",y,!0),document.addEventListener("keyup",y,!0),document.addEventListener("pointerdown",x,!0),document.addEventListener("keydown",w,!0),document.addEventListener("selectionchange",T),window.addEventListener("scroll",C,!0),()=>{clearTimeout(h),document.removeEventListener("pointerup",y,!0),document.removeEventListener("keyup",y,!0),document.removeEventListener("pointerdown",x,!0),document.removeEventListener("keydown",w,!0),document.removeEventListener("selectionchange",T),window.removeEventListener("scroll",C,!0)}},[t,r,n.environmentId,n.threadId]),l===null)return null;let f=l.source,p=Math.max(8,Math.min(window.innerWidth-200,l.x-12)),m=l.bottom+6,g=m+40<=window.innerHeight?m:Math.max(8,l.top-40);return u("div",{ref:c,className:"fixed z-50",style:{left:p,top:g},"data-assistant-quote-toolbar":"",children:b(ie,{size:"sm",variant:"outline",className:"shadow-md",disabled:f===null,title:f===null?a("timeline.quote.tooLong"):void 0,onMouseDown:h=>h.preventDefault(),onClick:()=>{f!==null&&i.current?.(f)===!0&&(s(f),document.getSelection()?.removeAllRanges(),d(null))},children:[u(Na,{"aria-hidden":"true"}),a("timeline.quote.cite")]})})}he();he();function OB(e){return e!==null&&"tagName"in e&&"closest"in e}function ki(e){return OB(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function qh(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function jS(e,t){let n=e.findIndex(o=>o.decision===t);return n===-1?null:{type:"respond",index:n}}function QS(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return jS(t,"accept");case"Escape":return jS(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let n=qh(e.key,t.length);return n===null?null:{type:"respond",index:n}}}}he();var Al=new Map,XS=24,FB=4e3,BB=1024,YS=16384;function Vh(e){let t=Al.get(e);if(t)return t;let n={values:new Map,listeners:new Set,stringLength:0};if(Al.set(e,n),Al.size>XS){for(let[o,r]of Al)if(r.listeners.size===0&&o!==e&&(Al.delete(o),Al.size<=XS))break}return n}function Wh(e,t,n){return Vh(e).values.get(t)??n}function kc(e,t,n,o=!0){let r=Vh(e);if(typeof n=="string"&&(n=n.slice(0,BB)),r.values.get(t)===n)return;let a=r.values.get(t);if(typeof a=="string"&&(r.stringLength-=a.length),r.values.delete(t),r.values.set(t,n),typeof n=="string"&&(r.stringLength+=n.length),r.stringLength>YS){for(let[i,s]of r.values)if(!(typeof s!="string"||i===t)&&(r.values.delete(i),r.stringLength-=s.length,r.stringLength<=YS))break}if(r.values.size>FB){let i=r.values.keys().next().value;if(i!==void 0){let s=r.values.get(i);typeof s=="string"&&(r.stringLength-=s.length),r.values.delete(i)}}o&&r.listeners.forEach(i=>i())}function Wo(e,t,n){let o=R(s=>{let l=Vh(e);return l.listeners.add(s),()=>l.listeners.delete(s)},[e]),r=R(()=>Wh(e,t,n),[e,t,n]),a=$o(o,r,r),i=R(s=>kc(e,t,s),[e,t]);return[a,i]}function ap(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}function JS(e){let t=e.map(o=>({key:o.key,turnId:o.turnId,firstRowIndex:o.firstRowIndex,endRowIndex:o.firstRowIndex+o.rowIds.length})),n=new Map;for(let o of e)for(let[r,a]of o.rowIds.entries())n.set(a,{turnId:o.turnId,index:o.firstRowIndex+r});return{sections:t,bySectionKey:new Map(t.map(o=>[o.key,o])),byRowId:n}}function ip({index:e,visibleSectionKeys:t,protectedRowIds:n,selectionRows:o}){let r=t.flatMap(d=>{let c=e.bySectionKey.get(d)?.turnId;return c==null?[]:[c]}),a=n.flatMap(d=>{let c=e.byRowId.get(d)?.turnId;return c==null?[]:[c]}),i=o?e.byRowId.get(o.firstRowId)?.index:void 0,s=o?e.byRowId.get(o.lastRowId)?.index:void 0,l=i===void 0||s===void 0?[]:e.sections.flatMap(d=>d.turnId!==null&&d.endRowIndex>Math.min(i,s)&&d.firstRowIndex<=Math.max(i,s)?[d.turnId]:[]);return{firstTurnId:r[0]??null,lastTurnId:r.at(-1)??null,protectedTurnIds:[...new Set(a)],selectionTurnRange:l.length>0?{firstTurnId:l[0],lastTurnId:l.at(-1)}:null}}function ZS(e,t,n,o){if(!o)return n;let r=e.findIndex(a=>t.has(a));return r<0?n:Math.max(n,e.length-r)}he();he();function Gh(e,t){for(let n of e.querySelectorAll("[data-timeline-row-id]"))if(n.dataset.timelineRowId===t)return n;return null}function ws(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 zB(e){let t=e.getBoundingClientRect().top,n=e.querySelectorAll("[data-timeline-turn-section]"),o=a=>{let i=a.querySelectorAll("[data-timeline-row-id]"),s=ws(i,t),l=s<0?void 0:i[s],d=l?.dataset.timelineRowId;return!l||d===void 0?null:{rowId:d,offsetPx:Math.round(t-l.getBoundingClientRect().top)}};if(n.length===0)return o(e);let r=ws(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 eI(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}var jh=class extends Aa{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function tI({inputKey:e,onBeforeInputChange:t,handleRef:n,onAttach:o,className:r,children:a,onScroll:i,onInteractionRowsChange:s}){let l=N(null),d=N({inputKey:e,store:xc()});d.current.inputKey!==e&&(d.current={inputKey:e,store:xc()});let c=N(s);c.current=s;let f=R(m=>{let g=d.current;return g.store.acquire(m,()=>{d.current===g&&c.current?.(g.store.rows())})},[]);Ce(()=>{s?.(d.current.store.rows())},[e,s]),rr(n,()=>({get node(){return l.current},measure:()=>{let m=l.current;return m?{scroll:m.scrollTop,scrollLength:m.clientHeight,contentLength:m.scrollHeight,topOf:g=>{let h=Gh(m,g);return h===null?null:eI(h,m)},heightOf:g=>{let h=Gh(m,g);return h===null?null:h.offsetHeight},rowAtScroll:()=>zB(m)}:null},scrollToEnd:m=>{let g=l.current;if(g){if(m?.animated){g.scrollTo({top:g.scrollHeight,behavior:"smooth"});return}g.scrollTop=g.scrollHeight-g.clientHeight}},scrollToRow:(m,g)=>{let h=l.current;if(!h)return!1;let v=Gh(h,m);return v?(h.scrollTop=Math.max(0,eI(v,h)-(g?.viewOffset??0)),!0):!1},scrollToOffset:m=>{let g=l.current;g&&(g.scrollTop=Math.max(0,m))}}),[]);let p=R(m=>{l.current=m,o(m)},[o]);return u(jh,{inputKey:e,onBeforeInputChange:t,children:u(yc,{value:f,children:u("div",{ref:p,className:r,style:{position:"relative"},onScroll:i,children:a})})})}function Rl(e){if(!e)return!1;let t=e.tagName?.toLowerCase(),n=e.getAttribute?.("contenteditable");if(t==="textarea"||n==="true"||n===""||n==="plaintext-only"||"isContentEditable"in e&&e.isContentEditable===!0)return!0;if(t==="input"){let o=e.getAttribute?.("type")?.toLowerCase()??"text";if(!["button","submit","reset","image","checkbox","radio"].includes(o))return!0}return e.matches?.(":focus-visible")??!1}function El(e,t){let o=(e?.nodeType===1?e:e?.parentElement)?.closest("[data-timeline-row-id]");return o&&t.contains(o)?o.dataset.timelineRowId??null:null}function sp(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return null;let n=null,o=null;for(let d=0;d<t.rangeCount;d+=1){let c=t.getRangeAt(d);c.intersectsNode(e)&&(n??=c,o=c)}if(!n||!o)return null;let r=El(n.startContainer,e),a=El(o.endContainer,e);if(r&&a)return{firstRowId:r,lastRowId:a};let i=e.querySelectorAll("[data-timeline-row-id]"),s=i[0]?.dataset.timelineRowId,l=i[i.length-1]?.dataset.timelineRowId;return s&&l?{firstRowId:r??s,lastRowId:a??l}:null}function Lc(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return!1;for(let n=0;n<t.rangeCount;n+=1)if(t.getRangeAt(n).intersectsNode(e))return!0;return!1}he();function Li(e){let t=N(e);t.current=e;let n=N(!1),o=N(null),r=N(null),a=N(0),i=R(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),s=R(()=>{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=R(c=>{o.current=c,s()},[s]),d=R(()=>{o.current=null,i()},[i]);return Ce(()=>(n.current=!0,s(),()=>{n.current=!1,i()}),[e,i,s]),q(()=>({request:l,cancel:d}),[l,d])}function nI({root:e,inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:i,onRangeChange:s,onSelectionChange:l}){let d=N({inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:i,onRangeChange:s,onSelectionChange:l});d.current={inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:i,onRangeChange:s,onSelectionChange:l};let c=Li(n),f=N(null),p=R(()=>{let g=d.current;if(!e||!g.visible||e.clientHeight<=0)return;let h=e.getBoundingClientRect();if(h.height<=0)return;let v=h.top+g.topInset,y=h.bottom-g.bottomInset,x=e.querySelectorAll("[data-timeline-turn-section]"),C=ws(x,v),w=[];if(C>=0)for(let I=C;I<x.length;I+=1){let P=x[I];if(P.getBoundingClientRect().top>=y)break;P.dataset.timelineTurnSection!==void 0&&w.push(P.dataset.timelineTurnSection)}let T=[...g.interactionRows()],S=e.ownerDocument.activeElement;if(Rl(S)){let I=El(S,e);I&&T.push(I)}let L=ip({index:g.index,visibleSectionKeys:w,protectedRowIds:T,selectionRows:sp(e)}),k=`${g.inputKey}:${JSON.stringify(L)}`;k!==f.current&&(f.current=k,g.onRangeChange?.(L))},[e]),m=R(()=>c.request(p),[c,p]);return Ce(()=>{if(f.current=null,!n||!e)return;let g=t,h=!0,v=()=>{!h||d.current.inputKey!==g||!d.current.visible||(d.current.onSelectionChange(Lc(e)),m())};e.addEventListener("scroll",v,{passive:!0}),e.addEventListener("focusin",v),e.addEventListener("focusout",v),e.ownerDocument.addEventListener("selectionchange",v);let y=typeof ResizeObserver>"u"?null:new ResizeObserver(v);return y?.observe(e),e.firstElementChild&&y?.observe(e.firstElementChild),v(),()=>{h=!1,c.cancel(),y?.disconnect(),e.removeEventListener("scroll",v),e.removeEventListener("focusin",v),e.removeEventListener("focusout",v),e.ownerDocument.removeEventListener("selectionchange",v),s?.(null)}},[c,t,s,m,e,n]),Ce(()=>{n&&m()},[o,m,n]),m}he();function Da(e){if(!Number.isFinite(e)||e<0)return"0ms";if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<1e4){let i=Math.round(e/100)/10;return i>=10?"10s":`${i.toFixed(1)}s`}if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.round(e/1e3),n=Math.floor(t/3600),o=Math.floor(t%3600/60),r=t%60,a=[];return n>0&&a.push(`${n}h`),o>0&&a.push(`${o}m`),r>0&&a.push(`${r}s`),a.join(" ")}function UB(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function HB(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function $B(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var Qh=HB($B()),oI=new Map;function rI(e,t){let n=`${e}:${t?"seconds":"minutes"}`,o=oI.get(n);if(o)return o;let r=new Intl.DateTimeFormat(Qh,UB(e,t));return oI.set(n,r),r}function Xh(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var KB=new Intl.DateTimeFormat(void 0,{month:"long"});function qB(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 VB(e,t){let n=Xh(e);return n?rI(t,!1).format(n):""}function aa(e,t){let n=Xh(e);if(!n)return"";let o=VB(e,t),r=n.getDate(),a=KB.format(n),i=n.getFullYear();return`${o}, ${r}${qB(r)} ${a} ${i}`}var WB=new Intl.DateTimeFormat(Qh,{month:"numeric",day:"numeric"}),GB=new Intl.DateTimeFormat(Qh,{month:"numeric",day:"numeric",year:"numeric"});function Pi(e,t,n,o=Date.now()){let r=Xh(e);if(!r)return"";let a=rI(t,!1).format(r),i=new Date(o),s=new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime(),l=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),d=Math.round((s-l)/864e5);return d<=0?a:d===1?n("relativeTime.yesterdayAt",{time:a}):`${(r.getFullYear()===i.getFullYear()?WB:GB).format(r)} ${a}`}he();he();var Ml=class extends Error{reason;constructor(t,n,o){super(n,o),this.reason=t}};function jB(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.fontSize="16px";let n=document.activeElement;document.body.appendChild(t);try{return t.focus({preventScroll:!0}),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{t.remove();let o=n?.focus;typeof o=="function"&&o.call(n)}}async function QB(e,t){let n=()=>new Ml("unavailable",`Clipboard API is unavailable while copying ${t}.`);if(typeof window>"u")throw n();if(!e)return!1;if(typeof navigator>"u"||!navigator.clipboard?.writeText){if(jB(e))return!0;throw n()}try{return await navigator.clipboard.writeText(e),!0}catch(o){throw new Ml("write-failed",`Failed to copy ${t} to the clipboard.`,{cause:o})}}function lp({timeout:e=2e3,target:t="text",onCopy:n,onError:o}={}){let[r,a]=Q(!1),i=N(null),s=N(n),l=N(o),d=N(t),c=N(e);s.current=n,l.current=o,d.current=t,c.current=e;let f=R((p,m)=>{QB(p,d.current).then(g=>{g&&(i.current&&clearTimeout(i.current),a(!0),s.current?.(m),c.current!==0&&(i.current=setTimeout(()=>{a(!1),i.current=null},c.current)))},g=>{l.current?.(g instanceof Error?g:new Error(String(g)),m)})},[]);return W(()=>()=>{i.current&&clearTimeout(i.current)},[]),{copyToClipboard:f,isCopied:r}}function ut(){let e=ar().i18n.usePluginTranslation();return{t:(t,n)=>e(t,n)}}var aI=1e3,XB={unavailable:"copyButton.clipboardUnavailable","write-failed":"copyButton.copyFailedDetail"};function YB({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 Nl=ve(function({text:t,size:n="xs",variant:o="outline",className:r,toastAnchor:a="above"}){let{t:i}=ut(),s=N(null),[l,d]=Q(null),c=N(null),f=(g,h)=>{let v=s.current?.getBoundingClientRect();v&&(c.current&&clearTimeout(c.current),d({top:a==="above"?Math.max(4,v.top-(h===void 0?26:40)):Math.min(window.innerHeight-26,v.bottom+4),left:Math.max(4,v.left+v.width/2),title:g,description:h}),c.current=setTimeout(()=>d(null),aI))};W(()=>()=>{c.current&&clearTimeout(c.current)},[]);let{copyToClipboard:p,isCopied:m}=lp({onCopy:()=>f(i("copyButton.copied")),onError:g=>f(i("copyButton.failedToCopy"),g instanceof Ml?i(XB[g.reason]):g.message),timeout:aI});return b(Je,{children:[u(et,{render:u(ie,{"aria-label":i("copyButton.copyToClipboard"),disabled:m,onClick:()=>p(t),ref:s,type:"button",size:n,variant:o,className:K("text-muted-foreground hover:text-foreground",r)}),children:m?u(ro,{className:"size-3 text-primary"}):u(ls,{className:"size-3"})}),u(Ze,{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(YB,{title:l.title,description:l.description})})}):null]})});function JB(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 dp({label:e,children:t}){let[n,o]=Q(!1);return b(Je,{open:n,onOpenChange:o,children:[u(et,{render:u("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm"}),"aria-label":e,onClick:()=>o(r=>!r),children:t}),u(Ze,{children:e})]})}var iI=ve(function({footer:t,timestampFormat:n,copyText:o}){let{t:r}=ut(),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(dp,{label:i,children:[a==="completed"?u(ro,{className:"size-icon-1 text-success","aria-hidden":!0}):a==="error"?u(en,{className:"size-icon-1 text-destructive","aria-hidden":!0}):u(hc,{className:"size-3","aria-hidden":!0}),u("span",{className:"sr-only",children:i})]}):null,t.completedAt?u(dp,{label:aa(t.completedAt,n),children:u("time",{dateTime:t.completedAt,children:Pi(t.completedAt,n,r)})}):null,t.workingElapsedMs!==void 0?b(dp,{label:r("timeline.workingTime",{duration:Da(t.workingElapsedMs)}),children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),Da(t.workingElapsedMs)]}):null,t.outputTokens!==void 0?b(dp,{label:`${r("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),JB(t.outputTokens)]}):null]}),o?u(Nl,{text:o,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});he();he();function sI(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 lI=ve(function(t){let{additions:n,deletions:o,className:r,showParentheses:a=!1,layout:i="aligned"}=t,{t:s}=ut(),l=new Intl.ListFormat(void 0,{type:"unit"}).format([s("changedFiles.additions",{count:n}),s("changedFiles.deletions",{count:o})]);return b(ke,{children:[a&&u("span",{className:"text-muted-foreground/70",children:"("}),b("span",{role:"group","aria-label":l,className:K(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-diff-addition",children:["+",sI(n)]}),b("span",{"aria-hidden":"true",className:"font-mono text-diff-deletion",children:["-",sI(o)]})]}),a&&u("span",{className:"text-muted-foreground/70",children:")"})]})});function ZB(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 dI(e){return e.replaceAll("\\","/")}function cI(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function ez(e){return e.replace(/[\\/]+$/,"")}function tz(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function nz(e){return e.replace(/^\.\/+/,"").replace(/^\/+/,"")}function oz(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function cp(e,t){let{path:n,line:o,column:r}=ZB(e),a=cI(dI(n)),i=a;if(t){let s=cI(dI(ez(t))),l=tz(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(!oz(a)){let m=nz(a);i=d.startsWith(p)?a:`${l}/${m}`}}return o?`${i}:${o}${r?`:${r}`:""}`:i}function uI(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function fI(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}var up="chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left";function Pc({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:K("block size-2 rounded-full",e==="failed"?"bg-destructive":e==="success"?"bg-success":"border border-muted-foreground/60")})})}function fp({state:e,variant:t="inline",className:n,children:o}){return b("div",{"data-process-state":e,"data-process-kind":t,className:K("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]})}function Ec({name:e,className:t}){switch(e){case"bot":return u(is,{className:t,"aria-hidden":!0});case"check":return u(ro,{className:t,"aria-hidden":!0});case"circle-alert":return u(Pn,{className:t,"aria-hidden":!0});case"eye":return u(ec,{className:t,"aria-hidden":!0});case"globe":return u(rc,{className:t,"aria-hidden":!0});case"hammer":return u(ic,{className:t,"aria-hidden":!0});case"message-circle":return u(ps,{className:t,"aria-hidden":!0});case"search":return u(ys,{className:t,"aria-hidden":!0});case"square-pen":return u(No,{className:t,"aria-hidden":!0});case"terminal":return u(qo,{className:t,"aria-hidden":!0});case"wrench":return u(vc,{className:t,"aria-hidden":!0});case"x":return u(en,{className:t,"aria-hidden":!0});case"zap":return u(Cs,{className:t,"aria-hidden":!0})}}function rz(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 Yh(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:rz(o),count:r}))}function Jh(e,t){let n;for(let o of Yh(e,t))(!n||o.count>n.count)&&(n=o);return n?.icon??"wrench"}var _l=20;function Dl(e){return ap(e)}function pI(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?cp(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(g=>g.toLowerCase()===m.toLowerCase())&&f.push(m)}return f.join(" ")||null}function mI({entry:e,failed:t}){let n=e.toolLabel?.diffStat;return!n||t||Zh(e)?null:u(lI,{...n,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function Zh(e){return e.toolLifecycleStatus==="declined"||e.toolLifecycleStatus==="stopped"}function gI({toolIcon:e,glyphClassName:t}){let n=wt(un),o=n.SiteIcon;return e.pageUrl!==void 0&&o!==void 0?u(o,{threadRef:n.threadRef,pageUrl:e.pageUrl,className:"size-3.5 shrink-0 rounded-sm object-contain"}):u(Ec,{name:"globe",className:t})}function az({entry:e,failed:t=!1,derive:n}){return t?u(Pn,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive"}):e.toolIcon!==void 0?u(gI,{toolIcon:e.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"}):u(Ec,{name:Jh([e],n.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function iz({entries:e,failed:t,derive:n}){let{t:o}=ut(),r=q(()=>Yh(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(Ec,{name:s,className:K("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive":"text-icon-muted")}),l]},i))})}function hI({entry:e}){let t=wt(un),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(ke,{children:r}):u("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:n??""})})}var sz=ve(function(t){let{entry:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}=t,s=wt(un).derive,{t:l}=ut(),[d,c]=Wo(o,`call:${Dl(n)}`,!1),f=s.workEntryIndicatesFailure(n),p=Zh(n),m=s.resolveWorkEntryStatus(n),g=m==="failed"||m==="running"?m:null,h=Jr();return b("div",{"data-tool-call-id":n.toolCallId??n.id,"data-tool-identity":Dl(n),className:"border-b border-border/50 last:border-b-0",children:[b("button",{type:"button","aria-expanded":d,"aria-controls":h,onClick:()=>{a?.(),c(!d)},className:K("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:g}),u(Pc,{children:u(az,{entry:n,failed:f,derive:s})}),b("span",{className:"flex min-w-0 flex-1 items-center",children:[u("span",{className:"truncate",children:pI(n,r,s)??l("toolGroup.calls",{count:1})}),u(mI,{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(rn,{"aria-hidden":!0,className:K("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),d?u("div",{id:h,children:u(hI,{entry:n})}):null]})});function lz({threadKey:e,stateKey:t,maxHeight:n,children:o}){let r=N(null);return Ce(()=>{let a=r.current;if(!a)return;a.scrollTop=Wh(e,`${t}:scroll`,0);let i=()=>{kc(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 vI=ve(function({entries:t,groupId:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}){let s=wt(un).derive,{t:l}=ut(),[d,c]=Wo(o,`group:${n}`,!1),[f,p]=Wo(o,`group-page:${n}`,0),m=Jr(),g=N(null),[h,v]=Q(null),y=t.at(-1),x=q(()=>t.filter(D=>s.workEntryIndicatesFailure(D)),[t,s]),C=q(()=>t.filter(Zh),[t]),w=t.filter(D=>D.toolLifecycleStatus==="inProgress").length,T=x[0]??C[0],S=T??y,L=Math.max(0,Math.ceil(t.length/_l)-1),k=Math.min(f,L),I=k*_l,P=t.slice(I,I+_l),E=t.length>1;if(Ce(()=>{if(!h)return;let D=g.current,ne=Array.from(D?.querySelectorAll("[data-tool-identity]")??[]).find(U=>U.dataset.toolIdentity===h.id);if(!ne)return;let B=ne.closest('[data-slot="scroll-area-viewport"]');B&&(B.scrollTop+=ne.getBoundingClientRect().top-B.getBoundingClientRect().top),ne.querySelector("button")?.focus({preventScroll:!0})},[h]),!y||!S)return null;let _=D=>{a?.(),p(D)},A={threadKey:o,workspaceRoot:r,onDisclosureChange:a},H=fI(t.map(D=>uI(s.resolveWorkEntryStatus(D)))),V=Jh(t,s.toolGroupAction),J=H==="failed"?"failed":H==="running"?"running":"success";return u(fp,{state:H,variant:"tool",children:b("section",{ref:g,"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),!E&&!d&&kc(o,`call:${Dl(y)}`,!0)},className:K(up,"flex-1",T?"text-destructive":"text-muted-foreground"),children:[u(Ac,{status:J}),u(Pc,{children:!E&&y.toolIcon!==void 0&&x.length===0?u(gI,{toolIcon:y.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] opacity-70 text-icon-muted"}):u(Ec,{name:V,className:K("size-icon-1 shrink-0 stroke-[1.8] opacity-70",x.length>0?"text-destructive":"text-icon-muted")})}),b("span",{className:K("flex min-w-0 flex-1 items-center",d&&E?"chat-process-text":"chat-tool-summary"),children:[u("span",{className:"truncate",children:d&&E?l("toolGroup.calls",{count:t.length}):pI(S,r,s)??l("toolGroup.calls",{count:1})}),d&&E?null:u(mI,{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,x.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.failed",{count:x.length})}):null,C.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.cancelled",{count:C.length})}):null,d&&E?null:u(iz,{entries:t,failed:x.length>0,derive:s}),u(rn,{"aria-hidden":!0,className:K("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),T&&E?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(T)/_l)),kc(o,`call:${Dl(T)}`,!0),v({id:Dl(T)})},children:l("toolGroup.showFailure")}):null]}),d?u("div",{id:m,className:"border-t border-border/50",children:E?b(ke,{children:[t.length>_l?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:I+1,to:Math.min(I+_l,t.length),count:t.length})}),[{label:l("toolGroup.firstPage"),target:0,disabled:k===0,Icon:Jd},{label:l("toolGroup.previousPage"),target:k-1,disabled:k===0,Icon:ss},{label:l("toolGroup.nextPage"),target:k+1,disabled:k===L,Icon:Ko},{label:l("toolGroup.lastPage"),target:L,disabled:k===L,Icon:Zd}].map(({label:D,target:ne,disabled:B,Icon:U})=>u("button",{type:"button","aria-label":D,disabled:B,onClick:()=>_(ne),className:"flex size-7 items-center justify-center rounded-control-3 disabled:opacity-64 [@media(pointer:coarse)]:size-11",children:u(U,{"aria-hidden":!0,className:"size-icon-1"})},D))]}):null,u(lz,{threadKey:o,stateKey:`group-scroll:${n}:${k}`,maxHeight:"min(320px, 50dvh)",children:u("div",{className:"space-y-0.5 py-1",children:P.map(D=>u(sz,{entry:D,...A},Dl(D)))})})]}):u(hI,{entry:y})}):null]})})});function dz(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 yI(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=dz(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}}}he();var xI=ve(function({sectionKey:t,rowKeyPrefix:n,rowIds: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}`))})});function cz(e,t,n){for(let o=t;o<n;o+=1){let r=e[o];switch(r.kind){case"turn-identity":return r.turnId;case"working":return r.turnId??null;case"message":if(r.message.role==="assistant")return r.message.turnId;break;case"tool-group":if(r.entries[0]?.turnId!==void 0)return r.entries[0].turnId??null;break;case"work":if(r.groupedEntries[0]?.turnId!==void 0)return r.groupedEntries[0].turnId??null;break;case"turn-plan":return r.turnPlan.turnId;case"proposed-plan":return r.proposedPlan.turnId;case"turn-summary":return r.footer.turnId}}return null}function CI(e,t,n=[]){let o=new Map(n.map(a=>[a.key,a])),r=[];for(let a of t){if(a.end<=a.start)continue;let i=cz(e,a.start,a.end),s=o.get(a.key);if(s!==void 0&&s.turnId===i&&uz(s,e,a.start,a.end)){r.push(s);continue}r.push({key:a.key,turnId:i,firstRowIndex:a.start,rowIds:e.slice(a.start,a.end).map(l=>l.id)})}return r}function uz(e,t,n,o){if(e.firstRowIndex!==n||e.rowIds.length!==o-n)return!1;for(let r=0;r<e.rowIds.length;r+=1)if(e.rowIds[r]!==t[n+r].id)return!1;return!0}function bI(e,t){let n=Math.max(0,Math.min(t,e)),o=e-n;return{startIndex:o,hasHiddenOlder:o>0}}function Ol(e,t,n){let o=e.findIndex(r=>r.rowIds.includes(t));return o<0?n:Math.max(n,e.length-o)}he();var Ss=3,ev=Ss;function wI(e){let[t,n]=Ht("timeline-reveal-window",e,Ss),o=R(()=>{n(s=>s+ev)},[n]),r=R(s=>{n(l=>s>l?s:l)},[n]),a=R(()=>{n(Ss)},[n]),i=R(s=>{n(l=>Math.min(l,Math.max(Ss,s)))},[n]);return{revealedCount:t,revealOlder:o,revealAtLeast:r,compactTo:i,reset:a}}function SI(e,t){return t.prefixMounted?"mounted":t.loading===null||t.now>e.until?"abandoned":t.loading?(e.loadingObserved=!0,e.sectionsWhileLoading=t.sections,"waiting"):e.loadingObserved?t.sections===e.sectionsWhileLoading?"waiting":"landed":"waiting"}function fz(e,t){let n=d=>d.replace(/\s+/g,""),o=n(t.text);if(o.length===0)return null;let r=(d,c)=>e.slice(Math.max(0,d-t.prefix.length),d)===t.prefix&&e.slice(c,c+t.suffix.length)===t.suffix;if(t.start<t.end&&t.end<=e.length&&n(e.slice(t.start,t.end))===o&&r(t.start,t.end))return{start:t.start,end:t.end};let a=Ic(t.text).trim(),i=[];for(let d=e.indexOf(a);d>=0;d=e.indexOf(a,d+1))i.push(d);let s=i.filter(d=>r(d,d+a.length)),l=s.length===1?s[0]:s.length===0&&i.length===1?i[0]:null;return l===null?null:{start:l,end:l+a.length}}function TI(e,t){let n=e.querySelector("[data-assistant-quote-body]")??tp(e);if(n===null)return null;let o=[],r="",a=document.createTreeWalker(n,NodeFilter.SHOW_TEXT);for(let c=a.nextNode();c;c=a.nextNode()){let f=c.data;for(let p=0;p<f.length;p+=1){let m=/\s/.test(f[p]);m&&r.endsWith(" ")||(r+=m?" ":f[p],o.push({node:c,offset:p}))}}let i=fz(r,t);if(i===null)return null;let s=o[i.start],l=o[i.end-1];if(!s||!l)return null;let d=document.createRange();return d.setStart(s.node,s.offset),d.setEnd(l.node,l.offset+1),d}var tv="assistant-quote",II=2400;function kI(e){let t=globalThis.CSS?.highlights,n=globalThis.Highlight;if(t&&n){let r=new n(e);t.set(tv,r),setTimeout(()=>{t.get(tv)===r&&t.delete(tv)},II);return}let o=document.getSelection();o&&(o.removeAllRanges(),o.addRange(e),setTimeout(()=>{let r=o.rangeCount>0?o.getRangeAt(0):null;r&&r.compareBoundaryPoints(Range.START_TO_START,e)===0&&o.removeAllRanges()},II))}var pz=400;function LI({root:e,minimumCount:t,keepAbovePx:n=0,canCompact:o,onCompact:r}){let a=e.ownerDocument,i=new Set,s,l=!1,d=()=>e.scrollHeight-e.clientHeight-e.scrollTop<=2,c=()=>{if(s=void 0,a.hidden||i.size>0||!o()||e.clientHeight<=0||!d()||Lc(e))return;let w=e.querySelectorAll("[data-timeline-turn-section]"),T=e.getBoundingClientRect().top-32-n,S=0,L=Math.max(0,w.length-t);for(;S<L;){let I=Math.floor((S+L)/2),P=w[I].getBoundingClientRect().bottom;if(!Number.isFinite(P))return;P<=T?S=I+1:L=I}if(S===0)return;let k=a.activeElement;if(k&&Rl(k)){for(let I=0;I<S;I+=1)if(w[I].contains(k))return}r(w.length-S)},f=!1,p=()=>{if(a.hidden||i.size>0||!o()||f){clearTimeout(s),s=void 0;return}s===void 0&&(s=setTimeout(c,pz))},m=()=>{clearTimeout(s),s=void 0,p()},g=()=>{let w=d();!w||!l?m():p(),l=w},h=w=>{i.add(w.pointerId),m()},v=w=>{i.delete(w.pointerId),m()},y=()=>{f=Lc(e),m()},x=()=>{i.clear(),m()},C=["wheel","keydown","focusin","focusout"];for(let w of C)e.addEventListener(w,m,{passive:!0});return e.addEventListener("scroll",g,{passive:!0}),e.addEventListener("pointerdown",h,!0),a.addEventListener("pointerup",v,!0),a.addEventListener("pointercancel",v,!0),a.addEventListener("selectionchange",y),a.addEventListener("visibilitychange",p),a.defaultView?.addEventListener("blur",x),p(),{schedule:p,disconnect:()=>{clearTimeout(s);for(let w of C)e.removeEventListener(w,m);e.removeEventListener("scroll",g),e.removeEventListener("pointerdown",h,!0),a.removeEventListener("pointerup",v,!0),a.removeEventListener("pointercancel",v,!0),a.removeEventListener("selectionchange",y),a.removeEventListener("visibilitychange",p),a.defaultView?.removeEventListener("blur",x)}}}he();function PI({root:e,topInsetPx:t,onActiveSectionChange:n,active:o}){let r=N(o);r.current=o;let a=Li(o),i=N(new Map),s=N(null),l=N(null),d=N(n);d.current=n;let c=R(()=>{if(!r.current||!e)return;let h=e.scrollTop+t,v=null,y=Number.NEGATIVE_INFINITY,x=null,C=Number.POSITIVE_INFINITY;for(let[T,S]of i.current){if(!S.isConnected)continue;let L=S.offsetTop;L<C&&(C=L,x=T),L<=h&&L>=y&&(y=L,v=T)}let w=v??x;w!==l.current&&(l.current=w,d.current(w))},[e,t]),f=R(()=>{r.current&&a.request(c)},[a,c]);W(()=>{if(!o||!e||typeof IntersectionObserver>"u")return;let h=!0,v=new IntersectionObserver(()=>{!h||!r.current||f()},{root:e,rootMargin:`-${t}px 0px 0px 0px`,threshold:0});s.current=v;for(let y of i.current.values())v.observe(y);return f(),()=>{h=!1,v.disconnect(),s.current=null,a.cancel()}},[o,a,f,e,t]);let p=N(new Map),m=R(h=>{let v=p.current.get(h);if(v)return v;let y=x=>{let C=i.current.get(h);C&&C!==x&&(s.current?.unobserve(C),i.current.delete(h)),x?(i.current.set(h,x),s.current?.observe(x)):p.current.get(h)===y&&p.current.delete(h)};return p.current.set(h,y),y},[]),g=R(()=>{r.current&&(l.current=null,f())},[f]);return q(()=>({observeSection:m,refresh:g}),[m,g])}function Rc(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(ke,{children:[e,t]}):b(ke,{children:[i[0],t,i[1]]})}he();function AI(e){return $o(e.subscribe,e.getStructure,e.getStructure)}function EI(e,t){let n=R(r=>e.subscribeRow(t,r),[e,t]),o=R(()=>e.getRow(t),[e,t]);return $o(n,o,o)}function Ai(e,t,n=Object.is){let o=N(null),r=R(()=>{let a=e.getVersion(),i=o.current;if(i!==null&&i.store===e&&i.select===t&&i.version===a)return i.value;let s=t(e),l=i!==null&&i.store===e&&n(i.value,s)?i.value:s;return o.current={store:e,select:t,version:a,value:l},l},[e,t,n]);return $o(e.subscribe,r,r)}he();function nv(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 Ei(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||mz.has(t)?"text":"file"}var mz=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function RI(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 gz="<ycodium-system>";function pp(e){return e.startsWith(gz)}var hz=/[ \t]*\(record [^\s()]+\)/g,vz=/^<\/?[a-z][a-z-]*(?:\s[^>]*)?>$/;function ov(e){return pp(e)?e.split(`
3800
+ `;he();he();var Tw=bt(null),kw=Tw.Provider,Lw=bt(""),Pw=Lw.Provider;function Af(){return Ut(Lw)}function rr(){let e=Ut(Tw);if(e===null)throw new Error("Conversation UI has not been registered.");return e}var Aw="ycodium.conversation.host-data.v16",Nh="ycodium:assistant-quote-open",_h="conversation";var Dh="__ycodiumConversationBridge",Ew="ycodium.conversation.rebindable-bridge.v1";he();function Rw(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=Rw(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Mw(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Rw(e))&&(o&&(o+=" "),o+=t);return o}var Nw=Mw;var AF=(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},EF=(e,t)=>({classGroupId:e,validator:t}),Hw=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n});var _w=[],RF="arbitrary..",MF=e=>{let t=_F(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return NF(i);let s=i.split("-"),l=s[0]===""&&s.length>1?1:0;return $w(s,l,t)},getConflictingClassGroupIds:(i,s)=>{if(s){let l=o[i],d=n[i];return l?d?AF(d,l):l:d||_w}return n[i]||_w}}},$w=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let d=$w(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}},NF=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?RF+o:void 0})(),_F=e=>{let{theme:t,classGroups:n}=e;return DF(n,t)},DF=(e,t)=>{let n=Hw();for(let o in e){let r=e[o];Bh(r,n,o,t)}return n},Bh=(e,t,n,o)=>{let r=e.length;for(let a=0;a<r;a++){let i=e[a];OF(i,t,n,o)}},OF=(e,t,n,o)=>{if(typeof e=="string"){FF(e,t,n);return}if(typeof e=="function"){BF(e,t,n,o);return}zF(e,t,n,o)},FF=(e,t,n)=>{let o=e===""?t:Kw(t,e);o.classGroupId=n},BF=(e,t,n,o)=>{if(UF(e)){Bh(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(EF(n,e))},zF=(e,t,n,o)=>{let r=Object.entries(e),a=r.length;for(let i=0;i<a;i++){let[s,l]=r[i];Bh(l,Kw(t,s),n,o)}},Kw=(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=Hw(),n.nextPart.set(i,s)),n=s}return n},UF=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,HF=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 $F=[],Dw=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),KF=e=>{let{prefix:t,experimentalParseClassName:n}=e,o=r=>{let a=[],i=0,s=0,l=0,d,c=r.length;for(let h=0;h<c;h++){let v=r[h];if(i===0&&s===0){if(v===":"){a.push(r.slice(l,h)),l=h+1;continue}if(v==="/"){d=h;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 g=d&&d>l?d-l:void 0;return Dw(a,m,p,g)};if(t){let r=t+":",a=o;o=i=>i.startsWith(r)?a(i.slice(r.length)):Dw($F,!1,i,void 0,!0)}if(n){let r=o;o=a=>n({className:a,parseClassName:r})}return o},qF=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}},VF=e=>({cache:HF(e.cacheSize),parseClassName:KF(e),sortModifiers:qF(e),postfixLookupClassGroupIds:WF(e),...MF(e)}),WF=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},GF=/\s+/,jF=(e,t)=>{let{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:a,postfixLookupClassGroupIds:i}=t,s=[],l=e.trim().split(GF),d="";for(let c=l.length-1;c>=0;c-=1){let f=l[c],{isExternal:p,modifiers:m,hasImportantModifier:g,baseClassName:h,maybePostfixModifierPosition:v}=n(f);if(p){d=f+(d.length>0?" "+d:d);continue}let y=!!v,x;if(y){let L=h.substring(0,v);x=o(L);let k=x&&i[x]?o(h):void 0;k&&k!==x&&(x=k,y=!1)}else x=o(h);if(!x){if(!y){d=f+(d.length>0?" "+d:d);continue}if(x=o(h),!x){d=f+(d.length>0?" "+d:d);continue}y=!1}let C=m.length===0?"":m.length===1?m[0]:a(m).join(":"),w=g?C+"!":C,T=w+x;if(s.indexOf(T)>-1)continue;s.push(T);let S=r(x,y);for(let L=0;L<S.length;++L){let k=S[L];s.push(w+k)}d=f+(d.length>0?" "+d:d)}return d},QF=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=qw(n))&&(r&&(r+=" "),r+=o);return r},qw=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=qw(e[o]))&&(n&&(n+=" "),n+=t);return n},Ow=(e,...t)=>{let n,o,r,a,i=l=>{let d=t.reduce((c,f)=>f(c),e());return n=VF(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=jF(l,n);return r(l,c),c};return a=i,(...l)=>a(QF(...l))},XF=[],Fn=e=>{let t=n=>n[e]||XF;return t.isThemeGetter=!0,t},Vw=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ww=/^\((?:(\w[\w-]*):)?(.+)\)$/i,YF=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,JF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ZF=/\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$/,e2=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,t2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,n2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,gi=e=>YF.test(e),gt=e=>!!e&&!Number.isNaN(Number(e)),Zr=e=>!!e&&Number.isInteger(Number(e)),Oh=e=>e.endsWith("%")&&gt(e.slice(0,-1)),Ra=e=>JF.test(e),Gw=()=>!0,o2=e=>ZF.test(e)&&!e2.test(e),zh=()=>!1,r2=e=>t2.test(e),a2=e=>n2.test(e),i2=e=>!Oe(e)&&!Fe(e),s2=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)),l2=e=>hi(e,Xw,zh),Oe=e=>Vw.test(e),os=e=>hi(e,Yw,o2),Fw=e=>hi(e,h2,gt),d2=e=>hi(e,Zw,Gw),c2=e=>hi(e,Jw,zh),Bw=e=>hi(e,jw,zh),u2=e=>hi(e,Qw,a2),Ef=e=>hi(e,eS,r2),Fe=e=>Ww.test(e),Wd=e=>rs(e,Yw),f2=e=>rs(e,Jw),zw=e=>rs(e,jw),p2=e=>rs(e,Xw),m2=e=>rs(e,Qw),Rf=e=>rs(e,eS,!0),g2=e=>rs(e,Zw,!0),hi=(e,t,n)=>{let o=Vw.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},rs=(e,t,n=!1)=>{let o=Ww.exec(e);return o?o[1]?t(o[1]):n:!1},jw=e=>e==="position"||e==="percentage",Qw=e=>e==="image"||e==="url",Xw=e=>e==="length"||e==="size"||e==="bg-size",Yw=e=>e==="length",h2=e=>e==="number",Jw=e=>e==="family-name",Zw=e=>e==="number"||e==="weight",eS=e=>e==="shadow";var Uw=()=>{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"),g=Fn("blur"),h=Fn("perspective"),v=Fn("aspect"),y=Fn("ease"),x=Fn("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"],T=()=>[...w(),Fe,Oe],S=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],k=()=>[Fe,Oe,l],I=()=>[gi,"full","auto",...k()],P=()=>[Zr,"none","subgrid",Fe,Oe],E=()=>["auto",{span:["full",Zr,Fe,Oe]},Zr,Fe,Oe],_=()=>[Zr,"auto",Fe,Oe],A=()=>["auto","min","max","fr",Fe,Oe],H=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],J=()=>["auto",...k()],D=()=>[gi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],ne=()=>[gi,"screen","full","dvw","lvw","svw","min","max","fit",...k()],F=()=>[gi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],U=()=>[e,Fe,Oe],ee=()=>[...w(),zw,Bw,{position:[Fe,Oe]}],j=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Z=()=>["auto","cover","contain",p2,l2,{size:[Fe,Oe]}],de=()=>[Oh,Wd,os],B=()=>["","none","full",d,Fe,Oe],X=()=>["",gt,Wd,os],pe=()=>["solid","dashed","dotted","double"],le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>[gt,Oh,zw,Bw],we=()=>["","none",g,Fe,Oe],Xe=()=>["none",gt,Fe,Oe],ot=()=>["none",gt,Fe,Oe],at=()=>[gt,Fe,Oe],je=()=>[gi,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ra],breakpoint:[Ra],color:[Gw],container:[Ra],"drop-shadow":[Ra],ease:["in","out","in-out"],font:[i2],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ra],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ra],shadow:[Ra],spacing:["px",gt],text:[Ra],"text-shadow":[Ra],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",gi,Oe,Fe,v]}],container:["container"],"container-type":[{"@container":["","normal","size",Fe,Oe]}],"container-named":[s2],columns:[{columns:[gt,Oe,Fe,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:T()}],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:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{"inset-s":I(),start:I()}],end:[{"inset-e":I(),end:I()}],"inset-bs":[{"inset-bs":I()}],"inset-be":[{"inset-be":I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[Zr,"auto",Fe,Oe]}],basis:[{basis:[gi,"full","auto",s,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[gt,gi,"auto","initial","none",Oe]}],grow:[{grow:["",gt,Fe,Oe]}],shrink:[{shrink:["",gt,Fe,Oe]}],order:[{order:[Zr,"first","last","none",Fe,Oe]}],"grid-cols":[{"grid-cols":P()}],"col-start-end":[{col:E()}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:E()}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...H(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...H()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":H()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:J()}],mx:[{mx:J()}],my:[{my:J()}],ms:[{ms:J()}],me:[{me:J()}],mbs:[{mbs:J()}],mbe:[{mbe:J()}],mt:[{mt:J()}],mr:[{mr:J()}],mb:[{mb:J()}],ml:[{ml:J()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:D()}],"inline-size":[{inline:["auto",...ne()]}],"min-inline-size":[{"min-inline":["auto",...ne()]}],"max-inline-size":[{"max-inline":["none",...ne()]}],"block-size":[{block:["auto",...F()]}],"min-block-size":[{"min-block":["auto",...F()]}],"max-block-size":[{"max-block":["none",...F()]}],w:[{w:[s,"screen",...D()]}],"min-w":[{"min-w":[s,"screen","none",...D()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...D()]}],h:[{h:["screen","lh",...D()]}],"min-h":[{"min-h":["screen","lh","none",...D()]}],"max-h":[{"max-h":["screen","lh",...D()]}],"font-size":[{text:["base",n,Wd,os]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,g2,d2]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Oh,Oe]}],"font-family":[{font:[f2,c2,t]}],"font-features":[{"font-features":[Oe]}],"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,Fe,Oe]}],"line-clamp":[{"line-clamp":[gt,"none",Fe,Fw]}],leading:[{leading:[a,...k()]}],"list-image":[{"list-image":["none",Fe,Oe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Fe,Oe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...pe(),"wavy"]}],"text-decoration-thickness":[{decoration:[gt,"from-font","auto",Fe,os]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[gt,"auto",Fe,Oe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"tab-size":[{tab:[Zr,Fe,Oe]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Fe,Oe]}],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",Fe,Oe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:j()}],"bg-size":[{bg:Z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zr,Fe,Oe],radial:["",Fe,Oe],conic:[Zr,Fe,Oe]},m2,u2]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:de()}],"gradient-via-pos":[{via:de()}],"gradient-to-pos":[{to:de()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:X()}],"border-w-x":[{"border-x":X()}],"border-w-y":[{"border-y":X()}],"border-w-s":[{"border-s":X()}],"border-w-e":[{"border-e":X()}],"border-w-bs":[{"border-bs":X()}],"border-w-be":[{"border-be":X()}],"border-w-t":[{"border-t":X()}],"border-w-r":[{"border-r":X()}],"border-w-b":[{"border-b":X()}],"border-w-l":[{"border-l":X()}],"divide-x":[{"divide-x":X()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":X()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...pe(),"hidden","none"]}],"divide-style":[{divide:[...pe(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...pe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[gt,Fe,Oe]}],"outline-w":[{outline:["",gt,Wd,os]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",c,Rf,Ef]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",f,Rf,Ef]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[gt,os]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":X()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",p,Rf,Ef]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[gt,Fe,Oe]}],"mix-blend":[{"mix-blend":[...le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":le()}],"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":[gt]}],"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":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"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":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"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":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"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":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"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":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"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":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"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":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Fe,Oe]}],"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":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"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":[gt]}],"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":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:j()}],"mask-size":[{mask:Z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Fe,Oe]}],filter:[{filter:["","none",Fe,Oe]}],blur:[{blur:we()}],brightness:[{brightness:[gt,Fe,Oe]}],contrast:[{contrast:[gt,Fe,Oe]}],"drop-shadow":[{"drop-shadow":["","none",m,Rf,Ef]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",gt,Fe,Oe]}],"hue-rotate":[{"hue-rotate":[gt,Fe,Oe]}],invert:[{invert:["",gt,Fe,Oe]}],saturate:[{saturate:[gt,Fe,Oe]}],sepia:[{sepia:["",gt,Fe,Oe]}],"backdrop-filter":[{"backdrop-filter":["","none",Fe,Oe]}],"backdrop-blur":[{"backdrop-blur":we()}],"backdrop-brightness":[{"backdrop-brightness":[gt,Fe,Oe]}],"backdrop-contrast":[{"backdrop-contrast":[gt,Fe,Oe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",gt,Fe,Oe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[gt,Fe,Oe]}],"backdrop-invert":[{"backdrop-invert":["",gt,Fe,Oe]}],"backdrop-opacity":[{"backdrop-opacity":[gt,Fe,Oe]}],"backdrop-saturate":[{"backdrop-saturate":[gt,Fe,Oe]}],"backdrop-sepia":[{"backdrop-sepia":["",gt,Fe,Oe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Fe,Oe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[gt,"initial",Fe,Oe]}],ease:[{ease:["linear","initial",y,Fe,Oe]}],delay:[{delay:[gt,Fe,Oe]}],animate:[{animate:["none",x,Fe,Oe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,Fe,Oe]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:Xe()}],"rotate-x":[{"rotate-x":Xe()}],"rotate-y":[{"rotate-y":Xe()}],"rotate-z":[{"rotate-z":Xe()}],scale:[{scale:ot()}],"scale-x":[{"scale-x":ot()}],"scale-y":[{"scale-y":ot()}],"scale-z":[{"scale-z":ot()}],"scale-3d":["scale-3d"],skew:[{skew:at()}],"skew-x":[{"skew-x":at()}],"skew-y":[{"skew-y":at()}],transform:[{transform:[Fe,Oe,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:je()}],"translate-x":[{"translate-x":je()}],"translate-y":[{"translate-y":je()}],"translate-z":[{"translate-z":je()}],"translate-none":["translate-none"],zoom:[{zoom:[Zr,Fe,Oe]}],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"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",Fe,Oe]}],"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":U()}],"scrollbar-track-color":[{"scrollbar-track":U()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",Fe,Oe]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[gt,Wd,os,Fw]}],stroke:[{stroke:["none",...U()]}],"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"]}},v2=(e,{cacheSize:t,prefix:n,experimentalParseClassName:o,extend:r={},override:a={}})=>(wl(e,"cacheSize",t),wl(e,"prefix",n),wl(e,"experimentalParseClassName",o),Mf(e.theme,a.theme),Mf(e.classGroups,a.classGroups),Mf(e.conflictingClassGroups,a.conflictingClassGroups),Mf(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),wl(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),wl(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),Nf(e.theme,r.theme),Nf(e.classGroups,r.classGroups),Nf(e.conflictingClassGroups,r.conflictingClassGroups),Nf(e.conflictingClassGroupModifiers,r.conflictingClassGroupModifiers),Fh(e,r,"postfixLookupClassGroups"),Fh(e,r,"orderSensitiveModifiers"),e),wl=(e,t,n)=>{n!==void 0&&(e[t]=n)},Mf=(e,t)=>{if(t)for(let n in t)wl(e,n,t[n])},Nf=(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)},tS=(e,...t)=>typeof e=="function"?Ow(Uw,e,...t):Ow(()=>v2(Uw(),e),...t);var y2=tS({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 K(...e){return y2(Nw(e))}he();var _f=bt(!0);function nS(){return wt(_f)}var Uh=bt(void 0);function ea(){let e=wt(_f);return wt(Uh)??e}he();var Df=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();var oS=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var rS=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase());var Hh=e=>{let t=rS(e);return t.charAt(0).toUpperCase()+t.slice(1)};he();var aS={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 iS=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var sS=Wn(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:a,iconNode:i,...s},l)=>De("svg",{ref:l,...aS,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:Df("lucide",r),...!a&&!iS(s)&&{"aria-hidden":"true"},...s},[...i.map(([d,c])=>De(d,c)),...Array.isArray(a)?a:[a]]));var te=(e,t)=>{let n=Wn(({className:o,...r},a)=>De(sS,{ref:a,iconNode:t,className:Df(`lucide-${oS(Hh(e))}`,`lucide-${e}`,o),...r}));return n.displayName=Hh(e),n};var x2=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Gd=te("arrow-down",x2);var C2=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],jd=te("arrow-up-right",C2);var b2=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Qd=te("arrow-up",b2);var w2=[["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"}]],Xd=te("blocks",w2);var S2=[["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"}]],Sl=te("bookmark",S2);var I2=[["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"}]],as=te("bot",I2);var T2=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ro=te("check",T2);var k2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],rn=te("chevron-down",k2);var L2=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],is=te("chevron-left",L2);var P2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ko=te("chevron-right",P2);var A2=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Yd=te("chevron-up",A2);var E2=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Jd=te("chevrons-left",E2);var R2=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Zd=te("chevrons-right",R2);var M2=[["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"}]],Pn=te("circle-alert",M2);var N2=[["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"}]],ss=te("copy",N2);var _2=[["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"}]],ar=te("ellipsis",_2);var D2=[["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"}]],ec=te("eye",D2);var O2=[["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"}]],ls=te("file-code",O2);var F2=[["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"}]],ds=te("file-text",F2);var B2=[["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"}]],tc=te("file",B2);var z2=[["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"}]],vi=te("folder",z2);var U2=[["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"}]],nc=te("frame",U2);var H2=[["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"}]],oc=te("git-branch-plus",H2);var $2=[["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"}]],rc=te("globe",$2);var K2=[["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"}]],ac=te("grip-vertical",K2);var q2=[["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"}]],ic=te("hammer",q2);var V2=[["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"}]],cs=te("image",V2);var W2=[["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"}]],Ma=te("layers",W2);var G2=[["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"}]],sc=te("list-ordered",G2);var j2=[["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"}]],us=te("list-todo",j2);var Q2=[["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"}]],lc=te("list",Q2);var X2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],yi=te("loader-circle",X2);var Y2=[["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"}]],xi=te("lock-open",Y2);var J2=[["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"}]],dc=te("lock",J2);var Z2=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ci=te("message-circle-question-mark",Z2);var eB=[["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"}]],fs=te("message-circle",eB);var tB=[["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"}]],ps=te("message-square",tB);var nB=[["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"}]],cc=te("minimize-2",nB);var oB=[["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"}]],ta=te("mouse-pointer-click",oB);var rB=[["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"}]],uc=te("package",rB);var aB=[["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"}]],ms=te("paintbrush",aB);var iB=[["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"}]],wo=te("paperclip",iB);var sB=[["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"}]],na=te("pen-line",sB);var lB=[["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"}]],fc=te("pencil-ruler",lB);var dB=[["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"}]],pc=te("pencil",dB);var cB=[["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"}]],gs=te("puzzle",cB);var uB=[["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"}]],hs=te("rotate-ccw",uB);var fB=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],vs=te("search",fB);var pB=[["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"}]],mc=te("send",pB);var mB=[["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"}]],gc=te("settings",mB);var gB=[["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"}]],Il=te("sliders-horizontal",gB);var hB=[["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"}]],bi=te("sparkles",hB);var vB=[["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=te("square-pen",vB);var yB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],hc=te("square",yB);var xB=[["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"}]],ys=te("star",xB);var CB=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],qo=te("terminal",CB);var bB=[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]],Na=te("text-quote",bB);var wB=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],oa=te("user-round",wB);var SB=[["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"}]],vc=te("wrench",SB);var IB=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],en=te("x",IB);var TB=[["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"}]],xs=te("zap",TB);he();function ye(){return{t:rr().i18n.usePluginTranslation()}}he();he();var Tl=bt(null),yc=bt(null);function Of(e,t){let n=wt(yc);Ce(()=>{if(!(!t||e===null||n===null))return n(e)},[n,t,e])}function xc(){let e=new Map;return{rows:()=>[...e.keys()],acquire:(t,n)=>{e.set(t,(e.get(t)??0)+1),n();let o=!0;return()=>{if(!o)return;o=!1;let r=e.get(t)??0;r>1?e.set(t,r-1):e.delete(t),n()}}}}var lS=new Set(["Select","AlertDialog","Dialog","DropdownMenu","Menu","Popover","Tooltip","Combobox"]);function ue(e){let t=lS.has(e),n=o=>{let r=rr(),a=Af(),i=ea(),s=r.ui[e],l={};if(t){let d=wt(Tl),[c,f]=Q(o.defaultOpen===!0),p=typeof o.open=="boolean"?o.open:c;Of(d,i&&p),Ce(()=>{i||f(!1)},[i]),l={open:i&&p,onOpenChange:(m,...g)=>{f(m),typeof o.onOpenChange=="function"&&o.onOpenChange(m,...g)}}}return De(s,{...o,...l,...lS.has(e)&&!i?{open:!1}:{},className:`${a} ${typeof o.className=="string"?o.className:""}`})};return n.displayName=e,n}var pJ=ue("useLinkContextMenu"),wr=ue("ProviderInstanceIcon"),dS=ue("UserAvatar"),ra=ue("Badge"),ie=ue("Button"),mJ=ue("Label"),kl=ue("Input"),cS=ue("Textarea"),gJ=ue("Switch"),hJ=ue("Separator"),vJ=ue("Skeleton"),Ff=ue("Spinner"),yJ=ue("ScrollArea"),xJ=ue("Card"),CJ=ue("CardAction"),bJ=ue("CardContent"),wJ=ue("CardDescription"),SJ=ue("CardFooter"),IJ=ue("CardHeader"),TJ=ue("CardTitle"),kJ=ue("Empty"),LJ=ue("EmptyContent"),PJ=ue("EmptyDescription"),AJ=ue("EmptyHeader"),EJ=ue("EmptyMedia"),RJ=ue("EmptyTitle"),MJ=ue("InputGroup"),NJ=ue("InputGroupAddon"),_J=ue("InputGroupInput"),DJ=ue("DocumentPanel"),OJ=ue("MasterDetail"),Bf=ue("Select"),FJ=ue("SelectContent"),zf=ue("SelectItem"),Uf=ue("SelectPopup"),uS=ue("SelectTrigger"),Hf=ue("SelectValue"),Cc=ue("Toggle"),fS=ue("ToggleGroup"),pS=ue("AlertDialog"),mS=ue("AlertDialogClose"),gS=ue("AlertDialogDescription"),hS=ue("AlertDialogFooter"),vS=ue("AlertDialogHeader"),yS=ue("AlertDialogPopup"),xS=ue("AlertDialogTitle"),$f=ue("Dialog"),BJ=ue("DialogClose"),Kf=ue("DialogDescription"),qf=ue("DialogFooter"),Vf=ue("DialogHeader"),Wf=ue("DialogPopup"),CS=ue("DialogPanel"),Gf=ue("DialogTitle"),zJ=ue("DialogTrigger"),UJ=ue("DropdownMenu"),HJ=ue("DropdownMenuContent"),$J=ue("DropdownMenuItem"),KJ=ue("DropdownMenuTrigger"),_o=ue("Menu"),Ll=ue("MenuGroup"),bS=ue("MenuGroupLabel"),ir=ue("MenuItem"),Do=ue("MenuPopup"),Sr=ue("MenuRadioGroup"),Vo=ue("MenuRadioItem"),_a=ue("MenuSeparator"),Oo=ue("MenuTrigger"),wi=ue("Popover"),Si=ue("PopoverPopup"),Ii=ue("PopoverTrigger"),wS=ue("Table"),SS=ue("TableBody"),Ti=ue("TableCell"),Cs=ue("TableHead"),IS=ue("TableHeader"),jf=ue("TableRow"),Je=ue("Tooltip"),Ze=ue("TooltipPopup"),et=ue("TooltipTrigger"),TS=ue("Collapsible"),kS=ue("CollapsiblePanel"),LS=ue("CollapsibleTrigger"),bc=ue("Alert"),wc=ue("AlertAction"),Qf=ue("AlertDescription"),$h=ue("AlertTitle"),Xf=ue("Kbd"),Yf=ue("Command"),Jf=ue("CommandGroup"),Zf=ue("CommandItem"),ep=ue("CommandList"),PS=ue("Combobox"),AS=ue("ComboboxEmpty"),ES=ue("ComboboxInput"),Pl=ue("ComboboxItem"),RS=ue("ComboboxListVirtualized"),MS=ue("TooltipProvider"),NS=ue("StyledDiffCodeView"),_S=ue("DevBackdropArt"),sr=ue("Markdown"),DS=ue("DiffView");var{jsx:u,jsxs:b,Fragment:ke}=window.__ycodiumPluginHost.jsxRuntime;function OS({mode:e,onModeChange:t}){let{t:n}=ye();return b(fS,{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(Cc,{value:"chat","aria-label":n("trajectory.toggleChat"),children:[u(ps,{"aria-hidden":!0}),n("trajectory.toggleChat")]}),b(Cc,{value:"trajectory","aria-label":n("trajectory.toggleTrajectory"),children:[u(sc,{"aria-hidden":!0}),n("trajectory.toggleTrajectory")]})]})}function FS({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(Uh,{value:t,children:r==="chat"?n:o})})}he();function ao(){return{t:rr().i18n.usePluginTranslation()}}function BS(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 zS(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 Sc(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 kB=ve(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:Sc(o.outputTokens)}):null]}):null]})]})});function LB({totals:e}){let{t}=ao();if(!e)return null;let n=BS(e),o=[e.outputTokens===void 0?null:{label:t("turnNavigator.usageOutput"),value:Sc(e.outputTokens)},e.inputTokens===void 0?null:{label:t("turnNavigator.usageInput"),value:Sc(e.inputTokens)},e.cachedInputTokens===void 0?null:{label:t("turnNavigator.usageCacheRead"),value:n===null?Sc(e.cachedInputTokens):`${Sc(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 PB=ve(function({getText:t,size:n="xs",variant:o="outline",className:r}){let{t:a}=ao(),i=rr().writeClipboard,[s,l]=Q(!1),d=a("turnNavigator.copyMarkdown");return b(Je,{children:[u(et,{render:u(ie,{"aria-label":d,disabled:s,onClick:()=>{i(t()).then(()=>{l(!0),window.setTimeout(()=>l(!1),1e3)})},type:"button",size:n,variant:o,className:K("text-muted-foreground hover:text-foreground",r)}),children:s?u(ro,{className:"size-3 text-primary"}):u(ss,{className:"size-3"})}),u(Ze,{children:u("p",{children:d})})]})});function US({items:e,totalTurnCount:t,bottomInset:n,usageByTurnId:o,onSelect:r,exportMarkdown:a,onDownload:i,placement:s="float"}){let{t:l}=ao(),[d,c]=Q(!1),f=q(()=>e.map((h,v)=>({item:h,ordinal:v+1})).reverse(),[e]),p=q(()=>zS(f.map(({item:h})=>h.turnId===null?void 0:o.get(h.turnId))),[f,o]);if(e.length===0)return null;let m=t??e.length,g=l("turnNavigator.open",{count:m});return b(wi,{onOpenChange:c,open:d,children:[b(Ii,{render:u(ie,{"aria-label":g,className:K("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:g,variant:"glass"}),children:[u(lc,{"aria-hidden":!0}),u("span",{className:"font-mono font-semibold text-[11px] tabular-nums",children:m})]}),u(Si,{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:K("min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-1"),children:f.map(({item:h,ordinal:v})=>u(kB,{item:h,onSelect:y=>{c(!1),r(y)},ordinal:v,usage:h.turnId===null?void 0:o.get(h.turnId)},h.sectionKey))}),u(LB,{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(PB,{size:"icon-xs",getText:a,variant:"ghost"}),u(ie,{"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(ie,{"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"})})]})]})})]})}he();function Ic(e){return e.replace(/\s+/g," ")}function AB(e,t){let n=e.slice(Math.max(0,e.length-t));return/^[\uDC00-\uDFFF]/.test(n)&&(n=n.slice(1)),n}function EB(e,t){let n=e.slice(0,t);return/[\uD800-\uDBFF]$/.test(n)&&(n=n.slice(0,-1)),n}function tp(e){let n=(e instanceof Element?e:e?.parentElement??null)?.closest("[data-assistant-quote-body]")??null;return n?.closest('[data-message-role="assistant"]')?n:null}function HS(e){if(!e||e.isCollapsed||e.rangeCount===0)return null;let t=e.getRangeAt(0),n=tp(t.startContainer);if(n===null||tp(t.endContainer)!==n)return null;let o=n.closest("[data-message-id]")?.dataset.messageId;if(!o)return null;let r=e.toString().trim();if(r.length===0)return null;let a=document.createRange();a.selectNodeContents(n),a.setEnd(t.startContainer,t.startOffset);let i=document.createRange();i.selectNodeContents(n),i.setStart(t.endContainer,t.endOffset);let s=Ic(t.toString()),l=s.length>s.trimStart().length?" ":"",d=s.length>s.trimEnd().length?" ":"",c=Ic(a.toString()+l),f=Ic(d+i.toString()),p=c.length,m=p+s.trim().length,g=t.getClientRects(),h=g[0]??t.getBoundingClientRect(),v=g[g.length-1]??h;return{messageId:o,text:r,start:p,end:m,prefix:AB(c,32),suffix:EB(f,32),anchor:{x:v.right,top:h.top,bottom:v.bottom}}}var np="assistant-quote-inserter",op="assistant-quote-open-comment";he();var KS=100,RB=new Map,$S=new Map,rp=e=>typeof e=="function"?e():e,qS=(e,t)=>typeof t=="function"?t(e):t;function MB(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 NB(e,t){let n=$S.get(e);return n===void 0&&(n={values:new Map,limit:Math.max(1,t)},$S.set(e,n)),n}function _B(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 Kh(e,t,n){e.values.get(t)===n&&(e.values.delete(t),e.values.set(t,n))}function VS(e,t,n){let o=e.values.get(t);return o===void 0&&(o={value:rp(n),subscribers:new Set,leases:0,alive:!0,committed:!1},e.values.set(t,o)),o}function Tc(e){queueMicrotask(()=>_B(e))}function Ht(e,t,n,o=KS){let r=Math.max(1,o),a=MB(RB,e,r),i=VS(a,t,n),s=R(f=>i.alive?(a.limit=r,i.committed=!0,Kh(a,t,i),i.leases+=1,i.subscribers.add(f),Tc(a),()=>{i.subscribers.delete(f),i.leases=Math.max(0,i.leases-1),Tc(a)}):()=>{},[r,i,a,t]),l=R(()=>i.value,[i]),d=$o(s,l,l),c=R(f=>{if(!i.alive||a.values.get(t)!==i)return;let p=i.value,m=qS(p,f);if(!Object.is(m,p)){i.value=m,Kh(a,t,i);for(let g of i.subscribers)g();Tc(a)}},[i,a,t]);return[d,c]}function WS(e,t){let n=N(null);(n.current===null||n.current.key!==e)&&(n.current={key:e,value:rp(t)});let[,o]=Ea(a=>a+1,0),r=R(a=>{let i=n.current;if(i===null||i.key!==e)return;let s=qS(i.value,a);Object.is(s,i.value)||(i.value=s,o())},[e]);return[n.current.value,r]}function St(e,t,n,o=KS){let r=Math.max(1,o),a=NB(e,r),i=VS(a,t,()=>({current:rp(n)}));return W(()=>{if(!(!i.alive||a.values.get(t)!==i))return a.limit=r,i.committed=!0,Kh(a,t,i),i.leases+=1,Tc(a),()=>{i.leases=Math.max(0,i.leases-1),Tc(a)}},[r,i,a,t]),i.value}function Ir(e,t){let n=N(null);return(n.current===null||n.current.key!==e)&&(n.current={key:e,ref:{current:rp(t)}}),n.current.ref}var DB=300;function GS(e){let{data:t,target:n,threadKey:o,surfaceRef:r}=e,{t:a}=ye(),i=St(np,o,null),[,s]=Ht(op,o,null),[l,d]=Q(null),c=N(null);if(W(()=>{let h,v=()=>{let S=r.current,L=document.getSelection(),k=L&&L.rangeCount>0?L.getRangeAt(0):null;if(!S||!k||!S.contains(k.commonAncestorContainer)){d(null);return}let I=HS(L);if(I===null){d(null);return}let P=t.assistantQuotes.serialize({version:1,environmentId:n.environmentId,threadId:n.threadId,messageId:I.messageId,text:I.text,start:I.start,end:I.end,prefix:I.prefix,suffix:I.suffix});d({source:P,...I.anchor})},y=S=>{c.current?.contains(S.target)||(clearTimeout(h),h=setTimeout(v,DB))},x=S=>{c.current?.contains(S.target)||(clearTimeout(h),d(null))},C=()=>d(null),w=S=>{S.key==="Escape"&&d(null)},T=()=>{(document.getSelection()?.isCollapsed??!0)&&d(null)};return document.addEventListener("pointerup",y,!0),document.addEventListener("keyup",y,!0),document.addEventListener("pointerdown",x,!0),document.addEventListener("keydown",w,!0),document.addEventListener("selectionchange",T),window.addEventListener("scroll",C,!0),()=>{clearTimeout(h),document.removeEventListener("pointerup",y,!0),document.removeEventListener("keyup",y,!0),document.removeEventListener("pointerdown",x,!0),document.removeEventListener("keydown",w,!0),document.removeEventListener("selectionchange",T),window.removeEventListener("scroll",C,!0)}},[t,r,n.environmentId,n.threadId]),l===null)return null;let f=l.source,p=Math.max(8,Math.min(window.innerWidth-200,l.x-12)),m=l.bottom+6,g=m+40<=window.innerHeight?m:Math.max(8,l.top-40);return u("div",{ref:c,className:"fixed z-50",style:{left:p,top:g},"data-assistant-quote-toolbar":"",children:b(ie,{size:"sm",variant:"outline",className:"shadow-md",disabled:f===null,title:f===null?a("timeline.quote.tooLong"):void 0,onMouseDown:h=>h.preventDefault(),onClick:()=>{f!==null&&i.current?.(f)===!0&&(s(f),document.getSelection()?.removeAllRanges(),d(null))},children:[u(Na,{"aria-hidden":"true"}),a("timeline.quote.cite")]})})}he();he();function OB(e){return e!==null&&"tagName"in e&&"closest"in e}function ki(e){return OB(e)?e.tagName==="INPUT"||e.tagName==="TEXTAREA"?!0:e.closest('[contenteditable]:not([contenteditable="false"])')!==null:!1}function qh(e,t){if(!/^[1-9]$/.test(e))return null;let n=Number(e)-1;return n<t?n:null}function jS(e,t){let n=e.findIndex(o=>o.decision===t);return n===-1?null:{type:"respond",index:n}}function QS(e,t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return null;switch(e.key){case"Enter":return jS(t,"accept");case"Escape":return jS(t,"cancel");case"ArrowDown":case"ArrowRight":return{type:"move",delta:1};case"ArrowUp":case"ArrowLeft":return{type:"move",delta:-1};default:{let n=qh(e.key,t.length);return n===null?null:{type:"respond",index:n}}}}he();var Al=new Map,XS=24,FB=4e3,BB=1024,YS=16384;function Vh(e){let t=Al.get(e);if(t)return t;let n={values:new Map,listeners:new Set,stringLength:0};if(Al.set(e,n),Al.size>XS){for(let[o,r]of Al)if(r.listeners.size===0&&o!==e&&(Al.delete(o),Al.size<=XS))break}return n}function Wh(e,t,n){return Vh(e).values.get(t)??n}function kc(e,t,n,o=!0){let r=Vh(e);if(typeof n=="string"&&(n=n.slice(0,BB)),r.values.get(t)===n)return;let a=r.values.get(t);if(typeof a=="string"&&(r.stringLength-=a.length),r.values.delete(t),r.values.set(t,n),typeof n=="string"&&(r.stringLength+=n.length),r.stringLength>YS){for(let[i,s]of r.values)if(!(typeof s!="string"||i===t)&&(r.values.delete(i),r.stringLength-=s.length,r.stringLength<=YS))break}if(r.values.size>FB){let i=r.values.keys().next().value;if(i!==void 0){let s=r.values.get(i);typeof s=="string"&&(r.stringLength-=s.length),r.values.delete(i)}}o&&r.listeners.forEach(i=>i())}function Wo(e,t,n){let o=R(s=>{let l=Vh(e);return l.listeners.add(s),()=>l.listeners.delete(s)},[e]),r=R(()=>Wh(e,t,n),[e,t,n]),a=$o(o,r,r),i=R(s=>kc(e,t,s),[e,t]);return[a,i]}function ap(e){return JSON.stringify([e.turnId??null,e.toolCallId?"tool":"entry",e.toolCallId||e.id])}function JS(e){let t=e.map(o=>({key:o.key,turnId:o.turnId,firstRowIndex:o.firstRowIndex,endRowIndex:o.firstRowIndex+o.rowIds.length})),n=new Map;for(let o of e)for(let[r,a]of o.rowIds.entries())n.set(a,{turnId:o.turnId,index:o.firstRowIndex+r});return{sections:t,bySectionKey:new Map(t.map(o=>[o.key,o])),byRowId:n}}function ip({index:e,visibleSectionKeys:t,protectedRowIds:n,selectionRows:o}){let r=t.flatMap(d=>{let c=e.bySectionKey.get(d)?.turnId;return c==null?[]:[c]}),a=n.flatMap(d=>{let c=e.byRowId.get(d)?.turnId;return c==null?[]:[c]}),i=o?e.byRowId.get(o.firstRowId)?.index:void 0,s=o?e.byRowId.get(o.lastRowId)?.index:void 0,l=i===void 0||s===void 0?[]:e.sections.flatMap(d=>d.turnId!==null&&d.endRowIndex>Math.min(i,s)&&d.firstRowIndex<=Math.max(i,s)?[d.turnId]:[]);return{firstTurnId:r[0]??null,lastTurnId:r.at(-1)??null,protectedTurnIds:[...new Set(a)],selectionTurnRange:l.length>0?{firstTurnId:l[0],lastTurnId:l.at(-1)}:null}}function ZS(e,t,n,o){if(!o)return n;let r=e.findIndex(a=>t.has(a));return r<0?n:Math.max(n,e.length-r)}he();he();function Gh(e,t){for(let n of e.querySelectorAll("[data-timeline-row-id]"))if(n.dataset.timelineRowId===t)return n;return null}function bs(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 zB(e){let t=e.getBoundingClientRect().top,n=e.querySelectorAll("[data-timeline-turn-section]"),o=a=>{let i=a.querySelectorAll("[data-timeline-row-id]"),s=bs(i,t),l=s<0?void 0:i[s],d=l?.dataset.timelineRowId;return!l||d===void 0?null:{rowId:d,offsetPx:Math.round(t-l.getBoundingClientRect().top)}};if(n.length===0)return o(e);let r=bs(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 eI(e,t){let n=0,o=e;for(;o&&o!==t;)n+=o.offsetTop,o=o.offsetParent;return n}var jh=class extends Aa{getSnapshotBeforeUpdate(t){return t.inputKey!==this.props.inputKey&&t.onBeforeInputChange(),null}componentDidUpdate(){}componentWillUnmount(){this.props.onBeforeInputChange()}render(){return this.props.children}};function tI({inputKey:e,onBeforeInputChange:t,handleRef:n,onAttach:o,className:r,children:a,onScroll:i,onInteractionRowsChange:s}){let l=N(null),d=N({inputKey:e,store:xc()});d.current.inputKey!==e&&(d.current={inputKey:e,store:xc()});let c=N(s);c.current=s;let f=R(m=>{let g=d.current;return g.store.acquire(m,()=>{d.current===g&&c.current?.(g.store.rows())})},[]);Ce(()=>{s?.(d.current.store.rows())},[e,s]),or(n,()=>({get node(){return l.current},measure:()=>{let m=l.current;return m?{scroll:m.scrollTop,scrollLength:m.clientHeight,contentLength:m.scrollHeight,topOf:g=>{let h=Gh(m,g);return h===null?null:eI(h,m)},heightOf:g=>{let h=Gh(m,g);return h===null?null:h.offsetHeight},rowAtScroll:()=>zB(m)}:null},scrollToEnd:m=>{let g=l.current;if(g){if(m?.animated){g.scrollTo({top:g.scrollHeight,behavior:"smooth"});return}g.scrollTop=g.scrollHeight-g.clientHeight}},scrollToRow:(m,g)=>{let h=l.current;if(!h)return!1;let v=Gh(h,m);return v?(h.scrollTop=Math.max(0,eI(v,h)-(g?.viewOffset??0)),!0):!1},scrollToOffset:m=>{let g=l.current;g&&(g.scrollTop=Math.max(0,m))}}),[]);let p=R(m=>{l.current=m,o(m)},[o]);return u(jh,{inputKey:e,onBeforeInputChange:t,children:u(yc,{value:f,children:u("div",{ref:p,className:r,style:{position:"relative"},onScroll:i,children:a})})})}function Rl(e){if(!e)return!1;let t=e.tagName?.toLowerCase(),n=e.getAttribute?.("contenteditable");if(t==="textarea"||n==="true"||n===""||n==="plaintext-only"||"isContentEditable"in e&&e.isContentEditable===!0)return!0;if(t==="input"){let o=e.getAttribute?.("type")?.toLowerCase()??"text";if(!["button","submit","reset","image","checkbox","radio"].includes(o))return!0}return e.matches?.(":focus-visible")??!1}function El(e,t){let o=(e?.nodeType===1?e:e?.parentElement)?.closest("[data-timeline-row-id]");return o&&t.contains(o)?o.dataset.timelineRowId??null:null}function sp(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return null;let n=null,o=null;for(let d=0;d<t.rangeCount;d+=1){let c=t.getRangeAt(d);c.intersectsNode(e)&&(n??=c,o=c)}if(!n||!o)return null;let r=El(n.startContainer,e),a=El(o.endContainer,e);if(r&&a)return{firstRowId:r,lastRowId:a};let i=e.querySelectorAll("[data-timeline-row-id]"),s=i[0]?.dataset.timelineRowId,l=i[i.length-1]?.dataset.timelineRowId;return s&&l?{firstRowId:r??s,lastRowId:a??l}:null}function Lc(e){let t=e.ownerDocument.getSelection?.();if(!t||t.isCollapsed)return!1;for(let n=0;n<t.rangeCount;n+=1)if(t.getRangeAt(n).intersectsNode(e))return!0;return!1}he();function Li(e){let t=N(e);t.current=e;let n=N(!1),o=N(null),r=N(null),a=N(0),i=R(()=>{a.current+=1,r.current!==null&&cancelAnimationFrame(r.current),r.current=null},[]),s=R(()=>{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=R(c=>{o.current=c,s()},[s]),d=R(()=>{o.current=null,i()},[i]);return Ce(()=>(n.current=!0,s(),()=>{n.current=!1,i()}),[e,i,s]),q(()=>({request:l,cancel:d}),[l,d])}function nI({root:e,inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:i,onRangeChange:s,onSelectionChange:l}){let d=N({inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:i,onRangeChange:s,onSelectionChange:l});d.current={inputKey:t,visible:n,index:o,topInset:r,bottomInset:a,interactionRows:i,onRangeChange:s,onSelectionChange:l};let c=Li(n),f=N(null),p=R(()=>{let g=d.current;if(!e||!g.visible||e.clientHeight<=0)return;let h=e.getBoundingClientRect();if(h.height<=0)return;let v=h.top+g.topInset,y=h.bottom-g.bottomInset,x=e.querySelectorAll("[data-timeline-turn-section]"),C=bs(x,v),w=[];if(C>=0)for(let I=C;I<x.length;I+=1){let P=x[I];if(P.getBoundingClientRect().top>=y)break;P.dataset.timelineTurnSection!==void 0&&w.push(P.dataset.timelineTurnSection)}let T=[...g.interactionRows()],S=e.ownerDocument.activeElement;if(Rl(S)){let I=El(S,e);I&&T.push(I)}let L=ip({index:g.index,visibleSectionKeys:w,protectedRowIds:T,selectionRows:sp(e)}),k=`${g.inputKey}:${JSON.stringify(L)}`;k!==f.current&&(f.current=k,g.onRangeChange?.(L))},[e]),m=R(()=>c.request(p),[c,p]);return Ce(()=>{if(f.current=null,!n||!e)return;let g=t,h=!0,v=()=>{!h||d.current.inputKey!==g||!d.current.visible||(d.current.onSelectionChange(Lc(e)),m())};e.addEventListener("scroll",v,{passive:!0}),e.addEventListener("focusin",v),e.addEventListener("focusout",v),e.ownerDocument.addEventListener("selectionchange",v);let y=typeof ResizeObserver>"u"?null:new ResizeObserver(v);return y?.observe(e),e.firstElementChild&&y?.observe(e.firstElementChild),v(),()=>{h=!1,c.cancel(),y?.disconnect(),e.removeEventListener("scroll",v),e.removeEventListener("focusin",v),e.removeEventListener("focusout",v),e.ownerDocument.removeEventListener("selectionchange",v),s?.(null)}},[c,t,s,m,e,n]),Ce(()=>{n&&m()},[o,m,n]),m}he();function Da(e){if(!Number.isFinite(e)||e<0)return"0ms";if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<1e4){let i=Math.round(e/100)/10;return i>=10?"10s":`${i.toFixed(1)}s`}if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.round(e/1e3),n=Math.floor(t/3600),o=Math.floor(t%3600/60),r=t%60,a=[];return n>0&&a.push(`${n}h`),o>0&&a.push(`${o}m`),r>0&&a.push(`${r}s`),a.join(" ")}function UB(e,t){let n={hour:"numeric",minute:"2-digit",...t?{second:"2-digit"}:{}};return e==="locale"?n:{...n,hour12:e==="12-hour"}}function HB(e){let t=e?.trim();if(t)try{return Intl.DateTimeFormat.supportedLocalesOf([t]),t}catch{return}}function $B(){return typeof window>"u"?null:window.desktopBridge?.getSystemLocale?.()??null}var Qh=HB($B()),oI=new Map;function rI(e,t){let n=`${e}:${t?"seconds":"minutes"}`,o=oI.get(n);if(o)return o;let r=new Intl.DateTimeFormat(Qh,UB(e,t));return oI.set(n,r),r}function Xh(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}var KB=new Intl.DateTimeFormat(void 0,{month:"long"});function qB(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 VB(e,t){let n=Xh(e);return n?rI(t,!1).format(n):""}function aa(e,t){let n=Xh(e);if(!n)return"";let o=VB(e,t),r=n.getDate(),a=KB.format(n),i=n.getFullYear();return`${o}, ${r}${qB(r)} ${a} ${i}`}var WB=new Intl.DateTimeFormat(Qh,{month:"numeric",day:"numeric"}),GB=new Intl.DateTimeFormat(Qh,{month:"numeric",day:"numeric",year:"numeric"});function Pi(e,t,n,o=Date.now()){let r=Xh(e);if(!r)return"";let a=rI(t,!1).format(r),i=new Date(o),s=new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime(),l=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),d=Math.round((s-l)/864e5);return d<=0?a:d===1?n("relativeTime.yesterdayAt",{time:a}):`${(r.getFullYear()===i.getFullYear()?WB:GB).format(r)} ${a}`}he();he();var Ml=class extends Error{reason;constructor(t,n,o){super(n,o),this.reason=t}};function jB(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.fontSize="16px";let n=document.activeElement;document.body.appendChild(t);try{return t.focus({preventScroll:!0}),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{t.remove();let o=n?.focus;typeof o=="function"&&o.call(n)}}async function QB(e,t){let n=()=>new Ml("unavailable",`Clipboard API is unavailable while copying ${t}.`);if(typeof window>"u")throw n();if(!e)return!1;if(typeof navigator>"u"||!navigator.clipboard?.writeText){if(jB(e))return!0;throw n()}try{return await navigator.clipboard.writeText(e),!0}catch(o){throw new Ml("write-failed",`Failed to copy ${t} to the clipboard.`,{cause:o})}}function lp({timeout:e=2e3,target:t="text",onCopy:n,onError:o}={}){let[r,a]=Q(!1),i=N(null),s=N(n),l=N(o),d=N(t),c=N(e);s.current=n,l.current=o,d.current=t,c.current=e;let f=R((p,m)=>{QB(p,d.current).then(g=>{g&&(i.current&&clearTimeout(i.current),a(!0),s.current?.(m),c.current!==0&&(i.current=setTimeout(()=>{a(!1),i.current=null},c.current)))},g=>{l.current?.(g instanceof Error?g:new Error(String(g)),m)})},[]);return W(()=>()=>{i.current&&clearTimeout(i.current)},[]),{copyToClipboard:f,isCopied:r}}function ut(){let e=rr().i18n.usePluginTranslation();return{t:(t,n)=>e(t,n)}}var aI=1e3,XB={unavailable:"copyButton.clipboardUnavailable","write-failed":"copyButton.copyFailedDetail"};function YB({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 Nl=ve(function({text:t,size:n="xs",variant:o="outline",className:r,toastAnchor:a="above"}){let{t:i}=ut(),s=N(null),[l,d]=Q(null),c=N(null),f=(g,h)=>{let v=s.current?.getBoundingClientRect();v&&(c.current&&clearTimeout(c.current),d({top:a==="above"?Math.max(4,v.top-(h===void 0?26:40)):Math.min(window.innerHeight-26,v.bottom+4),left:Math.max(4,v.left+v.width/2),title:g,description:h}),c.current=setTimeout(()=>d(null),aI))};W(()=>()=>{c.current&&clearTimeout(c.current)},[]);let{copyToClipboard:p,isCopied:m}=lp({onCopy:()=>f(i("copyButton.copied")),onError:g=>f(i("copyButton.failedToCopy"),g instanceof Ml?i(XB[g.reason]):g.message),timeout:aI});return b(Je,{children:[u(et,{render:u(ie,{"aria-label":i("copyButton.copyToClipboard"),disabled:m,onClick:()=>p(t),ref:s,type:"button",size:n,variant:o,className:K("text-muted-foreground hover:text-foreground",r)}),children:m?u(ro,{className:"size-3 text-primary"}):u(ss,{className:"size-3"})}),u(Ze,{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(YB,{title:l.title,description:l.description})})}):null]})});function JB(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 dp({label:e,children:t}){let[n,o]=Q(!1);return b(Je,{open:n,onOpenChange:o,children:[u(et,{render:u("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm"}),"aria-label":e,onClick:()=>o(r=>!r),children:t}),u(Ze,{children:e})]})}var iI=ve(function({footer:t,timestampFormat:n,copyText:o}){let{t:r}=ut(),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(dp,{label:i,children:[a==="completed"?u(ro,{className:"size-icon-1 text-success","aria-hidden":!0}):a==="error"?u(en,{className:"size-icon-1 text-destructive","aria-hidden":!0}):u(hc,{className:"size-3","aria-hidden":!0}),u("span",{className:"sr-only",children:i})]}):null,t.completedAt?u(dp,{label:aa(t.completedAt,n),children:u("time",{dateTime:t.completedAt,children:Pi(t.completedAt,n,r)})}):null,t.workingElapsedMs!==void 0?b(dp,{label:r("timeline.workingTime",{duration:Da(t.workingElapsedMs)}),children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),Da(t.workingElapsedMs)]}):null,t.outputTokens!==void 0?b(dp,{label:`${r("timeline.outputTokens")}: ${t.outputTokens.toLocaleString()}`,children:[u("span",{"aria-hidden":!0,children:"\xB7 "}),JB(t.outputTokens)]}):null]}),o?u(Nl,{text:o,variant:"ghost",size:"icon-xs",className:"shrink-0",toastAnchor:"below"}):null]})});he();he();function sI(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 lI=ve(function(t){let{additions:n,deletions:o,className:r,showParentheses:a=!1,layout:i="aligned"}=t,{t:s}=ut(),l=new Intl.ListFormat(void 0,{type:"unit"}).format([s("changedFiles.additions",{count:n}),s("changedFiles.deletions",{count:o})]);return b(ke,{children:[a&&u("span",{className:"text-muted-foreground/70",children:"("}),b("span",{role:"group","aria-label":l,className:K(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-diff-addition",children:["+",sI(n)]}),b("span",{"aria-hidden":"true",className:"font-mono text-diff-deletion",children:["-",sI(o)]})]}),a&&u("span",{className:"text-muted-foreground/70",children:")"})]})});function ZB(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 dI(e){return e.replaceAll("\\","/")}function cI(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function ez(e){return e.replace(/[\\/]+$/,"")}function tz(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function nz(e){return e.replace(/^\.\/+/,"").replace(/^\/+/,"")}function oz(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function cp(e,t){let{path:n,line:o,column:r}=ZB(e),a=cI(dI(n)),i=a;if(t){let s=cI(dI(ez(t))),l=tz(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(!oz(a)){let m=nz(a);i=d.startsWith(p)?a:`${l}/${m}`}}return o?`${i}:${o}${r?`:${r}`:""}`:i}function uI(e){return e==="failed"?"failed":e==="running"?"running":"idle"}function fI(e){return e.includes("failed")?"failed":e.includes("running")?"running":"idle"}var up="chat-process-row flex w-full min-w-0 items-center gap-1.5 px-2 text-left";function Pc({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:K("block size-2 rounded-full",e==="failed"?"bg-destructive":e==="success"?"bg-success":"border border-muted-foreground/60")})})}function fp({state:e,variant:t="inline",className:n,children:o}){return b("div",{"data-process-state":e,"data-process-kind":t,className:K("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]})}function Ec({name:e,className:t}){switch(e){case"bot":return u(as,{className:t,"aria-hidden":!0});case"check":return u(ro,{className:t,"aria-hidden":!0});case"circle-alert":return u(Pn,{className:t,"aria-hidden":!0});case"eye":return u(ec,{className:t,"aria-hidden":!0});case"globe":return u(rc,{className:t,"aria-hidden":!0});case"hammer":return u(ic,{className:t,"aria-hidden":!0});case"message-circle":return u(fs,{className:t,"aria-hidden":!0});case"search":return u(vs,{className:t,"aria-hidden":!0});case"square-pen":return u(No,{className:t,"aria-hidden":!0});case"terminal":return u(qo,{className:t,"aria-hidden":!0});case"wrench":return u(vc,{className:t,"aria-hidden":!0});case"x":return u(en,{className:t,"aria-hidden":!0});case"zap":return u(xs,{className:t,"aria-hidden":!0})}}function rz(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 Yh(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:rz(o),count:r}))}function Jh(e,t){let n;for(let o of Yh(e,t))(!n||o.count>n.count)&&(n=o);return n?.icon??"wrench"}var _l=20;function Dl(e){return ap(e)}function pI(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?cp(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(g=>g.toLowerCase()===m.toLowerCase())&&f.push(m)}return f.join(" ")||null}function mI({entry:e,failed:t}){let n=e.toolLabel?.diffStat;return!n||t||Zh(e)?null:u(lI,{...n,layout:"inline",className:"chat-process-meta ms-2 shrink-0"})}function Zh(e){return e.toolLifecycleStatus==="declined"||e.toolLifecycleStatus==="stopped"}function gI({toolIcon:e,glyphClassName:t}){let n=wt(un),o=n.SiteIcon;return e.pageUrl!==void 0&&o!==void 0?u(o,{threadRef:n.threadRef,pageUrl:e.pageUrl,className:"size-3.5 shrink-0 rounded-sm object-contain"}):u(Ec,{name:"globe",className:t})}function az({entry:e,failed:t=!1,derive:n}){return t?u(Pn,{"aria-hidden":!0,className:"size-icon-1 shrink-0 text-destructive"}):e.toolIcon!==void 0?u(gI,{toolIcon:e.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"}):u(Ec,{name:Jh([e],n.toolGroupAction),className:"size-icon-1 shrink-0 stroke-[1.8] text-muted-foreground opacity-70"})}function iz({entries:e,failed:t,derive:n}){let{t:o}=ut(),r=q(()=>Yh(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(Ec,{name:s,className:K("size-icon-1 shrink-0 stroke-[1.8] opacity-70",t?"text-destructive":"text-icon-muted")}),l]},i))})}function hI({entry:e}){let t=wt(un),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(ke,{children:r}):u("pre",{className:"chat-tool-body overflow-x-auto rounded-md bg-muted/40 p-2",children:n??""})})}var sz=ve(function(t){let{entry:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}=t,s=wt(un).derive,{t:l}=ut(),[d,c]=Wo(o,`call:${Dl(n)}`,!1),f=s.workEntryIndicatesFailure(n),p=Zh(n),m=s.resolveWorkEntryStatus(n),g=m==="failed"||m==="running"?m:null,h=Jr();return b("div",{"data-tool-call-id":n.toolCallId??n.id,"data-tool-identity":Dl(n),className:"border-b border-border/50 last:border-b-0",children:[b("button",{type:"button","aria-expanded":d,"aria-controls":h,onClick:()=>{a?.(),c(!d)},className:K("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:g}),u(Pc,{children:u(az,{entry:n,failed:f,derive:s})}),b("span",{className:"flex min-w-0 flex-1 items-center",children:[u("span",{className:"truncate",children:pI(n,r,s)??l("toolGroup.calls",{count:1})}),u(mI,{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(rn,{"aria-hidden":!0,className:K("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),d?u("div",{id:h,children:u(hI,{entry:n})}):null]})});function lz({threadKey:e,stateKey:t,maxHeight:n,children:o}){let r=N(null);return Ce(()=>{let a=r.current;if(!a)return;a.scrollTop=Wh(e,`${t}:scroll`,0);let i=()=>{kc(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 vI=ve(function({entries:t,groupId:n,threadKey:o,workspaceRoot:r,onDisclosureChange:a}){let s=wt(un).derive,{t:l}=ut(),[d,c]=Wo(o,`group:${n}`,!1),[f,p]=Wo(o,`group-page:${n}`,0),m=Jr(),g=N(null),[h,v]=Q(null),y=t.at(-1),x=q(()=>t.filter(D=>s.workEntryIndicatesFailure(D)),[t,s]),C=q(()=>t.filter(Zh),[t]),w=t.filter(D=>D.toolLifecycleStatus==="inProgress").length,T=x[0]??C[0],S=T??y,L=Math.max(0,Math.ceil(t.length/_l)-1),k=Math.min(f,L),I=k*_l,P=t.slice(I,I+_l),E=t.length>1;if(Ce(()=>{if(!h)return;let D=g.current,ne=Array.from(D?.querySelectorAll("[data-tool-identity]")??[]).find(U=>U.dataset.toolIdentity===h.id);if(!ne)return;let F=ne.closest('[data-slot="scroll-area-viewport"]');F&&(F.scrollTop+=ne.getBoundingClientRect().top-F.getBoundingClientRect().top),ne.querySelector("button")?.focus({preventScroll:!0})},[h]),!y||!S)return null;let _=D=>{a?.(),p(D)},A={threadKey:o,workspaceRoot:r,onDisclosureChange:a},H=fI(t.map(D=>uI(s.resolveWorkEntryStatus(D)))),V=Jh(t,s.toolGroupAction),J=H==="failed"?"failed":H==="running"?"running":"success";return u(fp,{state:H,variant:"tool",children:b("section",{ref:g,"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),!E&&!d&&kc(o,`call:${Dl(y)}`,!0)},className:K(up,"flex-1",T?"text-destructive":"text-muted-foreground"),children:[u(Ac,{status:J}),u(Pc,{children:!E&&y.toolIcon!==void 0&&x.length===0?u(gI,{toolIcon:y.toolIcon,glyphClassName:"size-icon-1 shrink-0 stroke-[1.8] opacity-70 text-icon-muted"}):u(Ec,{name:V,className:K("size-icon-1 shrink-0 stroke-[1.8] opacity-70",x.length>0?"text-destructive":"text-icon-muted")})}),b("span",{className:K("flex min-w-0 flex-1 items-center",d&&E?"chat-process-text":"chat-tool-summary"),children:[u("span",{className:"truncate",children:d&&E?l("toolGroup.calls",{count:t.length}):pI(S,r,s)??l("toolGroup.calls",{count:1})}),d&&E?null:u(mI,{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,x.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.failed",{count:x.length})}):null,C.length>0?u("span",{className:"chat-process-meta shrink-0 tabular-nums",children:l("toolGroup.cancelled",{count:C.length})}):null,d&&E?null:u(iz,{entries:t,failed:x.length>0,derive:s}),u(rn,{"aria-hidden":!0,className:K("size-icon-1 shrink-0",!d&&"-rotate-90")})]}),T&&E?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(T)/_l)),kc(o,`call:${Dl(T)}`,!0),v({id:Dl(T)})},children:l("toolGroup.showFailure")}):null]}),d?u("div",{id:m,className:"border-t border-border/50",children:E?b(ke,{children:[t.length>_l?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:I+1,to:Math.min(I+_l,t.length),count:t.length})}),[{label:l("toolGroup.firstPage"),target:0,disabled:k===0,Icon:Jd},{label:l("toolGroup.previousPage"),target:k-1,disabled:k===0,Icon:is},{label:l("toolGroup.nextPage"),target:k+1,disabled:k===L,Icon:Ko},{label:l("toolGroup.lastPage"),target:L,disabled:k===L,Icon:Zd}].map(({label:D,target:ne,disabled:F,Icon:U})=>u("button",{type:"button","aria-label":D,disabled:F,onClick:()=>_(ne),className:"flex size-7 items-center justify-center rounded-control-3 disabled:opacity-64 [@media(pointer:coarse)]:size-11",children:u(U,{"aria-hidden":!0,className:"size-icon-1"})},D))]}):null,u(lz,{threadKey:o,stateKey:`group-scroll:${n}:${k}`,maxHeight:"min(320px, 50dvh)",children:u("div",{className:"space-y-0.5 py-1",children:P.map(D=>u(sz,{entry:D,...A},Dl(D)))})})]}):u(hI,{entry:y})}):null]})})});function dz(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 yI(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=dz(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}}}he();var xI=ve(function({sectionKey:t,rowKeyPrefix:n,rowIds: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}`))})});function cz(e,t,n){for(let o=t;o<n;o+=1){let r=e[o];switch(r.kind){case"turn-identity":return r.turnId;case"working":return r.turnId??null;case"message":if(r.message.role==="assistant")return r.message.turnId;break;case"tool-group":if(r.entries[0]?.turnId!==void 0)return r.entries[0].turnId??null;break;case"work":if(r.groupedEntries[0]?.turnId!==void 0)return r.groupedEntries[0].turnId??null;break;case"turn-plan":return r.turnPlan.turnId;case"proposed-plan":return r.proposedPlan.turnId;case"turn-summary":return r.footer.turnId}}return null}function CI(e,t,n=[]){let o=new Map(n.map(a=>[a.key,a])),r=[];for(let a of t){if(a.end<=a.start)continue;let i=cz(e,a.start,a.end),s=o.get(a.key);if(s!==void 0&&s.turnId===i&&uz(s,e,a.start,a.end)){r.push(s);continue}r.push({key:a.key,turnId:i,firstRowIndex:a.start,rowIds:e.slice(a.start,a.end).map(l=>l.id)})}return r}function uz(e,t,n,o){if(e.firstRowIndex!==n||e.rowIds.length!==o-n)return!1;for(let r=0;r<e.rowIds.length;r+=1)if(e.rowIds[r]!==t[n+r].id)return!1;return!0}function bI(e,t){let n=Math.max(0,Math.min(t,e)),o=e-n;return{startIndex:o,hasHiddenOlder:o>0}}function Ol(e,t,n){let o=e.findIndex(r=>r.rowIds.includes(t));return o<0?n:Math.max(n,e.length-o)}he();var ws=3,ev=ws;function wI(e){let[t,n]=Ht("timeline-reveal-window",e,ws),o=R(()=>{n(s=>s+ev)},[n]),r=R(s=>{n(l=>s>l?s:l)},[n]),a=R(()=>{n(ws)},[n]),i=R(s=>{n(l=>Math.min(l,Math.max(ws,s)))},[n]);return{revealedCount:t,revealOlder:o,revealAtLeast:r,compactTo:i,reset:a}}function SI(e,t){return t.prefixMounted?"mounted":t.loading===null||t.now>e.until?"abandoned":t.loading?(e.loadingObserved=!0,e.sectionsWhileLoading=t.sections,"waiting"):e.loadingObserved?t.sections===e.sectionsWhileLoading?"waiting":"landed":"waiting"}function fz(e,t){let n=d=>d.replace(/\s+/g,""),o=n(t.text);if(o.length===0)return null;let r=(d,c)=>e.slice(Math.max(0,d-t.prefix.length),d)===t.prefix&&e.slice(c,c+t.suffix.length)===t.suffix;if(t.start<t.end&&t.end<=e.length&&n(e.slice(t.start,t.end))===o&&r(t.start,t.end))return{start:t.start,end:t.end};let a=Ic(t.text).trim(),i=[];for(let d=e.indexOf(a);d>=0;d=e.indexOf(a,d+1))i.push(d);let s=i.filter(d=>r(d,d+a.length)),l=s.length===1?s[0]:s.length===0&&i.length===1?i[0]:null;return l===null?null:{start:l,end:l+a.length}}function TI(e,t){let n=e.querySelector("[data-assistant-quote-body]")??tp(e);if(n===null)return null;let o=[],r="",a=document.createTreeWalker(n,NodeFilter.SHOW_TEXT);for(let c=a.nextNode();c;c=a.nextNode()){let f=c.data;for(let p=0;p<f.length;p+=1){let m=/\s/.test(f[p]);m&&r.endsWith(" ")||(r+=m?" ":f[p],o.push({node:c,offset:p}))}}let i=fz(r,t);if(i===null)return null;let s=o[i.start],l=o[i.end-1];if(!s||!l)return null;let d=document.createRange();return d.setStart(s.node,s.offset),d.setEnd(l.node,l.offset+1),d}var tv="assistant-quote",II=2400;function kI(e){let t=globalThis.CSS?.highlights,n=globalThis.Highlight;if(t&&n){let r=new n(e);t.set(tv,r),setTimeout(()=>{t.get(tv)===r&&t.delete(tv)},II);return}let o=document.getSelection();o&&(o.removeAllRanges(),o.addRange(e),setTimeout(()=>{let r=o.rangeCount>0?o.getRangeAt(0):null;r&&r.compareBoundaryPoints(Range.START_TO_START,e)===0&&o.removeAllRanges()},II))}var pz=400;function LI({root:e,minimumCount:t,keepAbovePx:n=0,canCompact:o,onCompact:r}){let a=e.ownerDocument,i=new Set,s,l=!1,d=()=>e.scrollHeight-e.clientHeight-e.scrollTop<=2,c=()=>{if(s=void 0,a.hidden||i.size>0||!o()||e.clientHeight<=0||!d()||Lc(e))return;let w=e.querySelectorAll("[data-timeline-turn-section]"),T=e.getBoundingClientRect().top-32-n,S=0,L=Math.max(0,w.length-t);for(;S<L;){let I=Math.floor((S+L)/2),P=w[I].getBoundingClientRect().bottom;if(!Number.isFinite(P))return;P<=T?S=I+1:L=I}if(S===0)return;let k=a.activeElement;if(k&&Rl(k)){for(let I=0;I<S;I+=1)if(w[I].contains(k))return}r(w.length-S)},f=!1,p=()=>{if(a.hidden||i.size>0||!o()||f){clearTimeout(s),s=void 0;return}s===void 0&&(s=setTimeout(c,pz))},m=()=>{clearTimeout(s),s=void 0,p()},g=()=>{let w=d();!w||!l?m():p(),l=w},h=w=>{i.add(w.pointerId),m()},v=w=>{i.delete(w.pointerId),m()},y=()=>{f=Lc(e),m()},x=()=>{i.clear(),m()},C=["wheel","keydown","focusin","focusout"];for(let w of C)e.addEventListener(w,m,{passive:!0});return e.addEventListener("scroll",g,{passive:!0}),e.addEventListener("pointerdown",h,!0),a.addEventListener("pointerup",v,!0),a.addEventListener("pointercancel",v,!0),a.addEventListener("selectionchange",y),a.addEventListener("visibilitychange",p),a.defaultView?.addEventListener("blur",x),p(),{schedule:p,disconnect:()=>{clearTimeout(s);for(let w of C)e.removeEventListener(w,m);e.removeEventListener("scroll",g),e.removeEventListener("pointerdown",h,!0),a.removeEventListener("pointerup",v,!0),a.removeEventListener("pointercancel",v,!0),a.removeEventListener("selectionchange",y),a.removeEventListener("visibilitychange",p),a.defaultView?.removeEventListener("blur",x)}}}he();function PI({root:e,topInsetPx:t,onActiveSectionChange:n,active:o}){let r=N(o);r.current=o;let a=Li(o),i=N(new Map),s=N(null),l=N(null),d=N(n);d.current=n;let c=R(()=>{if(!r.current||!e)return;let h=e.scrollTop+t,v=null,y=Number.NEGATIVE_INFINITY,x=null,C=Number.POSITIVE_INFINITY;for(let[T,S]of i.current){if(!S.isConnected)continue;let L=S.offsetTop;L<C&&(C=L,x=T),L<=h&&L>=y&&(y=L,v=T)}let w=v??x;w!==l.current&&(l.current=w,d.current(w))},[e,t]),f=R(()=>{r.current&&a.request(c)},[a,c]);W(()=>{if(!o||!e||typeof IntersectionObserver>"u")return;let h=!0,v=new IntersectionObserver(()=>{!h||!r.current||f()},{root:e,rootMargin:`-${t}px 0px 0px 0px`,threshold:0});s.current=v;for(let y of i.current.values())v.observe(y);return f(),()=>{h=!1,v.disconnect(),s.current=null,a.cancel()}},[o,a,f,e,t]);let p=N(new Map),m=R(h=>{let v=p.current.get(h);if(v)return v;let y=x=>{let C=i.current.get(h);C&&C!==x&&(s.current?.unobserve(C),i.current.delete(h)),x?(i.current.set(h,x),s.current?.observe(x)):p.current.get(h)===y&&p.current.delete(h)};return p.current.set(h,y),y},[]),g=R(()=>{r.current&&(l.current=null,f())},[f]);return q(()=>({observeSection:m,refresh:g}),[m,g])}function Rc(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(ke,{children:[e,t]}):b(ke,{children:[i[0],t,i[1]]})}he();function AI(e){return $o(e.subscribe,e.getStructure,e.getStructure)}function EI(e,t){let n=R(r=>e.subscribeRow(t,r),[e,t]),o=R(()=>e.getRow(t),[e,t]);return $o(n,o,o)}function Ai(e,t,n=Object.is){let o=N(null),r=R(()=>{let a=e.getVersion(),i=o.current;if(i!==null&&i.store===e&&i.select===t&&i.version===a)return i.value;let s=t(e),l=i!==null&&i.store===e&&n(i.value,s)?i.value:s;return o.current={store:e,select:t,version:a,value:l},l},[e,t,n]);return $o(e.subscribe,r,r)}he();function nv(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 Ei(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||mz.has(t)?"text":"file"}var mz=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function RI(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 gz="<ycodium-system>";function pp(e){return e.startsWith(gz)}var hz=/[ \t]*\(record [^\s()]+\)/g,vz=/^<\/?[a-z][a-z-]*(?:\s[^>]*)?>$/;function ov(e){return pp(e)?e.split(`
3801
3801
  `).filter(t=>!vz.test(t.trim())).join(`
3802
- `).replace(hz,""):e}var yz=/<ycodium-system>[\s\S]*?<\/ycodium-system>/g;function MI(e){let t=e.match(yz);return t&&t.length>0?t:[e]}function NI(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 _I(e){switch(e){case"image":return us;case"pdf":return cs;case"text":return ds;case"file":return wo}}var xz=[".m4v",".mov",".mp4",".ogv",".webm"],Cz=[".aac",".flac",".m4a",".mp3",".oga",".ogg",".opus",".wav",".weba"];function DI(e){let t=e.name.lastIndexOf(".");if(t<=0)return null;let n=e.name.slice(t).toLowerCase();return xz.includes(n)?"video":Cz.includes(n)?"audio":null}var bz=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/;function Mc(e){let t=bz.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=wz(t[1]??"");return{promptText:n,contextCount:o.length,contexts:o}}function wz(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3802
+ `).replace(hz,""):e}var yz=/<ycodium-system>[\s\S]*?<\/ycodium-system>/g;function MI(e){let t=e.match(yz);return t&&t.length>0?t:[e]}function NI(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 _I(e){switch(e){case"image":return cs;case"pdf":return ds;case"text":return ls;case"file":return wo}}var xz=[".m4v",".mov",".mp4",".ogv",".webm"],Cz=[".aac",".flac",".m4a",".mp3",".oga",".ogg",".opus",".wav",".weba"];function DI(e){let t=e.name.lastIndexOf(".");if(t<=0)return null;let n=e.name.slice(t).toLowerCase();return xz.includes(n)?"video":Cz.includes(n)?"audio":null}var bz=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/;function Mc(e){let t=bz.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=wz(t[1]??"");return{promptText:n,contextCount:o.length,contexts:o}}function wz(e){let t=[],n=null,o=()=>{n&&(t.push({header:n.header,body:n.bodyLines.join(`
3803
3803
  `).trimEnd()}),n=null)};for(let r of e.split(`
3804
3804
  `)){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 Sz=/\n*<preview_annotation>\n((?:(?!<preview_annotation>)[\s\S])*)\n<\/preview_annotation>\s*$/;function rv(e){let t=Sz.exec(e);if(!t)return{promptText:e,annotation:null};let n=t[1]??"",o=n.split(`
3805
3805
  `),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 Iz=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,Tz=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,kz=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function Lz(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function Pz(e){let t={};for(let n of e.matchAll(Tz))t[n[1]]=Lz(n[2]??"");return t}function OI(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function Az(e){let n=Array.from(e.matchAll(kz)).at(-1),o=n?.index;return{text:e.slice(0,o??e.length).trim(),language:n?.[2]?.trim()||"diff",contents:n?.[3]??""}}function Ez(e,t,n){let o=Pz(e),r=OI(o.startIndex),a=OI(o.endIndex),i=o.filePath?.trim(),s=o.sectionId?.trim();if(!i||!s||r===null||a===null)return null;let l=Az(t);return{id:`review-comment:${n}:${s}:${i}:${r}:${a}`,sectionId:s,sectionTitle:o.sectionTitle?.trim()||null,filePath:i,startIndex:Math.min(r,a),endIndex:Math.max(r,a),rangeLabel:o.rangeLabel?.trim()||null,text:l.text,diff:l.contents,fenceLanguage:l.language}}function av(e){let t=[],n=0,o=0;for(let a of e.matchAll(Iz)){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=Ez(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 FI(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(`
@@ -3809,44 +3809,44 @@ var nF=Object.create;var Tf=Object.defineProperty;var oF=Object.getOwnPropertyDe
3809
3809
  `)){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 zz(e){let t=Fz.exec(e);if(!t)return{promptText:e,contextCount:0,previewTitle:null,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,""),o=Bz(t[1]??"");return{promptText:n,contextCount:o.length,previewTitle:o.length>0?o.map(({header:r,body:a})=>a.length>0?`${r}
3810
3810
  ${a}`:r).join(`
3811
3811
 
3812
- `):null,contexts:o}}function $I(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 iv(e){let t=Mc(e),n=zz(t.promptText);return{visibleText:n.promptText,copyText:e,contextCount:n.contextCount,previewTitle:n.previewTitle,contexts:n.contexts,elementContexts:t.contexts}}var Uz=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function KI(e){let t=[];for(let n of e){let o=n.header.trim();o.length>0&&t.push(vp(o))}return t.join(" ")}function vp(e){let t=e.trim(),n=Uz.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,"-")}`:$I({terminalLabel:n[1]?.trim()||"terminal",lineStart:o,lineEnd:r})}function qI(e,t){let n=0;for(let o of t){let r=vp(o.header),a=e.indexOf(r,n);if(a===-1)return!1;n=a+r.length}return!0}function sv({row:e}){let t=wt(un).derive;if(pp(e.message.text)){let n=t.parsePresetPrefixText(e.message.text);return n?b(ke,{children:[u(Kz,{parsed:n}),n.body.length>0||(e.message.attachments?.length??0)>0?u(sv,{row:{...e,message:{...e.message,text:n.body}}}):null]}):u(Vz,{row:e})}return u(Hz,{row:e,text:e.message.text})}function lv({images:e}){let t=wt(un),{t:n}=ut();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=nv(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 Hz({row:e,text:t}){let{t:n}=ut(),o=wt(un),r=e.message.attachments??[],a=iv(t),i=a.contexts,s=[],l=a.visibleText;for(;;){let v=rv(l);if(!v.annotation)break;s.unshift(v.annotation),l=v.promptText}let d=Mc(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=>Ei(v)==="image"),g=p.filter(v=>Ei(v)!=="image"),h=e.message.author??null;return b("div",{className:"group flex min-w-0 items-start gap-2.5",children:[u($z,{author:h}),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:h?.displayName??n("message.user")}),b(Je,{children:[u(et,{render:u("span",{className:"text-muted-foreground tabular-nums"}),children:Pi(e.message.createdAt,o.timestampFormat,n)}),u(Ze,{children:aa(e.message.createdAt,o.timestampFormat)})]}),b("div",{className:"ms-auto flex items-center gap-0.5",children:[o.onForkFromUserMessage!==null&&u(Wz,{messageId:e.message.id,onFork:o.onForkFromUserMessage}),a.copyText&&u(Nl,{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(lv,{images:m}),g.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:g.map(v=>u(dv,{attachment:v},v.id))}),s.map((v,y)=>u(Qz,{annotation:v,image:f[y]??null},v.id)),c.length>0?u("div",{className:"mb-2 flex flex-wrap gap-1.5",children:c.map(v=>u(jz,{context:v},`${v.header}:${v.body}`))}):null,u(eU,{disclosureKey:`message:${e.message.id}:user`,text:d.promptText,terminalContexts:i,skills:o.skills,markdownCwd:o.markdownCwd})]})]})]})}function $z({author:e}){let t=e;return t!==null?u(dS,{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(oa,{className:"size-4"})})}function yp({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 Kz({parsed:e}){let{t}=ut();return b(yp,{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 qz={"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 Vz({row:e}){let{t}=ut(),n=wt(un).derive,o=e.message.attachments??[],r=o.filter(l=>Ei(l)==="image"),a=o.filter(l=>Ei(l)!=="image"),i=l=>{let d=NI(l);if(d)return b(yp,{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(yp,{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(yp,{children:[u("p",{className:"font-medium text-foreground/80",children:t(qz[f.kind],{title:f.title})}),f.summary.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:f.summary}):null]}):null},s=MI(e.message.text).map(i).filter(l=>l!==null);return s.length===0&&o.length===0?null:b(ke,{children:[s.map((l,d)=>u(mi,{children:l},d)),o.length>0?b("div",{className:"min-w-0 px-3 py-2",children:[u(lv,{images:r}),a.map(l=>u(dv,{attachment:l},l.id))]}):null]})}function GI(e,t){let n=t.parsePresetPrefixText(e??"")?.body??null;if(n===null&&pp(e??""))return null;let r=iv(n??e??"").visibleText;for(;;){let s=rv(r);if(!s.annotation)break;r=s.promptText}let a=Mc(r).promptText,i=av(a).map(s=>s.kind==="text"?s.text:s.comment.text).join(" ").replace(/\s+/g," ").trim();return i.length>0?i:null}var jI=34,QI=8,xp=jI+QI,XI=ve(function({ref:t,textRef:n,initialText:o,expanded:r,onToggleExpanded:a}){let{t:i}=ut(),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:QI},"data-timeline-turn-header":"true","data-truncated":"false",children:b("div",{className:K("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:jI}},children:[u("span",{ref:n,className:K("min-w-0 flex-1 text-foreground/85 text-chat",r?"max-h-40 overflow-y-auto whitespace-pre-wrap":"truncate"),children:o}),b(Je,{children:[u(et,{render:u(ie,{type:"button",size:"xs",variant:"ghost",className:"group-data-[truncated=false]:hidden","aria-label":s,onClick:a}),children:r?u(Yd,{}):u(rn,{})}),u(Ze,{side:"bottom",children:s})]})]})})});function Wz({messageId:e,onFork:t}){let{t:n}=ut(),o=n("fork.action");return b(Je,{children:[u(et,{render:u(ie,{type:"button",size:"xs",variant:"ghost",onClick:()=>t(e),"aria-label":o}),children:u(oc,{className:"size-3"})}),u(Ze,{side:"top",children:o})]})}function YI({row:e}){let t=wt(un),{t:n}=ut(),[o,r]=Wo(t.threadKey,`message:${e.message.id}`,!1);if(e.presentation==="compact"&&!o)return u(fp,{state:"idle",children:b("button",{type:"button",className:K(up,"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(Pc,{children:u(Na,{className:"size-icon-1","aria-hidden":!0})}),u("span",{className:"min-w-0 flex-1 truncate",children:t.derive.reasoningPreviewText(e.message.text)}),u(rn,{className:"size-icon-1 shrink-0 -rotate-90","aria-hidden":!0})]})});let i=e.message.attachments??[],s=i.filter(c=>Ei(c)==="image"),l=i.filter(c=>Ei(c)!=="image"),d=e.message.text||(e.message.streaming||i.length>0?"":n("timeline.emptyResponse"));return u(ke,{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(Nl,{text:e.message.text,variant:"ghost"})]}):null,e.modelBadge?u(cv,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,u("div",{"data-assistant-quote-body":"",children:u(lr,{disclosureKey:`message:${e.message.id}:assistant`,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(lv,{images:s}),l.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:l.map(c=>u(dv,{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 [@media(pointer:coarse)]:opacity-100",children:[u(Gz,{row:e}),e.showAssistantMeta&&!e.message.streaming&&e.modelBadge===null&&b(Je,{children:[u(et,{render:u("p",{className:"text-muted-foreground text-chat-row tabular-nums"}),children:Pi(e.message.updatedAt,t.timestampFormat,n)}),u(Ze,{children:aa(e.message.updatedAt,t.timestampFormat)})]})]}):null]})})}function Gz({row:e}){let n=wt(un).derive.resolveAssistantMessageCopyState({text:e.message.text??null,showCopyButton:e.showAssistantCopyButton,streaming:e.assistantCopyStreaming});return n.visible?u(Nl,{text:n.text??"",variant:"ghost"}):null}var VI=ve(function(t){let n=t.context.body.length>0?`${t.context.header}
3812
+ `):null,contexts:o}}function $I(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 iv(e){let t=Mc(e),n=zz(t.promptText);return{visibleText:n.promptText,copyText:e,contextCount:n.contextCount,previewTitle:n.previewTitle,contexts:n.contexts,elementContexts:t.contexts}}var Uz=/^(.*?)\s+line(?:s)?\s+(\d+)(?:-(\d+))?$/i;function KI(e){let t=[];for(let n of e){let o=n.header.trim();o.length>0&&t.push(vp(o))}return t.join(" ")}function vp(e){let t=e.trim(),n=Uz.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,"-")}`:$I({terminalLabel:n[1]?.trim()||"terminal",lineStart:o,lineEnd:r})}function qI(e,t){let n=0;for(let o of t){let r=vp(o.header),a=e.indexOf(r,n);if(a===-1)return!1;n=a+r.length}return!0}function sv({row:e}){let t=wt(un).derive;if(pp(e.message.text)){let n=t.parsePresetPrefixText(e.message.text);return n?b(ke,{children:[u(Kz,{parsed:n}),n.body.length>0||(e.message.attachments?.length??0)>0?u(sv,{row:{...e,message:{...e.message,text:n.body}}}):null]}):u(Vz,{row:e})}return u(Hz,{row:e,text:e.message.text})}function lv({images:e}){let t=wt(un),{t:n}=ut();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=nv(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 Hz({row:e,text:t}){let{t:n}=ut(),o=wt(un),r=e.message.attachments??[],a=iv(t),i=a.contexts,s=[],l=a.visibleText;for(;;){let v=rv(l);if(!v.annotation)break;s.unshift(v.annotation),l=v.promptText}let d=Mc(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=>Ei(v)==="image"),g=p.filter(v=>Ei(v)!=="image"),h=e.message.author??null;return b("div",{className:"group flex min-w-0 items-start gap-2.5",children:[u($z,{author:h}),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:h?.displayName??n("message.user")}),b(Je,{children:[u(et,{render:u("span",{className:"text-muted-foreground tabular-nums"}),children:Pi(e.message.createdAt,o.timestampFormat,n)}),u(Ze,{children:aa(e.message.createdAt,o.timestampFormat)})]}),b("div",{className:"ms-auto flex items-center gap-0.5",children:[o.onForkFromUserMessage!==null&&u(Wz,{messageId:e.message.id,onFork:o.onForkFromUserMessage}),a.copyText&&u(Nl,{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(lv,{images:m}),g.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:g.map(v=>u(dv,{attachment:v},v.id))}),s.map((v,y)=>u(Qz,{annotation:v,image:f[y]??null},v.id)),c.length>0?u("div",{className:"mb-2 flex flex-wrap gap-1.5",children:c.map(v=>u(jz,{context:v},`${v.header}:${v.body}`))}):null,u(eU,{disclosureKey:`message:${e.message.id}:user`,text:d.promptText,terminalContexts:i,skills:o.skills,markdownCwd:o.markdownCwd})]})]})]})}function $z({author:e}){let t=e;return t!==null?u(dS,{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(oa,{className:"size-4"})})}function yp({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 Kz({parsed:e}){let{t}=ut();return b(yp,{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 qz={"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 Vz({row:e}){let{t}=ut(),n=wt(un).derive,o=e.message.attachments??[],r=o.filter(l=>Ei(l)==="image"),a=o.filter(l=>Ei(l)!=="image"),i=l=>{let d=NI(l);if(d)return b(yp,{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(yp,{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(yp,{children:[u("p",{className:"font-medium text-foreground/80",children:t(qz[f.kind],{title:f.title})}),f.summary.trim().length>0?u("p",{className:"mt-1 whitespace-pre-wrap",children:f.summary}):null]}):null},s=MI(e.message.text).map(i).filter(l=>l!==null);return s.length===0&&o.length===0?null:b(ke,{children:[s.map((l,d)=>u(mi,{children:l},d)),o.length>0?b("div",{className:"min-w-0 px-3 py-2",children:[u(lv,{images:r}),a.map(l=>u(dv,{attachment:l},l.id))]}):null]})}function GI(e,t){let n=t.parsePresetPrefixText(e??"")?.body??null;if(n===null&&pp(e??""))return null;let r=iv(n??e??"").visibleText;for(;;){let s=rv(r);if(!s.annotation)break;r=s.promptText}let a=Mc(r).promptText,i=av(a).map(s=>s.kind==="text"?s.text:s.comment.text).join(" ").replace(/\s+/g," ").trim();return i.length>0?i:null}var jI=34,QI=8,xp=jI+QI,XI=ve(function({ref:t,textRef:n,initialText:o,expanded:r,onToggleExpanded:a}){let{t:i}=ut(),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:QI},"data-timeline-turn-header":"true","data-truncated":"false",children:b("div",{className:K("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:jI}},children:[u("span",{ref:n,className:K("min-w-0 flex-1 text-foreground/85 text-chat",r?"max-h-40 overflow-y-auto whitespace-pre-wrap":"truncate"),children:o}),b(Je,{children:[u(et,{render:u(ie,{type:"button",size:"xs",variant:"ghost",className:"group-data-[truncated=false]:hidden","aria-label":s,onClick:a}),children:r?u(Yd,{}):u(rn,{})}),u(Ze,{side:"bottom",children:s})]})]})})});function Wz({messageId:e,onFork:t}){let{t:n}=ut(),o=n("fork.action");return b(Je,{children:[u(et,{render:u(ie,{type:"button",size:"xs",variant:"ghost",onClick:()=>t(e),"aria-label":o}),children:u(oc,{className:"size-3"})}),u(Ze,{side:"top",children:o})]})}function YI({row:e}){let t=wt(un),{t:n}=ut(),[o,r]=Wo(t.threadKey,`message:${e.message.id}`,!1);if(e.presentation==="compact"&&!o)return u(fp,{state:"idle",children:b("button",{type:"button",className:K(up,"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(Pc,{children:u(Na,{className:"size-icon-1","aria-hidden":!0})}),u("span",{className:"min-w-0 flex-1 truncate",children:t.derive.reasoningPreviewText(e.message.text)}),u(rn,{className:"size-icon-1 shrink-0 -rotate-90","aria-hidden":!0})]})});let i=e.message.attachments??[],s=i.filter(c=>Ei(c)==="image"),l=i.filter(c=>Ei(c)!=="image"),d=e.message.text||(e.message.streaming||i.length>0?"":n("timeline.emptyResponse"));return u(ke,{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(Nl,{text:e.message.text,variant:"ghost"})]}):null,e.modelBadge?u(cv,{badge:e.modelBadge,createdAt:e.message.createdAt}):null,u("div",{"data-assistant-quote-body":"",children:u(sr,{disclosureKey:`message:${e.message.id}:assistant`,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,onImageExpand:t.onImageExpand})}),u(lv,{images:s}),l.length>0&&u("div",{className:"mb-2 flex max-w-[420px] flex-col gap-1.5",children:l.map(c=>u(dv,{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 [@media(pointer:coarse)]:opacity-100",children:[u(Gz,{row:e}),e.showAssistantMeta&&!e.message.streaming&&e.modelBadge===null&&b(Je,{children:[u(et,{render:u("p",{className:"text-muted-foreground text-chat-row tabular-nums"}),children:Pi(e.message.updatedAt,t.timestampFormat,n)}),u(Ze,{children:aa(e.message.updatedAt,t.timestampFormat)})]})]}):null]})})}function Gz({row:e}){let n=wt(un).derive.resolveAssistantMessageCopyState({text:e.message.text??null,showCopyButton:e.showAssistantCopyButton,streaming:e.assistantCopyStreaming});return n.visible?u(Nl,{text:n.text??"",variant:"ghost"}):null}var VI=ve(function(t){let n=t.context.body.length>0?`${t.context.header}
3813
3813
  ${t.context.body}`:t.context.header;return u(HI,{label:t.context.header,tooltipText:n})}),jz=ve(function(t){let n=t.context.body?`${t.context.header}
3814
- ${t.context.body}`:t.context.header;return b(Je,{children:[b(et,{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(ta,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:t.context.header})]}),u(Ze,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:n})]})});function dv(e){let{t}=ut(),n=Ei(e.attachment),o=_I(n),r=t("attachments.open",{name:e.attachment.name}),a=b(ke,{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:RI(e.attachment.sizeBytes)})]})]}),i=e.attachment.previewUrl?DI(e.attachment):null;return e.attachment.previewUrl&&i!==null?b("div",{className:"flex max-w-sm flex-col gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2",children:[u("a",{href:e.attachment.previewUrl,target:"_blank",rel:"noreferrer","aria-label":r,className:"flex items-center gap-2 hover:underline",children:a}),i==="video"?u("video",{src:e.attachment.previewUrl,"aria-label":e.attachment.name,controls:!0,playsInline:!0,preload:"metadata",className:"aspect-video w-full rounded-sm bg-black"}):u("audio",{src:e.attachment.previewUrl,"aria-label":e.attachment.name,controls:!0,preload:"metadata",className:"h-10 w-full"})]}):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 Qz(e){let t=wt(un),{t:n}=ut();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=nv([e.image],e.image.id);o&&t.onImageExpand(o)},children:u("img",{src:e.image.previewUrl,alt:n("previewAnnotation.cropAlt"),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:K("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(gs,{className:"size-3"}),e.annotation.styleChanges.length]}):null]})]})]})}var Xz=8,Yz=600,Jz=1.75,WI=`linear-gradient(to bottom, black calc(100% - ${Jz}rem), transparent)`;function Zz(e){return e.trim().length===0?!1:e.length>Yz||e.split(`
3815
- `).length>Xz}var eU=ve(function(t){let n=wt(un),{t:o}=ut(),[r,a]=Wo(n.threadKey,`${t.disclosureKey}:expanded`,!1),i=t.text.trim().length>0||t.terminalContexts.length>0,s=i&&Zz(t.text),l=s&&!r;return b("div",{children:[i?u("div",{className:K("relative",l&&"max-h-44 overflow-hidden"),"data-user-message-body":"true","data-user-message-collapsed":l?"true":"false","data-user-message-collapsible":s?"true":"false","data-user-message-fade":l?"true":"false",style:l?{WebkitMaskImage:WI,maskImage:WI}:void 0,children:u(tU,{disclosureKey:t.disclosureKey,text:t.text,terminalContexts:t.terminalContexts,skills:t.skills,markdownCwd:t.markdownCwd})}):null,s||t.footer?b("div",{className:K("mt-1.5 flex items-center gap-2",s&&t.footer?"justify-between":"justify-end"),"data-user-message-footer":"true",children:[s?u(ie,{type:"button",size:"xs",variant:"ghost","aria-expanded":r,"data-scroll-anchor-ignore":!0,onClick:()=>a(!r),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:o(r?"timeline.showLess":"timeline.expandMessage")}):null,t.footer?u("div",{className:"ml-auto flex items-center gap-2",children:t.footer}):null]}):null]})}),tU=ve(function(t){let n=wt(un),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(mi,{children:[s?u("span",{"aria-hidden":"true",children:s}):null,c?u(lr,{disclosureKey:`${t.disclosureKey}:inline:${i}`,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=av(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(lr,{disclosureKey:`${t.disclosureKey}:review:${a.id}`,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(nU,{comment:a.comment,disclosureKey:`${t.disclosureKey}:review-comment:${a.comment.id}`},a.comment.id))});if(t.terminalContexts.length>0){let a=qI(t.text,t.terminalContexts),i=KI(t.terminalContexts),s=[];if(a){let l=0;for(let d of t.terminalContexts){let c=vp(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(VI,{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(VI,{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(lr,{disclosureKey:`${t.disclosureKey}:terminal-main`,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(lr,{disclosureKey:`${t.disclosureKey}:body`,text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1})});function nU({comment:e,disclosureKey:t}){let n=wt(un),{t:o}=ut(),r=e.fenceLanguage??"diff",a=BI(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:cp(e.filePath,n.workspaceRoot)}),b("div",{className:"text-secondary-label text-chat-dense",children:[e.sectionTitle??o("timeline.reviewCommentDefaultSection")," \xB7"," ",e.rangeLabel??o("timeline.reviewCommentDefaultRange")]})]}),e.text.length>0&&u("div",{className:"whitespace-pre-wrap wrap-break-word text-chat",children:u(UI,{text:e.text,skills:n.skills})}),r!=="diff"&&e.diff.trim().length>0&&u(lr,{disclosureKey:`${t}:fence`,text:FI(r,e.diff),cwd:n.markdownCwd,threadRef:n.threadRef??void 0,skills:n.skills,className:"text-message-foreground"}),a?u(DS,{patch:a}):null]})}function oU({badge:e}){return b(ke,{children:[e.driverKind?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(Sr,{driver:e.driverKind,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.driverKind?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 cv({badge:e,createdAt:t}){let n=wt(un),{t:o}=ut();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(oU,{badge:e}),u("span",{"aria-hidden":!0,children:"\xB7"}),b(Je,{children:[u(et,{render:u("span",{className:"shrink-0 tabular-nums"}),children:Pi(t,n.timestampFormat,o)}),u(Ze,{children:aa(t,n.timestampFormat)})]})]})}function JI({row:e}){let{t}=ut(),n=e.badge.effortLabel?`${e.badge.modelLabel} \xB7 ${e.badge.effortLabel}`:e.badge.modelLabel,o=[e.badge.providerDisplayName,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.driverKind?u(Sr,{driver:e.badge.driverKind,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 uv=240,rU=/\s/u;function ZI(e){if(!e)return null;let t=[],n=0,o=!1,r=()=>{for(;n>uv-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(rU.test(a)){o=t.length>0;continue}if(o&&(t.push(" "),n+=1,o=!1,n>uv)||(t.push(a),n+=a.length,n>uv))return r()}return t.length>0?t.join(""):null}function aU(e,t,n){let o=t.find(i=>i.kind==="message"&&i.message.role==="user"),r=o?.kind==="message"?o.message:null,a=null;for(let i of t)i.kind==="message"&&i.message.role==="assistant"&&(a=i.message.text??null);return{id:e,sectionKey:e,anchorRowId:o?.id??t[0]?.id??e,userText:r===null?null:ZI(n.parseSystemNotificationText(r.text)?.summary??n.parseThreadHandoverText(r.text)?.body??r.text),assistantText:ZI(a),headerText:r===null?null:GI(r.text,n)}}function iU(e){for(let t of e){let n=t.kind==="message"?t.message.turnId??null:t.kind==="turn-summary"?t.footer.turnId:null;if(n!==null)return n}return null}function sU(e,t){return e.sectionKey===t.sectionKey&&e.anchorRowId===t.anchorRowId&&e.userText===t.userText&&e.assistantText===t.assistantText&&e.headerText===t.headerText&&e.turnId===t.turnId}function lU(e,t,n){for(let o=0;o<e.length;o+=1)if(e[o]!==n[t.firstRowIndex+o])return!1;return!0}function dU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function cU(e){let t=new Map,n=null;return o=>{let r=o.getVersion();if(n!==null&&n.store===o&&n.version===r)return n.entries;let a=new Map,i=[],s=o.getRows();for(let d of o.getStructure().sections){let c=t.get(d.key);if(c!==void 0&&c.rowIds===d.rowIds&&lU(c.rows,d,s)){a.set(d.key,c),i.push(c.entry);continue}let f=s.slice(d.firstRowIndex,d.firstRowIndex+d.rowIds.length),p=aU(d.key,f,e),m={...p,turnId:iU(f)},g=c!==void 0&&sU(c.entry.item,m)?c.entry:{summary:p,item:m};a.set(d.key,{rowIds:d.rowIds,rows:f,entry:g}),i.push(g)}t=a;let l=n!==null&&dU(n.entries,i)?n.entries:i;return n={store:o,version:r,entries:l},l}}var e0=new WeakMap;function o0(e,t){let n=e0.get(e);return(n===void 0||n.derive!==t)&&(n={derive:t,read:cU(t)},e0.set(e,n)),n.read(e)}var t0=new WeakMap;function r0(e,t){let n=o0(e,t),o=t0.get(n);return o===void 0&&(o=n.flatMap(({summary:r})=>r.headerText===null?[]:[{sectionKey:r.sectionKey,text:r.headerText}]),t0.set(n,o)),o}function a0(e,t){return e===t?!0:e.length!==t.length?!1:e.every((n,o)=>n.sectionKey===t[o].sectionKey&&n.text===t[o].text)}var n0=new WeakMap;function i0(e,t){let n=o0(e,t),o=n0.get(n);return o===void 0&&(o=n.filter(({summary:r})=>r.userText!==null).map(({item:r})=>r),n0.set(n,o)),o}function s0(e,t){return e===t?!0:e.length!==t.length?!1:e.every((n,o)=>n===t[o])}he();var uU=[],fU=e=>e.getMeta().usageByTurnId,pU=e=>e.getMeta().exportApi,l0=ve(function({rowsStore:t,derive:n,paneVisible:o,totalTurnCount:r,bottomInset:a,onSelect:i,onTurnNavigatorChange:s}){let l=R(m=>o?i0(m,n):uU,[n,o]),d=Ai(t,l,s0),c=Ai(t,fU),f=Ai(t,pU),p=q(()=>o?{items:d,totalTurnCount:r,bottomInset:a,usageByTurnId:c,onSelect:i,exportMarkdown:f.markdown,onDownload:f.download}:null,[a,f,d,i,o,r,c]);return W(()=>{p!==null&&s(p)},[s,p]),W(()=>{if(o)return()=>s(null)},[s,o]),null});he();function d0(){let e=ar(),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 Cp(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function fv(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(`
3814
+ ${t.context.body}`:t.context.header;return b(Je,{children:[b(et,{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(ta,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:t.context.header})]}),u(Ze,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:n})]})});function dv(e){let{t}=ut(),n=Ei(e.attachment),o=_I(n),r=t("attachments.open",{name:e.attachment.name}),a=b(ke,{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:RI(e.attachment.sizeBytes)})]})]}),i=e.attachment.previewUrl?DI(e.attachment):null;return e.attachment.previewUrl&&i!==null?b("div",{className:"flex max-w-sm flex-col gap-2 rounded-sm border border-border/70 bg-background/70 px-2.5 py-2",children:[u("a",{href:e.attachment.previewUrl,target:"_blank",rel:"noreferrer","aria-label":r,className:"flex items-center gap-2 hover:underline",children:a}),i==="video"?u("video",{src:e.attachment.previewUrl,"aria-label":e.attachment.name,controls:!0,playsInline:!0,preload:"metadata",className:"aspect-video w-full rounded-sm bg-black"}):u("audio",{src:e.attachment.previewUrl,"aria-label":e.attachment.name,controls:!0,preload:"metadata",className:"h-10 w-full"})]}):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 Qz(e){let t=wt(un),{t:n}=ut();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=nv([e.image],e.image.id);o&&t.onImageExpand(o)},children:u("img",{src:e.image.previewUrl,alt:n("previewAnnotation.cropAlt"),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:K("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(ms,{className:"size-3"}),e.annotation.styleChanges.length]}):null]})]})]})}var Xz=8,Yz=600,Jz=1.75,WI=`linear-gradient(to bottom, black calc(100% - ${Jz}rem), transparent)`;function Zz(e){return e.trim().length===0?!1:e.length>Yz||e.split(`
3815
+ `).length>Xz}var eU=ve(function(t){let n=wt(un),{t:o}=ut(),[r,a]=Wo(n.threadKey,`${t.disclosureKey}:expanded`,!1),i=t.text.trim().length>0||t.terminalContexts.length>0,s=i&&Zz(t.text),l=s&&!r;return b("div",{children:[i?u("div",{className:K("relative",l&&"max-h-44 overflow-hidden"),"data-user-message-body":"true","data-user-message-collapsed":l?"true":"false","data-user-message-collapsible":s?"true":"false","data-user-message-fade":l?"true":"false",style:l?{WebkitMaskImage:WI,maskImage:WI}:void 0,children:u(tU,{disclosureKey:t.disclosureKey,text:t.text,terminalContexts:t.terminalContexts,skills:t.skills,markdownCwd:t.markdownCwd})}):null,s||t.footer?b("div",{className:K("mt-1.5 flex items-center gap-2",s&&t.footer?"justify-between":"justify-end"),"data-user-message-footer":"true",children:[s?u(ie,{type:"button",size:"xs",variant:"ghost","aria-expanded":r,"data-scroll-anchor-ignore":!0,onClick:()=>a(!r),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:o(r?"timeline.showLess":"timeline.expandMessage")}):null,t.footer?u("div",{className:"ml-auto flex items-center gap-2",children:t.footer}):null]}):null]})}),tU=ve(function(t){let n=wt(un),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(mi,{children:[s?u("span",{"aria-hidden":"true",children:s}):null,c?u(sr,{disclosureKey:`${t.disclosureKey}:inline:${i}`,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=av(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(sr,{disclosureKey:`${t.disclosureKey}:review:${a.id}`,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(nU,{comment:a.comment,disclosureKey:`${t.disclosureKey}:review-comment:${a.comment.id}`},a.comment.id))});if(t.terminalContexts.length>0){let a=qI(t.text,t.terminalContexts),i=KI(t.terminalContexts),s=[];if(a){let l=0;for(let d of t.terminalContexts){let c=vp(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(VI,{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(VI,{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(sr,{disclosureKey:`${t.disclosureKey}:terminal-main`,text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1,onImageExpand:n.onImageExpand},"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(sr,{disclosureKey:`${t.disclosureKey}:body`,text:t.text,cwd:t.markdownCwd,threadRef:n.threadRef??void 0,skills:t.skills,className:"text-message-foreground",lineBreaks:!0,parseRawHtml:!1,onImageExpand:n.onImageExpand})});function nU({comment:e,disclosureKey:t}){let n=wt(un),{t:o}=ut(),r=e.fenceLanguage??"diff",a=BI(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:cp(e.filePath,n.workspaceRoot)}),b("div",{className:"text-secondary-label text-chat-dense",children:[e.sectionTitle??o("timeline.reviewCommentDefaultSection")," \xB7"," ",e.rangeLabel??o("timeline.reviewCommentDefaultRange")]})]}),e.text.length>0&&u("div",{className:"whitespace-pre-wrap wrap-break-word text-chat",children:u(UI,{text:e.text,skills:n.skills})}),r!=="diff"&&e.diff.trim().length>0&&u(sr,{disclosureKey:`${t}:fence`,text:FI(r,e.diff),cwd:n.markdownCwd,threadRef:n.threadRef??void 0,skills:n.skills,className:"text-message-foreground"}),a?u(DS,{patch:a}):null]})}function oU({badge:e}){return b(ke,{children:[e.driverKind?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(wr,{driver:e.driverKind,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.driverKind?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 cv({badge:e,createdAt:t}){let n=wt(un),{t:o}=ut();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(oU,{badge:e}),u("span",{"aria-hidden":!0,children:"\xB7"}),b(Je,{children:[u(et,{render:u("span",{className:"shrink-0 tabular-nums"}),children:Pi(t,n.timestampFormat,o)}),u(Ze,{children:aa(t,n.timestampFormat)})]})]})}function JI({row:e}){let{t}=ut(),n=e.badge.effortLabel?`${e.badge.modelLabel} \xB7 ${e.badge.effortLabel}`:e.badge.modelLabel,o=[e.badge.providerDisplayName,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.driverKind?u(wr,{driver:e.badge.driverKind,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 uv=240,rU=/\s/u;function ZI(e){if(!e)return null;let t=[],n=0,o=!1,r=()=>{for(;n>uv-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(rU.test(a)){o=t.length>0;continue}if(o&&(t.push(" "),n+=1,o=!1,n>uv)||(t.push(a),n+=a.length,n>uv))return r()}return t.length>0?t.join(""):null}function aU(e,t,n){let o=t.find(i=>i.kind==="message"&&i.message.role==="user"),r=o?.kind==="message"?o.message:null,a=null;for(let i of t)i.kind==="message"&&i.message.role==="assistant"&&(a=i.message.text??null);return{id:e,sectionKey:e,anchorRowId:o?.id??t[0]?.id??e,userText:r===null?null:ZI(n.parseSystemNotificationText(r.text)?.summary??n.parseThreadHandoverText(r.text)?.body??r.text),assistantText:ZI(a),headerText:r===null?null:GI(r.text,n)}}function iU(e){for(let t of e){let n=t.kind==="message"?t.message.turnId??null:t.kind==="turn-summary"?t.footer.turnId:null;if(n!==null)return n}return null}function sU(e,t){return e.sectionKey===t.sectionKey&&e.anchorRowId===t.anchorRowId&&e.userText===t.userText&&e.assistantText===t.assistantText&&e.headerText===t.headerText&&e.turnId===t.turnId}function lU(e,t,n){for(let o=0;o<e.length;o+=1)if(e[o]!==n[t.firstRowIndex+o])return!1;return!0}function dU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function cU(e){let t=new Map,n=null;return o=>{let r=o.getVersion();if(n!==null&&n.store===o&&n.version===r)return n.entries;let a=new Map,i=[],s=o.getRows();for(let d of o.getStructure().sections){let c=t.get(d.key);if(c!==void 0&&c.rowIds===d.rowIds&&lU(c.rows,d,s)){a.set(d.key,c),i.push(c.entry);continue}let f=s.slice(d.firstRowIndex,d.firstRowIndex+d.rowIds.length),p=aU(d.key,f,e),m={...p,turnId:iU(f)},g=c!==void 0&&sU(c.entry.item,m)?c.entry:{summary:p,item:m};a.set(d.key,{rowIds:d.rowIds,rows:f,entry:g}),i.push(g)}t=a;let l=n!==null&&dU(n.entries,i)?n.entries:i;return n={store:o,version:r,entries:l},l}}var e0=new WeakMap;function o0(e,t){let n=e0.get(e);return(n===void 0||n.derive!==t)&&(n={derive:t,read:cU(t)},e0.set(e,n)),n.read(e)}var t0=new WeakMap;function r0(e,t){let n=o0(e,t),o=t0.get(n);return o===void 0&&(o=n.flatMap(({summary:r})=>r.headerText===null?[]:[{sectionKey:r.sectionKey,text:r.headerText}]),t0.set(n,o)),o}function a0(e,t){return e===t?!0:e.length!==t.length?!1:e.every((n,o)=>n.sectionKey===t[o].sectionKey&&n.text===t[o].text)}var n0=new WeakMap;function i0(e,t){let n=o0(e,t),o=n0.get(n);return o===void 0&&(o=n.filter(({summary:r})=>r.userText!==null).map(({item:r})=>r),n0.set(n,o)),o}function s0(e,t){return e===t?!0:e.length!==t.length?!1:e.every((n,o)=>n===t[o])}he();var uU=[],fU=e=>e.getMeta().usageByTurnId,pU=e=>e.getMeta().exportApi,l0=ve(function({rowsStore:t,derive:n,paneVisible:o,totalTurnCount:r,bottomInset:a,onSelect:i,onTurnNavigatorChange:s}){let l=R(m=>o?i0(m,n):uU,[n,o]),d=Ai(t,l,s0),c=Ai(t,fU),f=Ai(t,pU),p=q(()=>o?{items:d,totalTurnCount:r,bottomInset:a,usageByTurnId:c,onSelect:i,exportMarkdown:f.markdown,onDownload:f.download}:null,[a,f,d,i,o,r,c]);return W(()=>{p!==null&&s(p)},[s,p]),W(()=>{if(o)return()=>s(null)},[s,o]),null});he();function d0(){let e=rr(),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 Cp(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}function fv(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(`
3816
3816
  `)}function c0(e,t,n){let o=n?.maxLines??8,r=fv(e).trimEnd().split(/\r?\n/).map(l=>l.trimEnd()),a=[],i=0,s=!1;for(let l of r){let d=l.trim().length>0;if(d&&i>=o){s=!0;break}a.push(l),d&&(i+=1)}for(;a.length>0&&a.at(-1)?.trim().length===0;)a.pop();return a.length===0?Cp(e)??t("proposedPlan.previewUnavailable"):(s&&a.push("","..."),a.join(`
3817
3817
  `))}function mU(e){let t=e.toLowerCase().replace(/[`'".,!?()[\]{}]+/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t.length>0?t:"plan"}function u0(e){let t=Cp(e);return`${mU(t??"plan")}.md`}function f0(e){return`${e.trimEnd()}
3818
- `}function p0(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 bp=1024,m0=ve(function({planMarkdown:t,threadKey:n,rowId:o,environmentId:r,threadRef:a,cwd:i,workspaceRoot:s,onSavePlanToWorkspace:l}){let{t:d}=ut(),c=d0(),[f,p]=Wo(n,`proposed-plan:${o}:expanded`,!1),[m,g]=Q(!1),[h,v]=Wo(n,`proposed-plan:${o}:save-path`,""),[y,x]=Q(!1);Of(o,m||y);let C=N(!1),w=N(!1);Ce(()=>(C.current=!0,()=>{C.current=!1}),[]);let{copyToClipboard:T,isCopied:S}=lp({target:"plan",onError:B=>{c.error(d("proposedPlan.couldNotCopy"),B,{description:d("proposedPlan.copyErrorDescription")})}}),L=Jr(),k=Cp(t)??d("proposedPlan.defaultTitle"),I=t.split(`
3819
- `).length,P=t.length>900||I>20,E=fv(t),_=P?c0(t,d,{maxLines:10}):null,A=u0(t),H=f0(t),V=()=>{p0(A,H)},J=()=>{T(H)},D=()=>{if(!s){c.error(d("proposedPlan.workspacePathUnavailable"),d("proposedPlan.workspacePathUnavailableDescription"));return}h.length===0&&v(A.slice(0,bp)),g(!0)},ne=()=>{if(w.current)return;let B=h.trim();if(!(!s||l===null)){if(!B){c.warning(d("proposedPlan.enterWorkspacePath"));return}if(B.length>bp){c.warning(d("proposedPlan.pathTooLong"));return}w.current=!0,x(!0),(async()=>{try{let U=await l({environmentId:r,workspaceRoot:s,relativePath:B,contents:H});if(!C.current)return;U.ok?(g(!1),c.success(d("proposedPlan.savedToWorkspace"),U.relativePath)):c.error(d("proposedPlan.couldNotSave"),void 0,{description:d("proposedPlan.saveErrorDescription")})}catch(U){C.current&&c.error(d("proposedPlan.couldNotSave"),U,{description:d("proposedPlan.saveErrorDescription")})}finally{w.current=!1,C.current&&x(!1)}})()}};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(ra,{variant:"secondary",children:d("proposedPlan.badge")}),u("p",{className:"truncate text-sm font-medium text-foreground",children:k})]}),b(_o,{children:[u(Oo,{render:u(ie,{"aria-label":d("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:u(ir,{"aria-hidden":"true",className:"size-4"})}),b(Do,{align:"end",children:[u(sr,{onClick:J,children:d(S?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),u(sr,{onClick:V,children:d("proposedPlan.downloadAsMarkdown")}),l!==null?u(sr,{onClick:D,disabled:!s||y,children:d("proposedPlan.saveToWorkspace")}):null]})]})]}),b("div",{className:"mt-4",children:[b("div",{className:K("relative",P&&!f&&"max-h-104 overflow-hidden"),children:[P&&!f?u(lr,{disclosureKey:`proposed-plan:${o}:plan`,text:_??"",cwd:i,threadRef:a,isStreaming:!1}):u(lr,{disclosureKey:`proposed-plan:${o}:plan`,text:E,cwd:i,threadRef:a,isStreaming:!1}),P&&!f?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]}),P?u("div",{className:"mt-4 flex justify-center",children:u(ie,{size:"sm",variant:"outline","data-scroll-anchor-ignore":!0,onClick:()=>p(!f),children:d(f?"proposedPlan.collapse":"proposedPlan.expand")})}):null]}),u($f,{open:m,onOpenChange:B=>{y||g(B)},children:b(Wf,{className:"max-w-xl",children:[b(Vf,{children:[u(Gf,{children:d("proposedPlan.saveToWorkspace")}),u(Kf,{children:Rc(d("proposedPlan.pathHint"),u("code",{children:s??d("proposedPlan.theWorkspace")}),"path")})]}),u(CS,{className:"space-y-3",children:b("label",{htmlFor:L,className:"grid gap-1.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:d("proposedPlan.workspacePath")}),u(kl,{id:L,value:h,maxLength:bp,onChange:B=>v(B.target.value.slice(0,bp)),placeholder:A,spellCheck:!1,disabled:y})]})}),b(qf,{children:[u(ie,{variant:"outline",size:"sm",onClick:()=>g(!1),disabled:y,children:d("proposedPlan.cancel")}),u(ie,{size:"sm",onClick:()=>{ne()},disabled:y,children:d(y?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});function g0({timeline:e,previousOverlayHeight:t,overlayHeight:n,followingEnd:o}){e&&o&&n>t&&e.scrollToEnd({animated:!1})}function h0(e,t){let n=e.topOf(t),o=e.heightOf(t);return typeof n!="number"||typeof o!="number"||!Number.isFinite(n)||!Number.isFinite(o)?null:n+Math.max(1,o)}function v0({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}he();var Fl=class extends Aa{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 gU({error:e,className:t}){let{t:n}=ut();return b(Je,{children:[b(et,{render:u("div",{className:K("flex min-h-6 min-w-0 items-center gap-1.5 px-0.5 py-0.5 text-destructive",t)}),children:[u(Pn,{"aria-hidden":!0,className:"size-4 shrink-0"}),u("span",{className:"min-w-0 flex-1 truncate",children:n("timeline.entryUnavailable")})]}),u(Ze,{className:"max-w-xs whitespace-pre-wrap font-mono text-[11px]",children:e.message})]})}function y0(e){return u(gU,{error:e})}var un=bt(null),b0=bt(null),hU=u("div",{className:"h-3 sm:h-4"}),vU=u("div",{className:"h-10 sm:h-12"}),yU=Object.freeze([]);function xU({loading:e,blocked:t,onLoadEarlier:n,fade:o}){let{t:r}=ut();return u("div",{className:o?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:n,disabled:e||t,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:r(e?"timeline.loadingEarlier":"timeline.loadEarlier")})})})}function CU({loading:e,blocked:t,onLoadLater:n,onReturnToLatest:o}){let{t:r}=ut();return b("div",{className:"transcript-col flex items-center justify-center gap-2 py-2",children:[u(ie,{variant:"ghost",size:"sm",onClick:n,disabled:e||t,children:r(e?"timeline.loadingLater":"timeline.loadLater")}),o?u(ie,{variant:"ghost",size:"sm",onClick:o,children:r("timeline.returnToLatest")}):null]})}function bU({onReveal:e,fade:t}){let{t:n}=ut();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:n("timeline.loadEarlier")})})})}var wU=u("div",{className:"h-3 sm:h-4"}),SU=[],IU=new Set,TU=200,x0=1e4,kU=20;function C0(e,t){let n=Array.from(e.querySelectorAll("[data-timeline-turn-section]")),o=n.findIndex(a=>a.querySelector(`[data-timeline-row-id="${CSS.escape(t)}"]`)),r=o<0?n:n.slice(0,o+1);for(let a of r)a.style.contentVisibility="visible";e.offsetHeight,requestAnimationFrame(()=>{for(let a of r)a.style.removeProperty("content-visibility")})}var pv=600;function mv(e,t){if(typeof Element>"u"||!(e instanceof Element))return!1;if(t===null||!t.contains(e))return!0;for(let n=e;n&&n!==t;){if(n instanceof HTMLElement&&n.scrollHeight>n.clientHeight&&n.scrollTop>0)return!0;n=n.parentElement}return!1}var LU=()=>{},PU=[];function AU(e){let t=e.getMeta().status;return{latestTurn:t.latestTurn??null,latestAssistantMessageId:t.latestAssistantMessageId??null,isWorking:t.isWorking,workingStepLabel:t.workingStepLabel??null,stall:t.stall??null,retry:t.retry??null,totalTurnCount:t.totalTurnCount??null,scheduledWakes:t.scheduledWakes??yU}}function EU(e,t){return e.latestTurn===t.latestTurn&&e.latestAssistantMessageId===t.latestAssistantMessageId&&e.isWorking===t.isWorking&&e.workingStepLabel===t.workingStepLabel&&e.stall===t.stall&&e.retry===t.retry&&e.totalTurnCount===t.totalTurnCount&&e.scheduledWakes===t.scheduledWakes}var RU=e=>e.getMeta().finalAssistantMessageReceived;function MU(e,t){let n=N(e);return t&&(n.current=e),n.current}var w0=ve(function({derive:t,SiteIcon:n,rowsStore:o,threadKey:r,threadRef:a,environmentId:i,onInterrupt:s=null,onRespondToDecision:l=null,onCancelScheduledWake:d=null,agentPanelModel:c,onOpenAgents:f=LU,onOpenFileDiff:p,onForkFromUserMessage:m,onImageExpand:g,markdownCwd:h,resolvedTheme:v,timestampFormat:y,workspaceRoot:x,skills:C=SU,onRowsChange:w,contentInsetEndAdjustment:T,liveFollowEnabled:S,awaitingUserDecision:L=!1,onIsAtEndChange:k,onManualNavigation:I,onDisclosureNavigation:P=I,hideEmptyPlaceholder:E=!1,topFadeEnabled:_=!1,scrollerRef:A,loadEarlier:H=null,loadLater:V=null,pagingBlockedByInteraction:J=!1,onReturnToLatest:D=null,onVisibleTurnRangeChange:ne=null,revealMessageRequest:B=null,onRevealMessageHandled:U,revealQuoteRequest:ee=null,onRevealQuoteDone:j,renderWorkGroup:Z,renderToolCallDetail:de,loadScrollAnchor:F,saveScrollAnchor:X,useVisibleThreadCompletion:pe,onSavePlanToWorkspace:le,paneActive:re,onTurnNavigatorChange:we}){let{t:Xe}=ut(),{latestTurn:ot,latestAssistantMessageId:at,isWorking:je,workingStepLabel:oe,stall:Te,retry:Y,totalTurnCount:me,scheduledWakes:ge}=Ai(o,AU,EU),G=ea(),Ye=N(G);Ye.current=G;let vt=N(B);vt.current=B;let[Mt,Dt]=Ht("timeline-disclosure-reading",r,!1),Nt=N(r);Nt.current=r;let Ot=N(J);Ot.current=J;let At=St("timeline-following-end",r,!0);At.current=V===null&&S;let xt=St("timeline-scroll-restore-pending",r,!1),_t=Tr(r,null),Xt=Tr(r,null),mn=Tr(r,null),Hn=St("timeline-content-inset",r,T),yt=N(null),qt=Tr(r,[]),an=Tr(r,!1),kn=N(null),sn=R(()=>qt.current,[qt]),Cn=R(z=>{qt.current=z,kn.current?.(),Ke.current?.schedule()},[qt]),$n=R(z=>{an.current=z,Ke.current?.schedule()},[an]),$=R(z=>{z!==null&&(yt.current=z),A(z)},[A]);Ce(()=>{g0({timeline:yt.current,previousOverlayHeight:Hn.current,overlayHeight:T,followingEnd:G&&V===null&&S&&!Mt}),Hn.current=T},[T,Mt,S,V,G]),W(()=>()=>{Xt.current?.stop()},[]);let ae=R(()=>{Xt.current?.stop(),Xt.current=null,_t.current=null,Dt(!1)},[_t,Xt,Dt]),ce=R(z=>{P(),_t.current=z,Dt(!0),Xt.current?.stop();let Ee=yt.current?.node??null;if(!Ee)return;let tt=Array.from(Ee.querySelectorAll("[data-timeline-row-id]")).find(On=>On.dataset.timelineRowId===z);if(!tt)return;let Yt=mn.current;Xt.current=yI({viewport:Ee,row:tt,anchor:Yt&&tt.contains(Yt)?Yt:tt,scrollToOffset:On=>{Ee.scrollTop=On}})},[P]),Le=St("timeline-live-follow-previous",r,S);Ce(()=>{S&&!Le.current&&ae(),Le.current=S},[S,ae]);let ze=MU(V!==null,G),ft=!ze&&je,gn=ze?null:oe,lt=ze?null:Te,hn=ze?null:Y,Ft=AI(o),rt=Ft.sections,Zt=Ft.rowIds.length,ln=R(z=>{let Ee=o.getRows().find(tt=>tt.id===z||tt.kind==="work"&&tt.groupedEntries.some(Yt=>Yt.id===z)||tt.kind==="tool-group"&&tt.entries.some(Yt=>Yt.id===z));ce(Ee?.id??z)},[o,ce]),Se=St("timeline-scroll-snapshot",r,null),Re=R((z,Ee=At.current)=>{z.scrollLength<=0||(Se.current={threadKey:r,anchor:v0({measurement:z,followingEnd:Ee})})},[At,r,Se]),qe=R(()=>{let z=Se.current;z&&X(z.threadKey,z.anchor)},[X,Se]),pt=R(()=>{if(!G||xt.current)return;if(Zt===0){qe();return}let z=yt.current?.measure();z&&z.scrollLength>0&&(Re(z,At.current&&t.resolveIsAtEnd(z,T)!==!1),qe())},[Re,T,t,At,G,qe,xt,Zt]),st=wI(r),it=N(st);it.current=st;let kt=St("timeline-top-reveal-armed",r,!0),Vt=St("timeline-network-prepend-awaiting-navigation",r,!1),Pe=N(null),Et=N(null);Ce(()=>()=>{Et.current!==null&&(cancelAnimationFrame(Et.current),Et.current=null)},[r,G]);let mt=St("timeline-network-prepend-scroll-top",r,null),on=St("timeline-mounted-section-keys",r,IU,3),Nn=Tr(r,null),xe=Nn.current,Ve=xe===null?-1:rt.findIndex(z=>z.key===xe.firstMountedSectionKey),Ct=Ve>0?rt.length-Math.max(0,Ve-ev):st.revealedCount,ct=Ve>0?Ct:st.revealedCount,vn=ZS(rt.map(z=>z.key),on.current,ct,V!==null||!S||Mt||an.current||qt.current.length>0),{startIndex:bn,hasHiddenOlder:yn}=bI(rt.length,vn),Lt=q(()=>rt.slice(bn),[bn,rt]),xn=xe!==null&&Ve>0&&bn<Ve,Wt=N(rt);Wt.current=rt,Ce(()=>{if(G){if(on.current=new Set(Lt.map(z=>z.key)),xe!==null){let z=SI(xe,{prefixMounted:xn,loading:H===null?null:H.loading,sections:rt,now:Date.now()});z!=="waiting"&&(Nn.current=null),z==="mounted"&&(Vt.current=!0)}vn<it.current.revealedCount?it.current.compactTo(vn):vn>it.current.revealedCount&&it.current.revealAtLeast(vn)}},[Vt,H,G,xe,xn,Nn,on,vn,rt,Lt]);let An=Tr(r,null),eo=R((z=null)=>{if(!Ye.current)return;let Ee=yt.current?.node;Ee&&(An.current={scrollHeight:Ee.scrollHeight,scrollTop:Ee.scrollTop,row:yt.current?.measure()?.rowAtScroll()??null,firstMountedSectionKey:z,until:Date.now()+x0})},[An]),va=R(()=>{let z=An.current;if(z===null||z.firstMountedSectionKey===null||Date.now()>z.until)return;let Ee=yt.current?.node;if(!Ee)return;let tt=Se.current;z.scrollHeight=Ee.scrollHeight,z.scrollTop=Ee.scrollTop,z.row=tt?.threadKey===r?tt.anchor:null},[An,r,Se]);Ce(()=>{if(!G)return;let z=An.current;if(!z)return;if(Date.now()>z.until){An.current=null;return}if(z.firstMountedSectionKey!==null&&Nn.current!==null)return;An.current=null;let Ee=yt.current?.node;if(Ee){if(z.row){C0(Ee,z.row.rowId);let tt=yt.current?.measure()?.topOf(z.row.rowId);tt!=null&&(Ee.scrollTop=tt+z.row.offsetPx)}else Ee.scrollTop=z.scrollTop+(Ee.scrollHeight-z.scrollHeight);xn&&(mt.current=Ee.scrollTop)}},[mt,G,xe,xn,bn,Ft]);let ya=R(()=>{eo(),it.current.revealOlder()},[eo]),He=N(ya);He.current=ya;let xa=N(yn);xa.current=yn;let Cr=N(null),qr=St("timeline-scroll-restore",r,void 0);if(qr.current===void 0&&Zt>0){let z=F(r);qr.current=z!==null&&Ft.rowIds.includes(z.rowId)?z:null}let _n=qr.current??null,tr=N(()=>{}),[Ro,ii]=Ht("timeline-scroll-restore-settled",r,!1),ul=_n!==null&&!Ro,Zi=St("timeline-last-anchor-save",r,0);W(()=>{let z=_n;if(!G||Ro||z===null)return;if(vt.current!==null){ii(!0);return}let Ee=null,tt=requestAnimationFrame(()=>{!Ye.current||Nt.current!==r||(I(),it.current.revealAtLeast(Ol(Wt.current,z.rowId,it.current.revealedCount)),Ee=requestAnimationFrame(()=>{!Ye.current||Nt.current!==r||(ii(!0),tr.current(z.rowId,-z.offsetPx))}))});return()=>{cancelAnimationFrame(tt),Ee!==null&&cancelAnimationFrame(Ee)}},[I,G,r,_n,Ro]);let to=St("timeline-restore-after-presentation",r,!1),gt=ul||to.current;xt.current=gt,Ce(()=>{if(G)return()=>{Nt.current!==r?qe():pt(),to.current=!0}},[G,r]),Ce(()=>{if(!G||!to.current)return;if(vt.current!==null){to.current=!1,xt.current=!1;return}let z=null,Ee=null,tt=()=>{!Ye.current||Nt.current!==r||(yt.current?.scrollToEnd(),to.current=!1,xt.current=!1,At.current=V===null,wa.current=V===null,no.current={...no.current,followEnabled:!0,restoreInProgress:!1},k(V===null))},Yt=F(r),On=Yt!==null&&Wt.current.some(ui=>ui.rowIds.includes(Yt.rowId));return Yt===null?z=requestAnimationFrame(tt):On?(I(),it.current.revealAtLeast(Ol(Wt.current,Yt.rowId,it.current.revealedCount)),z=requestAnimationFrame(()=>{Ee=requestAnimationFrame(()=>{!Ye.current||Nt.current!==r||(tr.current(Yt.rowId,-Yt.offsetPx),to.current=!1,xt.current=!1)})})):Zt>0&&(z=requestAnimationFrame(tt)),()=>{z!==null&&cancelAnimationFrame(z),Ee!==null&&cancelAnimationFrame(Ee)}},[F,V,k,I,G,r,Zt,rt.length]);let xo=R(z=>{ae(),I(),it.current.revealAtLeast(Ol(Wt.current,z.anchorRowId,it.current.revealedCount));let Ee=r;requestAnimationFrame(()=>{Nt.current===Ee&&tr.current(z.anchorRowId,24)})},[I,ae,r]);W(()=>{if(B===null||!G)return;ae(),I();let z=t.resolveToolGroupRevealRowId(o.getRows(),B.rowId);it.current.revealAtLeast(Ol(Wt.current,z,it.current.revealedCount));let Ee=requestAnimationFrame(()=>{Nt.current===r&&(tr.current(z,24),U?.())});return()=>cancelAnimationFrame(Ee)},[B,G,I,ae,U,t,r,o]);let zo=N(null);W(()=>{if(ee===null||!G)return;let z=zo.current;if((z===null||z.request!==ee)&&(z={request:ee,pages:0,done:!1},zo.current=z),z.done)return;let{quote:Ee}=ee,tt=Ee.messageId;if(!o.getRows().some(Yt=>Yt.id===tt)){if(H?.loading)return;let Yt=Cr.current;if(Yt!==null&&z.pages<kU){z.pages+=1,Yt();return}z.done=!0,j?.("message-missing");return}z.done=!0,ae(),I(),it.current.revealAtLeast(Ol(Wt.current,tt,it.current.revealedCount)),requestAnimationFrame(()=>{Nt.current===r&&(tr.current(tt,24),requestAnimationFrame(()=>{let Yt=yt.current?.node?.querySelector(`[data-timeline-row-id="${CSS.escape(tt)}"]`),On=Yt?TI(Yt,Ee):null,ui=yt.current?.node;if(On&&ui){let ph=On.getBoundingClientRect().top-ui.getBoundingClientRect().top-ui.clientHeight/3;yt.current?.scrollToOffset(ui.scrollTop+ph)}On&&kI(On),j?.(On?"found":"passage-missing")}))})},[ee,G,Ft,H,o,j,I,ae,r]);let Ae=R(z=>G?r0(z,t):PU,[t,G]),Uo=Ai(o,Ae,a0),es=N(Uo);es.current=Uo;let Dn=St("timeline-active-header",r,null),Vr=Uo.at(-1)?.text??null,co=Vr!==null,Wr=N(null),uo=N(null),[Ho,Kn]=Ht("timeline-pinned-header-expanded",r,!1),Co=N(Ho);Co.current=Ho;let si=R(()=>{if(!Ye.current)return;let z=Wr.current,Ee=uo.current;!z||!Ee||(z.dataset.truncated=Co.current||Ee.scrollWidth>Ee.clientWidth+1?"true":"false")},[]),[li,di]=Q(null),nr=Ai(o,RU),[wn,Gr]=Q(null),Mo=R(()=>{if(Ot.current||Nt.current!==r||H===null||H.loading)return;let z=Lt[0]?.key;z!==void 0&&(eo(z),Nn.current={firstMountedSectionKey:z,loadingObserved:!1,sectionsWhileLoading:Wt.current,until:Date.now()+x0},H.onLoadEarlier())},[eo,H,Nn,r,Lt]);Cr.current=H===null||H.loading||J?null:Mo;let Ca=R(()=>{Ot.current||Nt.current!==r||(eo(),V?.onLoadLater())},[eo,V,r]),ba=R((z,Ee)=>{if(!Ye.current)return;let tt=yt.current?.node;tt&&(C0(tt,z),yt.current?.scrollToRow(z,{viewOffset:Ee}))},[]);tr.current=ba;let qn=G&&V===null&&S&&!Mt&&!gt,wa=N(qn);wa.current=qn;let no=N({followEnabled:qn,restoreInProgress:gt,loadEarlier:H});no.current={followEnabled:qn,restoreInProgress:gt,loadEarlier:H};let Ke=N(null);W(()=>{if(!wn||!G)return;let z=LI({root:wn,minimumCount:Ss,keepAbovePx:pv,canCompact:()=>{let Ee=no.current,tt=An.current;return Ee.followEnabled&&qt.current.length===0&&!Ee.restoreInProgress&&!Ee.loadEarlier?.loading&&!(tt&&tt.until>Date.now())&&it.current.revealedCount>Ss},onCompact:Ee=>{kt.current=!0,eo(),it.current.compactTo(Ee)}});return Ke.current=z,()=>{z.disconnect(),Ke.current=null}},[eo,G,wn]),W(()=>{Ke.current?.schedule()},[qn,H?.loading,st.revealedCount,rt.length]),W(()=>{if(!wn||!G||typeof ResizeObserver>"u")return;let z=()=>{if(!Ye.current||!wa.current)return;let Yt=wn.scrollHeight-wn.clientHeight;Math.abs(wn.scrollTop-Yt)>.5&&(wn.scrollTop=Yt)},Ee=new ResizeObserver(z);Ee.observe(wn);let tt=wn.firstElementChild;return tt&&Ee.observe(tt),()=>Ee.disconnect()},[G,wn]),pe({viewport:li,viewActive:re&&G,threadKey:r,completedAt:V===null&&!gt&&ot?.state==="completed"&&nr?ot.completedAt:null,messageId:at,bottomInset:T});let Bt=Ft.rowIds.at(-1)??null;W(()=>{w?.(Bt)},[Bt,w,r]);let dn=St("timeline-later-load-armed",r,!0),Ln=R(z=>{if(z>pv){kt.current=!0;return}if(kt.current){if(kt.current=!1,xa.current){He.current();return}Cr.current?.()}},[kt]),Sa=R(()=>{Vt.current&&(Vt.current=!1,mt.current=null,kt.current=!0)},[Vt,mt,kt]),Ia=R(()=>{if(Et.current!==null||Ot.current||!Ye.current||Nt.current!==r||xt.current)return!1;let z=yt.current?.measure();return!z||z.scroll>2||z.contentLength-z.scrollLength-z.scroll<=2||!xa.current&&Cr.current===null?!1:(Vt.current=!1,mt.current=null,kt.current=!0,Et.current=requestAnimationFrame(()=>{Et.current=null}),Ln(z.scroll),!0)},[Ln,Vt,mt,r,xt,kt,Et]),Ta=R(()=>{if(!Ye.current||Nt.current!==r)return;let z=yt.current?.measure();if(!z||xt.current)return;Re(z);let Ee=mt.current;Vt.current&&Ee!==null&&Math.abs(z.scroll-Ee)>.5&&Sa(),va();let tt=t.resolveIsAtEnd({contentLength:z.contentLength,scroll:z.scroll,scrollLength:z.scrollLength},T);tt!==void 0&&k(V===null&&tt),z.contentLength-z.scrollLength-z.scroll>2&&Ln(z.scroll),z.contentLength-z.scrollLength-z.scroll>pv?dn.current=!0:dn.current&&V&&!V.loading&&!Ot.current&&(dn.current=!1,Ca());let On=Date.now();On-Zi.current>=TU&&(Zi.current=On,qe())},[Re,T,t,Ln,k,qe,va,r,V,dn,Ca,Vt,mt,Sa,xt]),ka=N(null),jr=R(()=>{Ye.current&&ka.current===null&&(ka.current=requestAnimationFrame(()=>{ka.current=null,si()}))},[si]);W(()=>()=>{ka.current!==null&&(cancelAnimationFrame(ka.current),ka.current=null)},[r]);let ts=R(z=>{if(z===null||z===Dn.current)return;Dn.current=z;let Ee=es.current.find(tt=>tt.sectionKey===z);Ee&&uo.current&&(uo.current.textContent=Ee.text),Co.current&&Kn(!1),jr()},[Dn,jr,Kn]),ci=PI({root:wn,topInsetPx:xp,onActiveSectionChange:ts,active:G}),ch=q(()=>JS(rt),[rt]),df=nI({root:wn,inputKey:r,visible:G,index:ch,topInset:co?xp:0,bottomInset:T,interactionRows:sn,onRangeChange:ne,onSelectionChange:$n});kn.current=df,W(()=>{if(!G){qe();return}let z=requestAnimationFrame(()=>{if(!Ye.current)return;let Ee=yt.current?.node;Ee&&wa.current&&(Ee.scrollTop=Ee.scrollHeight-Ee.clientHeight),ci.refresh()});return()=>cancelAnimationFrame(z)},[qe,ci,G]);let uh=R(()=>{Kn(z=>!z)},[Kn]);Ce(()=>{if(!G)return;let z=Dn.current,Ee=z===null?void 0:es.current.find(tt=>tt.sectionKey===z);Ee&&uo.current&&(uo.current.textContent=Ee.text),jr()},[G,jr,Ho]);let cf=q(()=>{let z=yn?u(bU,{onReveal:ya,fade:_}):H!==null?u(xU,{loading:H.loading,blocked:J,onLoadEarlier:Mo,fade:_}):_?vU:hU;return co?b(ke,{children:[u("div",{style:{height:xp}}),z]}):z},[Mo,yn,co,H,J,ya,_]);W(()=>{if(!G)return;let z=requestAnimationFrame(Ta);return()=>cancelAnimationFrame(z)},[Ta,G,gt,Zt]);let Fd=q(()=>({timestampFormat:y,threadKey:r,threadRef:a,markdownCwd:h,resolvedTheme:v,workspaceRoot:x,skills:C,activeThreadEnvironmentId:i,onForkFromUserMessage:m,onImageExpand:g,onOpenFileDiff:p,onProcessDisclosureChange:ln,agentPanelModel:c,onOpenAgents:f,onInterrupt:s,onRespondToDecision:l,scheduledWakes:ge,onCancelScheduledWake:d,derive:t,SiteIcon:n,renderWorkGroup:Z,renderToolCallDetail:de,onSavePlanToWorkspace:le}),[y,r,a,h,v,x,C,i,m,g,p,ln,c,f,s,l,ge,d,t,n,Z,de,le]),fh=q(()=>({isWorking:ft,workingStepLabel:gn,stall:lt,retry:hn}),[ft,hn,lt,gn]),or=R(z=>u(NU,{rowsStore:o,rowId:z}),[o]),uf=Zt===0&&!ft&&!E;return u(un,{value:Fd,children:b(b0,{value:fh,children:[u(l0,{rowsStore:o,derive:t,paneVisible:G,totalTurnCount:me,bottomInset:T,onSelect:xo,onTurnNavigatorChange:we}),b("div",{ref:di,onClickCapture:z=>{mn.current=z.target instanceof Element?z.target.closest("button"):null},onWheelCapture:ae,onTouchMoveCapture:ae,onPointerDownCapture:z=>{z.target===yt.current?.node&&(ae(),Ia())},onKeyDownCapture:z=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(z.key)&&ae()},className:"chat-timeline relative h-full min-h-0","data-awaiting-user-decision":L?"true":"false","data-disclosure-reading":Mt?"true":void 0,"data-timeline-follow-end":qn?"true":"false","data-timeline-end-inset":T,children:[u(tI,{inputKey:r,onBeforeInputChange:pt,handleRef:$,onAttach:Gr,onInteractionRowsChange:Cn,onScroll:Ta,className:K("scrollbar-gutter-both h-full min-h-0 overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 sm:px-5",_&&"topbar-scroll-fade"),children:b("div",{style:{paddingBottom:T},onWheel:z=>{z.defaultPrevented||z.deltaY>=0||ki(z.target)||mv(z.target,yt.current?.node??null)||Ia()},onTouchStartCapture:z=>{Pe.current=z.touches[0]?.clientY??null},onTouchMove:z=>{let Ee=z.touches[0],tt=Pe.current;z.defaultPrevented||ki(z.target)||mv(z.target,yt.current?.node??null)||Ee===void 0||tt===null||Ee.clientY<=tt||Ia()&&(Pe.current=null)},onTouchEndCapture:()=>{Pe.current=null},onTouchCancelCapture:()=>{Pe.current=null},onKeyDown:z=>{z.defaultPrevented||z.repeat||z.metaKey||z.ctrlKey||z.altKey||z.shiftKey||ki(z.target)||mv(z.target,yt.current?.node??null)||!["ArrowUp","PageUp","Home"].includes(z.key)||Ia()},children:[cf,Lt.map(z=>u(xI,{sectionKey:z.key,rowKeyPrefix:r,rowIds:z.rowIds,renderRow:or,sectionRef:ci.observeSection(z.key)},`${r}:${z.key}`)),V?u(CU,{loading:V.loading,blocked:J,onLoadLater:Ca,onReturnToLatest:D}):null,wU]})}),uf?u("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:u("p",{className:"text-placeholder text-chat",children:Xe("timeline.empty")})}):null,Vr!==null?u(XI,{ref:Wr,textRef:uo,initialText:Vr,expanded:Ho,onToggleExpanded:uh}):null]})]})})});var NU=ve(function({rowsStore:t,rowId:n}){let o=EI(t,n),r=wt(un);return o===void 0?null:u(Tl,{value:o.id,children:u("div",{className:K("relative",o.kind==="message"&&o.message.role==="user"?"pb-6":o.kind==="message"&&o.message.role==="assistant"?o.copyInFooter?"pb-1 group/assistant":"pb-4 group/assistant":"pb-2"),"data-timeline-row-id":o.id,"data-timeline-row-kind":o.kind,"data-message-id":o.kind==="message"?o.message.id:void 0,"data-message-role":o.kind==="message"?o.message.role:void 0,children:b(Fl,{resetKey:o.id,fallback:y0,children:[o.kind==="turn-summary"?u(iI,{footer:o.footer,copyText:o.copyText,timestampFormat:r.timestampFormat}):null,o.kind==="tool-group"?u(vI,{entries:o.entries,groupId:o.groupId,threadKey:r.threadKey,workspaceRoot:r.workspaceRoot,onDisclosureChange:()=>r.onProcessDisclosureChange?.(o.id)}):null,o.kind==="work"?u(_U,{row:o}):null,o.kind==="model-switch"?u(JI,{row:o}):null,o.kind==="turn-identity"?u("div",{"data-turn-identity":o.turnId,className:"px-1 pt-1",children:u(cv,{badge:o.badge,createdAt:o.createdAt})}):null,o.kind==="message"&&o.message.role==="user"?u(sv,{row:o}):null,o.kind==="message"&&o.message.role==="assistant"?u(YI,{row:o}):null,o.kind==="proposed-plan"?u(OU,{row:o}):null,o.kind==="turn-plan"?u(FU,{row:o}):null,o.kind==="working"?u(BU,{row:o}):null]})})})});function _U({row:e}){let t=wt(un),n=ea(),o=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:n});return o!==void 0?u(ke,{children:o}):u("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>u(DU,{entry:r},r.id))})}function DU({entry:e}){let t=wt(un),[n,o]=Wo(t.threadKey,`work-fallback:${ap(e)}`,!1),r=e.detail??e.command??e.rawCommand??e.toolLabel?.detail;return b("div",{children:[b("button",{type:"button","aria-expanded":n,className:K("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:()=>o(!n),disabled:r===void 0,children:[u("span",{"aria-hidden":!0,className:K("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}),r!==void 0?u(rn,{"aria-hidden":!0,className:K("size-icon-1 shrink-0",!n&&"-rotate-90")}):null]}),n&&r!==void 0?u("pre",{className:"chat-tool-body mx-2 overflow-x-auto rounded-md bg-muted/40 p-2",children:r}):null]})}function OU({row:e}){let t=wt(un);return u("div",{className:"min-w-0 px-1 py-0.5",children:u(m0,{threadKey:t.threadKey,rowId:e.id,planMarkdown:e.proposedPlan.planMarkdown,environmentId:t.activeThreadEnvironmentId,threadRef:t.threadRef??void 0,cwd:t.markdownCwd,workspaceRoot:t.workspaceRoot,onSavePlanToWorkspace:t.onSavePlanToWorkspace})})}var FU=ve(function({row:t}){let n=wt(un),{t:o}=ut(),[r,a]=Wo(n.threadKey,`turn-plan:${t.id}`,!1),{steps:i}=t.turnPlan.plan,s=i.filter(f=>f.status==="completed").length,l=s===i.length,d=i.find(f=>f.status==="inProgress")?.step??i.find(f=>f.status==="pending")?.step??i.at(-1)?.step??o("proposedPlan.badge");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":r,onClick:()=>a(!r),children:[u(r?rn:Ko,{className:"size-icon-1 shrink-0 text-muted-foreground/65"}),i.length>1?u("span",{"aria-hidden":!0,className:"flex shrink-0 items-center gap-0.5",children:i.map(f=>u("span",{className:K("h-[3px] w-2.5 rounded-full",f.status==="completed"?"bg-success":f.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},f.step))}):null,u("span",{className:K("min-w-0 truncate",l?"text-muted-foreground/65":"font-medium text-foreground/85"),children:d}),i.length>1?b("span",{className:"shrink-0 text-muted-foreground/50 tabular-nums",children:[s,"/",i.length]}):null]}),r?u("div",{className:"mt-0.5 space-y-px pl-6",children:i.map(f=>b("div",{className:"flex items-baseline gap-2 text-[12px] leading-5",children:[u("span",{className:K("w-3 shrink-0 text-center font-mono text-chat-meta",f.status==="completed"?"text-success":f.status==="inProgress"?"text-primary":"text-muted-foreground/40"),"aria-hidden":!0,children:f.status==="completed"?"\u2713":f.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:K("min-w-0",f.status==="completed"?"text-muted-foreground/55":f.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:f.step})]},f.step))}):null]})});function BU({row:e}){let{workingStepLabel:t,stall:n,retry:o}=wt(b0),{t:r}=ut();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?Rc(r("activity.workingForLive"),u(KU,{createdAt:e.createdAt})):r("activity.workingNoTimer"),t&&!e.compacting?b("span",{className:"ml-2 text-muted-foreground/55",children:["\xB7 ",t]}):null]})}),o?u(zU,{retry:o}):n&&!e.compacting?u(HU,{stall:n}):null]})}function zU({retry:e}){let{t}=ut(),n=wt(un);return b(bc,{variant:"warning",className:"mt-2 px-2 py-1.5 text-chat-row",children:[u(Qf,{children:n.derive.providerRetryMessage(e,(o,r)=>t(o,r))}),n.onInterrupt?u(wc,{children:u(ie,{onClick:n.onInterrupt,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:t("stall.interrupt")})}):null]})}var UU={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function HU({stall:e}){let{t}=ut(),{onInterrupt:n}=wt(un),o=t(UU[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:Rc(t("stall.noOutputForLive"),u($U,{since:e.since}))}),u("span",{"aria-hidden":!0,children:"\xB7"}),u("span",{children:o}),n?u(ie,{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 S0(e,t){let n=ea();W(()=>{let o=()=>{t.current&&(t.current.textContent=gv(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 $U({since:e}){let t=N(null);return S0(e,t),u("span",{className:"timeline-timer tabular-nums",ref:t,children:gv(e)})}function KU({createdAt:e}){let t=N(null);return S0(e,t),u("span",{ref:t,className:"timeline-timer tabular-nums",children:gv(e)})}function qU(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));return r<60?`${r}s`:Da(r*1e3)}function gv(e){return qU(e,new Date().toISOString())??"0s"}function wp(e,t){return e===t?!0:!e||!t?!1:e.identity===t.identity&&e.instanceId===t.instanceId&&e.driverKind===t.driverKind&&e.providerDisplayName===t.providerDisplayName&&e.accentColor===t.accentColor&&e.modelLabel===t.modelLabel&&e.effortLabel===t.effortLabel}function I0(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function T0(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&&wp(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&&I0(e.entries,n.entries)}case"working":{let n=t;return e.createdAt===n.createdAt&&e.turnId===n.turnId&&e.compacting===n.compacting&&wp(e.modelBadge,n.modelBadge)}case"model-switch":{let n=t;return e.createdAt===n.createdAt&&e.pending===n.pending&&wp(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&&I0(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&&wp(e.modelBadge,n.modelBadge)}}}function VU(e,t){let n=t.historyWindow,{status:o}=t,r={activities:t.activities,timelineEntries:t.timelineEntries,latestTurn:n?null:o.latestTurn,runningTurnId:n?null:o.runningTurnId,expandedTurnIds:t.expandedTurnIds,isWorking:!n&&o.isWorking,activeTurnStartedAt:n?null:o.activeTurnStartedAt,resolveModelBadge:t.resolveModelBadge,pendingModelSelection:n?null:o.pendingModelSelection},a=e.deriveGroups(r),i=o.latestTurn;if(n&&i&&i.completedAt!==null){let s=i.turnId;if(a.rows.some(d=>d.kind==="message"?d.message.role==="assistant"&&d.message.turnId===s:d.kind==="work"?d.groupedEntries.some(c=>c.turnId===s):d.kind==="tool-group"&&d.entries.some(c=>c.turnId===s)))return e.deriveGroups({...r,latestTurn:i})}return a}var WU=new Map,GU={markdown:()=>"",download(){}},jU=[],QU={latestTurn:null,latestAssistantMessageId:null,runningTurnId:null,isWorking:!1,workingStepLabel:null,stall:null,retry:null,activeTurnStartedAt:null,totalTurnCount:null,pendingModelSelection:null,scheduledWakes:jU},XU={inputs:null,structure:{rowIds:[],sections:[]},indexById:new Map,rows:[],meta:{status:QU,usageByTurnId:WU,exportApi:GU,finalAssistantMessageReceived:!1},version:0};function YU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function JU(e,t,n,o){let r=VU(n,e),a=ZU(t.structure.rowIds,r.rows),i=a?t.indexById:new Map(r.rows.map((g,h)=>[g.id,h])),s=r.rows.map((g,h)=>{let v=a?t.rows[h]:t.rows[t.indexById.get(g.id)??-1],y=v!==void 0&&T0(v,g)?v:g;return y!==v&&o.add(g.id),y});if(!a)for(let g of t.indexById.keys())i.has(g)||o.add(g);let l=CI(s,r.turnGroups,t.structure.sections),d=a?t.structure.rowIds:s.map(g=>g.id),c=a&&YU(t.structure.sections,l)?t.structure:{rowIds:d,sections:l},f=e.derive.hasSettledAssistantMessage(e.timelineEntries,e.status.latestAssistantMessageId),p=t.meta.status===e.status&&t.meta.usageByTurnId===e.usageByTurnId&&t.meta.exportApi===e.exportApi&&t.meta.finalAssistantMessageReceived===f?t.meta:{status:e.status,usageByTurnId:e.usageByTurnId,exportApi:e.exportApi,finalAssistantMessageReceived:f},m=o.size>0||c!==t.structure||p!==t.meta;return{inputs:e,structure:c,indexById:i,rows:s,meta:p,version:m?t.version+1:t.version}}function ZU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n].id)return!1;return!0}function k0(){let e=null,t=null,n=XU,o=new Set,r=0,a=new Set,i=new Map,s=()=>{if(e===null||n.inputs===e)return n;t??=e.derive.createRowsCache();let l=new Set;n=JU(e,n,t,l);for(let d of l)o.add(d);return n};return{setInputs(l){e=l},hasInputs:()=>e!==null,flush(){if(a.size===0&&i.size===0||e===null)return;let{version:l}=s();if(l===r&&o.size===0)return;r=l;let d=[...o];o.clear();for(let c of d){let f=i.get(c);if(f!==void 0)for(let p of Array.from(f))p()}for(let c of Array.from(a))c()},subscribe(l){return a.add(l),()=>{a.delete(l)}},subscribeRow(l,d){let c=i.get(l);return c===void 0&&(c=new Set,i.set(l,c)),c.add(d),()=>{c.delete(d),c.size===0&&i.get(l)===c&&i.delete(l)}},getStructure:()=>s().structure,getRow(l){let{indexById:d,rows:c}=s(),f=d.get(l);return f===void 0?void 0:c[f]},getRows:()=>s().rows,getMeta:()=>s().meta,getVersion:()=>s().version}}he();var eH=new Set;function L0({data:e,target:t,threadKey:n,visible:o,rowsStore:r,derive:a,resolveModelBadge:i,disclosure:s,historyWindow:l}){let d=e.useChatTimeline({target:t,threadKey:n,visible:o}),c=e.useTurnStatus({target:t,threadKey:n,visible:o}),f=ea(),p=s.usePersistedExpandedTurnIds(n),[m,g]=Ht("timeline-auto-expanded-turns",n,eH),h=q(()=>a.resolveExpandedTurnIds(p??[],m),[m,a,p]),{latestTurn:v}=c,y=St("timeline-latest-turn-previous",n,v);W(()=>{let C=y.current;if(y.current=v,!(!v||C?.turnId===void 0)){if(v.turnId===C.turnId){C.state==="running"&&v.state==="interrupted"&&g(w=>{let T=new Set(w);return T.add(v.turnId),T});return}g(w=>{if(!w.has(C.turnId))return w;let T=new Set(w);return T.delete(C.turnId),T})}},[v]);let x=q(()=>({derive:a,timelineEntries:d.timelineEntries,activities:d.activities,status:c,expandedTurnIds:h,resolveModelBadge:i,historyWindow:l,usageByTurnId:d.usageByTurnId,exportApi:d.export}),[d.activities,d.export,d.timelineEntries,d.usageByTurnId,a,h,l,i,c]);return(f||!r.hasInputs())&&r.setInputs(x),Ce(()=>{r.flush()}),null}var P0=ve(function({data:t,target:n,threadKey:o,visible:r,...a}){let i=St("timeline-rows-store",o,null,3);i.current??=k0();let s=i.current;return b(ke,{children:[u(L0,{data:t,target:n,threadKey:o,visible:r,rowsStore:s,derive:a.derive,resolveModelBadge:a.resolveModelBadge,disclosure:a.disclosure,historyWindow:(a.loadLater??null)!==null}),u(w0,{...a,threadKey:o,rowsStore:s,SiteIcon:t.SiteIcon})]})});he();function A0(e){return e==="loading"?"threadSync.loading":"threadSync.syncing"}var tH=1e3;function E0(e,t=tH){let[n,o]=Q(null);return W(()=>{if(e===null){o(null);return}let r=globalThis.setTimeout(()=>{o(e)},t);return()=>{globalThis.clearTimeout(r)}},[e,t]),n}function R0({phase:e}){let{t}=ye(),n=t(A0(e));return b("div",{"aria-label":n,className:"pointer-events-none flex items-center gap-2 rounded-full border border-border/60 bg-background/90 px-3 py-1 text-xs font-medium text-foreground shadow-sm backdrop-blur","data-thread-sync-pill":"true",role:"status",children:[u(yi,{"aria-hidden":!0,className:"size-icon-2 shrink-0 text-muted-foreground"}),u("span",{className:"truncate",children:n})]})}function M0({data:e,target:t,bottomInset:n,showScrollToEnd:o,onScrollToEnd:r}){let{t:a}=ye(),i=E0(e.useThreadSyncPhase(t));return i===null&&!o?null:b("div",{className:"pointer-events-none absolute left-1/2 z-30 flex -translate-x-1/2 flex-col items-center gap-1.5 py-1.5",style:{bottom:n+4},children:[i!==null?u(R0,{phase:i}):null,o?b(ie,{onClick:r,className:"pointer-events-auto gap-1.5 rounded-full px-3 text-muted-foreground hover:text-foreground",size:"xs",variant:"glass",children:[u(rn,{}),a("timeline.scrollToEnd")]}):null]})}he();function N0(){let e=!1;return{lock:()=>{e=!0},resume:()=>{e=!1},navigate:t=>!t||!e?!1:(e=!1,!0),isLocked:()=>e}}function _0(e){return e.requestedGeneration===e.currentGeneration&&e.mode==="following-end"&&!e.readingLocked}var nH=150,oH=16;function D0(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function O0({inputKey:e,visible:t,endInset:n,derive:o,onReturnToLatest:r,controlRef:a}){let[i,s]=Ht("timeline-live-follow-enabled",e,!0),[l,d]=Ht("timeline-show-scroll-to-end",e,!1),c=Tr(e,null),[f,p]=WS(e,null),m=R(j=>{c.current=j;let Z=j?.node??null;p(de=>de===Z?de:Z)},[c,p]),g=St("timeline-is-at-end",e,!0),h=Tr(e,null),v=R(()=>{h.current!==null&&clearTimeout(h.current),h.current=null},[h]),y=R(()=>{v(),h.current=setTimeout(()=>{h.current=null,d(!0)},nH)},[v,d,h]);W(()=>v,[v]);let x=R(()=>{let j=c.current?.measure();return j==null?void 0:{contentLength:j.contentLength,scroll:j.scroll,scrollLength:j.scrollLength}},[c]),C=St("timeline-scroll-mode",e,"following-end"),w=Li(t);Ce(()=>()=>w.cancel(),[w,e]);let T=St("timeline-user-scroll-generation",e,0),S=St("timeline-live-follow-generation",e,0),L=St("timeline-disclosure-reading-lock",e,N0),k=St("timeline-last-row-id",e,null),I=R(()=>{w.cancel(),T.current+=1,C.current="free-scrolling",S.current=null,s(!1)},[w,S,C,s,T]),P=R(()=>{L.current.lock(),I(),g.current=!1,v(),d(!0)},[v,g,I,L,d]),E=N(I);E.current=I;let _=R(()=>{let j=c.current?.measure(),Z=k.current;if(!j||Z===null)return!1;let de=h0(j,Z);return de===null?!1:de>Math.max(0,j.scrollLength-n-oH)},[n,c,k]),A=R(j=>{L.current.resume();let Z=++T.current;g.current=!0,C.current="following-end",S.current=T.current,s(!0),v(),d(!1),w.request(()=>{_0({requestedGeneration:Z,currentGeneration:T.current,mode:C.current,readingLocked:L.current.isLocked()})&&c.current?.scrollToEnd({animated:j})})},[v,w,c,g,S,L,C,s,d,T]),H=N(r);H.current=r;let V=R((j=!1)=>{let Z=H.current;if(Z){Z(()=>A(j));return}A(j)},[A]),J=R(()=>V(!0),[V]),D=R(()=>{L.current.navigate(!0)&&(g.current=!1,o.resolveIsAtEnd(x(),n)===!0&&V())},[o,n,g,x,L,V]);W(()=>{if(!t||f===null)return;let j=null,Z=requestAnimationFrame(()=>{let de=()=>{E.current()},F=ge=>{let G=ge instanceof Element?ge:null;for(;G&&G!==f;){if(G instanceof HTMLElement&&G.scrollHeight>G.clientHeight+1&&G.scrollTop+G.clientHeight<G.scrollHeight-1&&/auto|scroll/u.test(getComputedStyle(G).overflowY))return!1;G=G.parentElement}return G===f},X=ge=>{L.current.isLocked()&&F(ge)&&D()},pe=null,le=!1,re=f.scrollTop,we=ge=>{pe=ge.touches[0]?.clientY??null},Xe=()=>{pe=null,le=!1},ot=()=>{let ge=f.scrollTop;le&&ge>re&&X(f),re=ge},at=()=>_(),je=()=>o.resolveIsAtEnd(x(),n)===!1,oe=ge=>{ge.deltaY>0&&X(ge.target),ge.deltaY<0&&at()&&de()},Te=ge=>{let G=ge.touches[0]?.clientY??null,Ye=pe!==null&&G!==null&&G<pe;pe=G,je()&&de(),Ye&&X(ge.target)},Y=ge=>{if(ge.target===f){le=!0,re=f.scrollTop,at()&&de();return}je()&&de()},me=ge=>{if(!(ge.target instanceof Element?ge.target:null)?.closest("input, textarea, select, [contenteditable='true'], button, [role='button']"))switch(ge.key){case"PageUp":case"Home":case"ArrowUp":at()&&de();break;case"PageDown":case"End":case"ArrowDown":X(ge.target);break;case" ":ge.shiftKey||X(ge.target);break;default:break}};f.addEventListener("wheel",oe,{passive:!0}),f.addEventListener("touchmove",Te,{passive:!0}),f.addEventListener("touchstart",we,{passive:!0}),f.addEventListener("touchend",Xe,{passive:!0}),f.addEventListener("touchcancel",Xe,{passive:!0}),f.addEventListener("scroll",ot,{passive:!0}),window.addEventListener("pointerup",Xe,{passive:!0}),window.addEventListener("pointercancel",Xe,{passive:!0}),f.addEventListener("pointerdown",Y,{passive:!0}),f.addEventListener("keydown",me),j=()=>{f.removeEventListener("wheel",oe),f.removeEventListener("touchmove",Te),f.removeEventListener("touchstart",we),f.removeEventListener("touchend",Xe),f.removeEventListener("touchcancel",Xe),f.removeEventListener("scroll",ot),window.removeEventListener("pointerup",Xe),window.removeEventListener("pointercancel",Xe),f.removeEventListener("pointerdown",Y),f.removeEventListener("keydown",me)}});return()=>{cancelAnimationFrame(Z),j?.()}},[_,o,n,e,x,L,D,f,t]);let ne=R(j=>{k.current=j},[k]),B=R(j=>{if(L.current.isLocked()){g.current=!1,v(),d(!0);return}if(!j&&S.current===T.current){v(),d(!1);return}g.current!==j&&(g.current=j,j?(C.current="following-end",S.current=T.current,s(!0),v(),d(!1)):(C.current="free-scrolling",S.current=null,y()))},[v,g,S,L,y,C,s,d,T]),U=N(V);U.current=V;let ee=q(()=>({followEnd:j=>U.current(j?.animated??!1)}),[]);return Ce(()=>(D0(a,ee),()=>D0(a,null)),[ee,a]),{liveFollowEnabled:i,showScrollToEnd:l,bindTimelineHandle:m,onRowsChange:ne,onIsAtEndChange:B,onManualNavigation:I,onDisclosureNavigation:P,returnToEnd:J}}he();he();var F0=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];var B0=50,rH=32,hv=class extends Aa{getSnapshotBeforeUpdate(t){return(t.inputKey!==this.props.inputKey||t.rows!==this.props.rows||t.expandedRows!==this.props.expandedRows||t.visible&&!this.props.visible)&&t.capture(),null}componentDidUpdate(){}componentWillUnmount(){this.props.capture()}render(){return this.props.children}};function z0(e){let t=e.getBoundingClientRect();if(e.clientHeight<=0||t.height<=0)return[];let n=e.querySelector("thead"),o=t.top+(n?.getBoundingClientRect().height??0),r=e.querySelectorAll("[data-trajectory-chunk]"),a=ws(r,o),i=[];if(a<0)return i;for(let s=a;s<r.length;s+=1){let l=r[s];if(l.getBoundingClientRect().top>=t.bottom)break;let d=l.querySelectorAll("[data-timeline-row-id]"),c=ws(d,o);if(!(c<0))for(let f=c;f<d.length;f++){let p=d[f];if(p.getBoundingClientRect().top>=t.bottom)break;i.push(p)}}return i}function aH(e){let t=[];for(let n=0;n<e.length;n+=B0)t.push(e.slice(n,n+B0));return t}function iH({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(`
3818
+ `}function p0(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 bp=1024,m0=ve(function({planMarkdown:t,threadKey:n,rowId:o,environmentId:r,threadRef:a,cwd:i,workspaceRoot:s,onSavePlanToWorkspace:l}){let{t:d}=ut(),c=d0(),[f,p]=Wo(n,`proposed-plan:${o}:expanded`,!1),[m,g]=Q(!1),[h,v]=Wo(n,`proposed-plan:${o}:save-path`,""),[y,x]=Q(!1);Of(o,m||y);let C=N(!1),w=N(!1);Ce(()=>(C.current=!0,()=>{C.current=!1}),[]);let{copyToClipboard:T,isCopied:S}=lp({target:"plan",onError:F=>{c.error(d("proposedPlan.couldNotCopy"),F,{description:d("proposedPlan.copyErrorDescription")})}}),L=Jr(),k=Cp(t)??d("proposedPlan.defaultTitle"),I=t.split(`
3819
+ `).length,P=t.length>900||I>20,E=fv(t),_=P?c0(t,d,{maxLines:10}):null,A=u0(t),H=f0(t),V=()=>{p0(A,H)},J=()=>{T(H)},D=()=>{if(!s){c.error(d("proposedPlan.workspacePathUnavailable"),d("proposedPlan.workspacePathUnavailableDescription"));return}h.length===0&&v(A.slice(0,bp)),g(!0)},ne=()=>{if(w.current)return;let F=h.trim();if(!(!s||l===null)){if(!F){c.warning(d("proposedPlan.enterWorkspacePath"));return}if(F.length>bp){c.warning(d("proposedPlan.pathTooLong"));return}w.current=!0,x(!0),(async()=>{try{let U=await l({environmentId:r,workspaceRoot:s,relativePath:F,contents:H});if(!C.current)return;U.ok?(g(!1),c.success(d("proposedPlan.savedToWorkspace"),U.relativePath)):c.error(d("proposedPlan.couldNotSave"),void 0,{description:d("proposedPlan.saveErrorDescription")})}catch(U){C.current&&c.error(d("proposedPlan.couldNotSave"),U,{description:d("proposedPlan.saveErrorDescription")})}finally{w.current=!1,C.current&&x(!1)}})()}};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(ra,{variant:"secondary",children:d("proposedPlan.badge")}),u("p",{className:"truncate text-sm font-medium text-foreground",children:k})]}),b(_o,{children:[u(Oo,{render:u(ie,{"aria-label":d("proposedPlan.actions"),size:"icon-xs",variant:"outline"}),children:u(ar,{"aria-hidden":"true",className:"size-4"})}),b(Do,{align:"end",children:[u(ir,{onClick:J,children:d(S?"proposedPlan.copied":"proposedPlan.copyToClipboard")}),u(ir,{onClick:V,children:d("proposedPlan.downloadAsMarkdown")}),l!==null?u(ir,{onClick:D,disabled:!s||y,children:d("proposedPlan.saveToWorkspace")}):null]})]})]}),b("div",{className:"mt-4",children:[b("div",{className:K("relative",P&&!f&&"max-h-104 overflow-hidden"),children:[P&&!f?u(sr,{disclosureKey:`proposed-plan:${o}:plan`,text:_??"",cwd:i,threadRef:a,isStreaming:!1}):u(sr,{disclosureKey:`proposed-plan:${o}:plan`,text:E,cwd:i,threadRef:a,isStreaming:!1}),P&&!f?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]}),P?u("div",{className:"mt-4 flex justify-center",children:u(ie,{size:"sm",variant:"outline","data-scroll-anchor-ignore":!0,onClick:()=>p(!f),children:d(f?"proposedPlan.collapse":"proposedPlan.expand")})}):null]}),u($f,{open:m,onOpenChange:F=>{y||g(F)},children:b(Wf,{className:"max-w-xl",children:[b(Vf,{children:[u(Gf,{children:d("proposedPlan.saveToWorkspace")}),u(Kf,{children:Rc(d("proposedPlan.pathHint"),u("code",{children:s??d("proposedPlan.theWorkspace")}),"path")})]}),u(CS,{className:"space-y-3",children:b("label",{htmlFor:L,className:"grid gap-1.5",children:[u("span",{className:"text-xs font-medium text-foreground",children:d("proposedPlan.workspacePath")}),u(kl,{id:L,value:h,maxLength:bp,onChange:F=>v(F.target.value.slice(0,bp)),placeholder:A,spellCheck:!1,disabled:y})]})}),b(qf,{children:[u(ie,{variant:"outline",size:"sm",onClick:()=>g(!1),disabled:y,children:d("proposedPlan.cancel")}),u(ie,{size:"sm",onClick:()=>{ne()},disabled:y,children:d(y?"proposedPlan.saving":"proposedPlan.save")})]})]})})]})});function g0({timeline:e,previousOverlayHeight:t,overlayHeight:n,followingEnd:o}){e&&o&&n>t&&e.scrollToEnd({animated:!1})}function h0(e,t){let n=e.topOf(t),o=e.heightOf(t);return typeof n!="number"||typeof o!="number"||!Number.isFinite(n)||!Number.isFinite(o)?null:n+Math.max(1,o)}function v0({measurement:e,followingEnd:t}){return t?null:e.rowAtScroll()}he();var Fl=class extends Aa{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 gU({error:e,className:t}){let{t:n}=ut();return b(Je,{children:[b(et,{render:u("div",{className:K("flex min-h-6 min-w-0 items-center gap-1.5 px-0.5 py-0.5 text-destructive",t)}),children:[u(Pn,{"aria-hidden":!0,className:"size-4 shrink-0"}),u("span",{className:"min-w-0 flex-1 truncate",children:n("timeline.entryUnavailable")})]}),u(Ze,{className:"max-w-xs whitespace-pre-wrap font-mono text-[11px]",children:e.message})]})}function y0(e){return u(gU,{error:e})}var un=bt(null),b0=bt(null),hU=u("div",{className:"h-3 sm:h-4"}),vU=u("div",{className:"h-10 sm:h-12"}),yU=Object.freeze([]);function xU({loading:e,blocked:t,onLoadEarlier:n,fade:o}){let{t:r}=ut();return u("div",{className:o?"pt-10 sm:pt-12":"pt-3 sm:pt-4",children:u("div",{className:"transcript-col pb-2",children:u("button",{type:"button",onClick:n,disabled:e||t,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:r(e?"timeline.loadingEarlier":"timeline.loadEarlier")})})})}function CU({loading:e,blocked:t,onLoadLater:n,onReturnToLatest:o}){let{t:r}=ut();return b("div",{className:"transcript-col flex items-center justify-center gap-2 py-2",children:[u(ie,{variant:"ghost",size:"sm",onClick:n,disabled:e||t,children:r(e?"timeline.loadingLater":"timeline.loadLater")}),o?u(ie,{variant:"ghost",size:"sm",onClick:o,children:r("timeline.returnToLatest")}):null]})}function bU({onReveal:e,fade:t}){let{t:n}=ut();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:n("timeline.loadEarlier")})})})}var wU=u("div",{className:"h-3 sm:h-4"}),SU=[],IU=new Set,TU=200,x0=1e4,kU=20;function C0(e,t){let n=Array.from(e.querySelectorAll("[data-timeline-turn-section]")),o=n.findIndex(a=>a.querySelector(`[data-timeline-row-id="${CSS.escape(t)}"]`)),r=o<0?n:n.slice(0,o+1);for(let a of r)a.style.contentVisibility="visible";e.offsetHeight,requestAnimationFrame(()=>{for(let a of r)a.style.removeProperty("content-visibility")})}var pv=600;function mv(e,t){if(typeof Element>"u"||!(e instanceof Element))return!1;if(t===null||!t.contains(e))return!0;for(let n=e;n&&n!==t;){if(n instanceof HTMLElement&&n.scrollHeight>n.clientHeight&&n.scrollTop>0)return!0;n=n.parentElement}return!1}var LU=()=>{},PU=[];function AU(e){let t=e.getMeta().status;return{latestTurn:t.latestTurn??null,latestAssistantMessageId:t.latestAssistantMessageId??null,isWorking:t.isWorking,workingStepLabel:t.workingStepLabel??null,stall:t.stall??null,retry:t.retry??null,totalTurnCount:t.totalTurnCount??null,scheduledWakes:t.scheduledWakes??yU}}function EU(e,t){return e.latestTurn===t.latestTurn&&e.latestAssistantMessageId===t.latestAssistantMessageId&&e.isWorking===t.isWorking&&e.workingStepLabel===t.workingStepLabel&&e.stall===t.stall&&e.retry===t.retry&&e.totalTurnCount===t.totalTurnCount&&e.scheduledWakes===t.scheduledWakes}var RU=e=>e.getMeta().finalAssistantMessageReceived;function MU(e,t){let n=N(e);return t&&(n.current=e),n.current}var w0=ve(function({derive:t,SiteIcon:n,rowsStore:o,threadKey:r,threadRef:a,environmentId:i,onInterrupt:s=null,onRespondToDecision:l=null,onCancelScheduledWake:d=null,agentPanelModel:c,onOpenAgents:f=LU,onOpenFileDiff:p,onForkFromUserMessage:m,onImageExpand:g,markdownCwd:h,resolvedTheme:v,timestampFormat:y,workspaceRoot:x,skills:C=SU,onRowsChange:w,contentInsetEndAdjustment:T,liveFollowEnabled:S,awaitingUserDecision:L=!1,onIsAtEndChange:k,onManualNavigation:I,onDisclosureNavigation:P=I,hideEmptyPlaceholder:E=!1,topFadeEnabled:_=!1,scrollerRef:A,loadEarlier:H=null,loadLater:V=null,pagingBlockedByInteraction:J=!1,onReturnToLatest:D=null,onVisibleTurnRangeChange:ne=null,revealMessageRequest:F=null,onRevealMessageHandled:U,revealQuoteRequest:ee=null,onRevealQuoteDone:j,renderWorkGroup:Z,renderToolCallDetail:de,loadScrollAnchor:B,saveScrollAnchor:X,useVisibleThreadCompletion:pe,onSavePlanToWorkspace:le,paneActive:re,onTurnNavigatorChange:we}){let{t:Xe}=ut(),{latestTurn:ot,latestAssistantMessageId:at,isWorking:je,workingStepLabel:oe,stall:Te,retry:Y,totalTurnCount:me,scheduledWakes:ge}=Ai(o,AU,EU),G=ea(),Ye=N(G);Ye.current=G;let ht=N(F);ht.current=F;let[Mt,Dt]=Ht("timeline-disclosure-reading",r,!1),Nt=N(r);Nt.current=r;let Ot=N(J);Ot.current=J;let At=St("timeline-following-end",r,!0);At.current=V===null&&S;let xt=St("timeline-scroll-restore-pending",r,!1),_t=Ir(r,null),Xt=Ir(r,null),mn=Ir(r,null),Hn=St("timeline-content-inset",r,T),vt=N(null),qt=Ir(r,[]),an=Ir(r,!1),kn=N(null),sn=R(()=>qt.current,[qt]),Cn=R(z=>{qt.current=z,kn.current?.(),Ke.current?.schedule()},[qt]),$n=R(z=>{an.current=z,Ke.current?.schedule()},[an]),$=R(z=>{z!==null&&(vt.current=z),A(z)},[A]);Ce(()=>{g0({timeline:vt.current,previousOverlayHeight:Hn.current,overlayHeight:T,followingEnd:G&&V===null&&S&&!Mt}),Hn.current=T},[T,Mt,S,V,G]),W(()=>()=>{Xt.current?.stop()},[]);let ae=R(()=>{Xt.current?.stop(),Xt.current=null,_t.current=null,Dt(!1)},[_t,Xt,Dt]),ce=R(z=>{P(),_t.current=z,Dt(!0),Xt.current?.stop();let Ee=vt.current?.node??null;if(!Ee)return;let tt=Array.from(Ee.querySelectorAll("[data-timeline-row-id]")).find(On=>On.dataset.timelineRowId===z);if(!tt)return;let Yt=mn.current;Xt.current=yI({viewport:Ee,row:tt,anchor:Yt&&tt.contains(Yt)?Yt:tt,scrollToOffset:On=>{Ee.scrollTop=On}})},[P]),Le=St("timeline-live-follow-previous",r,S);Ce(()=>{S&&!Le.current&&ae(),Le.current=S},[S,ae]);let ze=MU(V!==null,G),ft=!ze&&je,gn=ze?null:oe,lt=ze?null:Te,hn=ze?null:Y,Ft=AI(o),rt=Ft.sections,Zt=Ft.rowIds.length,ln=R(z=>{let Ee=o.getRows().find(tt=>tt.id===z||tt.kind==="work"&&tt.groupedEntries.some(Yt=>Yt.id===z)||tt.kind==="tool-group"&&tt.entries.some(Yt=>Yt.id===z));ce(Ee?.id??z)},[o,ce]),Se=St("timeline-scroll-snapshot",r,null),Re=R((z,Ee=At.current)=>{z.scrollLength<=0||(Se.current={threadKey:r,anchor:v0({measurement:z,followingEnd:Ee})})},[At,r,Se]),qe=R(()=>{let z=Se.current;z&&X(z.threadKey,z.anchor)},[X,Se]),pt=R(()=>{if(!G||xt.current)return;if(Zt===0){qe();return}let z=vt.current?.measure();z&&z.scrollLength>0&&(Re(z,At.current&&t.resolveIsAtEnd(z,T)!==!1),qe())},[Re,T,t,At,G,qe,xt,Zt]),st=wI(r),it=N(st);it.current=st;let kt=St("timeline-top-reveal-armed",r,!0),Vt=St("timeline-network-prepend-awaiting-navigation",r,!1),Pe=N(null),Et=N(null);Ce(()=>()=>{Et.current!==null&&(cancelAnimationFrame(Et.current),Et.current=null)},[r,G]);let yt=St("timeline-network-prepend-scroll-top",r,null),on=St("timeline-mounted-section-keys",r,IU,3),Nn=Ir(r,null),xe=Nn.current,Ve=xe===null?-1:rt.findIndex(z=>z.key===xe.firstMountedSectionKey),Ct=Ve>0?rt.length-Math.max(0,Ve-ev):st.revealedCount,ct=Ve>0?Ct:st.revealedCount,vn=ZS(rt.map(z=>z.key),on.current,ct,V!==null||!S||Mt||an.current||qt.current.length>0),{startIndex:bn,hasHiddenOlder:yn}=bI(rt.length,vn),Lt=q(()=>rt.slice(bn),[bn,rt]),xn=xe!==null&&Ve>0&&bn<Ve,Wt=N(rt);Wt.current=rt,Ce(()=>{if(G){if(on.current=new Set(Lt.map(z=>z.key)),xe!==null){let z=SI(xe,{prefixMounted:xn,loading:H===null?null:H.loading,sections:rt,now:Date.now()});z!=="waiting"&&(Nn.current=null),z==="mounted"&&(Vt.current=!0)}vn<it.current.revealedCount?it.current.compactTo(vn):vn>it.current.revealedCount&&it.current.revealAtLeast(vn)}},[Vt,H,G,xe,xn,Nn,on,vn,rt,Lt]);let An=Ir(r,null),eo=R((z=null)=>{if(!Ye.current)return;let Ee=vt.current?.node;Ee&&(An.current={scrollHeight:Ee.scrollHeight,scrollTop:Ee.scrollTop,row:vt.current?.measure()?.rowAtScroll()??null,firstMountedSectionKey:z,until:Date.now()+x0})},[An]),va=R(()=>{let z=An.current;if(z===null||z.firstMountedSectionKey===null||Date.now()>z.until)return;let Ee=vt.current?.node;if(!Ee)return;let tt=Se.current;z.scrollHeight=Ee.scrollHeight,z.scrollTop=Ee.scrollTop,z.row=tt?.threadKey===r?tt.anchor:null},[An,r,Se]);Ce(()=>{if(!G)return;let z=An.current;if(!z)return;if(Date.now()>z.until){An.current=null;return}if(z.firstMountedSectionKey!==null&&Nn.current!==null)return;An.current=null;let Ee=vt.current?.node;if(Ee){if(z.row){C0(Ee,z.row.rowId);let tt=vt.current?.measure()?.topOf(z.row.rowId);tt!=null&&(Ee.scrollTop=tt+z.row.offsetPx)}else Ee.scrollTop=z.scrollTop+(Ee.scrollHeight-z.scrollHeight);xn&&(yt.current=Ee.scrollTop)}},[yt,G,xe,xn,bn,Ft]);let ya=R(()=>{eo(),it.current.revealOlder()},[eo]),He=N(ya);He.current=ya;let xa=N(yn);xa.current=yn;let xr=N(null),Kr=St("timeline-scroll-restore",r,void 0);if(Kr.current===void 0&&Zt>0){let z=B(r);Kr.current=z!==null&&Ft.rowIds.includes(z.rowId)?z:null}let _n=Kr.current??null,tr=N(()=>{}),[Ro,ii]=Ht("timeline-scroll-restore-settled",r,!1),cl=_n!==null&&!Ro,Zi=St("timeline-last-anchor-save",r,0);W(()=>{let z=_n;if(!G||Ro||z===null)return;if(ht.current!==null){ii(!0);return}let Ee=null,tt=requestAnimationFrame(()=>{!Ye.current||Nt.current!==r||(I(),it.current.revealAtLeast(Ol(Wt.current,z.rowId,it.current.revealedCount)),Ee=requestAnimationFrame(()=>{!Ye.current||Nt.current!==r||(ii(!0),tr.current(z.rowId,-z.offsetPx))}))});return()=>{cancelAnimationFrame(tt),Ee!==null&&cancelAnimationFrame(Ee)}},[I,G,r,_n,Ro]);let to=St("timeline-restore-after-presentation",r,!1),mt=cl||to.current;xt.current=mt,Ce(()=>{if(G)return()=>{Nt.current!==r?qe():pt(),to.current=!0}},[G,r]),Ce(()=>{if(!G||!to.current)return;if(ht.current!==null){to.current=!1,xt.current=!1;return}let z=null,Ee=null,tt=()=>{!Ye.current||Nt.current!==r||(vt.current?.scrollToEnd(),to.current=!1,xt.current=!1,At.current=V===null,wa.current=V===null,no.current={...no.current,followEnabled:!0,restoreInProgress:!1},k(V===null))},Yt=B(r),On=Yt!==null&&Wt.current.some(ui=>ui.rowIds.includes(Yt.rowId));return Yt===null?z=requestAnimationFrame(tt):On?(I(),it.current.revealAtLeast(Ol(Wt.current,Yt.rowId,it.current.revealedCount)),z=requestAnimationFrame(()=>{Ee=requestAnimationFrame(()=>{!Ye.current||Nt.current!==r||(tr.current(Yt.rowId,-Yt.offsetPx),to.current=!1,xt.current=!1)})})):Zt>0&&(z=requestAnimationFrame(tt)),()=>{z!==null&&cancelAnimationFrame(z),Ee!==null&&cancelAnimationFrame(Ee)}},[B,V,k,I,G,r,Zt,rt.length]);let xo=R(z=>{ae(),I(),it.current.revealAtLeast(Ol(Wt.current,z.anchorRowId,it.current.revealedCount));let Ee=r;requestAnimationFrame(()=>{Nt.current===Ee&&tr.current(z.anchorRowId,24)})},[I,ae,r]);W(()=>{if(F===null||!G)return;ae(),I();let z=t.resolveToolGroupRevealRowId(o.getRows(),F.rowId);it.current.revealAtLeast(Ol(Wt.current,z,it.current.revealedCount));let Ee=requestAnimationFrame(()=>{Nt.current===r&&(tr.current(z,24),U?.())});return()=>cancelAnimationFrame(Ee)},[F,G,I,ae,U,t,r,o]);let zo=N(null);W(()=>{if(ee===null||!G)return;let z=zo.current;if((z===null||z.request!==ee)&&(z={request:ee,pages:0,done:!1},zo.current=z),z.done)return;let{quote:Ee}=ee,tt=Ee.messageId;if(!o.getRows().some(Yt=>Yt.id===tt)){if(H?.loading)return;let Yt=xr.current;if(Yt!==null&&z.pages<kU){z.pages+=1,Yt();return}z.done=!0,j?.("message-missing");return}z.done=!0,ae(),I(),it.current.revealAtLeast(Ol(Wt.current,tt,it.current.revealedCount)),requestAnimationFrame(()=>{Nt.current===r&&(tr.current(tt,24),requestAnimationFrame(()=>{let Yt=vt.current?.node?.querySelector(`[data-timeline-row-id="${CSS.escape(tt)}"]`),On=Yt?TI(Yt,Ee):null,ui=vt.current?.node;if(On&&ui){let ph=On.getBoundingClientRect().top-ui.getBoundingClientRect().top-ui.clientHeight/3;vt.current?.scrollToOffset(ui.scrollTop+ph)}On&&kI(On),j?.(On?"found":"passage-missing")}))})},[ee,G,Ft,H,o,j,I,ae,r]);let Ae=R(z=>G?r0(z,t):PU,[t,G]),Uo=Ai(o,Ae,a0),es=N(Uo);es.current=Uo;let Dn=St("timeline-active-header",r,null),qr=Uo.at(-1)?.text??null,co=qr!==null,Vr=N(null),uo=N(null),[Ho,Kn]=Ht("timeline-pinned-header-expanded",r,!1),Co=N(Ho);Co.current=Ho;let si=R(()=>{if(!Ye.current)return;let z=Vr.current,Ee=uo.current;!z||!Ee||(z.dataset.truncated=Co.current||Ee.scrollWidth>Ee.clientWidth+1?"true":"false")},[]),[li,di]=Q(null),nr=Ai(o,RU),[wn,Wr]=Q(null),Mo=R(()=>{if(Ot.current||Nt.current!==r||H===null||H.loading)return;let z=Lt[0]?.key;z!==void 0&&(eo(z),Nn.current={firstMountedSectionKey:z,loadingObserved:!1,sectionsWhileLoading:Wt.current,until:Date.now()+x0},H.onLoadEarlier())},[eo,H,Nn,r,Lt]);xr.current=H===null||H.loading||J?null:Mo;let Ca=R(()=>{Ot.current||Nt.current!==r||(eo(),V?.onLoadLater())},[eo,V,r]),ba=R((z,Ee)=>{if(!Ye.current)return;let tt=vt.current?.node;tt&&(C0(tt,z),vt.current?.scrollToRow(z,{viewOffset:Ee}))},[]);tr.current=ba;let qn=G&&V===null&&S&&!Mt&&!mt,wa=N(qn);wa.current=qn;let no=N({followEnabled:qn,restoreInProgress:mt,loadEarlier:H});no.current={followEnabled:qn,restoreInProgress:mt,loadEarlier:H};let Ke=N(null);W(()=>{if(!wn||!G)return;let z=LI({root:wn,minimumCount:ws,keepAbovePx:pv,canCompact:()=>{let Ee=no.current,tt=An.current;return Ee.followEnabled&&qt.current.length===0&&!Ee.restoreInProgress&&!Ee.loadEarlier?.loading&&!(tt&&tt.until>Date.now())&&it.current.revealedCount>ws},onCompact:Ee=>{kt.current=!0,eo(),it.current.compactTo(Ee)}});return Ke.current=z,()=>{z.disconnect(),Ke.current=null}},[eo,G,wn]),W(()=>{Ke.current?.schedule()},[qn,H?.loading,st.revealedCount,rt.length]),W(()=>{if(!wn||!G||typeof ResizeObserver>"u")return;let z=()=>{if(!Ye.current||!wa.current)return;let Yt=wn.scrollHeight-wn.clientHeight;Math.abs(wn.scrollTop-Yt)>.5&&(wn.scrollTop=Yt)},Ee=new ResizeObserver(z);Ee.observe(wn);let tt=wn.firstElementChild;return tt&&Ee.observe(tt),()=>Ee.disconnect()},[G,wn]),pe({viewport:li,viewActive:re&&G,threadKey:r,completedAt:V===null&&!mt&&ot?.state==="completed"&&nr?ot.completedAt:null,messageId:at,bottomInset:T});let Bt=Ft.rowIds.at(-1)??null;W(()=>{w?.(Bt)},[Bt,w,r]);let dn=St("timeline-later-load-armed",r,!0),Ln=R(z=>{if(z>pv){kt.current=!0;return}if(kt.current){if(kt.current=!1,xa.current){He.current();return}xr.current?.()}},[kt]),Sa=R(()=>{Vt.current&&(Vt.current=!1,yt.current=null,kt.current=!0)},[Vt,yt,kt]),Ia=R(()=>{if(Et.current!==null||Ot.current||!Ye.current||Nt.current!==r||xt.current)return!1;let z=vt.current?.measure();return!z||z.scroll>2||z.contentLength-z.scrollLength-z.scroll<=2||!xa.current&&xr.current===null?!1:(Vt.current=!1,yt.current=null,kt.current=!0,Et.current=requestAnimationFrame(()=>{Et.current=null}),Ln(z.scroll),!0)},[Ln,Vt,yt,r,xt,kt,Et]),Ta=R(()=>{if(!Ye.current||Nt.current!==r)return;let z=vt.current?.measure();if(!z||xt.current)return;Re(z);let Ee=yt.current;Vt.current&&Ee!==null&&Math.abs(z.scroll-Ee)>.5&&Sa(),va();let tt=t.resolveIsAtEnd({contentLength:z.contentLength,scroll:z.scroll,scrollLength:z.scrollLength},T);tt!==void 0&&k(V===null&&tt),z.contentLength-z.scrollLength-z.scroll>2&&Ln(z.scroll),z.contentLength-z.scrollLength-z.scroll>pv?dn.current=!0:dn.current&&V&&!V.loading&&!Ot.current&&(dn.current=!1,Ca());let On=Date.now();On-Zi.current>=TU&&(Zi.current=On,qe())},[Re,T,t,Ln,k,qe,va,r,V,dn,Ca,Vt,yt,Sa,xt]),ka=N(null),Gr=R(()=>{Ye.current&&ka.current===null&&(ka.current=requestAnimationFrame(()=>{ka.current=null,si()}))},[si]);W(()=>()=>{ka.current!==null&&(cancelAnimationFrame(ka.current),ka.current=null)},[r]);let ts=R(z=>{if(z===null||z===Dn.current)return;Dn.current=z;let Ee=es.current.find(tt=>tt.sectionKey===z);Ee&&uo.current&&(uo.current.textContent=Ee.text),Co.current&&Kn(!1),Gr()},[Dn,Gr,Kn]),ci=PI({root:wn,topInsetPx:xp,onActiveSectionChange:ts,active:G}),ch=q(()=>JS(rt),[rt]),df=nI({root:wn,inputKey:r,visible:G,index:ch,topInset:co?xp:0,bottomInset:T,interactionRows:sn,onRangeChange:ne,onSelectionChange:$n});kn.current=df,W(()=>{if(!G){qe();return}let z=requestAnimationFrame(()=>{if(!Ye.current)return;let Ee=vt.current?.node;Ee&&wa.current&&(Ee.scrollTop=Ee.scrollHeight-Ee.clientHeight),ci.refresh()});return()=>cancelAnimationFrame(z)},[qe,ci,G]);let uh=R(()=>{Kn(z=>!z)},[Kn]);Ce(()=>{if(!G)return;let z=Dn.current,Ee=z===null?void 0:es.current.find(tt=>tt.sectionKey===z);Ee&&uo.current&&(uo.current.textContent=Ee.text),Gr()},[G,Gr,Ho]);let cf=q(()=>{let z=yn?u(bU,{onReveal:ya,fade:_}):H!==null?u(xU,{loading:H.loading,blocked:J,onLoadEarlier:Mo,fade:_}):_?vU:hU;return co?b(ke,{children:[u("div",{style:{height:xp}}),z]}):z},[Mo,yn,co,H,J,ya,_]);W(()=>{if(!G)return;let z=requestAnimationFrame(Ta);return()=>cancelAnimationFrame(z)},[Ta,G,mt,Zt]);let Fd=q(()=>({timestampFormat:y,threadKey:r,threadRef:a,markdownCwd:h,resolvedTheme:v,workspaceRoot:x,skills:C,activeThreadEnvironmentId:i,onForkFromUserMessage:m,onImageExpand:g,onOpenFileDiff:p,onProcessDisclosureChange:ln,agentPanelModel:c,onOpenAgents:f,onInterrupt:s,onRespondToDecision:l,scheduledWakes:ge,onCancelScheduledWake:d,derive:t,SiteIcon:n,renderWorkGroup:Z,renderToolCallDetail:de,onSavePlanToWorkspace:le}),[y,r,a,h,v,x,C,i,m,g,p,ln,c,f,s,l,ge,d,t,n,Z,de,le]),fh=q(()=>({isWorking:ft,workingStepLabel:gn,stall:lt,retry:hn}),[ft,hn,lt,gn]),jr=R(z=>u(NU,{rowsStore:o,rowId:z}),[o]),uf=Zt===0&&!ft&&!E;return u(un,{value:Fd,children:b(b0,{value:fh,children:[u(l0,{rowsStore:o,derive:t,paneVisible:G,totalTurnCount:me,bottomInset:T,onSelect:xo,onTurnNavigatorChange:we}),b("div",{ref:di,onClickCapture:z=>{mn.current=z.target instanceof Element?z.target.closest("button"):null},onWheelCapture:ae,onTouchMoveCapture:ae,onPointerDownCapture:z=>{z.target===vt.current?.node&&(ae(),Ia())},onKeyDownCapture:z=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"].includes(z.key)&&ae()},className:"chat-timeline relative h-full min-h-0","data-awaiting-user-decision":L?"true":"false","data-disclosure-reading":Mt?"true":void 0,"data-timeline-follow-end":qn?"true":"false","data-timeline-end-inset":T,children:[u(tI,{inputKey:r,onBeforeInputChange:pt,handleRef:$,onAttach:Wr,onInteractionRowsChange:Cn,onScroll:Ta,className:K("scrollbar-gutter-both h-full min-h-0 overflow-y-auto overflow-x-hidden overscroll-y-contain px-3 sm:px-5",_&&"topbar-scroll-fade"),children:b("div",{style:{paddingBottom:T},onWheel:z=>{z.defaultPrevented||z.deltaY>=0||ki(z.target)||mv(z.target,vt.current?.node??null)||Ia()},onTouchStartCapture:z=>{Pe.current=z.touches[0]?.clientY??null},onTouchMove:z=>{let Ee=z.touches[0],tt=Pe.current;z.defaultPrevented||ki(z.target)||mv(z.target,vt.current?.node??null)||Ee===void 0||tt===null||Ee.clientY<=tt||Ia()&&(Pe.current=null)},onTouchEndCapture:()=>{Pe.current=null},onTouchCancelCapture:()=>{Pe.current=null},onKeyDown:z=>{z.defaultPrevented||z.repeat||z.metaKey||z.ctrlKey||z.altKey||z.shiftKey||ki(z.target)||mv(z.target,vt.current?.node??null)||!["ArrowUp","PageUp","Home"].includes(z.key)||Ia()},children:[cf,Lt.map(z=>u(xI,{sectionKey:z.key,rowKeyPrefix:r,rowIds:z.rowIds,renderRow:jr,sectionRef:ci.observeSection(z.key)},`${r}:${z.key}`)),V?u(CU,{loading:V.loading,blocked:J,onLoadLater:Ca,onReturnToLatest:D}):null,wU]})}),uf?u("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:u("p",{className:"text-placeholder text-chat",children:Xe("timeline.empty")})}):null,qr!==null?u(XI,{ref:Vr,textRef:uo,initialText:qr,expanded:Ho,onToggleExpanded:uh}):null]})]})})});var NU=ve(function({rowsStore:t,rowId:n}){let o=EI(t,n),r=wt(un);return o===void 0?null:u(Tl,{value:o.id,children:u("div",{className:K("relative",o.kind==="message"&&o.message.role==="user"?"pb-6":o.kind==="message"&&o.message.role==="assistant"?o.copyInFooter?"pb-1 group/assistant":"pb-4 group/assistant":"pb-2"),"data-timeline-row-id":o.id,"data-timeline-row-kind":o.kind,"data-message-id":o.kind==="message"?o.message.id:void 0,"data-message-role":o.kind==="message"?o.message.role:void 0,children:b(Fl,{resetKey:o.id,fallback:y0,children:[o.kind==="turn-summary"?u(iI,{footer:o.footer,copyText:o.copyText,timestampFormat:r.timestampFormat}):null,o.kind==="tool-group"?u(vI,{entries:o.entries,groupId:o.groupId,threadKey:r.threadKey,workspaceRoot:r.workspaceRoot,onDisclosureChange:()=>r.onProcessDisclosureChange?.(o.id)}):null,o.kind==="work"?u(_U,{row:o}):null,o.kind==="model-switch"?u(JI,{row:o}):null,o.kind==="turn-identity"?u("div",{"data-turn-identity":o.turnId,className:"px-1 pt-1",children:u(cv,{badge:o.badge,createdAt:o.createdAt})}):null,o.kind==="message"&&o.message.role==="user"?u(sv,{row:o}):null,o.kind==="message"&&o.message.role==="assistant"?u(YI,{row:o}):null,o.kind==="proposed-plan"?u(OU,{row:o}):null,o.kind==="turn-plan"?u(FU,{row:o}):null,o.kind==="working"?u(BU,{row:o}):null]})})})});function _U({row:e}){let t=wt(un),n=ea(),o=t.renderWorkGroup?.({row:e,threadRef:t.threadRef,visible:n});return o!==void 0?u(ke,{children:o}):u("div",{className:"min-w-0 space-y-px py-0.5",children:e.groupedEntries.map(r=>u(DU,{entry:r},r.id))})}function DU({entry:e}){let t=wt(un),[n,o]=Wo(t.threadKey,`work-fallback:${ap(e)}`,!1),r=e.detail??e.command??e.rawCommand??e.toolLabel?.detail;return b("div",{children:[b("button",{type:"button","aria-expanded":n,className:K("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:()=>o(!n),disabled:r===void 0,children:[u("span",{"aria-hidden":!0,className:K("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}),r!==void 0?u(rn,{"aria-hidden":!0,className:K("size-icon-1 shrink-0",!n&&"-rotate-90")}):null]}),n&&r!==void 0?u("pre",{className:"chat-tool-body mx-2 overflow-x-auto rounded-md bg-muted/40 p-2",children:r}):null]})}function OU({row:e}){let t=wt(un);return u("div",{className:"min-w-0 px-1 py-0.5",children:u(m0,{threadKey:t.threadKey,rowId:e.id,planMarkdown:e.proposedPlan.planMarkdown,environmentId:t.activeThreadEnvironmentId,threadRef:t.threadRef??void 0,cwd:t.markdownCwd,workspaceRoot:t.workspaceRoot,onSavePlanToWorkspace:t.onSavePlanToWorkspace})})}var FU=ve(function({row:t}){let n=wt(un),{t:o}=ut(),[r,a]=Wo(n.threadKey,`turn-plan:${t.id}`,!1),{steps:i}=t.turnPlan.plan,s=i.filter(f=>f.status==="completed").length,l=s===i.length,d=i.find(f=>f.status==="inProgress")?.step??i.find(f=>f.status==="pending")?.step??i.at(-1)?.step??o("proposedPlan.badge");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":r,onClick:()=>a(!r),children:[u(r?rn:Ko,{className:"size-icon-1 shrink-0 text-muted-foreground/65"}),i.length>1?u("span",{"aria-hidden":!0,className:"flex shrink-0 items-center gap-0.5",children:i.map(f=>u("span",{className:K("h-[3px] w-2.5 rounded-full",f.status==="completed"?"bg-success":f.status==="inProgress"?"bg-primary":"bg-muted-foreground/25")},f.step))}):null,u("span",{className:K("min-w-0 truncate",l?"text-muted-foreground/65":"font-medium text-foreground/85"),children:d}),i.length>1?b("span",{className:"shrink-0 text-muted-foreground/50 tabular-nums",children:[s,"/",i.length]}):null]}),r?u("div",{className:"mt-0.5 space-y-px pl-6",children:i.map(f=>b("div",{className:"flex items-baseline gap-2 text-[12px] leading-5",children:[u("span",{className:K("w-3 shrink-0 text-center font-mono text-chat-meta",f.status==="completed"?"text-success":f.status==="inProgress"?"text-primary":"text-muted-foreground/40"),"aria-hidden":!0,children:f.status==="completed"?"\u2713":f.status==="inProgress"?"\u25CF":"\u25CB"}),u("span",{className:K("min-w-0",f.status==="completed"?"text-muted-foreground/55":f.status==="inProgress"?"text-foreground/90":"text-muted-foreground/70"),children:f.step})]},f.step))}):null]})});function BU({row:e}){let{workingStepLabel:t,stall:n,retry:o}=wt(b0),{t:r}=ut();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?Rc(r("activity.workingForLive"),u(KU,{createdAt:e.createdAt})):r("activity.workingNoTimer"),t&&!e.compacting?b("span",{className:"ml-2 text-muted-foreground/55",children:["\xB7 ",t]}):null]})}),o?u(zU,{retry:o}):n&&!e.compacting?u(HU,{stall:n}):null]})}function zU({retry:e}){let{t}=ut(),n=wt(un);return b(bc,{variant:"warning",className:"mt-2 px-2 py-1.5 text-chat-row",children:[u(Qf,{children:n.derive.providerRetryMessage(e,(o,r)=>t(o,r))}),n.onInterrupt?u(wc,{children:u(ie,{onClick:n.onInterrupt,size:"sm",variant:"ghost",title:t("stall.interruptHint"),children:t("stall.interrupt")})}):null]})}var UU={childThread:"stall.reasonChildThread",tool:"stall.reasonTool",approval:"stall.reasonApproval",userInput:"stall.reasonUserInput",model:"stall.reasonModel"};function HU({stall:e}){let{t}=ut(),{onInterrupt:n}=wt(un),o=t(UU[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:Rc(t("stall.noOutputForLive"),u($U,{since:e.since}))}),u("span",{"aria-hidden":!0,children:"\xB7"}),u("span",{children:o}),n?u(ie,{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 S0(e,t){let n=ea();W(()=>{let o=()=>{t.current&&(t.current.textContent=gv(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 $U({since:e}){let t=N(null);return S0(e,t),u("span",{className:"timeline-timer tabular-nums",ref:t,children:gv(e)})}function KU({createdAt:e}){let t=N(null);return S0(e,t),u("span",{ref:t,className:"timeline-timer tabular-nums",children:gv(e)})}function qU(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));return r<60?`${r}s`:Da(r*1e3)}function gv(e){return qU(e,new Date().toISOString())??"0s"}function wp(e,t){return e===t?!0:!e||!t?!1:e.identity===t.identity&&e.instanceId===t.instanceId&&e.driverKind===t.driverKind&&e.providerDisplayName===t.providerDisplayName&&e.accentColor===t.accentColor&&e.modelLabel===t.modelLabel&&e.effortLabel===t.effortLabel}function I0(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function T0(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&&wp(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&&I0(e.entries,n.entries)}case"working":{let n=t;return e.createdAt===n.createdAt&&e.turnId===n.turnId&&e.compacting===n.compacting&&wp(e.modelBadge,n.modelBadge)}case"model-switch":{let n=t;return e.createdAt===n.createdAt&&e.pending===n.pending&&wp(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&&I0(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&&wp(e.modelBadge,n.modelBadge)}}}function VU(e,t){let n=t.historyWindow,{status:o}=t,r={activities:t.activities,timelineEntries:t.timelineEntries,latestTurn:n?null:o.latestTurn,runningTurnId:n?null:o.runningTurnId,expandedTurnIds:t.expandedTurnIds,isWorking:!n&&o.isWorking,activeTurnStartedAt:n?null:o.activeTurnStartedAt,resolveModelBadge:t.resolveModelBadge,pendingModelSelection:n?null:o.pendingModelSelection},a=e.deriveGroups(r),i=o.latestTurn;if(n&&i&&i.completedAt!==null){let s=i.turnId;if(a.rows.some(d=>d.kind==="message"?d.message.role==="assistant"&&d.message.turnId===s:d.kind==="work"?d.groupedEntries.some(c=>c.turnId===s):d.kind==="tool-group"&&d.entries.some(c=>c.turnId===s)))return e.deriveGroups({...r,latestTurn:i})}return a}var WU=new Map,GU={markdown:()=>"",download(){}},jU=[],QU={latestTurn:null,latestAssistantMessageId:null,runningTurnId:null,isWorking:!1,workingStepLabel:null,stall:null,retry:null,activeTurnStartedAt:null,totalTurnCount:null,pendingModelSelection:null,scheduledWakes:jU},XU={inputs:null,structure:{rowIds:[],sections:[]},indexById:new Map,rows:[],meta:{status:QU,usageByTurnId:WU,exportApi:GU,finalAssistantMessageReceived:!1},version:0};function YU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function JU(e,t,n,o){let r=VU(n,e),a=ZU(t.structure.rowIds,r.rows),i=a?t.indexById:new Map(r.rows.map((g,h)=>[g.id,h])),s=r.rows.map((g,h)=>{let v=a?t.rows[h]:t.rows[t.indexById.get(g.id)??-1],y=v!==void 0&&T0(v,g)?v:g;return y!==v&&o.add(g.id),y});if(!a)for(let g of t.indexById.keys())i.has(g)||o.add(g);let l=CI(s,r.turnGroups,t.structure.sections),d=a?t.structure.rowIds:s.map(g=>g.id),c=a&&YU(t.structure.sections,l)?t.structure:{rowIds:d,sections:l},f=e.derive.hasSettledAssistantMessage(e.timelineEntries,e.status.latestAssistantMessageId),p=t.meta.status===e.status&&t.meta.usageByTurnId===e.usageByTurnId&&t.meta.exportApi===e.exportApi&&t.meta.finalAssistantMessageReceived===f?t.meta:{status:e.status,usageByTurnId:e.usageByTurnId,exportApi:e.exportApi,finalAssistantMessageReceived:f},m=o.size>0||c!==t.structure||p!==t.meta;return{inputs:e,structure:c,indexById:i,rows:s,meta:p,version:m?t.version+1:t.version}}function ZU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n].id)return!1;return!0}function k0(){let e=null,t=null,n=XU,o=new Set,r=0,a=new Set,i=new Map,s=()=>{if(e===null||n.inputs===e)return n;t??=e.derive.createRowsCache();let l=new Set;n=JU(e,n,t,l);for(let d of l)o.add(d);return n};return{setInputs(l){e=l},hasInputs:()=>e!==null,flush(){if(a.size===0&&i.size===0||e===null)return;let{version:l}=s();if(l===r&&o.size===0)return;r=l;let d=[...o];o.clear();for(let c of d){let f=i.get(c);if(f!==void 0)for(let p of Array.from(f))p()}for(let c of Array.from(a))c()},subscribe(l){return a.add(l),()=>{a.delete(l)}},subscribeRow(l,d){let c=i.get(l);return c===void 0&&(c=new Set,i.set(l,c)),c.add(d),()=>{c.delete(d),c.size===0&&i.get(l)===c&&i.delete(l)}},getStructure:()=>s().structure,getRow(l){let{indexById:d,rows:c}=s(),f=d.get(l);return f===void 0?void 0:c[f]},getRows:()=>s().rows,getMeta:()=>s().meta,getVersion:()=>s().version}}he();var eH=new Set;function L0({data:e,target:t,threadKey:n,visible:o,rowsStore:r,derive:a,resolveModelBadge:i,disclosure:s,historyWindow:l}){let d=e.useChatTimeline({target:t,threadKey:n,visible:o}),c=e.useTurnStatus({target:t,threadKey:n,visible:o}),f=ea(),p=s.usePersistedExpandedTurnIds(n),[m,g]=Ht("timeline-auto-expanded-turns",n,eH),h=q(()=>a.resolveExpandedTurnIds(p??[],m),[m,a,p]),{latestTurn:v}=c,y=St("timeline-latest-turn-previous",n,v);W(()=>{let C=y.current;if(y.current=v,!(!v||C?.turnId===void 0)){if(v.turnId===C.turnId){C.state==="running"&&v.state==="interrupted"&&g(w=>{let T=new Set(w);return T.add(v.turnId),T});return}g(w=>{if(!w.has(C.turnId))return w;let T=new Set(w);return T.delete(C.turnId),T})}},[v]);let x=q(()=>({derive:a,timelineEntries:d.timelineEntries,activities:d.activities,status:c,expandedTurnIds:h,resolveModelBadge:i,historyWindow:l,usageByTurnId:d.usageByTurnId,exportApi:d.export}),[d.activities,d.export,d.timelineEntries,d.usageByTurnId,a,h,l,i,c]);return(f||!r.hasInputs())&&r.setInputs(x),Ce(()=>{r.flush()}),null}var P0=ve(function({data:t,target:n,threadKey:o,visible:r,...a}){let i=St("timeline-rows-store",o,null,3);i.current??=k0();let s=i.current;return b(ke,{children:[u(L0,{data:t,target:n,threadKey:o,visible:r,rowsStore:s,derive:a.derive,resolveModelBadge:a.resolveModelBadge,disclosure:a.disclosure,historyWindow:(a.loadLater??null)!==null}),u(w0,{...a,threadKey:o,rowsStore:s,SiteIcon:t.SiteIcon})]})});he();function A0(e){return e==="loading"?"threadSync.loading":"threadSync.syncing"}var tH=1e3;function E0(e,t=tH){let[n,o]=Q(null);return W(()=>{if(e===null){o(null);return}let r=globalThis.setTimeout(()=>{o(e)},t);return()=>{globalThis.clearTimeout(r)}},[e,t]),n}function R0({phase:e}){let{t}=ye(),n=t(A0(e));return b("div",{"aria-label":n,className:"pointer-events-none flex items-center gap-2 rounded-full border border-border/60 bg-background/90 px-3 py-1 text-xs font-medium text-foreground shadow-sm backdrop-blur","data-thread-sync-pill":"true",role:"status",children:[u(yi,{"aria-hidden":!0,className:"size-icon-2 shrink-0 text-muted-foreground"}),u("span",{className:"truncate",children:n})]})}function M0({data:e,target:t,bottomInset:n,showScrollToEnd:o,onScrollToEnd:r}){let{t:a}=ye(),i=E0(e.useThreadSyncPhase(t));return i===null&&!o?null:b("div",{className:"pointer-events-none absolute left-1/2 z-30 flex -translate-x-1/2 flex-col items-center gap-1.5 py-1.5",style:{bottom:n+4},children:[i!==null?u(R0,{phase:i}):null,o?b(ie,{onClick:r,className:"pointer-events-auto gap-1.5 rounded-full px-3 text-muted-foreground hover:text-foreground",size:"xs",variant:"glass",children:[u(rn,{}),a("timeline.scrollToEnd")]}):null]})}he();function N0(){let e=!1;return{lock:()=>{e=!0},resume:()=>{e=!1},navigate:t=>!t||!e?!1:(e=!1,!0),isLocked:()=>e}}function _0(e){return e.requestedGeneration===e.currentGeneration&&e.mode==="following-end"&&!e.readingLocked}var nH=150,oH=16;function D0(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function O0({inputKey:e,visible:t,endInset:n,derive:o,onReturnToLatest:r,controlRef:a}){let[i,s]=Ht("timeline-live-follow-enabled",e,!0),[l,d]=Ht("timeline-show-scroll-to-end",e,!1),c=Ir(e,null),[f,p]=WS(e,null),m=R(j=>{c.current=j;let Z=j?.node??null;p(de=>de===Z?de:Z)},[c,p]),g=St("timeline-is-at-end",e,!0),h=Ir(e,null),v=R(()=>{h.current!==null&&clearTimeout(h.current),h.current=null},[h]),y=R(()=>{v(),h.current=setTimeout(()=>{h.current=null,d(!0)},nH)},[v,d,h]);W(()=>v,[v]);let x=R(()=>{let j=c.current?.measure();return j==null?void 0:{contentLength:j.contentLength,scroll:j.scroll,scrollLength:j.scrollLength}},[c]),C=St("timeline-scroll-mode",e,"following-end"),w=Li(t);Ce(()=>()=>w.cancel(),[w,e]);let T=St("timeline-user-scroll-generation",e,0),S=St("timeline-live-follow-generation",e,0),L=St("timeline-disclosure-reading-lock",e,N0),k=St("timeline-last-row-id",e,null),I=R(()=>{w.cancel(),T.current+=1,C.current="free-scrolling",S.current=null,s(!1)},[w,S,C,s,T]),P=R(()=>{L.current.lock(),I(),g.current=!1,v(),d(!0)},[v,g,I,L,d]),E=N(I);E.current=I;let _=R(()=>{let j=c.current?.measure(),Z=k.current;if(!j||Z===null)return!1;let de=h0(j,Z);return de===null?!1:de>Math.max(0,j.scrollLength-n-oH)},[n,c,k]),A=R(j=>{L.current.resume();let Z=++T.current;g.current=!0,C.current="following-end",S.current=T.current,s(!0),v(),d(!1),w.request(()=>{_0({requestedGeneration:Z,currentGeneration:T.current,mode:C.current,readingLocked:L.current.isLocked()})&&c.current?.scrollToEnd({animated:j})})},[v,w,c,g,S,L,C,s,d,T]),H=N(r);H.current=r;let V=R((j=!1)=>{let Z=H.current;if(Z){Z(()=>A(j));return}A(j)},[A]),J=R(()=>V(!0),[V]),D=R(()=>{L.current.navigate(!0)&&(g.current=!1,o.resolveIsAtEnd(x(),n)===!0&&V())},[o,n,g,x,L,V]);W(()=>{if(!t||f===null)return;let j=null,Z=requestAnimationFrame(()=>{let de=()=>{E.current()},B=ge=>{let G=ge instanceof Element?ge:null;for(;G&&G!==f;){if(G instanceof HTMLElement&&G.scrollHeight>G.clientHeight+1&&G.scrollTop+G.clientHeight<G.scrollHeight-1&&/auto|scroll/u.test(getComputedStyle(G).overflowY))return!1;G=G.parentElement}return G===f},X=ge=>{L.current.isLocked()&&B(ge)&&D()},pe=null,le=!1,re=f.scrollTop,we=ge=>{pe=ge.touches[0]?.clientY??null},Xe=()=>{pe=null,le=!1},ot=()=>{let ge=f.scrollTop;le&&ge>re&&X(f),re=ge},at=()=>_(),je=()=>o.resolveIsAtEnd(x(),n)===!1,oe=ge=>{ge.deltaY>0&&X(ge.target),ge.deltaY<0&&at()&&de()},Te=ge=>{let G=ge.touches[0]?.clientY??null,Ye=pe!==null&&G!==null&&G<pe;pe=G,je()&&de(),Ye&&X(ge.target)},Y=ge=>{if(ge.target===f){le=!0,re=f.scrollTop,at()&&de();return}je()&&de()},me=ge=>{if(!(ge.target instanceof Element?ge.target:null)?.closest("input, textarea, select, [contenteditable='true'], button, [role='button']"))switch(ge.key){case"PageUp":case"Home":case"ArrowUp":at()&&de();break;case"PageDown":case"End":case"ArrowDown":X(ge.target);break;case" ":ge.shiftKey||X(ge.target);break;default:break}};f.addEventListener("wheel",oe,{passive:!0}),f.addEventListener("touchmove",Te,{passive:!0}),f.addEventListener("touchstart",we,{passive:!0}),f.addEventListener("touchend",Xe,{passive:!0}),f.addEventListener("touchcancel",Xe,{passive:!0}),f.addEventListener("scroll",ot,{passive:!0}),window.addEventListener("pointerup",Xe,{passive:!0}),window.addEventListener("pointercancel",Xe,{passive:!0}),f.addEventListener("pointerdown",Y,{passive:!0}),f.addEventListener("keydown",me),j=()=>{f.removeEventListener("wheel",oe),f.removeEventListener("touchmove",Te),f.removeEventListener("touchstart",we),f.removeEventListener("touchend",Xe),f.removeEventListener("touchcancel",Xe),f.removeEventListener("scroll",ot),window.removeEventListener("pointerup",Xe),window.removeEventListener("pointercancel",Xe),f.removeEventListener("pointerdown",Y),f.removeEventListener("keydown",me)}});return()=>{cancelAnimationFrame(Z),j?.()}},[_,o,n,e,x,L,D,f,t]);let ne=R(j=>{k.current=j},[k]),F=R(j=>{if(L.current.isLocked()){g.current=!1,v(),d(!0);return}if(!j&&S.current===T.current){v(),d(!1);return}g.current!==j&&(g.current=j,j?(C.current="following-end",S.current=T.current,s(!0),v(),d(!1)):(C.current="free-scrolling",S.current=null,y()))},[v,g,S,L,y,C,s,d,T]),U=N(V);U.current=V;let ee=q(()=>({followEnd:j=>U.current(j?.animated??!1)}),[]);return Ce(()=>(D0(a,ee),()=>D0(a,null)),[ee,a]),{liveFollowEnabled:i,showScrollToEnd:l,bindTimelineHandle:m,onRowsChange:ne,onIsAtEndChange:F,onManualNavigation:I,onDisclosureNavigation:P,returnToEnd:J}}he();he();var F0=["user-message","assistant-message","reasoning","tool-call","approval","user-input","compaction","retry","session","turn-intent","scheduled-wake","communication","delegation","task","event"];var B0=50,rH=32,hv=class extends Aa{getSnapshotBeforeUpdate(t){return(t.inputKey!==this.props.inputKey||t.rows!==this.props.rows||t.expandedRows!==this.props.expandedRows||t.visible&&!this.props.visible)&&t.capture(),null}componentDidUpdate(){}componentWillUnmount(){this.props.capture()}render(){return this.props.children}};function z0(e){let t=e.getBoundingClientRect();if(e.clientHeight<=0||t.height<=0)return[];let n=e.querySelector("thead"),o=t.top+(n?.getBoundingClientRect().height??0),r=e.querySelectorAll("[data-trajectory-chunk]"),a=bs(r,o),i=[];if(a<0)return i;for(let s=a;s<r.length;s+=1){let l=r[s];if(l.getBoundingClientRect().top>=t.bottom)break;let d=l.querySelectorAll("[data-timeline-row-id]"),c=bs(d,o);if(!(c<0))for(let f=c;f<d.length;f++){let p=d[f];if(p.getBoundingClientRect().top>=t.bottom)break;i.push(p)}}return i}function aH(e){let t=[];for(let n=0;n<e.length;n+=B0)t.push(e.slice(n,n+B0));return t}function iH({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(`
3820
3820
 
3821
3821
  `):[r,...s].filter(Boolean).join(`
3822
3822
 
3823
- `);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 U0=ve(function({inputKey:t,rows:n,loadEarlier:o,loadLater:r=null,pagingBlockedByInteraction:a=!1,onReturnToLatest:i=null,onVisibleTurnRangeChange:s=null,timestampFormat:l,paneVisible:d,useToolCallDetail:c,threadRef:f,resolveChatAnchorMessageId:p,onOpenInChat:m}){let{t:g}=ao(),[h,v]=Ht("trajectory-kind-filter",t,"all"),[y,x]=Ht("trajectory-expanded-rows",t,()=>new Set),[C,w]=Ht("trajectory-follow-latest",t,!0),T=q(()=>{let oe=new Set(n.map(Te=>Te.kind));return F0.filter(Te=>oe.has(Te))},[n]),S=q(()=>h==="all"?n:n.filter(oe=>oe.kind===h),[n,h]),L=q(()=>aH(S),[S]),k=oe=>x(Te=>{let Y=new Set(Te);return Y.has(oe)?Y.delete(oe):Y.add(oe),Y}),I=N(null),P=N(null),E=R(oe=>{I.current=oe,oe&&(P.current=oe)},[]),_=St("trajectory-at-end",t,!0),A=St("trajectory-scroll-top",t,0),H=St("trajectory-row-anchor",t,null),V=N({inputKey:t,paneVisible:d,pagingBlockedByInteraction:a});V.current={inputKey:t,paneVisible:d,pagingBlockedByInteraction:a};let J=N(null);Ce(()=>{if(J.current=null,!!d)return()=>{J.current=null,s?.(null)}},[t,d,s]);let D=q(()=>({inputKey:t,store:xc()}),[t]),ne=N(D);ne.current=D;let B=N(()=>{}),U=R(oe=>{let Te=ne.current;return Te.store.acquire(oe,()=>{ne.current===Te&&B.current()})},[]),ee=q(()=>{let oe=S.map((Te,Y)=>({key:Te.id,turnId:Te.turnId??null,firstRowIndex:Y,endRowIndex:Y+1}));return{sections:oe,bySectionKey:new Map(oe.map(Te=>[Te.key,Te])),byRowId:new Map(oe.map(Te=>[Te.key,{turnId:Te.turnId,index:Te.firstRowIndex}]))}},[S]),j=R((oe,Te)=>Array.from(oe.querySelectorAll("[data-trajectory-row-id]")).find(Y=>Y.dataset.trajectoryRowId===Te),[]),Z=R((oe,Te)=>{let Y=Te[0]?.dataset.timelineRowId,me=Y===void 0?void 0:j(oe,Y);me&&Y!==void 0&&(H.current={rowId:Y,offset:oe.getBoundingClientRect().top-me.getBoundingClientRect().top})},[j,H]),de=R(()=>{if(!d)return;let oe=I.current??P.current;oe&&(A.current=oe.scrollTop,_.current=oe.scrollHeight-oe.scrollTop-oe.clientHeight<=rH,S.length>0&&Z(oe,z0(oe)))},[_,S.length,d,Z,A]),F=R(()=>V.current.inputKey===t&&V.current.paneVisible,[t]),X=R(()=>{if(!F()||s===null)return;let oe=I.current;if(!oe||oe.clientHeight<=0)return;let Te=z0(oe);Z(oe,Te);let Y=D.store.rows(),me=oe.ownerDocument.activeElement;if(Rl(me)){let Ye=El(me,oe);Ye&&Y.push(Ye)}let ge=ip({index:ee,visibleSectionKeys:Te.flatMap(Ye=>{let vt=Ye.dataset.timelineRowId;return vt===void 0?[]:[vt]}),protectedRowIds:Y,selectionRows:sp(oe)}),G=JSON.stringify(ge);J.current!==G&&(J.current=G,s(ge))},[D,F,s,ee,Z]),pe=Li(d),le=R(()=>{F()&&s!==null&&pe.request(X)},[F,s,pe,X]);B.current=le;let re=R(oe=>{let Te=H.current,Y=Te===null?void 0:j(oe,Te.rowId),me=Y?.closest("[data-trajectory-chunk]"),ge=me?.style.contentVisibility;me&&(me.style.contentVisibility="visible");try{oe.scrollTop=Y===void 0?A.current:oe.scrollTop+Y.getBoundingClientRect().top-oe.getBoundingClientRect().top+Te.offset}finally{me&&(me.style.contentVisibility=ge??"")}},[j,H,A]),we=R(()=>{F()&&(de(),le())},[de,F,le]),Xe=R(()=>{!F()||V.current.pagingBlockedByInteraction||o?.loading||(de(),o?.onLoadEarlier())},[de,F,o]),ot=R(()=>{!F()||V.current.pagingBlockedByInteraction||r?.loading||(de(),r?.onLoadLater())},[de,F,r]),at=R(()=>{F()&&i?.(()=>{if(!F())return;_.current=!0,w(!0);let oe=I.current;oe&&(oe.scrollTop=oe.scrollHeight)})},[F,i,_,w]),je=oe=>{if(F()){if(oe&&r!==null){at();return}oe&&(_.current=!0),w(oe)}};return Ce(()=>{if(!F())return;let oe=I.current;oe&&(C&&_.current&&r===null?oe.scrollTop=oe.scrollHeight:re(oe),le())},[_,y,S,C,t,F,r,d,le,re]),Ce(()=>{let oe=I.current;if(!F()||s===null||!oe)return;let Te=!0,Y=()=>{Te&&F()&&le()},me=()=>{!Te||!F()||(C&&_.current&&r===null?oe.scrollTop=oe.scrollHeight:re(oe),Y())},ge=typeof ResizeObserver>"u"?null:new ResizeObserver(me);ge?.observe(oe);let G=oe.querySelector("table");return G&&ge?.observe(G),oe.addEventListener("focusin",Y),oe.addEventListener("focusout",Y),oe.ownerDocument.addEventListener("selectionchange",Y),Y(),()=>{Te=!1,pe.cancel(),ge?.disconnect(),oe.removeEventListener("focusin",Y),oe.removeEventListener("focusout",Y),oe.ownerDocument.removeEventListener("selectionchange",Y)}},[_,C,t,F,r,s,d,pe,le,re]),u(hv,{inputKey:t,visible:d,rows:S,expandedRows:y,capture:de,children:u(yc,{value:U,children: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":g("trajectory.filterLabel"),className:"flex flex-wrap items-center gap-1",children:[u(ie,{size:"xs",variant:h==="all"?"secondary":"ghost","aria-pressed":h==="all",onClick:()=>v("all"),children:g("trajectory.filterAll")}),T.map(oe=>u(ie,{size:"xs",variant:h===oe?"secondary":"ghost","aria-pressed":h===oe,onClick:()=>v(oe),children:g(`trajectory.kinds.${oe}`)},oe))]}),u(Cc,{className:"ml-auto",size:"xs",variant:"outline",pressed:C,onPressedChange:je,"aria-label":g("trajectory.followLatest"),children:g("trajectory.followLatest")})]}),b("div",{ref:E,className:"min-h-0 flex-1 overflow-auto",onScroll:we,"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:g("trajectory.loadEarlier")}),u(ie,{size:"xs",variant:"outline",disabled:o.loading||a,onClick:Xe,children:o.loading?g("trajectory.loadingEarlier"):g("trajectory.loadEarlierAction")})]}):null,S.length===0?u("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:g("trajectory.empty")}):b(wS,{children:[u(IS,{className:"sticky top-0 z-10 bg-background",children:b(jf,{className:"hover:bg-transparent",children:[u(bs,{className:"w-px whitespace-nowrap",children:g("trajectory.columnTime")}),u(bs,{className:"w-px whitespace-nowrap",children:g("trajectory.columnType")}),u(bs,{children:g("trajectory.columnSummary")}),u(bs,{className:"w-px whitespace-nowrap",children:g("trajectory.columnStatus")}),u(bs,{className:"w-px whitespace-nowrap",children:g("trajectory.columnDuration")}),u(bs,{className:"w-px",children:u("span",{className:"sr-only",children:g("trajectory.openInChat")})})]})}),L.map((oe,Te)=>u(SS,{className:"trajectory-chunk [&_tr:last-child]:border-b","data-trajectory-chunk":oe[0]?.id??Te,children:oe.map(Y=>{let me=y.has(Y.id),ge=Y.detail!==void 0||Y.toolCallId!==void 0,G=p(Y);return u(Tl,{value:Y.id,children:[b(jf,{"data-trajectory-row-id":Y.id,"data-timeline-row-id":Y.id,className:K(ge&&"cursor-pointer"),onClick:ge?()=>k(Y.id):void 0,children:[u(Ti,{className:"whitespace-nowrap text-muted-foreground",title:aa(Y.createdAt,l),children:Pi(Y.createdAt,l,g)}),u(Ti,{className:"whitespace-nowrap",children:g(`trajectory.kinds.${Y.kind}`)}),u(Ti,{className:"max-w-0 whitespace-normal",children:b("span",{className:"inline-flex items-start gap-1",children:[ge?u(ie,{size:"xs",variant:"ghost",className:"mt-0.5 size-4 min-w-4 shrink-0 px-0","aria-label":g(me?"trajectory.collapseRow":"trajectory.expandRow"),"aria-expanded":me,onClick:Ye=>{Ye.stopPropagation(),k(Y.id)},children:me?u(rn,{"aria-hidden":!0}):u(Ko,{"aria-hidden":!0})}):null,u("span",{className:"break-words",children:Y.summary})]})}),u(Ti,{className:"whitespace-nowrap",children:g(`trajectory.status.${Y.status}`)}),u(Ti,{className:"whitespace-nowrap text-muted-foreground",children:Y.durationMs!==void 0?Da(Y.durationMs):g("trajectory.valueUnknown")}),u(Ti,{className:"whitespace-nowrap",children:G!==null?b(Je,{children:[u(et,{render:u(ie,{size:"xs",variant:"ghost","aria-label":g("trajectory.openInChat"),onClick:Ye=>{Ye.stopPropagation(),m(G)}}),children:u(ms,{"aria-hidden":!0})}),u(Ze,{side:"top",children:g("trajectory.openInChat")})]}):null})]},`${t}:${Y.id}`),me&&ge?u(jf,{className:"hover:bg-transparent","data-trajectory-detail-row":Y.id,"data-timeline-row-id":Y.id,children:b(Ti,{colSpan:6,className:"whitespace-normal",children:[u("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:g("trajectory.detailTitle")}),Y.kind==="tool-call"&&Y.toolCallId!==void 0?u(iH,{threadRef:f,useToolCallDetail:c,toolCallId:Y.toolCallId,turnId:Y.turnId,fallback:Y.detail,revision:`${Y.status}:${Y.updatedActivityId??Y.activityId??Y.id}`}):Y.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:Y.detail}):null]})},`${t}:${Y.id}:detail`):null]},`${t}:${Y.id}:owner`)})},`${t}:${oe[0]?.id??Te}`))]}),r!==null?b("div",{className:"flex justify-center gap-2 px-3 py-2",children:[u(ie,{size:"xs",variant:"outline",disabled:r.loading||a,onClick:ot,children:r.loading?g("timeline.loadingLater"):g("timeline.loadLater")}),i===null?null:u(ie,{size:"xs",variant:"ghost",onClick:at,children:g("timeline.returnToLatest")})]}):null]})]})})})});function H0({data:e,target:t,inputKey:n,paneVisible:o,timestampFormat:r,onOpenInChat:a}){let i=e.useTrajectory({target:t,threadKey:n,visible:o}),s=R(l=>e.useToolCallDetail(t,{toolCallId:l.toolCallId,turnId:l.turnId,revision:l.revision}),[e,t]);return u(U0,{inputKey:n,rows:i.rows,loadEarlier:i.loadEarlier,loadLater:i.loadLater,pagingBlockedByInteraction:i.pagingBlockedByInteraction,onReturnToLatest:i.onReturnToLatest,onVisibleTurnRangeChange:i.onVisibleTurnRangeChange,timestampFormat:r,paneVisible:o,threadRef:t,useToolCallDetail:s,resolveChatAnchorMessageId:i.resolveChatAnchorMessageId,onOpenInChat:a})}he();he();var vv=bt(null),Sp=vv.Provider;function ia(){let e=Ut(vv);if(e===null)throw new Error("Composer thread data has not been provided.");return e}function Oa(){return Ut(vv)}he();var As=qd(_c());he();function G0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return q(()=>o=>{t.forEach(r=>r(o))},t)}var Dc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Is(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Tp(e){return"nodeType"in e}function To(e){var t,n;return e?Is(e)?e:Tp(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function kp(e){let{Document:t}=To(e);return e instanceof t}function Bl(e){return Is(e)?!1:e instanceof To(e).HTMLElement}function xv(e){return e instanceof To(e).SVGElement}function Ts(e){return e?Is(e)?e.document:Tp(e)?kp(e)?e:Bl(e)||xv(e)?e.ownerDocument:document:document:document}var dr=Dc?Ce:W;function Lp(e){let t=N(e);return dr(()=>{t.current=e}),R(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 j0(){let e=N(null),t=R((o,r)=>{e.current=setInterval(o,r)},[]),n=R(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function zl(e,t){t===void 0&&(t=[e]);let n=N(e);return dr(()=>{n.current!==e&&(n.current=e)},t),n}function Ul(e,t){let n=N();return q(()=>{let o=e(n.current);return n.current=o,o},[...t])}function Oc(e){let t=Lp(e),n=N(null),o=R(r=>{r!==n.current&&t?.(r,n.current),n.current=r},[]);return[n,o]}function Pp(e){let t=N();return W(()=>{t.current=e},[e]),t.current}var yv={};function ks(e,t){return q(()=>{if(t)return t;let n=yv[e]==null?0:yv[e]+1;return yv[e]=n,e+"-"+n},[e,t])}function Q0(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 Ls=Q0(1),Ps=Q0(-1);function cH(e){return"clientX"in e&&"clientY"in e}function Fc(e){if(!e)return!1;let{KeyboardEvent:t}=To(e.target);return t&&e instanceof t}function uH(e){if(!e)return!1;let{TouchEvent:t}=To(e.target);return t&&e instanceof t}function Bc(e){if(uH(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 cH(e)?{x:e.clientX,y:e.clientY}:null}var Mi=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[Mi.Translate.toString(e),Mi.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:o}=e;return t+" "+n+"ms "+o}}}),W0="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function X0(e){return e.matches(W0)?e:e.querySelector(W0)}he();var fH={display:"none"};function Y0(e){let{id:t,value:n}=e;return Tn.createElement("div",{id:t,style:fH},n)}function J0(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 Tn.createElement("div",{id:t,style:r,role:"status","aria-live":o,"aria-atomic":!0},n)}function Z0(){let[e,t]=Q("");return{announce:R(o=>{o!=null&&t(o)},[]),announcement:e}}var fT=bt(null);function pH(e){let t=Ut(fT);W(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function mH(){let[e]=Q(()=>new Set),t=R(o=>(e.add(o),()=>e.delete(o)),[e]);return[R(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 gH={draggable:`
3823
+ `);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 U0=ve(function({inputKey:t,rows:n,loadEarlier:o,loadLater:r=null,pagingBlockedByInteraction:a=!1,onReturnToLatest:i=null,onVisibleTurnRangeChange:s=null,timestampFormat:l,paneVisible:d,useToolCallDetail:c,threadRef:f,resolveChatAnchorMessageId:p,onOpenInChat:m}){let{t:g}=ao(),[h,v]=Ht("trajectory-kind-filter",t,"all"),[y,x]=Ht("trajectory-expanded-rows",t,()=>new Set),[C,w]=Ht("trajectory-follow-latest",t,!0),T=q(()=>{let oe=new Set(n.map(Te=>Te.kind));return F0.filter(Te=>oe.has(Te))},[n]),S=q(()=>h==="all"?n:n.filter(oe=>oe.kind===h),[n,h]),L=q(()=>aH(S),[S]),k=oe=>x(Te=>{let Y=new Set(Te);return Y.has(oe)?Y.delete(oe):Y.add(oe),Y}),I=N(null),P=N(null),E=R(oe=>{I.current=oe,oe&&(P.current=oe)},[]),_=St("trajectory-at-end",t,!0),A=St("trajectory-scroll-top",t,0),H=St("trajectory-row-anchor",t,null),V=N({inputKey:t,paneVisible:d,pagingBlockedByInteraction:a});V.current={inputKey:t,paneVisible:d,pagingBlockedByInteraction:a};let J=N(null);Ce(()=>{if(J.current=null,!!d)return()=>{J.current=null,s?.(null)}},[t,d,s]);let D=q(()=>({inputKey:t,store:xc()}),[t]),ne=N(D);ne.current=D;let F=N(()=>{}),U=R(oe=>{let Te=ne.current;return Te.store.acquire(oe,()=>{ne.current===Te&&F.current()})},[]),ee=q(()=>{let oe=S.map((Te,Y)=>({key:Te.id,turnId:Te.turnId??null,firstRowIndex:Y,endRowIndex:Y+1}));return{sections:oe,bySectionKey:new Map(oe.map(Te=>[Te.key,Te])),byRowId:new Map(oe.map(Te=>[Te.key,{turnId:Te.turnId,index:Te.firstRowIndex}]))}},[S]),j=R((oe,Te)=>Array.from(oe.querySelectorAll("[data-trajectory-row-id]")).find(Y=>Y.dataset.trajectoryRowId===Te),[]),Z=R((oe,Te)=>{let Y=Te[0]?.dataset.timelineRowId,me=Y===void 0?void 0:j(oe,Y);me&&Y!==void 0&&(H.current={rowId:Y,offset:oe.getBoundingClientRect().top-me.getBoundingClientRect().top})},[j,H]),de=R(()=>{if(!d)return;let oe=I.current??P.current;oe&&(A.current=oe.scrollTop,_.current=oe.scrollHeight-oe.scrollTop-oe.clientHeight<=rH,S.length>0&&Z(oe,z0(oe)))},[_,S.length,d,Z,A]),B=R(()=>V.current.inputKey===t&&V.current.paneVisible,[t]),X=R(()=>{if(!B()||s===null)return;let oe=I.current;if(!oe||oe.clientHeight<=0)return;let Te=z0(oe);Z(oe,Te);let Y=D.store.rows(),me=oe.ownerDocument.activeElement;if(Rl(me)){let Ye=El(me,oe);Ye&&Y.push(Ye)}let ge=ip({index:ee,visibleSectionKeys:Te.flatMap(Ye=>{let ht=Ye.dataset.timelineRowId;return ht===void 0?[]:[ht]}),protectedRowIds:Y,selectionRows:sp(oe)}),G=JSON.stringify(ge);J.current!==G&&(J.current=G,s(ge))},[D,B,s,ee,Z]),pe=Li(d),le=R(()=>{B()&&s!==null&&pe.request(X)},[B,s,pe,X]);F.current=le;let re=R(oe=>{let Te=H.current,Y=Te===null?void 0:j(oe,Te.rowId),me=Y?.closest("[data-trajectory-chunk]"),ge=me?.style.contentVisibility;me&&(me.style.contentVisibility="visible");try{oe.scrollTop=Y===void 0?A.current:oe.scrollTop+Y.getBoundingClientRect().top-oe.getBoundingClientRect().top+Te.offset}finally{me&&(me.style.contentVisibility=ge??"")}},[j,H,A]),we=R(()=>{B()&&(de(),le())},[de,B,le]),Xe=R(()=>{!B()||V.current.pagingBlockedByInteraction||o?.loading||(de(),o?.onLoadEarlier())},[de,B,o]),ot=R(()=>{!B()||V.current.pagingBlockedByInteraction||r?.loading||(de(),r?.onLoadLater())},[de,B,r]),at=R(()=>{B()&&i?.(()=>{if(!B())return;_.current=!0,w(!0);let oe=I.current;oe&&(oe.scrollTop=oe.scrollHeight)})},[B,i,_,w]),je=oe=>{if(B()){if(oe&&r!==null){at();return}oe&&(_.current=!0),w(oe)}};return Ce(()=>{if(!B())return;let oe=I.current;oe&&(C&&_.current&&r===null?oe.scrollTop=oe.scrollHeight:re(oe),le())},[_,y,S,C,t,B,r,d,le,re]),Ce(()=>{let oe=I.current;if(!B()||s===null||!oe)return;let Te=!0,Y=()=>{Te&&B()&&le()},me=()=>{!Te||!B()||(C&&_.current&&r===null?oe.scrollTop=oe.scrollHeight:re(oe),Y())},ge=typeof ResizeObserver>"u"?null:new ResizeObserver(me);ge?.observe(oe);let G=oe.querySelector("table");return G&&ge?.observe(G),oe.addEventListener("focusin",Y),oe.addEventListener("focusout",Y),oe.ownerDocument.addEventListener("selectionchange",Y),Y(),()=>{Te=!1,pe.cancel(),ge?.disconnect(),oe.removeEventListener("focusin",Y),oe.removeEventListener("focusout",Y),oe.ownerDocument.removeEventListener("selectionchange",Y)}},[_,C,t,B,r,s,d,pe,le,re]),u(hv,{inputKey:t,visible:d,rows:S,expandedRows:y,capture:de,children:u(yc,{value:U,children: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":g("trajectory.filterLabel"),className:"flex flex-wrap items-center gap-1",children:[u(ie,{size:"xs",variant:h==="all"?"secondary":"ghost","aria-pressed":h==="all",onClick:()=>v("all"),children:g("trajectory.filterAll")}),T.map(oe=>u(ie,{size:"xs",variant:h===oe?"secondary":"ghost","aria-pressed":h===oe,onClick:()=>v(oe),children:g(`trajectory.kinds.${oe}`)},oe))]}),u(Cc,{className:"ml-auto",size:"xs",variant:"outline",pressed:C,onPressedChange:je,"aria-label":g("trajectory.followLatest"),children:g("trajectory.followLatest")})]}),b("div",{ref:E,className:"min-h-0 flex-1 overflow-auto",onScroll:we,"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:g("trajectory.loadEarlier")}),u(ie,{size:"xs",variant:"outline",disabled:o.loading||a,onClick:Xe,children:o.loading?g("trajectory.loadingEarlier"):g("trajectory.loadEarlierAction")})]}):null,S.length===0?u("div",{className:"flex h-full items-center justify-center p-6 text-sm text-muted-foreground",children:g("trajectory.empty")}):b(wS,{children:[u(IS,{className:"sticky top-0 z-10 bg-background",children:b(jf,{className:"hover:bg-transparent",children:[u(Cs,{className:"w-px whitespace-nowrap",children:g("trajectory.columnTime")}),u(Cs,{className:"w-px whitespace-nowrap",children:g("trajectory.columnType")}),u(Cs,{children:g("trajectory.columnSummary")}),u(Cs,{className:"w-px whitespace-nowrap",children:g("trajectory.columnStatus")}),u(Cs,{className:"w-px whitespace-nowrap",children:g("trajectory.columnDuration")}),u(Cs,{className:"w-px",children:u("span",{className:"sr-only",children:g("trajectory.openInChat")})})]})}),L.map((oe,Te)=>u(SS,{className:"trajectory-chunk [&_tr:last-child]:border-b","data-trajectory-chunk":oe[0]?.id??Te,children:oe.map(Y=>{let me=y.has(Y.id),ge=Y.detail!==void 0||Y.toolCallId!==void 0,G=p(Y);return u(Tl,{value:Y.id,children:[b(jf,{"data-trajectory-row-id":Y.id,"data-timeline-row-id":Y.id,className:K(ge&&"cursor-pointer"),onClick:ge?()=>k(Y.id):void 0,children:[u(Ti,{className:"whitespace-nowrap text-muted-foreground",title:aa(Y.createdAt,l),children:Pi(Y.createdAt,l,g)}),u(Ti,{className:"whitespace-nowrap",children:g(`trajectory.kinds.${Y.kind}`)}),u(Ti,{className:"max-w-0 whitespace-normal",children:b("span",{className:"inline-flex items-start gap-1",children:[ge?u(ie,{size:"xs",variant:"ghost",className:"mt-0.5 size-4 min-w-4 shrink-0 px-0","aria-label":g(me?"trajectory.collapseRow":"trajectory.expandRow"),"aria-expanded":me,onClick:Ye=>{Ye.stopPropagation(),k(Y.id)},children:me?u(rn,{"aria-hidden":!0}):u(Ko,{"aria-hidden":!0})}):null,u("span",{className:"break-words",children:Y.summary})]})}),u(Ti,{className:"whitespace-nowrap",children:g(`trajectory.status.${Y.status}`)}),u(Ti,{className:"whitespace-nowrap text-muted-foreground",children:Y.durationMs!==void 0?Da(Y.durationMs):g("trajectory.valueUnknown")}),u(Ti,{className:"whitespace-nowrap",children:G!==null?b(Je,{children:[u(et,{render:u(ie,{size:"xs",variant:"ghost","aria-label":g("trajectory.openInChat"),onClick:Ye=>{Ye.stopPropagation(),m(G)}}),children:u(ps,{"aria-hidden":!0})}),u(Ze,{side:"top",children:g("trajectory.openInChat")})]}):null})]},`${t}:${Y.id}`),me&&ge?u(jf,{className:"hover:bg-transparent","data-trajectory-detail-row":Y.id,"data-timeline-row-id":Y.id,children:b(Ti,{colSpan:6,className:"whitespace-normal",children:[u("div",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:g("trajectory.detailTitle")}),Y.kind==="tool-call"&&Y.toolCallId!==void 0?u(iH,{threadRef:f,useToolCallDetail:c,toolCallId:Y.toolCallId,turnId:Y.turnId,fallback:Y.detail,revision:`${Y.status}:${Y.updatedActivityId??Y.activityId??Y.id}`}):Y.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:Y.detail}):null]})},`${t}:${Y.id}:detail`):null]},`${t}:${Y.id}:owner`)})},`${t}:${oe[0]?.id??Te}`))]}),r!==null?b("div",{className:"flex justify-center gap-2 px-3 py-2",children:[u(ie,{size:"xs",variant:"outline",disabled:r.loading||a,onClick:ot,children:r.loading?g("timeline.loadingLater"):g("timeline.loadLater")}),i===null?null:u(ie,{size:"xs",variant:"ghost",onClick:at,children:g("timeline.returnToLatest")})]}):null]})]})})})});function H0({data:e,target:t,inputKey:n,paneVisible:o,timestampFormat:r,onOpenInChat:a}){let i=e.useTrajectory({target:t,threadKey:n,visible:o}),s=R(l=>e.useToolCallDetail(t,{toolCallId:l.toolCallId,turnId:l.turnId,revision:l.revision}),[e,t]);return u(U0,{inputKey:n,rows:i.rows,loadEarlier:i.loadEarlier,loadLater:i.loadLater,pagingBlockedByInteraction:i.pagingBlockedByInteraction,onReturnToLatest:i.onReturnToLatest,onVisibleTurnRangeChange:i.onVisibleTurnRangeChange,timestampFormat:r,paneVisible:o,threadRef:t,useToolCallDetail:s,resolveChatAnchorMessageId:i.resolveChatAnchorMessageId,onOpenInChat:a})}he();he();var vv=bt(null),Sp=vv.Provider;function ia(){let e=Ut(vv);if(e===null)throw new Error("Composer thread data has not been provided.");return e}function Oa(){return Ut(vv)}he();var Ps=qd(_c());he();function G0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return q(()=>o=>{t.forEach(r=>r(o))},t)}var Dc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ss(e){let t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Tp(e){return"nodeType"in e}function To(e){var t,n;return e?Ss(e)?e:Tp(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function kp(e){let{Document:t}=To(e);return e instanceof t}function Bl(e){return Ss(e)?!1:e instanceof To(e).HTMLElement}function xv(e){return e instanceof To(e).SVGElement}function Is(e){return e?Ss(e)?e.document:Tp(e)?kp(e)?e:Bl(e)||xv(e)?e.ownerDocument:document:document:document}var lr=Dc?Ce:W;function Lp(e){let t=N(e);return lr(()=>{t.current=e}),R(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 j0(){let e=N(null),t=R((o,r)=>{e.current=setInterval(o,r)},[]),n=R(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function zl(e,t){t===void 0&&(t=[e]);let n=N(e);return lr(()=>{n.current!==e&&(n.current=e)},t),n}function Ul(e,t){let n=N();return q(()=>{let o=e(n.current);return n.current=o,o},[...t])}function Oc(e){let t=Lp(e),n=N(null),o=R(r=>{r!==n.current&&t?.(r,n.current),n.current=r},[]);return[n,o]}function Pp(e){let t=N();return W(()=>{t.current=e},[e]),t.current}var yv={};function Ts(e,t){return q(()=>{if(t)return t;let n=yv[e]==null?0:yv[e]+1;return yv[e]=n,e+"-"+n},[e,t])}function Q0(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 ks=Q0(1),Ls=Q0(-1);function cH(e){return"clientX"in e&&"clientY"in e}function Fc(e){if(!e)return!1;let{KeyboardEvent:t}=To(e.target);return t&&e instanceof t}function uH(e){if(!e)return!1;let{TouchEvent:t}=To(e.target);return t&&e instanceof t}function Bc(e){if(uH(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 cH(e)?{x:e.clientX,y:e.clientY}:null}var Mi=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[Mi.Translate.toString(e),Mi.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:o}=e;return t+" "+n+"ms "+o}}}),W0="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function X0(e){return e.matches(W0)?e:e.querySelector(W0)}he();var fH={display:"none"};function Y0(e){let{id:t,value:n}=e;return Tn.createElement("div",{id:t,style:fH},n)}function J0(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 Tn.createElement("div",{id:t,style:r,role:"status","aria-live":o,"aria-atomic":!0},n)}function Z0(){let[e,t]=Q("");return{announce:R(o=>{o!=null&&t(o)},[]),announcement:e}}var fT=bt(null);function pH(e){let t=Ut(fT);W(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function mH(){let[e]=Q(()=>new Set),t=R(o=>(e.add(o),()=>e.delete(o)),[e]);return[R(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 gH={draggable:`
3824
3824
  To pick up a draggable item, press the space bar.
3825
3825
  While dragging, use the arrow keys to move the item.
3826
3826
  Press space again to drop the item in its new position, or press escape to cancel.
3827
- `},hH={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 vH(e){let{announcements:t=hH,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=gH}=e,{announce:a,announcement:i}=Z0(),s=ks("DndLiveRegion"),[l,d]=Q(!1);if(W(()=>{d(!0)},[]),pH(q(()=>({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=Tn.createElement(Tn.Fragment,null,Tn.createElement(Y0,{id:o,value:r.draggable}),Tn.createElement(J0,{id:s,announcement:i}));return n?(0,As.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 Ep(){}function Pv(e,t){return q(()=>({sensor:e,options:t??{}}),[e,t])}function pT(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return q(()=>[...t].filter(o=>o!=null),[...t])}var kr=Object.freeze({x:0,y:0});function mT(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function gT(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function yH(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function eT(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 tT(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 hT=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=tT(t,t.left,t.top),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=mT(tT(l),r);a.push({id:s,data:{droppableContainer:i,value:d}})}}return a.sort(gT)},vT=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=eT(t),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=eT(l),c=r.reduce((p,m,g)=>p+mT(d[g],m),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:i,value:f}})}}return a.sort(gT)};function xH(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 CH=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=xH(s,t);l>0&&r.push({id:i,data:{droppableContainer:a,value:l}})}}return r.sort(yH)};function bH(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function yT(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:kr}function wH(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 SH=wH(1);function IH(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 TH(e,t,n){let o=IH(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 kH={ignoreTransform:!1};function Ms(e,t){t===void 0&&(t=kH);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:d,transformOrigin:c}=To(e).getComputedStyle(e);d&&(n=TH(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 nT(e){return Ms(e,{ignoreTransform:!0})}function LH(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function PH(e,t){return t===void 0&&(t=To(e).getComputedStyle(e)),t.position==="fixed"}function AH(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 Kc(e,t){let n=[];function o(r){if(t!=null&&n.length>=t||!r)return n;if(kp(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!Bl(r)||xv(r)||n.includes(r))return n;let a=To(e).getComputedStyle(r);return r!==e&&AH(r,a)&&n.push(r),PH(r,a)?n:o(r.parentNode)}return e?o(e):n}function xT(e){let[t]=Kc(e,1);return t??null}function Cv(e){return!Dc||!e?null:Is(e)?e:Tp(e)?kp(e)||e===Ts(e).scrollingElement?window:Bl(e)?e:null:null}function CT(e){return Is(e)?e.scrollX:e.scrollLeft}function bT(e){return Is(e)?e.scrollY:e.scrollTop}function Sv(e){return{x:CT(e),y:bT(e)}}var Gn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Gn||(Gn={}));function wT(e){return!Dc||!e?!1:e===document.scrollingElement}function ST(e){let t={x:0,y:0},n=wT(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 EH={x:.2,y:.2};function RH(e,t,n,o,r){let{top:a,left:i,right:s,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=EH);let{isTop:d,isBottom:c,isLeft:f,isRight:p}=ST(e),m={x:0,y:0},g={x:0,y:0},h={height:t.height*r.y,width:t.width*r.x};return!d&&a<=t.top+h.height?(m.y=Gn.Backward,g.y=o*Math.abs((t.top+h.height-a)/h.height)):!c&&l>=t.bottom-h.height&&(m.y=Gn.Forward,g.y=o*Math.abs((t.bottom-h.height-l)/h.height)),!p&&s>=t.right-h.width?(m.x=Gn.Forward,g.x=o*Math.abs((t.right-h.width-s)/h.width)):!f&&i<=t.left+h.width&&(m.x=Gn.Backward,g.x=o*Math.abs((t.left+h.width-i)/h.width)),{direction:m,speed:g}}function MH(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 IT(e){return e.reduce((t,n)=>Ls(t,Sv(n)),kr)}function NH(e){return e.reduce((t,n)=>t+CT(n),0)}function _H(e){return e.reduce((t,n)=>t+bT(n),0)}function DH(e,t){if(t===void 0&&(t=Ms),!e)return;let{top:n,left:o,bottom:r,right:a}=t(e);xT(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var OH=[["x",["left","right"],NH],["y",["top","bottom"],_H]],Uc=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=Kc(n),r=IT(o);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,i,s]of OH)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})}},Es=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 FH(e){let{EventTarget:t}=To(e);return e instanceof t?e:Ts(e)}function bv(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 cr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(cr||(cr={}));function oT(e){e.preventDefault()}function BH(e){e.stopPropagation()}var It;(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"})(It||(It={}));var TT={start:[It.Space,It.Enter],cancel:[It.Esc],end:[It.Space,It.Enter,It.Tab]},zH=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case It.Right:return{...n,x:n.x+25};case It.Left:return{...n,x:n.x-25};case It.Down:return{...n,y:n.y+25};case It.Up:return{...n,y:n.y-25}}},Hl=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 Es(Ts(n)),this.windowListeners=new Es(To(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(cr.Resize,this.handleCancel),this.windowListeners.add(cr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(cr.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:n}=this.props,o=t.node.current;o&&DH(o),n(kr)}handleKeyDown(t){if(Fc(t)){let{active:n,context:o,options:r}=this.props,{keyboardCodes:a=TT,coordinateGetter:i=zH,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}:kr;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:g}=o.current;for(let h of g){let v=t.code,{isTop:y,isRight:x,isLeft:C,isBottom:w,maxScroll:T,minScroll:S}=ST(h),L=MH(h),k={x:Math.min(v===It.Right?L.right-L.width/2:L.right,Math.max(v===It.Right?L.left:L.left+L.width/2,f.x)),y:Math.min(v===It.Down?L.bottom-L.height/2:L.bottom,Math.max(v===It.Down?L.top:L.top+L.height/2,f.y))},I=v===It.Right&&!x||v===It.Left&&!C,P=v===It.Down&&!w||v===It.Up&&!y;if(I&&k.x!==f.x){let E=h.scrollLeft+p.x,_=v===It.Right&&E<=T.x||v===It.Left&&E>=S.x;if(_&&!p.y){h.scrollTo({left:E,behavior:s});return}_?m.x=h.scrollLeft-E:m.x=v===It.Right?h.scrollLeft-T.x:h.scrollLeft-S.x,m.x&&h.scrollBy({left:-m.x,behavior:s});break}else if(P&&k.y!==f.y){let E=h.scrollTop+p.y,_=v===It.Down&&E<=T.y||v===It.Up&&E>=S.y;if(_&&!p.x){h.scrollTo({top:E,behavior:s});return}_?m.y=h.scrollTop-E:m.y=v===It.Down?h.scrollTop-T.y:h.scrollTop-S.y,m.y&&h.scrollBy({top:-m.y,behavior:s});break}}this.handleMove(t,Ls(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()}};Hl.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=TT,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 rT(e){return!!(e&&"distance"in e)}function aT(e){return!!(e&&"delay"in e)}var Hc=class{constructor(t,n,o){var r;o===void 0&&(o=FH(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=Ts(i),this.documentListeners=new Es(this.document),this.listeners=new Es(o),this.windowListeners=new Es(To(i)),this.initialCoordinates=(r=Bc(a))!=null?r:kr,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(cr.Resize,this.handleCancel),this.windowListeners.add(cr.DragStart,oT),this.windowListeners.add(cr.VisibilityChange,this.handleCancel),this.windowListeners.add(cr.ContextMenu,oT),this.documentListeners.add(cr.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(aT(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(rT(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(cr.Click,BH,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(cr.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=Bc(t))!=null?n:kr,d=Ps(r,l);if(!o&&s){if(rT(s)){if(s.tolerance!=null&&bv(d,s.tolerance))return this.handleCancel();if(bv(d,s.distance))return this.handleStart()}if(aT(s)&&bv(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===It.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},UH={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},$l=class extends Hc{constructor(t){let{event:n}=t,o=Ts(n.target);super(t,UH,o)}};$l.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 HH={move:{name:"mousemove"},end:{name:"mouseup"}},Iv;(function(e){e[e.RightClick=2]="RightClick"})(Iv||(Iv={}));var Tv=class extends Hc{constructor(t){super(t,HH,Ts(t.event.target))}};Tv.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button===Iv.RightClick?!1:(o?.({event:n}),!0)}}];var wv={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},kv=class extends Hc{constructor(t){super(t,wv)}static setup(){return window.addEventListener(wv.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(wv.move.name,t)};function t(){}}};kv.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 zc;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(zc||(zc={}));var Rp;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Rp||(Rp={}));function $H(e){let{acceleration:t,activator:n=zc.Pointer,canScroll:o,draggingRect:r,enabled:a,interval:i=5,order:s=Rp.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:c,delta:f,threshold:p}=e,m=qH({delta:f,disabled:!a}),[g,h]=j0(),v=N({x:0,y:0}),y=N({x:0,y:0}),x=q(()=>{switch(n){case zc.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case zc.DraggableRect:return r}},[n,r,l]),C=N(null),w=R(()=>{let S=C.current;if(!S)return;let L=v.current.x*y.current.x,k=v.current.y*y.current.y;S.scrollBy(L,k)},[]),T=q(()=>s===Rp.TreeOrder?[...d].reverse():d,[s,d]);W(()=>{if(!a||!d.length||!x){h();return}for(let S of T){if(o?.(S)===!1)continue;let L=d.indexOf(S),k=c[L];if(!k)continue;let{direction:I,speed:P}=RH(S,k,x,t,p);for(let E of["x","y"])m[E][I[E]]||(P[E]=0,I[E]=0);if(P.x>0||P.y>0){h(),C.current=S,g(w,i),v.current=P,y.current=I;return}}v.current={x:0,y:0},y.current={x:0,y:0},h()},[t,w,o,h,a,i,JSON.stringify(x),JSON.stringify(m),g,d,T,c,JSON.stringify(p)])}var KH={x:{[Gn.Backward]:!1,[Gn.Forward]:!1},y:{[Gn.Backward]:!1,[Gn.Forward]:!1}};function qH(e){let{delta:t,disabled:n}=e,o=Pp(t);return Ul(r=>{if(n||!o||!r)return KH;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 VH(e,t){let n=t!=null?e.get(t):void 0,o=n?n.node.current:null;return Ul(r=>{var a;return t==null?null:(a=o??r)!=null?a:null},[o,t])}function WH(e,t){return q(()=>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 $c;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})($c||($c={}));var Lv;(function(e){e.Optimized="optimized"})(Lv||(Lv={}));var iT=new Map;function GH(e,t){let{dragging:n,dependencies:o,config:r}=t,[a,i]=Q(null),{frequency:s,measure:l,strategy:d}=r,c=N(e),f=v(),p=zl(f),m=R(function(y){y===void 0&&(y=[]),!p.current&&i(x=>x===null?y:x.concat(y.filter(C=>!x.includes(C))))},[p]),g=N(null),h=Ul(y=>{if(f&&!n)return iT;if(!y||y===iT||c.current!==e||a!=null){let x=new Map;for(let C of e){if(!C)continue;if(a&&a.length>0&&!a.includes(C.id)&&C.rect.current){x.set(C.id,C.rect.current);continue}let w=C.node.current,T=w?new Uc(l(w),w):null;C.rect.current=T,T&&x.set(C.id,T)}return x}return y},[e,a,n,f,l]);return W(()=>{c.current=e},[e]),W(()=>{f||m()},[n,f]),W(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),W(()=>{f||typeof s!="number"||g.current!==null||(g.current=setTimeout(()=>{m(),g.current=null},s))},[s,f,m,...o]),{droppableRects:h,measureDroppableContainers:m,measuringScheduled:a!=null};function v(){switch(d){case $c.Always:return!1;case $c.BeforeDragging:return n;default:return!n}}}function kT(e,t){return Ul(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function jH(e,t){return kT(e,t)}function QH(e){let{callback:t,disabled:n}=e,o=Lp(t),r=q(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(o)},[o,n]);return W(()=>()=>r?.disconnect(),[r]),r}function Mp(e){let{callback:t,disabled:n}=e,o=Lp(t),r=q(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(o)},[n]);return W(()=>()=>r?.disconnect(),[r]),r}function XH(e){return new Uc(Ms(e),e)}function sT(e,t,n){t===void 0&&(t=XH);let[o,r]=Q(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=QH({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=Mp({callback:a});return dr(()=>{a(),e?(s?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[e]),o}function YH(e){let t=kT(e);return yT(e,t)}var lT=[];function JH(e){let t=N(e),n=Ul(o=>e?o&&o!==lT&&e&&t.current&&e.parentNode===t.current.parentNode?o:Kc(e):lT,[e]);return W(()=>{t.current=e},[e]),n}function ZH(e){let[t,n]=Q(null),o=N(e),r=R(a=>{let i=Cv(a.target);i&&n(s=>s?(s.set(i,Sv(i)),new Map(s)):null)},[]);return W(()=>{let a=o.current;if(e!==a){i(a);let s=e.map(l=>{let d=Cv(l);return d?(d.addEventListener("scroll",r,{passive:!0}),[d,Sv(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=Cv(l);d?.removeEventListener("scroll",r)})}},[r,e]),q(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>Ls(a,i),kr):IT(e):kr,[e,t])}function dT(e,t){t===void 0&&(t=[]);let n=N(null);return W(()=>{n.current=null},t),W(()=>{let o=e!==kr;o&&!n.current&&(n.current=e),!o&&n.current&&(n.current=null)},[e]),n.current?Ps(e,n.current):kr}function e5(e){W(()=>{if(!Dc)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 t5(e,t){return q(()=>e.reduce((n,o)=>{let{eventName:r,handler:a}=o;return n[r]=i=>{a(i,t)},n},{}),[e,t])}function LT(e){return q(()=>e?LH(e):null,[e])}var cT=[];function n5(e,t){t===void 0&&(t=Ms);let[n]=e,o=LT(n?To(n):null),[r,a]=Q(cT);function i(){a(()=>e.length?e.map(l=>wT(l)?o:new Uc(t(l),l)):cT)}let s=Mp({callback:i});return dr(()=>{s?.disconnect(),i(),e.forEach(l=>s?.observe(l))},[e]),r}function o5(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Bl(t)?t:e}function r5(e){let{measure:t}=e,[n,o]=Q(null),r=R(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=Mp({callback:r}),i=R(d=>{let c=o5(d);a?.disconnect(),c&&a?.observe(c),o(c?t(c):null)},[t,a]),[s,l]=Oc(i);return q(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}var a5=[{sensor:$l,options:{}},{sensor:Hl,options:{}}],i5={current:{}},Ap={draggable:{measure:nT},droppable:{measure:nT,strategy:$c.WhileDragging,frequency:Lv.Optimized},dragOverlay:{measure:Ms}},Rs=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}},s5={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Rs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ep},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ap,measureDroppableContainers:Ep,windowRect:null,measuringScheduled:!1},l5={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ep,draggableNodes:new Map,over:null,measureDroppableContainers:Ep},Np=bt(l5),PT=bt(s5);function d5(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Rs}}}function c5(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 Rs(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 Rs(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 Rs(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function u5(e){let{disabled:t}=e,{active:n,activatorEvent:o,draggableNodes:r}=Ut(Np),a=Pp(o),i=Pp(n?.id);return W(()=>{if(!t&&!o&&a&&i!=null){if(!Fc(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=X0(c);if(f){f.focus();break}}})}},[o,t,r,i,a]),null}function f5(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...o}),n):n}function p5(e){return q(()=>({draggable:{...Ap.draggable,...e?.draggable},droppable:{...Ap.droppable,...e?.droppable},dragOverlay:{...Ap.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function m5(e){let{activeNode:t,measure:n,initialRect:o,config:r=!0}=e,a=N(!1),{x:i,y:s}=typeof r=="boolean"?{x:r,y:r}:r;dr(()=>{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=yT(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=xT(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,s,o,n])}var AT=bt({...kr,scaleX:1,scaleY:1}),Ni;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ni||(Ni={}));var ET=ve(function(t){var n,o,r,a;let{id:i,accessibility:s,autoScroll:l=!0,children:d,sensors:c=a5,collisionDetection:f=CH,measuring:p,modifiers:m,...g}=t,h=Ea(c5,void 0,d5),[v,y]=h,[x,C]=mH(),[w,T]=Q(Ni.Uninitialized),S=w===Ni.Initialized,{draggable:{active:L,nodes:k,translate:I},droppable:{containers:P}}=v,E=L!=null?k.get(L):null,_=N({initial:null,translated:null}),A=q(()=>{var ce;return L!=null?{id:L,data:(ce=E?.data)!=null?ce:i5,rect:_}:null},[L,E]),H=N(null),[V,J]=Q(null),[D,ne]=Q(null),B=zl(g,Object.values(g)),U=ks("DndDescribedBy",i),ee=q(()=>P.getEnabled(),[P]),j=p5(p),{droppableRects:Z,measureDroppableContainers:de,measuringScheduled:F}=GH(ee,{dragging:S,dependencies:[I.x,I.y],config:j.droppable}),X=VH(k,L),pe=q(()=>D?Bc(D):null,[D]),le=ae(),re=jH(X,j.draggable.measure);m5({activeNode:L!=null?k.get(L):null,config:le.layoutShiftCompensation,initialRect:re,measure:j.draggable.measure});let we=sT(X,j.draggable.measure,re),Xe=sT(X?X.parentElement:null),ot=N({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:Z,draggableNodes:k,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),at=P.getNodeFor((n=ot.current.over)==null?void 0:n.id),je=r5({measure:j.dragOverlay.measure}),oe=(o=je.nodeRef.current)!=null?o:X,Te=S?(r=je.rect)!=null?r:we:null,Y=!!(je.nodeRef.current&&je.rect),me=YH(Y?null:we),ge=LT(oe?To(oe):null),G=JH(S?at??X:null),Ye=n5(G),vt=f5(m,{transform:{x:I.x-me.x,y:I.y-me.y,scaleX:1,scaleY:1},activatorEvent:D,active:A,activeNodeRect:we,containerNodeRect:Xe,draggingNodeRect:Te,over:ot.current.over,overlayNodeRect:je.rect,scrollableAncestors:G,scrollableAncestorRects:Ye,windowRect:ge}),Mt=pe?Ls(pe,I):null,Dt=ZH(G),Nt=dT(Dt),Ot=dT(Dt,[we]),At=Ls(vt,Nt),xt=Te?SH(Te,vt):null,_t=A&&xt?f({active:A,collisionRect:xt,droppableRects:Z,droppableContainers:ee,pointerCoordinates:Mt}):null,Xt=Av(_t,"id"),[mn,Hn]=Q(null),yt=Y?vt:Ls(vt,Ot),qt=bH(yt,(a=mn?.rect)!=null?a:null,we),an=N(null),kn=R((ce,Le)=>{let{sensor:ze,options:ft}=Le;if(H.current==null)return;let gn=k.get(H.current);if(!gn)return;let lt=ce.nativeEvent,hn=new ze({active:H.current,activeNode:gn,event:lt,options:ft,context:ot,onAbort(rt){if(!k.get(rt))return;let{onDragAbort:ln}=B.current,Se={id:rt};ln?.(Se),x({type:"onDragAbort",event:Se})},onPending(rt,Zt,ln,Se){if(!k.get(rt))return;let{onDragPending:qe}=B.current,pt={id:rt,constraint:Zt,initialCoordinates:ln,offset:Se};qe?.(pt),x({type:"onDragPending",event:pt})},onStart(rt){let Zt=H.current;if(Zt==null)return;let ln=k.get(Zt);if(!ln)return;let{onDragStart:Se}=B.current,Re={activatorEvent:lt,active:{id:Zt,data:ln.data,rect:_}};(0,As.unstable_batchedUpdates)(()=>{Se?.(Re),T(Ni.Initializing),y({type:Bn.DragStart,initialCoordinates:rt,active:Zt}),x({type:"onDragStart",event:Re}),J(an.current),ne(lt)})},onMove(rt){y({type:Bn.DragMove,coordinates:rt})},onEnd:Ft(Bn.DragEnd),onCancel:Ft(Bn.DragCancel)});an.current=hn;function Ft(rt){return async function(){let{active:ln,collisions:Se,over:Re,scrollAdjustedTranslate:qe}=ot.current,pt=null;if(ln&&qe){let{cancelDrop:st}=B.current;pt={activatorEvent:lt,active:ln,collisions:Se,delta:qe,over:Re},rt===Bn.DragEnd&&typeof st=="function"&&await Promise.resolve(st(pt))&&(rt=Bn.DragCancel)}H.current=null,(0,As.unstable_batchedUpdates)(()=>{y({type:rt}),T(Ni.Uninitialized),Hn(null),J(null),ne(null),an.current=null;let st=rt===Bn.DragEnd?"onDragEnd":"onDragCancel";if(pt){let it=B.current[st];it?.(pt),x({type:st,event:pt})}})}}},[k]),sn=R((ce,Le)=>(ze,ft)=>{let gn=ze.nativeEvent,lt=k.get(ft);if(H.current!==null||!lt||gn.dndKit||gn.defaultPrevented)return;let hn={active:lt};ce(ze,Le.options,hn)===!0&&(gn.dndKit={capturedBy:Le.sensor},H.current=ft,kn(ze,Le))},[k,kn]),Cn=WH(c,sn);e5(c),dr(()=>{we&&w===Ni.Initializing&&T(Ni.Initialized)},[we,w]),W(()=>{let{onDragMove:ce}=B.current,{active:Le,activatorEvent:ze,collisions:ft,over:gn}=ot.current;if(!Le||!ze)return;let lt={active:Le,activatorEvent:ze,collisions:ft,delta:{x:At.x,y:At.y},over:gn};(0,As.unstable_batchedUpdates)(()=>{ce?.(lt),x({type:"onDragMove",event:lt})})},[At.x,At.y]),W(()=>{let{active:ce,activatorEvent:Le,collisions:ze,droppableContainers:ft,scrollAdjustedTranslate:gn}=ot.current;if(!ce||H.current==null||!Le||!gn)return;let{onDragOver:lt}=B.current,hn=ft.get(Xt),Ft=hn&&hn.rect.current?{id:hn.id,rect:hn.rect.current,data:hn.data,disabled:hn.disabled}:null,rt={active:ce,activatorEvent:Le,collisions:ze,delta:{x:gn.x,y:gn.y},over:Ft};(0,As.unstable_batchedUpdates)(()=>{Hn(Ft),lt?.(rt),x({type:"onDragOver",event:rt})})},[Xt]),dr(()=>{ot.current={activatorEvent:D,active:A,activeNode:X,collisionRect:xt,collisions:_t,droppableRects:Z,draggableNodes:k,draggingNode:oe,draggingNodeRect:Te,droppableContainers:P,over:mn,scrollableAncestors:G,scrollAdjustedTranslate:At},_.current={initial:Te,translated:xt}},[A,X,_t,xt,k,oe,Te,Z,P,mn,G,At]),$H({...le,delta:I,draggingRect:xt,pointerCoordinates:Mt,scrollableAncestors:G,scrollableAncestorRects:Ye});let $n=q(()=>({active:A,activeNode:X,activeNodeRect:we,activatorEvent:D,collisions:_t,containerNodeRect:Xe,dragOverlay:je,draggableNodes:k,droppableContainers:P,droppableRects:Z,over:mn,measureDroppableContainers:de,scrollableAncestors:G,scrollableAncestorRects:Ye,measuringConfiguration:j,measuringScheduled:F,windowRect:ge}),[A,X,we,D,_t,Xe,je,k,P,Z,mn,de,G,Ye,j,F,ge]),$=q(()=>({activatorEvent:D,activators:Cn,active:A,activeNodeRect:we,ariaDescribedById:{draggable:U},dispatch:y,draggableNodes:k,over:mn,measureDroppableContainers:de}),[D,Cn,A,we,y,U,k,mn,de]);return Tn.createElement(fT.Provider,{value:C},Tn.createElement(Np.Provider,{value:$},Tn.createElement(PT.Provider,{value:$n},Tn.createElement(AT.Provider,{value:qt},d)),Tn.createElement(u5,{disabled:s?.restoreFocus===!1})),Tn.createElement(vH,{...s,hiddenTextDescribedById:U}));function ae(){let ce=V?.autoScrollEnabled===!1,Le=typeof l=="object"?l.enabled===!1:l===!1,ze=S&&!ce&&!Le;return typeof l=="object"?{...l,enabled:ze}:{enabled:ze}}}),g5=bt(null),uT="button",h5="Draggable";function RT(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e,a=ks(h5),{activators:i,activatorEvent:s,active:l,activeNodeRect:d,ariaDescribedById:c,draggableNodes:f,over:p}=Ut(Np),{role:m=uT,roleDescription:g="draggable",tabIndex:h=0}=r??{},v=l?.id===t,y=Ut(v?AT:g5),[x,C]=Oc(),[w,T]=Oc(),S=t5(i,t),L=zl(n);dr(()=>(f.set(t,{id:t,key:a,node:x,activatorNode:w,data:L}),()=>{let I=f.get(t);I&&I.key===a&&f.delete(t)}),[f,t]);let k=q(()=>({role:m,tabIndex:h,"aria-disabled":o,"aria-pressed":v&&m===uT?!0:void 0,"aria-roledescription":g,"aria-describedby":c.draggable}),[o,m,h,v,g,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:d,attributes:k,isDragging:v,listeners:o?void 0:S,node:x,over:p,setNodeRef:C,setActivatorNodeRef:T,transform:y}}function MT(){return Ut(PT)}var v5="Droppable",y5={timeout:25};function NT(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e,a=ks(v5),{active:i,dispatch:s,over:l,measureDroppableContainers:d}=Ut(Np),c=N({disabled:n}),f=N(!1),p=N(null),m=N(null),{disabled:g,updateMeasurementsFor:h,timeout:v}={...y5,...r},y=zl(h??o),x=R(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(y.current)?y.current:[y.current]),m.current=null},v)},[v]),C=Mp({callback:x,disabled:g||!i}),w=R((k,I)=>{C&&(I&&(C.unobserve(I),f.current=!1),k&&C.observe(k))},[C]),[T,S]=Oc(w),L=zl(t);return W(()=>{!C||!T.current||(C.disconnect(),f.current=!1,C.observe(T.current))},[T,C]),W(()=>(s({type:Bn.RegisterDroppable,element:{id:o,key:a,disabled:n,node:T,rect:p,data:L}}),()=>s({type:Bn.UnregisterDroppable,key:a,id:o})),[o]),W(()=>{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:T,over:l,setNodeRef:S}}he();function _T(e,t,n){let o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function x5(e,t){return e.reduce((n,o,r)=>{let a=t.get(o);return a&&(n[r]=a),n},Array(e.length))}function _p(e){return e!==null&&e>=0}function C5(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 b5(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var DT=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e,a=_T(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 Dp={scaleX:1,scaleY:1},OT=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,...Dp}:null}let l=w5(a,r,n);return r>n&&r<=i?{x:0,y:-s.height-l,...Dp}:r<n&&r>=i?{x:0,y:s.height+l,...Dp}:{x:0,y:0,...Dp}};function w5(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 FT="Sortable",BT=Tn.createContext({activeIndex:-1,containerId:FT,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:DT,disabled:{draggable:!1,droppable:!1}});function zT(e){let{children:t,id:n,items:o,strategy:r=DT,disabled:a=!1}=e,{active:i,dragOverlay:s,droppableRects:l,over:d,measureDroppableContainers:c}=MT(),f=ks(FT,n),p=s.rect!==null,m=q(()=>o.map(S=>typeof S=="object"&&"id"in S?S.id:S),[o]),g=i!=null,h=i?m.indexOf(i.id):-1,v=d?m.indexOf(d.id):-1,y=N(m),x=!C5(m,y.current),C=v!==-1&&h===-1||x,w=b5(a);dr(()=>{x&&g&&c(m)},[x,m,g,c]),W(()=>{y.current=m},[m]);let T=q(()=>({activeIndex:h,containerId:f,disabled:w,disableTransforms:C,items:m,overIndex:v,useDragOverlay:p,sortedRects:x5(m,l),strategy:r}),[h,f,w.draggable,w.droppable,C,m,v,l,p,r]);return Tn.createElement(BT.Provider,{value:T},t)}var S5=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return _T(n,o,r).indexOf(t)},I5=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},T5={duration:200,easing:"ease"},UT="transform",k5=Mi.Transition.toString({property:UT,duration:0,easing:"linear"}),L5={roleDescription:"sortable"};function P5(e){let{disabled:t,index:n,node:o,rect:r}=e,[a,i]=Q(null),s=N(n);return dr(()=>{if(!t&&n!==s.current&&o.current){let l=r.current;if(l){let d=Ms(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]),W(()=>{a&&i(null)},[a]),a}function HT(e){let{animateLayoutChanges:t=I5,attributes:n,disabled:o,data:r,getNewIndex:a=S5,id:i,strategy:s,resizeObserverConfig:l,transition:d=T5}=e,{items:c,containerId:f,activeIndex:p,disabled:m,disableTransforms:g,sortedRects:h,overIndex:v,useDragOverlay:y,strategy:x}=Ut(BT),C=A5(o,m),w=c.indexOf(i),T=q(()=>({sortable:{containerId:f,index:w,items:c},...r}),[f,r,w,c]),S=q(()=>c.slice(c.indexOf(i)),[c,i]),{rect:L,node:k,isOver:I,setNodeRef:P}=NT({id:i,data:T,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...l}}),{active:E,activatorEvent:_,activeNodeRect:A,attributes:H,setNodeRef:V,listeners:J,isDragging:D,over:ne,setActivatorNodeRef:B,transform:U}=RT({id:i,data:T,attributes:{...L5,...n},disabled:C.draggable}),ee=G0(P,V),j=!!E,Z=j&&!g&&_p(p)&&_p(v),de=!y&&D,F=de&&Z?U:null,pe=Z?F??(s??x)({rects:h,activeNodeRect:A,activeIndex:p,overIndex:v,index:w}):null,le=_p(p)&&_p(v)?a({id:i,items:c,activeIndex:p,overIndex:v}):w,re=E?.id,we=N({activeId:re,items:c,newIndex:le,containerId:f}),Xe=c!==we.current.items,ot=t({active:E,containerId:f,isDragging:D,isSorting:j,id:i,index:w,items:c,newIndex:we.current.newIndex,previousItems:we.current.items,previousContainerId:we.current.containerId,transition:d,wasDragging:we.current.activeId!=null}),at=P5({disabled:!ot,index:w,node:k,rect:L});return W(()=>{j&&we.current.newIndex!==le&&(we.current.newIndex=le),f!==we.current.containerId&&(we.current.containerId=f),c!==we.current.items&&(we.current.items=c)},[j,le,f,c]),W(()=>{if(re===we.current.activeId)return;if(re!=null&&we.current.activeId==null){we.current.activeId=re;return}let oe=setTimeout(()=>{we.current.activeId=re},50);return()=>clearTimeout(oe)},[re]),{active:E,activeIndex:p,attributes:H,data:T,rect:L,index:w,newIndex:le,items:c,isOver:I,isSorting:j,isDragging:D,listeners:J,node:k,overIndex:v,over:ne,setNodeRef:ee,setActivatorNodeRef:B,setDroppableNodeRef:P,setDraggableNodeRef:V,transform:at??pe,transition:je()};function je(){if(at||Xe&&we.current.newIndex===w)return k5;if(!(de&&!Fc(_)||!d)&&(j||ot))return Mi.Transition.toString({...d,property:UT})}}function A5(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 Op(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 E5=[It.Down,It.Right,It.Up,It.Left],$T=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:i,scrollableAncestors:s}}=t;if(E5.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 It.Down:o.top<p.top&&l.push(f);break;case It.Up:o.top>p.top&&l.push(f);break;case It.Left:o.left>p.left&&l.push(f);break;case It.Right:o.left<p.left&&l.push(f);break}});let d=vT({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,g=p?.node.current;if(g&&m&&f&&p){let v=Kc(g).some((S,L)=>s[L]!==S),y=KT(f,p),x=R5(f,p),C=v||!y?{x:0,y:0}:{x:x?o.width-m.width:0,y:x?o.height-m.height:0},w={x:m.left,y:m.top};return C.x&&C.y?w:Ps(w,C)}}}};function KT(e,t){return!Op(e)||!Op(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function R5(e,t){return!Op(e)||!Op(t)||!KT(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function M5(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 qT=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:o}=e,r=o[0];return!t||!r?n:M5(n,t,r)},VT=e=>{let{transform:t}=e;return{...t,x:0}};he();he();var Fp={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function WT(e){return`(min-width: ${typeof e=="number"?e:Fp[e]}px)`}function GT(e){return`(max-width: ${(typeof e=="number"?e:Fp[e])-1}px)`}function N5(e){if(typeof e!="string"){let n=[];return e.min!=null&&n.push(WT(e.min)),e.max!=null&&n.push(GT(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 Fp&&t.push(GT(o))}else n in Fp&&t.push(WT(n));return t.length>0?t.join(" and "):e}function _5(){return!1}function Bp(e){let t=N5(e),n=R(r=>{if(typeof window>"u")return()=>{};let a=window.matchMedia(t);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[t]),o=R(()=>typeof window>"u"?!1:window.matchMedia(t).matches,[t]);return $o(n,o,_5)}he();var Ev={};En(Ev,{LexicalComposerContext:()=>jT,createLexicalComposerContext:()=>D5,useLexicalComposerContext:()=>O5});he();var jT=bt(null);function D5(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}}function O5(){let e=Ut(jT);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 Rv=Ev,QT=Rv.LexicalComposerContext,XT=Rv.createLexicalComposerContext,fn=Rv.useLexicalComposerContext;var ix={};En(ix,{$addUpdateTag:()=>Sm,$applyNodeReplacement:()=>mu,$caretFromPoint:()=>Ki,$caretRangeFromSelection:()=>yy,$cloneWithProperties:()=>Zy,$cloneWithPropertiesEphemeral:()=>xK,$comparePointCaretNext:()=>ox,$copyNode:()=>Yy,$create:()=>bK,$createLineBreakNode:()=>Yl,$createNodeSelection:()=>Oy,$createParagraphNode:()=>Ka,$createPoint:()=>Mr,$createRangeSelection:()=>UL,$createRangeSelectionFromDom:()=>j$,$createTabNode:()=>vm,$createTextNode:()=>jn,$extendCaretToRange:()=>tx,$findMatchingParent:()=>Qc,$getAdjacentChildCaret:()=>ad,$getAdjacentNode:()=>iP,$getAdjacentSiblingOrParentSiblingCaret:()=>AK,$getCaretInDirection:()=>qi,$getCaretRange:()=>$i,$getCaretRangeInDirection:()=>ax,$getCharacterOffsets:()=>cy,$getChildCaret:()=>Va,$getChildCaretAtIndex:()=>bP,$getChildCaretOrSelf:()=>hP,$getCollapsedCaretRange:()=>vP,$getCommonAncestor:()=>Xc,$getCommonAncestorResultBranchOrder:()=>rx,$getEditor:()=>Jy,$getNearestNodeFromDOMNode:()=>wm,$getNearestRootOrShadowRoot:()=>dP,$getNodeByKey:()=>Un,$getNodeByKeyOrThrow:()=>cP,$getNodeFromDOMNode:()=>qy,$getPreviousSelection:()=>Ks,$getRoot:()=>Go,$getSelection:()=>zt,$getSiblingCaret:()=>Zn,$getState:()=>Xp,$getStateChange:()=>m$,$getTextContent:()=>Y$,$getTextNodeOffset:()=>Rr,$getTextPointCaret:()=>Hi,$getTextPointCaretSlice:()=>hy,$getWritableNodeState:()=>wy,$hasAncestor:()=>um,$hasUpdateTag:()=>mK,$insertNodes:()=>X$,$isBlockElementNode:()=>G$,$isChildCaret:()=>Er,$isDecoratorNode:()=>tn,$isEditorState:()=>tK,$isElementNode:()=>se,$isExtendableTextPointCaret:()=>CP,$isInlineElementOrDecoratorNode:()=>gK,$isLeafNode:()=>uK,$isLineBreakNode:()=>Os,$isNodeCaret:()=>IK,$isNodeSelection:()=>cu,$isParagraphNode:()=>GL,$isRangeSelection:()=>Ge,$isRootNode:()=>io,$isRootOrShadowRoot:()=>fr,$isSiblingCaret:()=>$s,$isTabNode:()=>Dy,$isTextNode:()=>Ue,$isTextPointCaret:()=>qa,$isTextPointCaretSlice:()=>PK,$isTokenOrSegmented:()=>Ua,$isTokenOrTab:()=>Oi,$nodesOfType:()=>pK,$normalizeCaret:()=>Pr,$normalizeSelection__EXPERIMENTAL:()=>Yp,$onUpdate:()=>lP,$parseSerializedNode:()=>eK,$removeTextFromCaretRange:()=>xP,$rewindSiblingCaret:()=>dd,$selectAll:()=>fK,$setCompositionKey:()=>Xn,$setPointFromCaret:()=>id,$setSelection:()=>Bo,$setSelectionFromCaretRange:()=>yP,$setState:()=>g$,$splitAtPointCaretNext:()=>MK,$splitNode:()=>hK,$updateRangeSelectionFromCaretRange:()=>Yc,ArtificialNode__DO_NOT_USE:()=>dm,BEFORE_INPUT_COMMAND:()=>Iy,BLUR_COMMAND:()=>xL,CAN_REDO_COMMAND:()=>L$,CAN_UNDO_COMMAND:()=>P$,CLEAR_EDITOR_COMMAND:()=>T$,CLEAR_HISTORY_COMMAND:()=>k$,CLICK_COMMAND:()=>nL,COLLABORATION_TAG:()=>EL,COMMAND_PRIORITY_CRITICAL:()=>iK,COMMAND_PRIORITY_EDITOR:()=>Vl,COMMAND_PRIORITY_HIGH:()=>aK,COMMAND_PRIORITY_LOW:()=>oK,COMMAND_PRIORITY_NORMAL:()=>rK,COMPOSITION_END_COMMAND:()=>Ly,COMPOSITION_END_TAG:()=>_L,COMPOSITION_START_COMMAND:()=>ky,COMPOSITION_START_TAG:()=>NL,CONTROLLED_TEXT_INSERTION_COMMAND:()=>Gl,COPY_COMMAND:()=>My,CUT_COMMAND:()=>Ny,DELETE_CHARACTER_COMMAND:()=>tu,DELETE_LINE_COMMAND:()=>ou,DELETE_WORD_COMMAND:()=>nu,DRAGEND_COMMAND:()=>vL,DRAGOVER_COMMAND:()=>hL,DRAGSTART_COMMAND:()=>gL,DROP_COMMAND:()=>mL,DecoratorNode:()=>au,ElementNode:()=>zi,FOCUS_COMMAND:()=>yL,FORMAT_ELEMENT_COMMAND:()=>I$,FORMAT_TEXT_COMMAND:()=>_i,HISTORIC_TAG:()=>O$,HISTORY_MERGE_TAG:()=>Gp,HISTORY_PUSH_TAG:()=>F$,INDENT_CONTENT_COMMAND:()=>w$,INPUT_COMMAND:()=>Ty,INSERT_LINE_BREAK_COMMAND:()=>Wc,INSERT_PARAGRAPH_COMMAND:()=>ey,INSERT_TAB_COMMAND:()=>b$,INTERNAL_$isBlock:()=>$a,IS_ALL_FORMATTING:()=>Q5,IS_BOLD:()=>$5,IS_CODE:()=>W5,IS_HIGHLIGHT:()=>xy,IS_ITALIC:()=>K5,IS_STRIKETHROUGH:()=>q5,IS_SUBSCRIPT:()=>G5,IS_SUPERSCRIPT:()=>j5,IS_UNDERLINE:()=>V5,KEY_ARROW_DOWN_COMMAND:()=>lL,KEY_ARROW_LEFT_COMMAND:()=>aL,KEY_ARROW_RIGHT_COMMAND:()=>oL,KEY_ARROW_UP_COMMAND:()=>sL,KEY_BACKSPACE_COMMAND:()=>cL,KEY_DELETE_COMMAND:()=>fL,KEY_DOWN_COMMAND:()=>Ry,KEY_ENTER_COMMAND:()=>nm,KEY_ESCAPE_COMMAND:()=>uL,KEY_MODIFIER_COMMAND:()=>CL,KEY_SPACE_COMMAND:()=>dL,KEY_TAB_COMMAND:()=>pL,LineBreakNode:()=>Xl,MOVE_TO_END:()=>rL,MOVE_TO_START:()=>iL,NODE_STATE_KEY:()=>l$,OUTDENT_CONTENT_COMMAND:()=>S$,PASTE_COMMAND:()=>Py,PASTE_TAG:()=>B$,ParagraphNode:()=>ed,REDO_COMMAND:()=>Ey,REMOVE_TEXT_COMMAND:()=>ty,RootNode:()=>Zl,SELECTION_CHANGE_COMMAND:()=>Sy,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>C$,SELECT_ALL_COMMAND:()=>ny,SKIP_COLLAB_TAG:()=>z$,SKIP_DOM_SELECTION_TAG:()=>ML,SKIP_SCROLL_INTO_VIEW_TAG:()=>RL,SKIP_SELECTION_FOCUS_TAG:()=>ly,TEXT_TYPE_TO_FORMAT:()=>mo,TabNode:()=>Jl,TextNode:()=>zs,UNDO_COMMAND:()=>Ay,addClassNamesToElement:()=>BK,buildImportMap:()=>D$,configExtension:()=>_K,createCommand:()=>nt,createEditor:()=>sK,createSharedNodeState:()=>Xk,createState:()=>p$,declarePeerDependency:()=>DK,defineExtension:()=>NK,flipDirection:()=>Vi,getDOMOwnerDocument:()=>Qy,getDOMSelection:()=>_r,getDOMSelectionFromTarget:()=>uP,getDOMTextNode:()=>Hs,getEditorPropertyFromDOMNode:()=>fu,getNearestEditorFromDOMNode:()=>Ky,getRegisteredNode:()=>Hy,getRegisteredNodeOrThrow:()=>Uy,getStaticNodeConfig:()=>gu,getTextDirection:()=>cK,getTransformSetFromKlass:()=>QL,isBlockDomNode:()=>my,isCurrentlyReadOnlyMode:()=>sd,isDOMDocumentNode:()=>JL,isDOMNode:()=>ld,isDOMTextNode:()=>da,isDOMUnmanaged:()=>gP,isDocumentFragment:()=>fP,isExactShortcutMatch:()=>$t,isHTMLAnchorElement:()=>vK,isHTMLElement:()=>ko,isInlineDomNode:()=>pP,isLexicalEditor:()=>Cm,isModifierMatch:()=>aP,isSelectionCapturedInDecoratorInput:()=>$y,isSelectionWithinEditor:()=>uu,makeStepwiseIterator:()=>nx,mergeRegister:()=>UK,normalizeClassNames:()=>hu,removeClassNamesFromElement:()=>zK,removeFromParent:()=>Fi,resetRandomKey:()=>lK,safeCast:()=>OK,setDOMUnmanaged:()=>CK,setNodeIndentFromDOM:()=>mP,shallowMergeConfig:()=>FK,toggleTextFormatType:()=>su});function fe(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 $k(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 Nr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,F5=Nr&&"documentMode"in document?document.documentMode:null,Lr=Nr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Bi=Nr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Qp=!(!Nr||!("InputEvent"in window)||F5)&&"getTargetRanges"in new window.InputEvent("input"),pm=Nr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),du=Nr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,B5=Nr&&/Android/.test(navigator.userAgent),Kk=Nr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),$v=Nr&&B5&&Kk,mm=Nr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Lr&&!Kk,z5=0,U5=1,H5=2,$5=1,K5=2,q5=4,V5=8,W5=16,G5=32,j5=64,xy=128,Q5=2047,X5=1,Y5=2,J5=3,Z5=4,e$=5,t$=6,Jc=pm||du||mm?"\xA0":"\u200B",gm=`
3827
+ `},hH={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 vH(e){let{announcements:t=hH,container:n,hiddenTextDescribedById:o,screenReaderInstructions:r=gH}=e,{announce:a,announcement:i}=Z0(),s=Ts("DndLiveRegion"),[l,d]=Q(!1);if(W(()=>{d(!0)},[]),pH(q(()=>({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=Tn.createElement(Tn.Fragment,null,Tn.createElement(Y0,{id:o,value:r.draggable}),Tn.createElement(J0,{id:s,announcement:i}));return n?(0,Ps.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 Ep(){}function Pv(e,t){return q(()=>({sensor:e,options:t??{}}),[e,t])}function pT(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return q(()=>[...t].filter(o=>o!=null),[...t])}var Tr=Object.freeze({x:0,y:0});function mT(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function gT(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return n-o}function yH(e,t){let{data:{value:n}}=e,{data:{value:o}}=t;return o-n}function eT(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 tT(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 hT=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=tT(t,t.left,t.top),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=mT(tT(l),r);a.push({id:s,data:{droppableContainer:i,value:d}})}}return a.sort(gT)},vT=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:o}=e,r=eT(t),a=[];for(let i of o){let{id:s}=i,l=n.get(s);if(l){let d=eT(l),c=r.reduce((p,m,g)=>p+mT(d[g],m),0),f=Number((c/4).toFixed(4));a.push({id:s,data:{droppableContainer:i,value:f}})}}return a.sort(gT)};function xH(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 CH=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=xH(s,t);l>0&&r.push({id:i,data:{droppableContainer:a,value:l}})}}return r.sort(yH)};function bH(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function yT(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Tr}function wH(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 SH=wH(1);function IH(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 TH(e,t,n){let o=IH(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 kH={ignoreTransform:!1};function Rs(e,t){t===void 0&&(t=kH);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:d,transformOrigin:c}=To(e).getComputedStyle(e);d&&(n=TH(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 nT(e){return Rs(e,{ignoreTransform:!0})}function LH(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function PH(e,t){return t===void 0&&(t=To(e).getComputedStyle(e)),t.position==="fixed"}function AH(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 Kc(e,t){let n=[];function o(r){if(t!=null&&n.length>=t||!r)return n;if(kp(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!Bl(r)||xv(r)||n.includes(r))return n;let a=To(e).getComputedStyle(r);return r!==e&&AH(r,a)&&n.push(r),PH(r,a)?n:o(r.parentNode)}return e?o(e):n}function xT(e){let[t]=Kc(e,1);return t??null}function Cv(e){return!Dc||!e?null:Ss(e)?e:Tp(e)?kp(e)||e===Is(e).scrollingElement?window:Bl(e)?e:null:null}function CT(e){return Ss(e)?e.scrollX:e.scrollLeft}function bT(e){return Ss(e)?e.scrollY:e.scrollTop}function Sv(e){return{x:CT(e),y:bT(e)}}var Gn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Gn||(Gn={}));function wT(e){return!Dc||!e?!1:e===document.scrollingElement}function ST(e){let t={x:0,y:0},n=wT(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 EH={x:.2,y:.2};function RH(e,t,n,o,r){let{top:a,left:i,right:s,bottom:l}=n;o===void 0&&(o=10),r===void 0&&(r=EH);let{isTop:d,isBottom:c,isLeft:f,isRight:p}=ST(e),m={x:0,y:0},g={x:0,y:0},h={height:t.height*r.y,width:t.width*r.x};return!d&&a<=t.top+h.height?(m.y=Gn.Backward,g.y=o*Math.abs((t.top+h.height-a)/h.height)):!c&&l>=t.bottom-h.height&&(m.y=Gn.Forward,g.y=o*Math.abs((t.bottom-h.height-l)/h.height)),!p&&s>=t.right-h.width?(m.x=Gn.Forward,g.x=o*Math.abs((t.right-h.width-s)/h.width)):!f&&i<=t.left+h.width&&(m.x=Gn.Backward,g.x=o*Math.abs((t.left+h.width-i)/h.width)),{direction:m,speed:g}}function MH(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 IT(e){return e.reduce((t,n)=>ks(t,Sv(n)),Tr)}function NH(e){return e.reduce((t,n)=>t+CT(n),0)}function _H(e){return e.reduce((t,n)=>t+bT(n),0)}function DH(e,t){if(t===void 0&&(t=Rs),!e)return;let{top:n,left:o,bottom:r,right:a}=t(e);xT(e)&&(r<=0||a<=0||n>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}var OH=[["x",["left","right"],NH],["y",["top","bottom"],_H]],Uc=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=Kc(n),r=IT(o);this.rect={...t},this.width=t.width,this.height=t.height;for(let[a,i,s]of OH)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})}},As=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 FH(e){let{EventTarget:t}=To(e);return e instanceof t?e:Is(e)}function bv(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 dr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(dr||(dr={}));function oT(e){e.preventDefault()}function BH(e){e.stopPropagation()}var It;(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"})(It||(It={}));var TT={start:[It.Space,It.Enter],cancel:[It.Esc],end:[It.Space,It.Enter,It.Tab]},zH=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case It.Right:return{...n,x:n.x+25};case It.Left:return{...n,x:n.x-25};case It.Down:return{...n,y:n.y+25};case It.Up:return{...n,y:n.y-25}}},Hl=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 As(Is(n)),this.windowListeners=new As(To(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(dr.Resize,this.handleCancel),this.windowListeners.add(dr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(dr.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:t,onStart:n}=this.props,o=t.node.current;o&&DH(o),n(Tr)}handleKeyDown(t){if(Fc(t)){let{active:n,context:o,options:r}=this.props,{keyboardCodes:a=TT,coordinateGetter:i=zH,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}:Tr;this.referenceCoordinates||(this.referenceCoordinates=c);let f=i(t,{active:n,context:o.current,currentCoordinates:c});if(f){let p=Ls(f,c),m={x:0,y:0},{scrollableAncestors:g}=o.current;for(let h of g){let v=t.code,{isTop:y,isRight:x,isLeft:C,isBottom:w,maxScroll:T,minScroll:S}=ST(h),L=MH(h),k={x:Math.min(v===It.Right?L.right-L.width/2:L.right,Math.max(v===It.Right?L.left:L.left+L.width/2,f.x)),y:Math.min(v===It.Down?L.bottom-L.height/2:L.bottom,Math.max(v===It.Down?L.top:L.top+L.height/2,f.y))},I=v===It.Right&&!x||v===It.Left&&!C,P=v===It.Down&&!w||v===It.Up&&!y;if(I&&k.x!==f.x){let E=h.scrollLeft+p.x,_=v===It.Right&&E<=T.x||v===It.Left&&E>=S.x;if(_&&!p.y){h.scrollTo({left:E,behavior:s});return}_?m.x=h.scrollLeft-E:m.x=v===It.Right?h.scrollLeft-T.x:h.scrollLeft-S.x,m.x&&h.scrollBy({left:-m.x,behavior:s});break}else if(P&&k.y!==f.y){let E=h.scrollTop+p.y,_=v===It.Down&&E<=T.y||v===It.Up&&E>=S.y;if(_&&!p.x){h.scrollTo({top:E,behavior:s});return}_?m.y=h.scrollTop-E:m.y=v===It.Down?h.scrollTop-T.y:h.scrollTop-S.y,m.y&&h.scrollBy({top:-m.y,behavior:s});break}}this.handleMove(t,ks(Ls(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()}};Hl.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:o=TT,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 rT(e){return!!(e&&"distance"in e)}function aT(e){return!!(e&&"delay"in e)}var Hc=class{constructor(t,n,o){var r;o===void 0&&(o=FH(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=Is(i),this.documentListeners=new As(this.document),this.listeners=new As(o),this.windowListeners=new As(To(i)),this.initialCoordinates=(r=Bc(a))!=null?r:Tr,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(dr.Resize,this.handleCancel),this.windowListeners.add(dr.DragStart,oT),this.windowListeners.add(dr.VisibilityChange,this.handleCancel),this.windowListeners.add(dr.ContextMenu,oT),this.documentListeners.add(dr.Keydown,this.handleKeydown),n){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(aT(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(rT(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(dr.Click,BH,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(dr.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=Bc(t))!=null?n:Tr,d=Ls(r,l);if(!o&&s){if(rT(s)){if(s.tolerance!=null&&bv(d,s.tolerance))return this.handleCancel();if(bv(d,s.distance))return this.handleStart()}if(aT(s)&&bv(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===It.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}},UH={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},$l=class extends Hc{constructor(t){let{event:n}=t,o=Is(n.target);super(t,UH,o)}};$l.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 HH={move:{name:"mousemove"},end:{name:"mouseup"}},Iv;(function(e){e[e.RightClick=2]="RightClick"})(Iv||(Iv={}));var Tv=class extends Hc{constructor(t){super(t,HH,Is(t.event.target))}};Tv.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:o}=t;return n.button===Iv.RightClick?!1:(o?.({event:n}),!0)}}];var wv={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},kv=class extends Hc{constructor(t){super(t,wv)}static setup(){return window.addEventListener(wv.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(wv.move.name,t)};function t(){}}};kv.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 zc;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(zc||(zc={}));var Rp;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Rp||(Rp={}));function $H(e){let{acceleration:t,activator:n=zc.Pointer,canScroll:o,draggingRect:r,enabled:a,interval:i=5,order:s=Rp.TreeOrder,pointerCoordinates:l,scrollableAncestors:d,scrollableAncestorRects:c,delta:f,threshold:p}=e,m=qH({delta:f,disabled:!a}),[g,h]=j0(),v=N({x:0,y:0}),y=N({x:0,y:0}),x=q(()=>{switch(n){case zc.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case zc.DraggableRect:return r}},[n,r,l]),C=N(null),w=R(()=>{let S=C.current;if(!S)return;let L=v.current.x*y.current.x,k=v.current.y*y.current.y;S.scrollBy(L,k)},[]),T=q(()=>s===Rp.TreeOrder?[...d].reverse():d,[s,d]);W(()=>{if(!a||!d.length||!x){h();return}for(let S of T){if(o?.(S)===!1)continue;let L=d.indexOf(S),k=c[L];if(!k)continue;let{direction:I,speed:P}=RH(S,k,x,t,p);for(let E of["x","y"])m[E][I[E]]||(P[E]=0,I[E]=0);if(P.x>0||P.y>0){h(),C.current=S,g(w,i),v.current=P,y.current=I;return}}v.current={x:0,y:0},y.current={x:0,y:0},h()},[t,w,o,h,a,i,JSON.stringify(x),JSON.stringify(m),g,d,T,c,JSON.stringify(p)])}var KH={x:{[Gn.Backward]:!1,[Gn.Forward]:!1},y:{[Gn.Backward]:!1,[Gn.Forward]:!1}};function qH(e){let{delta:t,disabled:n}=e,o=Pp(t);return Ul(r=>{if(n||!o||!r)return KH;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 VH(e,t){let n=t!=null?e.get(t):void 0,o=n?n.node.current:null;return Ul(r=>{var a;return t==null?null:(a=o??r)!=null?a:null},[o,t])}function WH(e,t){return q(()=>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 $c;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})($c||($c={}));var Lv;(function(e){e.Optimized="optimized"})(Lv||(Lv={}));var iT=new Map;function GH(e,t){let{dragging:n,dependencies:o,config:r}=t,[a,i]=Q(null),{frequency:s,measure:l,strategy:d}=r,c=N(e),f=v(),p=zl(f),m=R(function(y){y===void 0&&(y=[]),!p.current&&i(x=>x===null?y:x.concat(y.filter(C=>!x.includes(C))))},[p]),g=N(null),h=Ul(y=>{if(f&&!n)return iT;if(!y||y===iT||c.current!==e||a!=null){let x=new Map;for(let C of e){if(!C)continue;if(a&&a.length>0&&!a.includes(C.id)&&C.rect.current){x.set(C.id,C.rect.current);continue}let w=C.node.current,T=w?new Uc(l(w),w):null;C.rect.current=T,T&&x.set(C.id,T)}return x}return y},[e,a,n,f,l]);return W(()=>{c.current=e},[e]),W(()=>{f||m()},[n,f]),W(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),W(()=>{f||typeof s!="number"||g.current!==null||(g.current=setTimeout(()=>{m(),g.current=null},s))},[s,f,m,...o]),{droppableRects:h,measureDroppableContainers:m,measuringScheduled:a!=null};function v(){switch(d){case $c.Always:return!1;case $c.BeforeDragging:return n;default:return!n}}}function kT(e,t){return Ul(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function jH(e,t){return kT(e,t)}function QH(e){let{callback:t,disabled:n}=e,o=Lp(t),r=q(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(o)},[o,n]);return W(()=>()=>r?.disconnect(),[r]),r}function Mp(e){let{callback:t,disabled:n}=e,o=Lp(t),r=q(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(o)},[n]);return W(()=>()=>r?.disconnect(),[r]),r}function XH(e){return new Uc(Rs(e),e)}function sT(e,t,n){t===void 0&&(t=XH);let[o,r]=Q(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=QH({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=Mp({callback:a});return lr(()=>{a(),e?(s?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[e]),o}function YH(e){let t=kT(e);return yT(e,t)}var lT=[];function JH(e){let t=N(e),n=Ul(o=>e?o&&o!==lT&&e&&t.current&&e.parentNode===t.current.parentNode?o:Kc(e):lT,[e]);return W(()=>{t.current=e},[e]),n}function ZH(e){let[t,n]=Q(null),o=N(e),r=R(a=>{let i=Cv(a.target);i&&n(s=>s?(s.set(i,Sv(i)),new Map(s)):null)},[]);return W(()=>{let a=o.current;if(e!==a){i(a);let s=e.map(l=>{let d=Cv(l);return d?(d.addEventListener("scroll",r,{passive:!0}),[d,Sv(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=Cv(l);d?.removeEventListener("scroll",r)})}},[r,e]),q(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>ks(a,i),Tr):IT(e):Tr,[e,t])}function dT(e,t){t===void 0&&(t=[]);let n=N(null);return W(()=>{n.current=null},t),W(()=>{let o=e!==Tr;o&&!n.current&&(n.current=e),!o&&n.current&&(n.current=null)},[e]),n.current?Ls(e,n.current):Tr}function e5(e){W(()=>{if(!Dc)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 t5(e,t){return q(()=>e.reduce((n,o)=>{let{eventName:r,handler:a}=o;return n[r]=i=>{a(i,t)},n},{}),[e,t])}function LT(e){return q(()=>e?LH(e):null,[e])}var cT=[];function n5(e,t){t===void 0&&(t=Rs);let[n]=e,o=LT(n?To(n):null),[r,a]=Q(cT);function i(){a(()=>e.length?e.map(l=>wT(l)?o:new Uc(t(l),l)):cT)}let s=Mp({callback:i});return lr(()=>{s?.disconnect(),i(),e.forEach(l=>s?.observe(l))},[e]),r}function o5(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Bl(t)?t:e}function r5(e){let{measure:t}=e,[n,o]=Q(null),r=R(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=Mp({callback:r}),i=R(d=>{let c=o5(d);a?.disconnect(),c&&a?.observe(c),o(c?t(c):null)},[t,a]),[s,l]=Oc(i);return q(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}var a5=[{sensor:$l,options:{}},{sensor:Hl,options:{}}],i5={current:{}},Ap={draggable:{measure:nT},droppable:{measure:nT,strategy:$c.WhileDragging,frequency:Lv.Optimized},dragOverlay:{measure:Rs}},Es=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}},s5={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Es,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ep},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ap,measureDroppableContainers:Ep,windowRect:null,measuringScheduled:!1},l5={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ep,draggableNodes:new Map,over:null,measureDroppableContainers:Ep},Np=bt(l5),PT=bt(s5);function d5(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Es}}}function c5(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 Es(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 Es(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 Es(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function u5(e){let{disabled:t}=e,{active:n,activatorEvent:o,draggableNodes:r}=Ut(Np),a=Pp(o),i=Pp(n?.id);return W(()=>{if(!t&&!o&&a&&i!=null){if(!Fc(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=X0(c);if(f){f.focus();break}}})}},[o,t,r,i,a]),null}function f5(e,t){let{transform:n,...o}=t;return e!=null&&e.length?e.reduce((r,a)=>a({transform:r,...o}),n):n}function p5(e){return q(()=>({draggable:{...Ap.draggable,...e?.draggable},droppable:{...Ap.droppable,...e?.droppable},dragOverlay:{...Ap.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function m5(e){let{activeNode:t,measure:n,initialRect:o,config:r=!0}=e,a=N(!1),{x:i,y:s}=typeof r=="boolean"?{x:r,y:r}:r;lr(()=>{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=yT(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=xT(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,s,o,n])}var AT=bt({...Tr,scaleX:1,scaleY:1}),Ni;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ni||(Ni={}));var ET=ve(function(t){var n,o,r,a;let{id:i,accessibility:s,autoScroll:l=!0,children:d,sensors:c=a5,collisionDetection:f=CH,measuring:p,modifiers:m,...g}=t,h=Ea(c5,void 0,d5),[v,y]=h,[x,C]=mH(),[w,T]=Q(Ni.Uninitialized),S=w===Ni.Initialized,{draggable:{active:L,nodes:k,translate:I},droppable:{containers:P}}=v,E=L!=null?k.get(L):null,_=N({initial:null,translated:null}),A=q(()=>{var ce;return L!=null?{id:L,data:(ce=E?.data)!=null?ce:i5,rect:_}:null},[L,E]),H=N(null),[V,J]=Q(null),[D,ne]=Q(null),F=zl(g,Object.values(g)),U=Ts("DndDescribedBy",i),ee=q(()=>P.getEnabled(),[P]),j=p5(p),{droppableRects:Z,measureDroppableContainers:de,measuringScheduled:B}=GH(ee,{dragging:S,dependencies:[I.x,I.y],config:j.droppable}),X=VH(k,L),pe=q(()=>D?Bc(D):null,[D]),le=ae(),re=jH(X,j.draggable.measure);m5({activeNode:L!=null?k.get(L):null,config:le.layoutShiftCompensation,initialRect:re,measure:j.draggable.measure});let we=sT(X,j.draggable.measure,re),Xe=sT(X?X.parentElement:null),ot=N({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:Z,draggableNodes:k,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),at=P.getNodeFor((n=ot.current.over)==null?void 0:n.id),je=r5({measure:j.dragOverlay.measure}),oe=(o=je.nodeRef.current)!=null?o:X,Te=S?(r=je.rect)!=null?r:we:null,Y=!!(je.nodeRef.current&&je.rect),me=YH(Y?null:we),ge=LT(oe?To(oe):null),G=JH(S?at??X:null),Ye=n5(G),ht=f5(m,{transform:{x:I.x-me.x,y:I.y-me.y,scaleX:1,scaleY:1},activatorEvent:D,active:A,activeNodeRect:we,containerNodeRect:Xe,draggingNodeRect:Te,over:ot.current.over,overlayNodeRect:je.rect,scrollableAncestors:G,scrollableAncestorRects:Ye,windowRect:ge}),Mt=pe?ks(pe,I):null,Dt=ZH(G),Nt=dT(Dt),Ot=dT(Dt,[we]),At=ks(ht,Nt),xt=Te?SH(Te,ht):null,_t=A&&xt?f({active:A,collisionRect:xt,droppableRects:Z,droppableContainers:ee,pointerCoordinates:Mt}):null,Xt=Av(_t,"id"),[mn,Hn]=Q(null),vt=Y?ht:ks(ht,Ot),qt=bH(vt,(a=mn?.rect)!=null?a:null,we),an=N(null),kn=R((ce,Le)=>{let{sensor:ze,options:ft}=Le;if(H.current==null)return;let gn=k.get(H.current);if(!gn)return;let lt=ce.nativeEvent,hn=new ze({active:H.current,activeNode:gn,event:lt,options:ft,context:ot,onAbort(rt){if(!k.get(rt))return;let{onDragAbort:ln}=F.current,Se={id:rt};ln?.(Se),x({type:"onDragAbort",event:Se})},onPending(rt,Zt,ln,Se){if(!k.get(rt))return;let{onDragPending:qe}=F.current,pt={id:rt,constraint:Zt,initialCoordinates:ln,offset:Se};qe?.(pt),x({type:"onDragPending",event:pt})},onStart(rt){let Zt=H.current;if(Zt==null)return;let ln=k.get(Zt);if(!ln)return;let{onDragStart:Se}=F.current,Re={activatorEvent:lt,active:{id:Zt,data:ln.data,rect:_}};(0,Ps.unstable_batchedUpdates)(()=>{Se?.(Re),T(Ni.Initializing),y({type:Bn.DragStart,initialCoordinates:rt,active:Zt}),x({type:"onDragStart",event:Re}),J(an.current),ne(lt)})},onMove(rt){y({type:Bn.DragMove,coordinates:rt})},onEnd:Ft(Bn.DragEnd),onCancel:Ft(Bn.DragCancel)});an.current=hn;function Ft(rt){return async function(){let{active:ln,collisions:Se,over:Re,scrollAdjustedTranslate:qe}=ot.current,pt=null;if(ln&&qe){let{cancelDrop:st}=F.current;pt={activatorEvent:lt,active:ln,collisions:Se,delta:qe,over:Re},rt===Bn.DragEnd&&typeof st=="function"&&await Promise.resolve(st(pt))&&(rt=Bn.DragCancel)}H.current=null,(0,Ps.unstable_batchedUpdates)(()=>{y({type:rt}),T(Ni.Uninitialized),Hn(null),J(null),ne(null),an.current=null;let st=rt===Bn.DragEnd?"onDragEnd":"onDragCancel";if(pt){let it=F.current[st];it?.(pt),x({type:st,event:pt})}})}}},[k]),sn=R((ce,Le)=>(ze,ft)=>{let gn=ze.nativeEvent,lt=k.get(ft);if(H.current!==null||!lt||gn.dndKit||gn.defaultPrevented)return;let hn={active:lt};ce(ze,Le.options,hn)===!0&&(gn.dndKit={capturedBy:Le.sensor},H.current=ft,kn(ze,Le))},[k,kn]),Cn=WH(c,sn);e5(c),lr(()=>{we&&w===Ni.Initializing&&T(Ni.Initialized)},[we,w]),W(()=>{let{onDragMove:ce}=F.current,{active:Le,activatorEvent:ze,collisions:ft,over:gn}=ot.current;if(!Le||!ze)return;let lt={active:Le,activatorEvent:ze,collisions:ft,delta:{x:At.x,y:At.y},over:gn};(0,Ps.unstable_batchedUpdates)(()=>{ce?.(lt),x({type:"onDragMove",event:lt})})},[At.x,At.y]),W(()=>{let{active:ce,activatorEvent:Le,collisions:ze,droppableContainers:ft,scrollAdjustedTranslate:gn}=ot.current;if(!ce||H.current==null||!Le||!gn)return;let{onDragOver:lt}=F.current,hn=ft.get(Xt),Ft=hn&&hn.rect.current?{id:hn.id,rect:hn.rect.current,data:hn.data,disabled:hn.disabled}:null,rt={active:ce,activatorEvent:Le,collisions:ze,delta:{x:gn.x,y:gn.y},over:Ft};(0,Ps.unstable_batchedUpdates)(()=>{Hn(Ft),lt?.(rt),x({type:"onDragOver",event:rt})})},[Xt]),lr(()=>{ot.current={activatorEvent:D,active:A,activeNode:X,collisionRect:xt,collisions:_t,droppableRects:Z,draggableNodes:k,draggingNode:oe,draggingNodeRect:Te,droppableContainers:P,over:mn,scrollableAncestors:G,scrollAdjustedTranslate:At},_.current={initial:Te,translated:xt}},[A,X,_t,xt,k,oe,Te,Z,P,mn,G,At]),$H({...le,delta:I,draggingRect:xt,pointerCoordinates:Mt,scrollableAncestors:G,scrollableAncestorRects:Ye});let $n=q(()=>({active:A,activeNode:X,activeNodeRect:we,activatorEvent:D,collisions:_t,containerNodeRect:Xe,dragOverlay:je,draggableNodes:k,droppableContainers:P,droppableRects:Z,over:mn,measureDroppableContainers:de,scrollableAncestors:G,scrollableAncestorRects:Ye,measuringConfiguration:j,measuringScheduled:B,windowRect:ge}),[A,X,we,D,_t,Xe,je,k,P,Z,mn,de,G,Ye,j,B,ge]),$=q(()=>({activatorEvent:D,activators:Cn,active:A,activeNodeRect:we,ariaDescribedById:{draggable:U},dispatch:y,draggableNodes:k,over:mn,measureDroppableContainers:de}),[D,Cn,A,we,y,U,k,mn,de]);return Tn.createElement(fT.Provider,{value:C},Tn.createElement(Np.Provider,{value:$},Tn.createElement(PT.Provider,{value:$n},Tn.createElement(AT.Provider,{value:qt},d)),Tn.createElement(u5,{disabled:s?.restoreFocus===!1})),Tn.createElement(vH,{...s,hiddenTextDescribedById:U}));function ae(){let ce=V?.autoScrollEnabled===!1,Le=typeof l=="object"?l.enabled===!1:l===!1,ze=S&&!ce&&!Le;return typeof l=="object"?{...l,enabled:ze}:{enabled:ze}}}),g5=bt(null),uT="button",h5="Draggable";function RT(e){let{id:t,data:n,disabled:o=!1,attributes:r}=e,a=Ts(h5),{activators:i,activatorEvent:s,active:l,activeNodeRect:d,ariaDescribedById:c,draggableNodes:f,over:p}=Ut(Np),{role:m=uT,roleDescription:g="draggable",tabIndex:h=0}=r??{},v=l?.id===t,y=Ut(v?AT:g5),[x,C]=Oc(),[w,T]=Oc(),S=t5(i,t),L=zl(n);lr(()=>(f.set(t,{id:t,key:a,node:x,activatorNode:w,data:L}),()=>{let I=f.get(t);I&&I.key===a&&f.delete(t)}),[f,t]);let k=q(()=>({role:m,tabIndex:h,"aria-disabled":o,"aria-pressed":v&&m===uT?!0:void 0,"aria-roledescription":g,"aria-describedby":c.draggable}),[o,m,h,v,g,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:d,attributes:k,isDragging:v,listeners:o?void 0:S,node:x,over:p,setNodeRef:C,setActivatorNodeRef:T,transform:y}}function MT(){return Ut(PT)}var v5="Droppable",y5={timeout:25};function NT(e){let{data:t,disabled:n=!1,id:o,resizeObserverConfig:r}=e,a=Ts(v5),{active:i,dispatch:s,over:l,measureDroppableContainers:d}=Ut(Np),c=N({disabled:n}),f=N(!1),p=N(null),m=N(null),{disabled:g,updateMeasurementsFor:h,timeout:v}={...y5,...r},y=zl(h??o),x=R(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(y.current)?y.current:[y.current]),m.current=null},v)},[v]),C=Mp({callback:x,disabled:g||!i}),w=R((k,I)=>{C&&(I&&(C.unobserve(I),f.current=!1),k&&C.observe(k))},[C]),[T,S]=Oc(w),L=zl(t);return W(()=>{!C||!T.current||(C.disconnect(),f.current=!1,C.observe(T.current))},[T,C]),W(()=>(s({type:Bn.RegisterDroppable,element:{id:o,key:a,disabled:n,node:T,rect:p,data:L}}),()=>s({type:Bn.UnregisterDroppable,key:a,id:o})),[o]),W(()=>{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:T,over:l,setNodeRef:S}}he();function _T(e,t,n){let o=e.slice();return o.splice(n<0?o.length+n:n,0,o.splice(t,1)[0]),o}function x5(e,t){return e.reduce((n,o,r)=>{let a=t.get(o);return a&&(n[r]=a),n},Array(e.length))}function _p(e){return e!==null&&e>=0}function C5(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 b5(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}var DT=e=>{let{rects:t,activeIndex:n,overIndex:o,index:r}=e,a=_T(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 Dp={scaleX:1,scaleY:1},OT=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,...Dp}:null}let l=w5(a,r,n);return r>n&&r<=i?{x:0,y:-s.height-l,...Dp}:r<n&&r>=i?{x:0,y:s.height+l,...Dp}:{x:0,y:0,...Dp}};function w5(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 FT="Sortable",BT=Tn.createContext({activeIndex:-1,containerId:FT,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:DT,disabled:{draggable:!1,droppable:!1}});function zT(e){let{children:t,id:n,items:o,strategy:r=DT,disabled:a=!1}=e,{active:i,dragOverlay:s,droppableRects:l,over:d,measureDroppableContainers:c}=MT(),f=Ts(FT,n),p=s.rect!==null,m=q(()=>o.map(S=>typeof S=="object"&&"id"in S?S.id:S),[o]),g=i!=null,h=i?m.indexOf(i.id):-1,v=d?m.indexOf(d.id):-1,y=N(m),x=!C5(m,y.current),C=v!==-1&&h===-1||x,w=b5(a);lr(()=>{x&&g&&c(m)},[x,m,g,c]),W(()=>{y.current=m},[m]);let T=q(()=>({activeIndex:h,containerId:f,disabled:w,disableTransforms:C,items:m,overIndex:v,useDragOverlay:p,sortedRects:x5(m,l),strategy:r}),[h,f,w.draggable,w.droppable,C,m,v,l,p,r]);return Tn.createElement(BT.Provider,{value:T},t)}var S5=e=>{let{id:t,items:n,activeIndex:o,overIndex:r}=e;return _T(n,o,r).indexOf(t)},I5=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},T5={duration:200,easing:"ease"},UT="transform",k5=Mi.Transition.toString({property:UT,duration:0,easing:"linear"}),L5={roleDescription:"sortable"};function P5(e){let{disabled:t,index:n,node:o,rect:r}=e,[a,i]=Q(null),s=N(n);return lr(()=>{if(!t&&n!==s.current&&o.current){let l=r.current;if(l){let d=Rs(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]),W(()=>{a&&i(null)},[a]),a}function HT(e){let{animateLayoutChanges:t=I5,attributes:n,disabled:o,data:r,getNewIndex:a=S5,id:i,strategy:s,resizeObserverConfig:l,transition:d=T5}=e,{items:c,containerId:f,activeIndex:p,disabled:m,disableTransforms:g,sortedRects:h,overIndex:v,useDragOverlay:y,strategy:x}=Ut(BT),C=A5(o,m),w=c.indexOf(i),T=q(()=>({sortable:{containerId:f,index:w,items:c},...r}),[f,r,w,c]),S=q(()=>c.slice(c.indexOf(i)),[c,i]),{rect:L,node:k,isOver:I,setNodeRef:P}=NT({id:i,data:T,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...l}}),{active:E,activatorEvent:_,activeNodeRect:A,attributes:H,setNodeRef:V,listeners:J,isDragging:D,over:ne,setActivatorNodeRef:F,transform:U}=RT({id:i,data:T,attributes:{...L5,...n},disabled:C.draggable}),ee=G0(P,V),j=!!E,Z=j&&!g&&_p(p)&&_p(v),de=!y&&D,B=de&&Z?U:null,pe=Z?B??(s??x)({rects:h,activeNodeRect:A,activeIndex:p,overIndex:v,index:w}):null,le=_p(p)&&_p(v)?a({id:i,items:c,activeIndex:p,overIndex:v}):w,re=E?.id,we=N({activeId:re,items:c,newIndex:le,containerId:f}),Xe=c!==we.current.items,ot=t({active:E,containerId:f,isDragging:D,isSorting:j,id:i,index:w,items:c,newIndex:we.current.newIndex,previousItems:we.current.items,previousContainerId:we.current.containerId,transition:d,wasDragging:we.current.activeId!=null}),at=P5({disabled:!ot,index:w,node:k,rect:L});return W(()=>{j&&we.current.newIndex!==le&&(we.current.newIndex=le),f!==we.current.containerId&&(we.current.containerId=f),c!==we.current.items&&(we.current.items=c)},[j,le,f,c]),W(()=>{if(re===we.current.activeId)return;if(re!=null&&we.current.activeId==null){we.current.activeId=re;return}let oe=setTimeout(()=>{we.current.activeId=re},50);return()=>clearTimeout(oe)},[re]),{active:E,activeIndex:p,attributes:H,data:T,rect:L,index:w,newIndex:le,items:c,isOver:I,isSorting:j,isDragging:D,listeners:J,node:k,overIndex:v,over:ne,setNodeRef:ee,setActivatorNodeRef:F,setDroppableNodeRef:P,setDraggableNodeRef:V,transform:at??pe,transition:je()};function je(){if(at||Xe&&we.current.newIndex===w)return k5;if(!(de&&!Fc(_)||!d)&&(j||ot))return Mi.Transition.toString({...d,property:UT})}}function A5(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 Op(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 E5=[It.Down,It.Right,It.Up,It.Left],$T=(e,t)=>{let{context:{active:n,collisionRect:o,droppableRects:r,droppableContainers:a,over:i,scrollableAncestors:s}}=t;if(E5.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 It.Down:o.top<p.top&&l.push(f);break;case It.Up:o.top>p.top&&l.push(f);break;case It.Left:o.left>p.left&&l.push(f);break;case It.Right:o.left<p.left&&l.push(f);break}});let d=vT({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,g=p?.node.current;if(g&&m&&f&&p){let v=Kc(g).some((S,L)=>s[L]!==S),y=KT(f,p),x=R5(f,p),C=v||!y?{x:0,y:0}:{x:x?o.width-m.width:0,y:x?o.height-m.height:0},w={x:m.left,y:m.top};return C.x&&C.y?w:Ls(w,C)}}}};function KT(e,t){return!Op(e)||!Op(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function R5(e,t){return!Op(e)||!Op(t)||!KT(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function M5(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 qT=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:o}=e,r=o[0];return!t||!r?n:M5(n,t,r)},VT=e=>{let{transform:t}=e;return{...t,x:0}};he();he();var Fp={"2xl":1536,"3xl":1600,"4xl":2e3,lg:1024,md:768,sm:640,xl:1280};function WT(e){return`(min-width: ${typeof e=="number"?e:Fp[e]}px)`}function GT(e){return`(max-width: ${(typeof e=="number"?e:Fp[e])-1}px)`}function N5(e){if(typeof e!="string"){let n=[];return e.min!=null&&n.push(WT(e.min)),e.max!=null&&n.push(GT(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 Fp&&t.push(GT(o))}else n in Fp&&t.push(WT(n));return t.length>0?t.join(" and "):e}function _5(){return!1}function Bp(e){let t=N5(e),n=R(r=>{if(typeof window>"u")return()=>{};let a=window.matchMedia(t);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[t]),o=R(()=>typeof window>"u"?!1:window.matchMedia(t).matches,[t]);return $o(n,o,_5)}he();var Ev={};En(Ev,{LexicalComposerContext:()=>jT,createLexicalComposerContext:()=>D5,useLexicalComposerContext:()=>O5});he();var jT=bt(null);function D5(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n!=null?n.getTheme():null)}}}function O5(){let e=Ut(jT);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 Rv=Ev,QT=Rv.LexicalComposerContext,XT=Rv.createLexicalComposerContext,fn=Rv.useLexicalComposerContext;var ix={};En(ix,{$addUpdateTag:()=>Sm,$applyNodeReplacement:()=>mu,$caretFromPoint:()=>Ki,$caretRangeFromSelection:()=>yy,$cloneWithProperties:()=>Zy,$cloneWithPropertiesEphemeral:()=>xK,$comparePointCaretNext:()=>ox,$copyNode:()=>Yy,$create:()=>bK,$createLineBreakNode:()=>Yl,$createNodeSelection:()=>Oy,$createParagraphNode:()=>Ka,$createPoint:()=>Rr,$createRangeSelection:()=>UL,$createRangeSelectionFromDom:()=>j$,$createTabNode:()=>vm,$createTextNode:()=>jn,$extendCaretToRange:()=>tx,$findMatchingParent:()=>Qc,$getAdjacentChildCaret:()=>ad,$getAdjacentNode:()=>iP,$getAdjacentSiblingOrParentSiblingCaret:()=>AK,$getCaretInDirection:()=>qi,$getCaretRange:()=>$i,$getCaretRangeInDirection:()=>ax,$getCharacterOffsets:()=>cy,$getChildCaret:()=>Va,$getChildCaretAtIndex:()=>bP,$getChildCaretOrSelf:()=>hP,$getCollapsedCaretRange:()=>vP,$getCommonAncestor:()=>Xc,$getCommonAncestorResultBranchOrder:()=>rx,$getEditor:()=>Jy,$getNearestNodeFromDOMNode:()=>wm,$getNearestRootOrShadowRoot:()=>dP,$getNodeByKey:()=>Un,$getNodeByKeyOrThrow:()=>cP,$getNodeFromDOMNode:()=>qy,$getPreviousSelection:()=>$s,$getRoot:()=>Go,$getSelection:()=>zt,$getSiblingCaret:()=>Zn,$getState:()=>Xp,$getStateChange:()=>m$,$getTextContent:()=>Y$,$getTextNodeOffset:()=>Er,$getTextPointCaret:()=>Hi,$getTextPointCaretSlice:()=>hy,$getWritableNodeState:()=>wy,$hasAncestor:()=>um,$hasUpdateTag:()=>mK,$insertNodes:()=>X$,$isBlockElementNode:()=>G$,$isChildCaret:()=>Ar,$isDecoratorNode:()=>tn,$isEditorState:()=>tK,$isElementNode:()=>se,$isExtendableTextPointCaret:()=>CP,$isInlineElementOrDecoratorNode:()=>gK,$isLeafNode:()=>uK,$isLineBreakNode:()=>Ds,$isNodeCaret:()=>IK,$isNodeSelection:()=>cu,$isParagraphNode:()=>GL,$isRangeSelection:()=>Ge,$isRootNode:()=>io,$isRootOrShadowRoot:()=>ur,$isSiblingCaret:()=>Hs,$isTabNode:()=>Dy,$isTextNode:()=>Ue,$isTextPointCaret:()=>qa,$isTextPointCaretSlice:()=>PK,$isTokenOrSegmented:()=>Ua,$isTokenOrTab:()=>Oi,$nodesOfType:()=>pK,$normalizeCaret:()=>Lr,$normalizeSelection__EXPERIMENTAL:()=>Yp,$onUpdate:()=>lP,$parseSerializedNode:()=>eK,$removeTextFromCaretRange:()=>xP,$rewindSiblingCaret:()=>dd,$selectAll:()=>fK,$setCompositionKey:()=>Xn,$setPointFromCaret:()=>id,$setSelection:()=>Bo,$setSelectionFromCaretRange:()=>yP,$setState:()=>g$,$splitAtPointCaretNext:()=>MK,$splitNode:()=>hK,$updateRangeSelectionFromCaretRange:()=>Yc,ArtificialNode__DO_NOT_USE:()=>dm,BEFORE_INPUT_COMMAND:()=>Iy,BLUR_COMMAND:()=>xL,CAN_REDO_COMMAND:()=>L$,CAN_UNDO_COMMAND:()=>P$,CLEAR_EDITOR_COMMAND:()=>T$,CLEAR_HISTORY_COMMAND:()=>k$,CLICK_COMMAND:()=>nL,COLLABORATION_TAG:()=>EL,COMMAND_PRIORITY_CRITICAL:()=>iK,COMMAND_PRIORITY_EDITOR:()=>Vl,COMMAND_PRIORITY_HIGH:()=>aK,COMMAND_PRIORITY_LOW:()=>oK,COMMAND_PRIORITY_NORMAL:()=>rK,COMPOSITION_END_COMMAND:()=>Ly,COMPOSITION_END_TAG:()=>_L,COMPOSITION_START_COMMAND:()=>ky,COMPOSITION_START_TAG:()=>NL,CONTROLLED_TEXT_INSERTION_COMMAND:()=>Gl,COPY_COMMAND:()=>My,CUT_COMMAND:()=>Ny,DELETE_CHARACTER_COMMAND:()=>tu,DELETE_LINE_COMMAND:()=>ou,DELETE_WORD_COMMAND:()=>nu,DRAGEND_COMMAND:()=>vL,DRAGOVER_COMMAND:()=>hL,DRAGSTART_COMMAND:()=>gL,DROP_COMMAND:()=>mL,DecoratorNode:()=>au,ElementNode:()=>zi,FOCUS_COMMAND:()=>yL,FORMAT_ELEMENT_COMMAND:()=>I$,FORMAT_TEXT_COMMAND:()=>_i,HISTORIC_TAG:()=>O$,HISTORY_MERGE_TAG:()=>Gp,HISTORY_PUSH_TAG:()=>F$,INDENT_CONTENT_COMMAND:()=>w$,INPUT_COMMAND:()=>Ty,INSERT_LINE_BREAK_COMMAND:()=>Wc,INSERT_PARAGRAPH_COMMAND:()=>ey,INSERT_TAB_COMMAND:()=>b$,INTERNAL_$isBlock:()=>$a,IS_ALL_FORMATTING:()=>Q5,IS_BOLD:()=>$5,IS_CODE:()=>W5,IS_HIGHLIGHT:()=>xy,IS_ITALIC:()=>K5,IS_STRIKETHROUGH:()=>q5,IS_SUBSCRIPT:()=>G5,IS_SUPERSCRIPT:()=>j5,IS_UNDERLINE:()=>V5,KEY_ARROW_DOWN_COMMAND:()=>lL,KEY_ARROW_LEFT_COMMAND:()=>aL,KEY_ARROW_RIGHT_COMMAND:()=>oL,KEY_ARROW_UP_COMMAND:()=>sL,KEY_BACKSPACE_COMMAND:()=>cL,KEY_DELETE_COMMAND:()=>fL,KEY_DOWN_COMMAND:()=>Ry,KEY_ENTER_COMMAND:()=>nm,KEY_ESCAPE_COMMAND:()=>uL,KEY_MODIFIER_COMMAND:()=>CL,KEY_SPACE_COMMAND:()=>dL,KEY_TAB_COMMAND:()=>pL,LineBreakNode:()=>Xl,MOVE_TO_END:()=>rL,MOVE_TO_START:()=>iL,NODE_STATE_KEY:()=>l$,OUTDENT_CONTENT_COMMAND:()=>S$,PASTE_COMMAND:()=>Py,PASTE_TAG:()=>B$,ParagraphNode:()=>ed,REDO_COMMAND:()=>Ey,REMOVE_TEXT_COMMAND:()=>ty,RootNode:()=>Zl,SELECTION_CHANGE_COMMAND:()=>Sy,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>C$,SELECT_ALL_COMMAND:()=>ny,SKIP_COLLAB_TAG:()=>z$,SKIP_DOM_SELECTION_TAG:()=>ML,SKIP_SCROLL_INTO_VIEW_TAG:()=>RL,SKIP_SELECTION_FOCUS_TAG:()=>ly,TEXT_TYPE_TO_FORMAT:()=>mo,TabNode:()=>Jl,TextNode:()=>Bs,UNDO_COMMAND:()=>Ay,addClassNamesToElement:()=>BK,buildImportMap:()=>D$,configExtension:()=>_K,createCommand:()=>nt,createEditor:()=>sK,createSharedNodeState:()=>Xk,createState:()=>p$,declarePeerDependency:()=>DK,defineExtension:()=>NK,flipDirection:()=>Vi,getDOMOwnerDocument:()=>Qy,getDOMSelection:()=>Nr,getDOMSelectionFromTarget:()=>uP,getDOMTextNode:()=>Us,getEditorPropertyFromDOMNode:()=>fu,getNearestEditorFromDOMNode:()=>Ky,getRegisteredNode:()=>Hy,getRegisteredNodeOrThrow:()=>Uy,getStaticNodeConfig:()=>gu,getTextDirection:()=>cK,getTransformSetFromKlass:()=>QL,isBlockDomNode:()=>my,isCurrentlyReadOnlyMode:()=>sd,isDOMDocumentNode:()=>JL,isDOMNode:()=>ld,isDOMTextNode:()=>da,isDOMUnmanaged:()=>gP,isDocumentFragment:()=>fP,isExactShortcutMatch:()=>$t,isHTMLAnchorElement:()=>vK,isHTMLElement:()=>ko,isInlineDomNode:()=>pP,isLexicalEditor:()=>Cm,isModifierMatch:()=>aP,isSelectionCapturedInDecoratorInput:()=>$y,isSelectionWithinEditor:()=>uu,makeStepwiseIterator:()=>nx,mergeRegister:()=>UK,normalizeClassNames:()=>hu,removeClassNamesFromElement:()=>zK,removeFromParent:()=>Fi,resetRandomKey:()=>lK,safeCast:()=>OK,setDOMUnmanaged:()=>CK,setNodeIndentFromDOM:()=>mP,shallowMergeConfig:()=>FK,toggleTextFormatType:()=>su});function fe(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 $k(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 Mr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,F5=Mr&&"documentMode"in document?document.documentMode:null,kr=Mr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Bi=Mr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Qp=!(!Mr||!("InputEvent"in window)||F5)&&"getTargetRanges"in new window.InputEvent("input"),pm=Mr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),du=Mr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,B5=Mr&&/Android/.test(navigator.userAgent),Kk=Mr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),$v=Mr&&B5&&Kk,mm=Mr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&kr&&!Kk,z5=0,U5=1,H5=2,$5=1,K5=2,q5=4,V5=8,W5=16,G5=32,j5=64,xy=128,Q5=2047,X5=1,Y5=2,J5=3,Z5=4,e$=5,t$=6,Jc=pm||du||mm?"\xA0":"\u200B",gm=`
3828
3828
 
3829
- `,Cy=Bi?"\xA0":Jc,qk="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Vk="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",n$=new RegExp("^[^"+Vk+"]*["+qk+"]"),o$=new RegExp("^[^"+qk+"]*["+Vk+"]"),mo={bold:1,capitalize:1024,code:16,highlight:xy,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},r$={directionless:1,unmergeable:2},Kv={center:2,end:6,justify:4,left:1,right:3,start:5},a$={[Y5]:"center",[t$]:"end",[Z5]:"justify",[X5]:"left",[J5]:"right",[e$]:"start"},i$={normal:0,segmented:2,token:1},s$={[z5]:"normal",[H5]:"segmented",[U5]:"token"},l$="$",YT="$config";function Wk(e,t,n,o,r,a){let i=e.getFirstChild();for(;i!==null;){let s=i.__key;i.__parent===t&&(se(i)&&Wk(i,s,n,o,r,a),n.has(s)||a.delete(s),r.push(s)),i=i.getNextSibling()}}var qv=!1,by=0;function d$(e){by=e.timeStamp}function Mv(e,t,n){let o=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||o&&e.previousSibling===r)||o&&bm(e,n)!==void 0}function c$(e,t,n){let o=_r(jo(n)),r=null,a=null;o!==null&&o.anchorNode===e&&(r=o.anchorOffset,a=o.focusOffset);let i=e.nodeValue;i!==null&&Gy(t,i,r,a,!1)}function u$(e,t,n){if(Ge(e)){let o=e.anchor.getNode();if(o.is(n)&&e.format!==o.getFormat())return!1}return da(t)&&n.isAttached()}function f$(e,t,n,o){for(let r=e;r&&!gP(r);r=pu(r)){let a=bm(r,t);if(a!==void 0){let i=Un(a,n);if(i)return tn(i)||!ko(r)?void 0:[r,i]}else if(r===o)return[o,tP(n)]}}function Gk(e,t,n){qv=!0;let o=performance.now()-by>100;try{la(e,()=>{let r=zt()||(function(p){return p.getEditorState().read(()=>{let m=zt();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],g=m.type,h=m.target,v=f$(h,e,s,i);if(!v)continue;let[y,x]=v;if(g==="characterData")o&&Ue(x)&&da(h)&&u$(r,h,x)&&c$(h,x,e);else if(g==="childList"){d=!0;let C=m.addedNodes;for(let S=0;S<C.length;S++){let L=C[S],k=qy(L),I=L.parentNode;if(I!=null&&L!==l&&k===null&&!Mv(L,I,e)){if(Bi){let P=(ko(L)?L.innerText:null)||L.nodeValue;P&&(c+=P)}I.removeChild(L)}}let w=m.removedNodes,T=w.length;if(T>0){let S=0;for(let L=0;L<T;L++){let k=w[L];(Mv(k,h,e)||l===k)&&(h.appendChild(k),S++)}T!==S&&a.set(y,x)}}}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],g=m.addedNodes,h=m.target;for(let v=0;v<g.length;v++){let y=g[v],x=y.parentNode;x==null||y.nodeName!=="BR"||Mv(y,h,e)||x.removeChild(y)}}n.takeRecords()}r!==null&&(d&&Bo(r),Bi&&sP(e)&&r.insertRawText(c))})}finally{qv=!1}}function jk(e){let t=e._observer;t!==null&&Gk(e,t.takeRecords(),t)}function Qk(e){(function(t){by===0&&jo(t).addEventListener("textInput",d$,!0)})(e),e._observer=new MutationObserver((t,n)=>{Gk(e,t,n)})}var Vv=class{key;parse;unparse;isEqual;defaultValue;constructor(t,n){this.key=t,this.parse=n.parse.bind(n),this.unparse=(n.unparse||h$).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function p$(e,t){return new Vv(e,t)}function Xp(e,t,n="latest"){let o=(n==="latest"?e.getLatest():e).__state;return o?o.getValue(t):t.defaultValue}function m$(e,t,n){let o=Xp(e,n,"direct"),r=Xp(t,n,"direct");return n.isEqual(o,r)?null:[o,r]}function g$(e,t,n){let o;if(Qn(),typeof n=="function"){let a=e.getLatest(),i=Xp(a,t);if(o=n(i),t.isEqual(i,o))return a}else o=n;let r=e.getWritable();return wy(r).updateFromKnown(t,o),r}function Xk(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}=gu(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 Wv=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 JT(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=JT(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 wy(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new Wv(t,Yk(t));return t.__state=n,n}function Yk(e){return e.__state?e.__state.sharedNodeState:Uy(Jy(),e.getType()).sharedNodeState}function JT(e){if(e)for(let t in e)return e}function h$(e){return e}function ZT(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 ek(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 tk(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function nk(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&&ZT(p,c,f)||f&&ZT(p,f,c)||c&&ek(p,c,f)||f&&ek(p,f,c))})(l,d))}function ok(e,t){let n=e.mergeWithSibling(t),o=Jt()._normalizedNodes;return o.add(e.__key),o.add(t.__key),n}function rk(e){let t,n,o=e;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(t=o.getPreviousSibling())!==null&&Ue(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(nk(t,o)){o=ok(t,o);break}break}t.remove()}for(;(n=o.getNextSibling())!==null&&Ue(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(nk(o,n)){o=ok(o,n);break}break}n.remove()}}else o.remove()}function Yp(e){return ak(e.anchor),ak(e.focus),e}function ak(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),Ue(o)){e.set(o.__key,r?o.getTextContentSize():0,"text",!0);break}if(!se(o))break;e.set(o.__key,r?o.getChildrenSize():0,"element",!0)}}var Fs,so,Zc,hm,Gv,jv,Bs,Ar,Qv,eu,zn="",sa=null,_s=null,Kl=!1,Jp=!1;function Zp(e,t){let n=Bs.get(e);if(t!==null){let o=Zv(e);o.parentNode===t&&t.removeChild(o)}if(Ar.has(e)||so._keyToDOMMap.delete(e),se(n)){let o=tm(n,Bs);Xv(o,0,o.length-1,null)}n!==void 0&&jy(eu,Zc,hm,n,"destroyed")}function Xv(e,t,n,o){for(let r=t;r<=n;++r){let a=e[r];a!==void 0&&Zp(a,o)}}function Ns(e,t){e.setProperty("text-align",t)}var v$="40px";function Jk(e,t){let n=Fs.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(so._rootElement||e).getPropertyValue("--lexical-indent-base-value")||v$;e.style.setProperty("padding-inline-start",`calc(${t} * ${o})`)}function Zk(e,t){let n=e.style;t===0?Ns(n,""):t===1?Ns(n,"left"):t===2?Ns(n,"center"):t===3?Ns(n,"right"):t===4?Ns(n,"justify"):t===5?Ns(n,"start"):t===6&&Ns(n,"end")}function Yv(e,t){let n=(function(o){let r=o.__dir;if(r!==null)return r;if(io(o))return null;let a=o.getParentOrThrow();return io(a)&&a.__dir===null?"auto":null})(t);n!==null?e.dir=n:e.removeAttribute("dir")}function em(e,t){let n=Ar.get(e);n===void 0&&fe(60);let o=n.createDOM(Fs,so);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,so),Ue(n)?o.setAttribute("data-lexical-text","true"):tn(n)&&o.setAttribute("data-lexical-decorator","true"),se(n)){let r=n.__indent,a=n.__size;if(Yv(o,n),r!==0&&Jk(o,r),a!==0){let s=a-1;Jv(tm(n,Ar),n,0,s,n.getDOMSlot(o))}let i=n.__format;i!==0&&Zk(o,i),n.isInline()||eL(null,n,o)}else{let r=n.getTextContent();if(tn(n)){let a=n.decorate(so,Fs);a!==null&&tL(e,a),o.contentEditable="false"}zn+=r}return t!==null&&t.insertChild(o),jy(eu,Zc,hm,n,"created"),o}function Jv(e,t,n,o,r){let a=zn;zn="";let i=n;for(;i<=o;++i){em(e[i],r);let s=Ar.get(e[i]);s!==null&&Ue(s)?sa===null&&(sa=s.getFormat(),_s=s.getStyle()):se(s)&&i<o&&!s.isInline()&&(zn+=gm)}r.element.__lexicalTextContent=zn,zn=a+zn}function ik(e,t){if(e){let n=e.__last;if(n){let o=t.get(n);if(o)return Os(o)?"line-break":tn(o)&&o.isInline()?"decorator":null}return"empty"}return null}function eL(e,t,n){let o=ik(e,Bs),r=ik(t,Ar);o!==r&&t.getDOMSlot(n).setManagedLineBreak(r)}function y$(e,t,n){var o;sa=null,_s=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)Kp(f,c);else{let g=Zv(f),h=em(p,null);try{c.replaceChild(h,g)}catch(v){if(typeof v=="object"&&v!=null){let y=`${v.toString()} Parent: ${c.tagName}, new child: {tag: ${h.tagName} key: ${p}}, old child: {tag: ${g.tagName}, key: ${f}}.`;throw new Error(y)}throw v}Zp(f,null)}let m=Ar.get(p);Ue(m)&&sa===null&&(sa=m.getFormat(),_s=m.getStyle())}else{let f=tm(r,Bs),p=tm(a,Ar);if(f.length!==l&&fe(227),p.length!==d&&fe(228),l===0)d!==0&&Jv(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;Xv(f,0,l-1,m?null:c),m&&(c.textContent="")}}else(function(m,g,h,v,y,x){let C=v-1,w=y-1,T,S,L=x.getFirstChild(),k=0,I=0;for(;k<=C&&I<=w;){let _=g[k],A=h[I];if(_===A)L=Nv(Kp(A,x.element)),k++,I++;else{if(S===void 0&&(S=sk(h,I)),T===void 0)T=sk(g,k);else if(!T.has(_)){k++;continue}if(!S.has(_)){L=Nv(Zv(_)),Zp(_,x.element),k++,T.delete(_);continue}if(T.has(A)){let V=td(so,A);V!==L&&x.withBefore(L).insertChild(V),L=Nv(Kp(A,x.element)),k++,I++}else em(A,x.withBefore(L)),I++}let H=Ar.get(A);H!==null&&Ue(H)?sa===null&&(sa=H.getFormat(),_s=H.getStyle()):se(H)&&I<=w&&!H.isInline()&&(zn+=gm)}let P=k>C,E=I>w;if(P&&!E){let _=h[w+1],A=_===void 0?null:so.getElementByKey(_);Jv(h,0,I,w,x.withBefore(A))}else E&&!P&&Xv(g,k,C,x.element)})(0,f,p,l,d,i)}c.__lexicalTextContent=zn,zn=s+zn})(e,t,t.getDOMSlot(n)),o=t,sa==null||sa===o.__textFormat||Jp||o.setTextFormat(sa),(function(r){_s==null||_s===r.__textStyle||Jp||r.setTextStyle(_s)})(t)}function tm(e,t){let n=[],o=e.__first;for(;o!==null;){let r=t.get(o);r===void 0&&fe(101),n.push(o),o=r.__next}return n}function Kp(e,t){let n=Bs.get(e),o=Ar.get(e);n!==void 0&&o!==void 0||fe(61);let r=Kl||jv.has(e)||Gv.has(e),a=td(so,e);if(n===o&&!r){let i;if(se(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&&jy(eu,Zc,hm,o,"updated"),o.updateDOM(n,a,Fs)){let i=em(e,null);return t===null&&fe(62),t.replaceChild(i,a),Zp(e,null),i}if(se(n)){se(o)||fe(334,e);let i=o.__indent;(Kl||i!==n.__indent)&&Jk(a,i);let s=o.__format;if((Kl||s!==n.__format)&&Zk(a,s),r)y$(n,o,a),io(o)||o.isInline()||eL(n,o,a);else{let l=a.__lexicalTextContent,d;typeof l=="string"?d=l:(d=n.getTextContent(),a.__lexicalTextContent=d),zn+=d}if((Kl||o.__dir!==n.__dir)&&(Yv(a,o),io(o)&&!Kl))for(let l of o.getChildren())se(l)&&Yv(td(so,l.getKey()),l)}else{let i=o.getTextContent();if(tn(o)){let s=o.decorate(so,Fs);s!==null&&tL(e,s)}zn+=i}if(!Jp&&io(o)&&o.__cachedText!==zn){let i=o.getWritable();i.__cachedText=zn,o=i}return a}function tL(e,t){let n=so._pendingDecorators,o=so._decorators;if(n===null){if(o[e]===t)return;n=eP(so)}n[e]=t}function Nv(e){let t=e.nextSibling;return t!==null&&t===so._blockCursorElement&&(t=t.nextSibling),t}function sk(e,t){let n=new Set;for(let o=t;o<e.length;o++)n.add(e[o]);return n}function x$(e,t,n,o,r,a){zn="",Kl=o===2,so=n,Fs=n._config,Zc=n._nodes,hm=so._listeners.mutation,Gv=r,jv=a,Bs=e._nodeMap,Ar=t._nodeMap,Jp=t._readOnly,Qv=new Map(n._keyToDOMMap);let i=new Map;return eu=i,Kp("root",null),so=void 0,Zc=void 0,Gv=void 0,jv=void 0,Bs=void 0,Ar=void 0,Fs=void 0,Qv=void 0,eu=void 0,i}function Zv(e){let t=Qv.get(e);return t===void 0&&fe(75,e),t}function nt(e){return{type:e}}var Sy=nt("SELECTION_CHANGE_COMMAND"),C$=nt("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),nL=nt("CLICK_COMMAND"),Iy=nt("BEFORE_INPUT_COMMAND"),Ty=nt("INPUT_COMMAND"),ky=nt("COMPOSITION_START_COMMAND"),Ly=nt("COMPOSITION_END_COMMAND"),tu=nt("DELETE_CHARACTER_COMMAND"),Wc=nt("INSERT_LINE_BREAK_COMMAND"),ey=nt("INSERT_PARAGRAPH_COMMAND"),Gl=nt("CONTROLLED_TEXT_INSERTION_COMMAND"),Py=nt("PASTE_COMMAND"),ty=nt("REMOVE_TEXT_COMMAND"),nu=nt("DELETE_WORD_COMMAND"),ou=nt("DELETE_LINE_COMMAND"),_i=nt("FORMAT_TEXT_COMMAND"),Ay=nt("UNDO_COMMAND"),Ey=nt("REDO_COMMAND"),Ry=nt("KEYDOWN_COMMAND"),oL=nt("KEY_ARROW_RIGHT_COMMAND"),rL=nt("MOVE_TO_END"),aL=nt("KEY_ARROW_LEFT_COMMAND"),iL=nt("MOVE_TO_START"),sL=nt("KEY_ARROW_UP_COMMAND"),lL=nt("KEY_ARROW_DOWN_COMMAND"),nm=nt("KEY_ENTER_COMMAND"),dL=nt("KEY_SPACE_COMMAND"),cL=nt("KEY_BACKSPACE_COMMAND"),uL=nt("KEY_ESCAPE_COMMAND"),fL=nt("KEY_DELETE_COMMAND"),pL=nt("KEY_TAB_COMMAND"),b$=nt("INSERT_TAB_COMMAND"),w$=nt("INDENT_CONTENT_COMMAND"),S$=nt("OUTDENT_CONTENT_COMMAND"),mL=nt("DROP_COMMAND"),I$=nt("FORMAT_ELEMENT_COMMAND"),gL=nt("DRAGSTART_COMMAND"),hL=nt("DRAGOVER_COMMAND"),vL=nt("DRAGEND_COMMAND"),My=nt("COPY_COMMAND"),Ny=nt("CUT_COMMAND"),ny=nt("SELECT_ALL_COMMAND"),T$=nt("CLEAR_EDITOR_COMMAND"),k$=nt("CLEAR_HISTORY_COMMAND"),L$=nt("CAN_REDO_COMMAND"),P$=nt("CAN_UNDO_COMMAND"),yL=nt("FOCUS_COMMAND"),xL=nt("BLUR_COMMAND"),CL=nt("KEY_MODIFIER_COMMAND"),Fa=Object.freeze({}),oy=[["keydown",function(e,t){ru=e.timeStamp,bL=e.key,!t.isComposing()&&Me(t,Ry,e)}],["pointerdown",function(e,t){let n=e.target,o=e.pointerType;ld(n)&&o!=="touch"&&o!=="pen"&&e.button===0&&la(t,()=>{YL(n)||(iy=!0)})}],["compositionstart",function(e,t){Me(t,ky,e)}],["compositionend",function(e,t){Bi?Vc=!0:du||!pm&&!mm?Me(t,Ly,e):(qp=!0,Vp=e.data)}],["input",function(e,t){e.stopPropagation(),la(t,()=>{t.dispatchCommand(Ty,e)},{event:e}),ql=null}],["click",function(e,t){la(t,()=>{let n=zt(),o=_r(jo(t)),r=Ks();if(o){if(Ge(n)){let a=n.anchor,i=a.getNode();if(a.type==="element"&&a.offset===0&&n.isCollapsed()&&!io(i)&&Go().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=Qc(i,l=>se(l)&&!l.isInline());se(s)&&s.select(0)}}else if(e.pointerType==="touch"||e.pointerType==="pen"){let a=o.anchorNode;(ko(a)||da(a))&&Bo(ym(r,o,t,e))}}Me(t,nL,e)})}],["cut",Fa],["copy",Fa],["dragstart",Fa],["dragover",Fa],["dragend",Fa],["paste",Fa],["focus",Fa],["blur",Fa],["drop",Fa]];Qp&&oy.push(["beforeinput",(e,t)=>(function(n,o){let r=n.inputType;r==="deleteCompositionText"||Bi&&sP(o)||r!=="insertCompositionText"&&Me(o,Iy,n)})(e,t)]);var ru=0,bL=null,wL=0,ql=null,ry=new WeakMap,om=new WeakMap,ay=!1,iy=!1,Gc=!1,Vc=!1,qp=!1,Vp="",Ds=null,SL=[0,"",0,"root",0];function IL(e,t,n,o,r){let a=e.anchor,i=e.focus,s=a.getNode(),l=Jt(),d=_r(jo(l)),c=d!==null?d.anchorNode:null,f=a.key,p=l.getElementByKey(f),m=n.length;return f!==i.key||!Ue(s)||(!r&&(!Qp||wL<o+50)||s.isDirty()&&m<2||nP(n))&&a.offset!==i.offset&&!s.isComposing()||Ua(s)||s.isDirty()&&m>1||(r||!Qp)&&p!==null&&!s.isComposing()&&c!==Hs(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(g,h){if(h.isSegmented())return!0;if(!g.isCollapsed())return!1;let v=g.anchor.offset,y=h.getParentOrThrow(),x=Oi(h);return v===0?!h.canInsertTextBefore()||!y.canInsertTextBefore()&&!h.isComposing()||x||(function(C){let w=C.getPreviousSibling();return(Ue(w)||se(w)&&w.isInline())&&!w.canInsertTextAfter()})(h):v===h.getTextContentSize()&&(!h.canInsertTextAfter()||!y.canInsertTextAfter()&&!h.isComposing()||x)})(e,s)}function lk(e,t){return da(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function dk(e,t,n){let{anchorNode:o,anchorOffset:r,focusNode:a,focusOffset:i}=e;ay&&(ay=!1,lk(o,r)&&lk(a,i)&&!Ds)||la(t,()=>{if(!n)return void Bo(null);if(!uu(t,o,a))return;let s=zt();if(Ds&&Ge(s)&&s.isCollapsed()){let l=s.anchor,d=Ds.anchor;(l.key===d.key&&l.offset===d.offset+1||l.offset===1&&d.getNode().is(l.getNode().getPreviousSibling()))&&(s=Ds.clone(),Bo(s))}if(Ds=null,Ge(s)){let l=s.anchor,d=l.getNode();if(s.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(s.dirty=!0);let c=jo(t).event,f=c?c.timeStamp:performance.now(),[p,m,g,h,v]=SL,y=Go(),x=t.isComposing()===!1&&y.getTextContent()==="";if(f<v+200&&l.offset===g&&l.key===h)Wp(s,p,m);else if(l.type==="text")Ue(d)||fe(141),TL(s,d);else if(l.type==="element"&&!x){se(d)||fe(259);let C=l.getNode();C.isEmpty()?(function(w,T){let S=T.getTextFormat(),L=T.getTextStyle();Wp(w,S,L)})(s,C):Wp(s,0,"")}}else{let c=l.key,f=s.focus.key,p=s.getNodes(),m=p.length,g=s.isBackward(),h=g?i:r,v=g?r:i,y=g?f:c,x=g?c:f,C=2047,w=!1;for(let T=0;T<m;T++){let S=p[T],L=S.getTextContentSize();if(Ue(S)&&L!==0&&!(T===0&&S.__key===y&&h===L||T===m-1&&S.__key===x&&v===0)&&(w=!0,C&=S.getFormat(),C===0))break}s.format=w?C:0}}Me(t,Sy,void 0)})}function Wp(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function TL(e,t){Wp(e,t.getFormat(),t.getStyle())}function kL(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function A$(e){let t=e.inputType,n=kL(e),o=Jt(),r=zt();if(t==="deleteContentBackward"){if(r===null){let f=Ks();if(!Ge(f))return!0;Bo(f.clone())}if(Ge(r)){let f=r.anchor.key===r.focus.key;if(a=e.timeStamp,bL==="MediaLast"&&a<ru+30&&o.isComposing()&&f){if(Xn(null),ru=0,setTimeout(()=>{la(o,()=>{Xn(null)})},30),Ge(r)){let p=r.anchor.getNode();p.markDirty(),Ue(p)||fe(142),TL(r,p)}}else{Xn(null),e.preventDefault();let p=r.anchor.getNode(),m=p.getTextContent(),g=p.canInsertTextAfter(),h=r.anchor.offset===0&&r.focus.offset===m.length,v=$v&&f&&!h&&g;if(v&&r.isCollapsed()&&(v=!tn(iP(r.anchor,!0))),!v){Me(o,tu,!0);let y=zt();$v&&Ge(y)&&y.isCollapsed()&&(Ds=y,setTimeout(()=>Ds=null))}}return!0}}var a;if(!Ge(r))return!0;let i=e.data;ql!==null&&Wy(!1,o,ql),r.dirty&&ql===null||!r.isCollapsed()||io(r.anchor.getNode())||n===null||r.applyDOMRange(n),ql=null;let s=r.anchor,l=r.focus,d=s.getNode(),c=l.getNode();if(t==="insertText"||t==="insertTranspose"){if(i===`
3830
- `)e.preventDefault(),Me(o,Wc,!1);else if(i===gm)e.preventDefault(),Me(o,ey,void 0);else if(i==null&&e.dataTransfer){let f=e.dataTransfer.getData("text/plain");e.preventDefault(),r.insertRawText(f)}else i!=null&&IL(r,n,i,e.timeStamp,!0)?(e.preventDefault(),Me(o,Gl,i)):ql=i;return wL=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Me(o,Gl,e);break;case"insertFromComposition":Xn(null),Me(o,Gl,e);break;case"insertLineBreak":Xn(null),Me(o,Wc,!1);break;case"insertParagraph":Xn(null),Gc&&!du?(Gc=!1,Me(o,Wc,!1)):Me(o,ey,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Me(o,Py,e);break;case"deleteByComposition":(function(f,p){return f!==p||se(f)||se(p)||!Oi(f)||!Oi(p)})(d,c)&&Me(o,ty,e);break;case"deleteByDrag":case"deleteByCut":Me(o,ty,e);break;case"deleteContent":Me(o,tu,!1);break;case"deleteWordBackward":Me(o,nu,!0);break;case"deleteWordForward":Me(o,nu,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Me(o,ou,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Me(o,ou,!1);break;case"formatStrikeThrough":Me(o,_i,"strikethrough");break;case"formatBold":Me(o,_i,"bold");break;case"formatItalic":Me(o,_i,"italic");break;case"formatUnderline":Me(o,_i,"underline");break;case"historyUndo":Me(o,Ay,void 0);break;case"historyRedo":Me(o,Ey,void 0)}return!0}function E$(e){if(ko(e.target)&&YL(e.target))return!0;let t=Jt(),n=zt(),o=e.data,r=kL(e);if(o!=null&&Ge(n)&&IL(n,r,o,e.timeStamp,!1)){Vc&&(rm(t,o),Vc=!1);let a=n.anchor.getNode(),i=_r(jo(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;Qp&&!n.isCollapsed()&&Ue(a)&&i.anchorNode!==null&&a.getTextContent().slice(0,l)+o+a.getTextContent().slice(l+d)===rP(i.anchorNode)||Me(t,Gl,o);let c=o.length;Bi&&c>1&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(n.anchor.offset-=c),$v&&t.isComposing()&&(ru=0,Xn(null))}else Wy(!1,t,o!==null?o:void 0),Vc&&(rm(t,o||void 0),Vc=!1);return(function(){Qn();let a=Jt();jk(a)})(),!0}function R$(e){let t=Jt(),n=zt();if(Ge(n)&&!t.isComposing()){let o=n.anchor,r=n.anchor.getNode();Xn(o.key),Sm(NL),(e.timeStamp<ru+30||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||Ue(r)&&r.getStyle()!==n.style)&&Me(t,Gl,Cy)}return!0}function M$(e){return rm(Jt(),e.data),Sm(_L),!0}function rm(e,t){let n=e._compositionKey;if(Xn(null),n!==null&&t!=null){if(t===""){let o=Un(n),r=Hs(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&Ue(o)){let a=_r(jo(e)),i=null,s=null;a!==null&&a.anchorNode===r&&(i=a.anchorOffset,s=a.focusOffset),Gy(o,r.nodeValue,i,s,!0)}return}if(t[t.length-1]===`
3831
- `){let o=zt();if(Ge(o)||cu(o)){if(Ge(o)){let r=o.focus;o.anchor.set(r.key,r.offset,r.type)}return void Me(e,nm,null)}}}Wy(!0,e,t)}function N$(e){let t=Jt();if(e.key==null)return!0;if(qp){if(Ok(e))return la(t,()=>{rm(t,Vp)}),qp=!1,Vp="",!0;qp=!1,Vp=""}if((function(n){return $t(n,"ArrowRight",{shiftKey:"any"})})(e))Me(t,oL,e);else if((function(n){return $t(n,"ArrowRight",za)})(e))Me(t,rL,e);else if((function(n){return $t(n,"ArrowLeft",{shiftKey:"any"})})(e))Me(t,aL,e);else if((function(n){return $t(n,"ArrowLeft",za)})(e))Me(t,iL,e);else if((function(n){return $t(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))Me(t,sL,e);else if((function(n){return $t(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))Me(t,lL,e);else if((function(n){return $t(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))Gc=!0,Me(t,nm,e);else if((function(n){return n.key===" "})(e))Me(t,dL,e);else if((function(n){return Lr&&$t(n,"o",{ctrlKey:!0})})(e))e.preventDefault(),Gc=!0,Me(t,Wc,!0);else if((function(n){return $t(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))Gc=!1,Me(t,nm,e);else if((function(n){return $t(n,"Backspace",{shiftKey:"any"})||Lr&&$t(n,"h",{ctrlKey:!0})})(e))Ok(e)?Me(t,cL,e):(e.preventDefault(),Me(t,tu,!0));else if((function(n){return n.key==="Escape"})(e))Me(t,uL,e);else if((function(n){return $t(n,"Delete",{})||Lr&&$t(n,"d",{ctrlKey:!0})})(e))(function(n){return n.key==="Delete"})(e)?Me(t,fL,e):(e.preventDefault(),Me(t,tu,!1));else if((function(n){return $t(n,"Backspace",Dk)})(e))e.preventDefault(),Me(t,nu,!0);else if((function(n){return $t(n,"Delete",Dk)})(e))e.preventDefault(),Me(t,nu,!1);else if((function(n){return Lr&&$t(n,"Backspace",{metaKey:!0})})(e))e.preventDefault(),Me(t,ou,!0);else if((function(n){return Lr&&($t(n,"Delete",{metaKey:!0})||$t(n,"k",{ctrlKey:!0}))})(e))e.preventDefault(),Me(t,ou,!1);else if((function(n){return $t(n,"b",za)})(e))e.preventDefault(),Me(t,_i,"bold");else if((function(n){return $t(n,"u",za)})(e))e.preventDefault(),Me(t,_i,"underline");else if((function(n){return $t(n,"i",za)})(e))e.preventDefault(),Me(t,_i,"italic");else if((function(n){return $t(n,"Tab",{shiftKey:"any"})})(e))Me(t,pL,e);else if((function(n){return $t(n,"z",za)})(e))e.preventDefault(),Me(t,Ay,void 0);else if((function(n){return Lr?$t(n,"z",{metaKey:!0,shiftKey:!0}):$t(n,"y",{ctrlKey:!0})||$t(n,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),Me(t,Ey,void 0);else{let n=t._editorState._selection;n===null||Ge(n)?Fk(e)&&(e.preventDefault(),Me(t,ny,e)):(function(o){return $t(o,"c",za)})(e)?(e.preventDefault(),Me(t,My,e)):(function(o){return $t(o,"x",za)})(e)?(e.preventDefault(),Me(t,Ny,e)):Fk(e)&&(e.preventDefault(),Me(t,ny,e))}return(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(e)&&t.dispatchCommand(CL,e),!0}function LL(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var jl=new Map;function PL(e){let t=uP(e.target);if(t===null)return;let n=Ky(t.anchorNode);if(n===null)return;iy&&(iy=!1,la(n,()=>{let l=Ks(),d=t.anchorNode;(ko(d)||da(d))&&Bo(ym(l,t,n,e))}));let o=Vy(n),r=o[o.length-1],a=r._key,i=jl.get(a),s=i||r;s!==n&&dk(t,s,!1),dk(t,n,!0),n!==r?jl.set(a,n):i&&jl.delete(a)}function ck(e){e._lexicalHandled=!0}function uk(e){return e._lexicalHandled===!0}var fk=()=>{};function _$(e){let t=ry.get(e);if(t===void 0)return void fk();let n=om.get(t);if(n===void 0)return void fk();let o=n-1;o>=0||fe(164),ry.delete(e),om.set(t,o),o===0&&t.removeEventListener("selectionchange",PL);let r=fu(e);Cm(r)?((function(i){if(i._parentEditor!==null){let s=Vy(i),l=s[s.length-1]._key;jl.get(l)===i&&jl.delete(l)}else jl.delete(i._key)})(r),e.__lexicalEditor=null):r&&fe(198);let a=LL(e);for(let i=0;i<a.length;i++)a[i]();e.__lexicalEventHandles=[]}function sy(e,t,n){Qn();let o=e.__key,r=e.getParent();if(r===null)return;let a=(function(s){let l=zt();if(!Ge(l)||!se(s))return l;let{anchor:d,focus:c}=l,f=d.getNode(),p=c.getNode();return um(f,s)&&d.set(s.__key,0,"element"),um(p,s)&&c.set(s.__key,0,"element"),l})(e),i=!1;if(Ge(a)&&t){let s=a.anchor,l=a.focus;s.key===o&&(lm(s,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0),l.key===o&&(lm(l,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0)}else cu(a)&&t&&e.isSelected()&&e.selectPrevious();if(Ge(a)&&t&&!i){let s=e.getIndexWithinParent();Fi(e),sm(a,r,s,-1)}else Fi(e);n||fr(r)||r.canBeEmpty()||!r.isEmpty()||sy(r,t),t&&a&&io(r)&&r.isEmpty()&&r.selectEnd()}function D$(e){return e}var AL=Symbol.for("ephemeral");function am(e){return e[AL]||!1}var ur=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=gu(this);return t===void 0&&fe(64,this.name),t}static clone(t){fe(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}),ZL(this,t)}getType(){return this.__type}isInline(){fe(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let n=Un(t);if(n===null)break;t=n.__parent}return!1}isSelected(t){let n=t||zt();if(n==null)return!1;let o=n.getNodes().some(r=>r.__key===this.__key);if(Ue(this))return o;if(Ge(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;let r=this.getParent();if(tn(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:Un(t)}getParentOrThrow(){let t=this.getParent();return t===null&&fe(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let n=t.getParent();if(fr(n))return se(t)||t===this&&tn(t)||fe(194),t;t=n}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&fe(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:Un(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:Un(t)}getNextSiblings(){let t=[],n=this.getNextSibling();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getCommonAncestor(t){let n=se(this)?this:this.getParent(),o=se(t)?t:t.getParent(),r=n&&o?Xc(n,o):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let n=Xc(this,t);return n!==null&&(n.type==="descendant"||(n.type==="branch"?rx(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&fe(279),!1)))}isParentOf(t){let n=Xc(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=se(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&&fe(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=Jt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(am(this))return this;let t=Un(this.__key);return t===null&&fe(113),t}getWritable(){if(am(this))return this;Qn();let t=Wa(),n=Jt(),o=t._nodeMap,r=this.__key,a=this.getLatest(),i=n._cloneNotNeeded,s=zt();if(s!==null&&s.setCachedNodes(null),i.has(r))return cm(a),a;let l=Zy(a);return i.add(r),cm(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,n){fe(70)}updateDOM(t,n,o){fe(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){fe(18,this.name)}updateFromJSON(t){return(function(n,o){let r=n.getWritable(),a=o.$,i=a;for(let s of Yk(r).flatKeys)s in o&&(i!==void 0&&i!==a||(i={...a}),i[s]=o[s]);return(r.__state||i)&&wy(n).updateFromJSON(i),r})(this,t)}static transform(){return null}remove(t){sy(this,!0,t)}replace(t,n){Qn();let o=zt();o!==null&&(o=o.clone()),zv(this,t);let r=this.getLatest(),a=this.__key,i=t.__key,s=t.getWritable(),l=this.getParentOrThrow().getWritable(),d=l.__size;Fi(s);let c=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,g=r.__parent;if(sy(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=g,l.__size=d,n&&(se(this)&&se(s)||fe(139),this.getChildren().forEach(h=>{s.append(h)})),Ge(o)){Bo(o);let h=o.anchor,v=o.focus;h.key===a&&hk(h,s),v.key===a&&hk(v,s)}return Di()===a&&Xn(i),s}insertAfter(t,n=!0){Qn(),zv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.getParent(),i=zt(),s=!1,l=!1;if(a!==null){let m=t.getIndexWithinParent();if(Fi(r),Ge(i)){let g=a.__key,h=i.anchor,v=i.focus;s=h.type==="element"&&h.key===g&&h.offset===m+1,l=v.type==="element"&&v.key===g&&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&&Ge(i)){let m=this.getIndexWithinParent();sm(i,c,m+1);let g=c.__key;s&&i.anchor.set(g,m+2,"element"),l&&i.focus.set(g,m+2,"element")}return t}insertBefore(t,n=!0){Qn(),zv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.__key;Fi(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=zt();return n&&Ge(c)&&sm(c,this.getParentOrThrow(),d),t}isParentRequired(){return!1}createParentElementNode(){return Ka()}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(se(o))return o.select();if(!Ue(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(se(o))return o.select(0,0);if(!Ue(o)){let a=o.getIndexWithinParent();return r.select(a,a)}return o.select(t,n)}markDirty(){this.getWritable()}reconcileObservedMutation(t,n){this.markDirty()}},O$="historic",F$="history-push",Gp="history-merge",B$="paste",EL="collaboration",z$="skip-collab",RL="skip-scroll-into-view",ML="skip-dom-selection",ly="skip-selection-focus",NL="composition-start",_L="composition-end",Xl=class e extends ur{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
3832
- `}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&&my(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&zp(r)){let a=o.lastChild;if(a===n||a.previousSibling===n&&zp(a))return!0}}return!1})(t)||(function(n){let o=n.parentElement;if(o!==null&&my(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&zp(r))return!1;let a=o.lastChild;if(a===n||a.previousSibling===n&&zp(a))return!0}return!1})(t)?null:{conversion:U$,priority:0}}}static importJSON(t){return Yl().updateFromJSON(t)}};function U$(e){return{node:Yl()}}function Yl(){return mu(new Xl)}function Os(e){return e instanceof Xl}function zp(e){return da(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function _v(e,t){return 16&t?"code":t&xy?"mark":32&t?"sub":64&t?"sup":null}function Dv(e,t){return 1&t?"strong":2&t?"em":"span"}function DL(e,t,n,o,r){let a=o.classList,i=Ql(r,"base");i!==void 0&&a.add(...i),i=Ql(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 mo){let c=mo[d];if(i=Ql(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 OL(e,t,n){let o=t.firstChild,r=n.isComposing(),a=e+(r?Jc:"");if(o==null)t.textContent=a;else{let i=o.nodeValue;if(i!==a)if(r||Bi){let[s,l,d]=(function(c,f){let p=c.length,m=f.length,g=0,h=0;for(;g<p&&g<m&&c[g]===f[g];)g++;for(;h+g<p&&h+g<m&&c[p-h-1]===f[m-h-1];)h++;return[g,p-g-h,f.slice(g,m-h)]})(i,a);l!==0&&o.deleteData(s,l),o.insertData(s,d)}else o.nodeValue=a}}function pk(e,t,n,o,r,a){OL(r,e,t);let i=a.theme.text;i!==void 0&&DL(0,0,o,e,i)}function Up(e,t){let n=document.createElement(t);return n.appendChild(e),n}var zs=class e extends ur{__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 s$[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Di()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){let n=mo[t];return(this.getFormat()&n)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,n){return su(this.getLatest().__format,t,n)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,n){let o=this.__format,r=_v(0,o),a=Dv(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)),pk(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=_v(0,a),l=_v(0,i),d=Dv(0,a),c=Dv(0,i);if((s===null?d:s)!==(l===null?c:l))return!0;if(s===l&&d!==c){let h=n.firstChild;h==null&&fe(48);let v=document.createElement(c);return pk(v,this,0,i,r,o),n.replaceChild(v,h),!1}let f=n;l!==null&&s!==null&&(f=n.firstChild,f==null&&fe(49)),OL(r,f,this);let p=o.theme.text;p!==void 0&&a!==i&&DL(0,a,i,f,p);let m=t.__style,g=this.__style;return m!==g&&(n.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:q$,priority:0}),b:()=>({conversion:$$,priority:0}),code:()=>({conversion:Ba,priority:0}),em:()=>({conversion:Ba,priority:0}),i:()=>({conversion:Ba,priority:0}),mark:()=>({conversion:Ba,priority:0}),s:()=>({conversion:Ba,priority:0}),span:()=>({conversion:H$,priority:0}),strong:()=>({conversion:Ba,priority:0}),sub:()=>({conversion:Ba,priority:0}),sup:()=>({conversion:Ba,priority:0}),u:()=>({conversion:Ba,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)||fe(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=Up(n,"b")),this.hasFormat("italic")&&(n=Up(n,"i")),this.hasFormat("strikethrough")&&(n=Up(n,"s")),this.hasFormat("underline")&&(n=Up(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"?mo[t]:t,n}setDetail(t){let n=this.getWritable();return n.__detail=typeof t=="string"?r$[t]:t,n}setStyle(t){let n=this.getWritable();return n.__style=t,n}toggleFormat(t){let n=su(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=i$[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=zt(),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(!Ge(a))return zL(s,o,s,r,"text","text");{let l=Di();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=zt();if(r&&Ge(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=Di(),i=o.length;t.sort((k,I)=>k-I),t.push(i);let s=[],l=t.length;for(let k=0,I=0;k<i&&I<=l;I++){let P=t[I];P>k&&(s.push(o.slice(k,P)),k=P)}let d=s.length;if(d===1)return[n];let c=s[0],f=n.getParent(),p,m=n.getFormat(),g=n.getStyle(),h=n.__detail,v=!1,y=null,x=null,C=zt();if(Ge(C)){let[k,I]=C.isBackward()?[C.focus,C.anchor]:[C.anchor,C.focus];k.type==="text"&&k.key===r&&(y=k),I.type==="text"&&I.key===r&&(x=I)}n.isSegmented()?(p=jn(c),p.__format=m,p.__style=g,p.__detail=h,p.__state=tk(n,p),v=!0):p=n.setTextContent(c);let w=[p];for(let k=1;k<d;k++){let I=jn(s[k]);I.__format=m,I.__style=g,I.__detail=h,I.__state=tk(n,I);let P=I.__key;a===r&&Xn(P),w.push(I)}let T=y?y.offset:null,S=x?x.offset:null,L=0;for(let k of w){if(!y&&!x)break;let I=L+k.getTextContentSize();if(y!==null&&T!==null&&T<=I&&T>=L&&(y.set(k.getKey(),T-L,"text"),T<I&&(y=null)),x!==null&&S!==null&&S<=I&&S>=L){x.set(k.getKey(),S-L,"text");break}L=I}if(f!==null){(function(P){let E=P.getPreviousSibling(),_=P.getNextSibling();E!==null&&cm(E),_!==null&&cm(_)})(this);let k=f.getWritable(),I=this.getIndexWithinParent();v?(k.splice(I,0,w),this.remove()):k.splice(I,1,w),Ge(C)&&sm(C,f,I,d-1)}return w}mergeWithSibling(t){let n=t===this.getPreviousSibling();n||t===this.getNextSibling()||fe(50);let o=this.__key,r=t.__key,a=this.__text,i=a.length;Di()===r&&Xn(o);let s=zt();if(Ge(s)){let f=s.anchor,p=s.focus;f!==null&&f.key===r&&Sk(f,n,o,t,i),p!==null&&p.key===r&&Sk(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 H$(e){return{forChild:_y(e.style),node:null}}function $$(e){let t=e,n=t.style.fontWeight==="normal";return{forChild:_y(t.style,n?void 0:"bold"),node:null}}var mk=new WeakMap;function K$(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 q$(e){let t=e;e.parentElement===null&&fe(129);let n=t.textContent||"";if((function(o){let r,a=o.parentNode,i=[o];for(;a!==null&&(r=mk.get(a))===void 0&&!K$(a);)i.push(a),a=a.parentNode;let s=r===void 0?a:r;for(let l=0;l<i.length;l++)mk.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===`
3829
+ `,Cy=Bi?"\xA0":Jc,qk="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Vk="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",n$=new RegExp("^[^"+Vk+"]*["+qk+"]"),o$=new RegExp("^[^"+qk+"]*["+Vk+"]"),mo={bold:1,capitalize:1024,code:16,highlight:xy,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},r$={directionless:1,unmergeable:2},Kv={center:2,end:6,justify:4,left:1,right:3,start:5},a$={[Y5]:"center",[t$]:"end",[Z5]:"justify",[X5]:"left",[J5]:"right",[e$]:"start"},i$={normal:0,segmented:2,token:1},s$={[z5]:"normal",[H5]:"segmented",[U5]:"token"},l$="$",YT="$config";function Wk(e,t,n,o,r,a){let i=e.getFirstChild();for(;i!==null;){let s=i.__key;i.__parent===t&&(se(i)&&Wk(i,s,n,o,r,a),n.has(s)||a.delete(s),r.push(s)),i=i.getNextSibling()}}var qv=!1,by=0;function d$(e){by=e.timeStamp}function Mv(e,t,n){let o=e.nodeName==="BR",r=t.__lexicalLineBreak;return r&&(e===r||o&&e.previousSibling===r)||o&&bm(e,n)!==void 0}function c$(e,t,n){let o=Nr(jo(n)),r=null,a=null;o!==null&&o.anchorNode===e&&(r=o.anchorOffset,a=o.focusOffset);let i=e.nodeValue;i!==null&&Gy(t,i,r,a,!1)}function u$(e,t,n){if(Ge(e)){let o=e.anchor.getNode();if(o.is(n)&&e.format!==o.getFormat())return!1}return da(t)&&n.isAttached()}function f$(e,t,n,o){for(let r=e;r&&!gP(r);r=pu(r)){let a=bm(r,t);if(a!==void 0){let i=Un(a,n);if(i)return tn(i)||!ko(r)?void 0:[r,i]}else if(r===o)return[o,tP(n)]}}function Gk(e,t,n){qv=!0;let o=performance.now()-by>100;try{la(e,()=>{let r=zt()||(function(p){return p.getEditorState().read(()=>{let m=zt();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],g=m.type,h=m.target,v=f$(h,e,s,i);if(!v)continue;let[y,x]=v;if(g==="characterData")o&&Ue(x)&&da(h)&&u$(r,h,x)&&c$(h,x,e);else if(g==="childList"){d=!0;let C=m.addedNodes;for(let S=0;S<C.length;S++){let L=C[S],k=qy(L),I=L.parentNode;if(I!=null&&L!==l&&k===null&&!Mv(L,I,e)){if(Bi){let P=(ko(L)?L.innerText:null)||L.nodeValue;P&&(c+=P)}I.removeChild(L)}}let w=m.removedNodes,T=w.length;if(T>0){let S=0;for(let L=0;L<T;L++){let k=w[L];(Mv(k,h,e)||l===k)&&(h.appendChild(k),S++)}T!==S&&a.set(y,x)}}}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],g=m.addedNodes,h=m.target;for(let v=0;v<g.length;v++){let y=g[v],x=y.parentNode;x==null||y.nodeName!=="BR"||Mv(y,h,e)||x.removeChild(y)}}n.takeRecords()}r!==null&&(d&&Bo(r),Bi&&sP(e)&&r.insertRawText(c))})}finally{qv=!1}}function jk(e){let t=e._observer;t!==null&&Gk(e,t.takeRecords(),t)}function Qk(e){(function(t){by===0&&jo(t).addEventListener("textInput",d$,!0)})(e),e._observer=new MutationObserver((t,n)=>{Gk(e,t,n)})}var Vv=class{key;parse;unparse;isEqual;defaultValue;constructor(t,n){this.key=t,this.parse=n.parse.bind(n),this.unparse=(n.unparse||h$).bind(n),this.isEqual=(n.isEqual||Object.is).bind(n),this.defaultValue=this.parse(void 0)}};function p$(e,t){return new Vv(e,t)}function Xp(e,t,n="latest"){let o=(n==="latest"?e.getLatest():e).__state;return o?o.getValue(t):t.defaultValue}function m$(e,t,n){let o=Xp(e,n,"direct"),r=Xp(t,n,"direct");return n.isEqual(o,r)?null:[o,r]}function g$(e,t,n){let o;if(Qn(),typeof n=="function"){let a=e.getLatest(),i=Xp(a,t);if(o=n(i),t.isEqual(i,o))return a}else o=n;let r=e.getWritable();return wy(r).updateFromKnown(t,o),r}function Xk(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}=gu(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 Wv=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 JT(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=JT(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 wy(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new Wv(t,Yk(t));return t.__state=n,n}function Yk(e){return e.__state?e.__state.sharedNodeState:Uy(Jy(),e.getType()).sharedNodeState}function JT(e){if(e)for(let t in e)return e}function h$(e){return e}function ZT(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 ek(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 tk(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function nk(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&&ZT(p,c,f)||f&&ZT(p,f,c)||c&&ek(p,c,f)||f&&ek(p,f,c))})(l,d))}function ok(e,t){let n=e.mergeWithSibling(t),o=Jt()._normalizedNodes;return o.add(e.__key),o.add(t.__key),n}function rk(e){let t,n,o=e;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(t=o.getPreviousSibling())!==null&&Ue(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(nk(t,o)){o=ok(t,o);break}break}t.remove()}for(;(n=o.getNextSibling())!==null&&Ue(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==""){if(nk(o,n)){o=ok(o,n);break}break}n.remove()}}else o.remove()}function Yp(e){return ak(e.anchor),ak(e.focus),e}function ak(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),Ue(o)){e.set(o.__key,r?o.getTextContentSize():0,"text",!0);break}if(!se(o))break;e.set(o.__key,r?o.getChildrenSize():0,"element",!0)}}var Os,so,Zc,hm,Gv,jv,Fs,Pr,Qv,eu,zn="",sa=null,Ns=null,Kl=!1,Jp=!1;function Zp(e,t){let n=Fs.get(e);if(t!==null){let o=Zv(e);o.parentNode===t&&t.removeChild(o)}if(Pr.has(e)||so._keyToDOMMap.delete(e),se(n)){let o=tm(n,Fs);Xv(o,0,o.length-1,null)}n!==void 0&&jy(eu,Zc,hm,n,"destroyed")}function Xv(e,t,n,o){for(let r=t;r<=n;++r){let a=e[r];a!==void 0&&Zp(a,o)}}function Ms(e,t){e.setProperty("text-align",t)}var v$="40px";function Jk(e,t){let n=Os.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(so._rootElement||e).getPropertyValue("--lexical-indent-base-value")||v$;e.style.setProperty("padding-inline-start",`calc(${t} * ${o})`)}function Zk(e,t){let n=e.style;t===0?Ms(n,""):t===1?Ms(n,"left"):t===2?Ms(n,"center"):t===3?Ms(n,"right"):t===4?Ms(n,"justify"):t===5?Ms(n,"start"):t===6&&Ms(n,"end")}function Yv(e,t){let n=(function(o){let r=o.__dir;if(r!==null)return r;if(io(o))return null;let a=o.getParentOrThrow();return io(a)&&a.__dir===null?"auto":null})(t);n!==null?e.dir=n:e.removeAttribute("dir")}function em(e,t){let n=Pr.get(e);n===void 0&&fe(60);let o=n.createDOM(Os,so);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,so),Ue(n)?o.setAttribute("data-lexical-text","true"):tn(n)&&o.setAttribute("data-lexical-decorator","true"),se(n)){let r=n.__indent,a=n.__size;if(Yv(o,n),r!==0&&Jk(o,r),a!==0){let s=a-1;Jv(tm(n,Pr),n,0,s,n.getDOMSlot(o))}let i=n.__format;i!==0&&Zk(o,i),n.isInline()||eL(null,n,o)}else{let r=n.getTextContent();if(tn(n)){let a=n.decorate(so,Os);a!==null&&tL(e,a),o.contentEditable="false"}zn+=r}return t!==null&&t.insertChild(o),jy(eu,Zc,hm,n,"created"),o}function Jv(e,t,n,o,r){let a=zn;zn="";let i=n;for(;i<=o;++i){em(e[i],r);let s=Pr.get(e[i]);s!==null&&Ue(s)?sa===null&&(sa=s.getFormat(),Ns=s.getStyle()):se(s)&&i<o&&!s.isInline()&&(zn+=gm)}r.element.__lexicalTextContent=zn,zn=a+zn}function ik(e,t){if(e){let n=e.__last;if(n){let o=t.get(n);if(o)return Ds(o)?"line-break":tn(o)&&o.isInline()?"decorator":null}return"empty"}return null}function eL(e,t,n){let o=ik(e,Fs),r=ik(t,Pr);o!==r&&t.getDOMSlot(n).setManagedLineBreak(r)}function y$(e,t,n){var o;sa=null,Ns=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)Kp(f,c);else{let g=Zv(f),h=em(p,null);try{c.replaceChild(h,g)}catch(v){if(typeof v=="object"&&v!=null){let y=`${v.toString()} Parent: ${c.tagName}, new child: {tag: ${h.tagName} key: ${p}}, old child: {tag: ${g.tagName}, key: ${f}}.`;throw new Error(y)}throw v}Zp(f,null)}let m=Pr.get(p);Ue(m)&&sa===null&&(sa=m.getFormat(),Ns=m.getStyle())}else{let f=tm(r,Fs),p=tm(a,Pr);if(f.length!==l&&fe(227),p.length!==d&&fe(228),l===0)d!==0&&Jv(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;Xv(f,0,l-1,m?null:c),m&&(c.textContent="")}}else(function(m,g,h,v,y,x){let C=v-1,w=y-1,T,S,L=x.getFirstChild(),k=0,I=0;for(;k<=C&&I<=w;){let _=g[k],A=h[I];if(_===A)L=Nv(Kp(A,x.element)),k++,I++;else{if(S===void 0&&(S=sk(h,I)),T===void 0)T=sk(g,k);else if(!T.has(_)){k++;continue}if(!S.has(_)){L=Nv(Zv(_)),Zp(_,x.element),k++,T.delete(_);continue}if(T.has(A)){let V=td(so,A);V!==L&&x.withBefore(L).insertChild(V),L=Nv(Kp(A,x.element)),k++,I++}else em(A,x.withBefore(L)),I++}let H=Pr.get(A);H!==null&&Ue(H)?sa===null&&(sa=H.getFormat(),Ns=H.getStyle()):se(H)&&I<=w&&!H.isInline()&&(zn+=gm)}let P=k>C,E=I>w;if(P&&!E){let _=h[w+1],A=_===void 0?null:so.getElementByKey(_);Jv(h,0,I,w,x.withBefore(A))}else E&&!P&&Xv(g,k,C,x.element)})(0,f,p,l,d,i)}c.__lexicalTextContent=zn,zn=s+zn})(e,t,t.getDOMSlot(n)),o=t,sa==null||sa===o.__textFormat||Jp||o.setTextFormat(sa),(function(r){Ns==null||Ns===r.__textStyle||Jp||r.setTextStyle(Ns)})(t)}function tm(e,t){let n=[],o=e.__first;for(;o!==null;){let r=t.get(o);r===void 0&&fe(101),n.push(o),o=r.__next}return n}function Kp(e,t){let n=Fs.get(e),o=Pr.get(e);n!==void 0&&o!==void 0||fe(61);let r=Kl||jv.has(e)||Gv.has(e),a=td(so,e);if(n===o&&!r){let i;if(se(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&&jy(eu,Zc,hm,o,"updated"),o.updateDOM(n,a,Os)){let i=em(e,null);return t===null&&fe(62),t.replaceChild(i,a),Zp(e,null),i}if(se(n)){se(o)||fe(334,e);let i=o.__indent;(Kl||i!==n.__indent)&&Jk(a,i);let s=o.__format;if((Kl||s!==n.__format)&&Zk(a,s),r)y$(n,o,a),io(o)||o.isInline()||eL(n,o,a);else{let l=a.__lexicalTextContent,d;typeof l=="string"?d=l:(d=n.getTextContent(),a.__lexicalTextContent=d),zn+=d}if((Kl||o.__dir!==n.__dir)&&(Yv(a,o),io(o)&&!Kl))for(let l of o.getChildren())se(l)&&Yv(td(so,l.getKey()),l)}else{let i=o.getTextContent();if(tn(o)){let s=o.decorate(so,Os);s!==null&&tL(e,s)}zn+=i}if(!Jp&&io(o)&&o.__cachedText!==zn){let i=o.getWritable();i.__cachedText=zn,o=i}return a}function tL(e,t){let n=so._pendingDecorators,o=so._decorators;if(n===null){if(o[e]===t)return;n=eP(so)}n[e]=t}function Nv(e){let t=e.nextSibling;return t!==null&&t===so._blockCursorElement&&(t=t.nextSibling),t}function sk(e,t){let n=new Set;for(let o=t;o<e.length;o++)n.add(e[o]);return n}function x$(e,t,n,o,r,a){zn="",Kl=o===2,so=n,Os=n._config,Zc=n._nodes,hm=so._listeners.mutation,Gv=r,jv=a,Fs=e._nodeMap,Pr=t._nodeMap,Jp=t._readOnly,Qv=new Map(n._keyToDOMMap);let i=new Map;return eu=i,Kp("root",null),so=void 0,Zc=void 0,Gv=void 0,jv=void 0,Fs=void 0,Pr=void 0,Os=void 0,Qv=void 0,eu=void 0,i}function Zv(e){let t=Qv.get(e);return t===void 0&&fe(75,e),t}function nt(e){return{type:e}}var Sy=nt("SELECTION_CHANGE_COMMAND"),C$=nt("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),nL=nt("CLICK_COMMAND"),Iy=nt("BEFORE_INPUT_COMMAND"),Ty=nt("INPUT_COMMAND"),ky=nt("COMPOSITION_START_COMMAND"),Ly=nt("COMPOSITION_END_COMMAND"),tu=nt("DELETE_CHARACTER_COMMAND"),Wc=nt("INSERT_LINE_BREAK_COMMAND"),ey=nt("INSERT_PARAGRAPH_COMMAND"),Gl=nt("CONTROLLED_TEXT_INSERTION_COMMAND"),Py=nt("PASTE_COMMAND"),ty=nt("REMOVE_TEXT_COMMAND"),nu=nt("DELETE_WORD_COMMAND"),ou=nt("DELETE_LINE_COMMAND"),_i=nt("FORMAT_TEXT_COMMAND"),Ay=nt("UNDO_COMMAND"),Ey=nt("REDO_COMMAND"),Ry=nt("KEYDOWN_COMMAND"),oL=nt("KEY_ARROW_RIGHT_COMMAND"),rL=nt("MOVE_TO_END"),aL=nt("KEY_ARROW_LEFT_COMMAND"),iL=nt("MOVE_TO_START"),sL=nt("KEY_ARROW_UP_COMMAND"),lL=nt("KEY_ARROW_DOWN_COMMAND"),nm=nt("KEY_ENTER_COMMAND"),dL=nt("KEY_SPACE_COMMAND"),cL=nt("KEY_BACKSPACE_COMMAND"),uL=nt("KEY_ESCAPE_COMMAND"),fL=nt("KEY_DELETE_COMMAND"),pL=nt("KEY_TAB_COMMAND"),b$=nt("INSERT_TAB_COMMAND"),w$=nt("INDENT_CONTENT_COMMAND"),S$=nt("OUTDENT_CONTENT_COMMAND"),mL=nt("DROP_COMMAND"),I$=nt("FORMAT_ELEMENT_COMMAND"),gL=nt("DRAGSTART_COMMAND"),hL=nt("DRAGOVER_COMMAND"),vL=nt("DRAGEND_COMMAND"),My=nt("COPY_COMMAND"),Ny=nt("CUT_COMMAND"),ny=nt("SELECT_ALL_COMMAND"),T$=nt("CLEAR_EDITOR_COMMAND"),k$=nt("CLEAR_HISTORY_COMMAND"),L$=nt("CAN_REDO_COMMAND"),P$=nt("CAN_UNDO_COMMAND"),yL=nt("FOCUS_COMMAND"),xL=nt("BLUR_COMMAND"),CL=nt("KEY_MODIFIER_COMMAND"),Fa=Object.freeze({}),oy=[["keydown",function(e,t){ru=e.timeStamp,bL=e.key,!t.isComposing()&&Me(t,Ry,e)}],["pointerdown",function(e,t){let n=e.target,o=e.pointerType;ld(n)&&o!=="touch"&&o!=="pen"&&e.button===0&&la(t,()=>{YL(n)||(iy=!0)})}],["compositionstart",function(e,t){Me(t,ky,e)}],["compositionend",function(e,t){Bi?Vc=!0:du||!pm&&!mm?Me(t,Ly,e):(qp=!0,Vp=e.data)}],["input",function(e,t){e.stopPropagation(),la(t,()=>{t.dispatchCommand(Ty,e)},{event:e}),ql=null}],["click",function(e,t){la(t,()=>{let n=zt(),o=Nr(jo(t)),r=$s();if(o){if(Ge(n)){let a=n.anchor,i=a.getNode();if(a.type==="element"&&a.offset===0&&n.isCollapsed()&&!io(i)&&Go().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=Qc(i,l=>se(l)&&!l.isInline());se(s)&&s.select(0)}}else if(e.pointerType==="touch"||e.pointerType==="pen"){let a=o.anchorNode;(ko(a)||da(a))&&Bo(ym(r,o,t,e))}}Me(t,nL,e)})}],["cut",Fa],["copy",Fa],["dragstart",Fa],["dragover",Fa],["dragend",Fa],["paste",Fa],["focus",Fa],["blur",Fa],["drop",Fa]];Qp&&oy.push(["beforeinput",(e,t)=>(function(n,o){let r=n.inputType;r==="deleteCompositionText"||Bi&&sP(o)||r!=="insertCompositionText"&&Me(o,Iy,n)})(e,t)]);var ru=0,bL=null,wL=0,ql=null,ry=new WeakMap,om=new WeakMap,ay=!1,iy=!1,Gc=!1,Vc=!1,qp=!1,Vp="",_s=null,SL=[0,"",0,"root",0];function IL(e,t,n,o,r){let a=e.anchor,i=e.focus,s=a.getNode(),l=Jt(),d=Nr(jo(l)),c=d!==null?d.anchorNode:null,f=a.key,p=l.getElementByKey(f),m=n.length;return f!==i.key||!Ue(s)||(!r&&(!Qp||wL<o+50)||s.isDirty()&&m<2||nP(n))&&a.offset!==i.offset&&!s.isComposing()||Ua(s)||s.isDirty()&&m>1||(r||!Qp)&&p!==null&&!s.isComposing()&&c!==Us(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(g,h){if(h.isSegmented())return!0;if(!g.isCollapsed())return!1;let v=g.anchor.offset,y=h.getParentOrThrow(),x=Oi(h);return v===0?!h.canInsertTextBefore()||!y.canInsertTextBefore()&&!h.isComposing()||x||(function(C){let w=C.getPreviousSibling();return(Ue(w)||se(w)&&w.isInline())&&!w.canInsertTextAfter()})(h):v===h.getTextContentSize()&&(!h.canInsertTextAfter()||!y.canInsertTextAfter()&&!h.isComposing()||x)})(e,s)}function lk(e,t){return da(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function dk(e,t,n){let{anchorNode:o,anchorOffset:r,focusNode:a,focusOffset:i}=e;ay&&(ay=!1,lk(o,r)&&lk(a,i)&&!_s)||la(t,()=>{if(!n)return void Bo(null);if(!uu(t,o,a))return;let s=zt();if(_s&&Ge(s)&&s.isCollapsed()){let l=s.anchor,d=_s.anchor;(l.key===d.key&&l.offset===d.offset+1||l.offset===1&&d.getNode().is(l.getNode().getPreviousSibling()))&&(s=_s.clone(),Bo(s))}if(_s=null,Ge(s)){let l=s.anchor,d=l.getNode();if(s.isCollapsed()){e.type==="Range"&&e.anchorNode===e.focusNode&&(s.dirty=!0);let c=jo(t).event,f=c?c.timeStamp:performance.now(),[p,m,g,h,v]=SL,y=Go(),x=t.isComposing()===!1&&y.getTextContent()==="";if(f<v+200&&l.offset===g&&l.key===h)Wp(s,p,m);else if(l.type==="text")Ue(d)||fe(141),TL(s,d);else if(l.type==="element"&&!x){se(d)||fe(259);let C=l.getNode();C.isEmpty()?(function(w,T){let S=T.getTextFormat(),L=T.getTextStyle();Wp(w,S,L)})(s,C):Wp(s,0,"")}}else{let c=l.key,f=s.focus.key,p=s.getNodes(),m=p.length,g=s.isBackward(),h=g?i:r,v=g?r:i,y=g?f:c,x=g?c:f,C=2047,w=!1;for(let T=0;T<m;T++){let S=p[T],L=S.getTextContentSize();if(Ue(S)&&L!==0&&!(T===0&&S.__key===y&&h===L||T===m-1&&S.__key===x&&v===0)&&(w=!0,C&=S.getFormat(),C===0))break}s.format=w?C:0}}Me(t,Sy,void 0)})}function Wp(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function TL(e,t){Wp(e,t.getFormat(),t.getStyle())}function kL(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function A$(e){let t=e.inputType,n=kL(e),o=Jt(),r=zt();if(t==="deleteContentBackward"){if(r===null){let f=$s();if(!Ge(f))return!0;Bo(f.clone())}if(Ge(r)){let f=r.anchor.key===r.focus.key;if(a=e.timeStamp,bL==="MediaLast"&&a<ru+30&&o.isComposing()&&f){if(Xn(null),ru=0,setTimeout(()=>{la(o,()=>{Xn(null)})},30),Ge(r)){let p=r.anchor.getNode();p.markDirty(),Ue(p)||fe(142),TL(r,p)}}else{Xn(null),e.preventDefault();let p=r.anchor.getNode(),m=p.getTextContent(),g=p.canInsertTextAfter(),h=r.anchor.offset===0&&r.focus.offset===m.length,v=$v&&f&&!h&&g;if(v&&r.isCollapsed()&&(v=!tn(iP(r.anchor,!0))),!v){Me(o,tu,!0);let y=zt();$v&&Ge(y)&&y.isCollapsed()&&(_s=y,setTimeout(()=>_s=null))}}return!0}}var a;if(!Ge(r))return!0;let i=e.data;ql!==null&&Wy(!1,o,ql),r.dirty&&ql===null||!r.isCollapsed()||io(r.anchor.getNode())||n===null||r.applyDOMRange(n),ql=null;let s=r.anchor,l=r.focus,d=s.getNode(),c=l.getNode();if(t==="insertText"||t==="insertTranspose"){if(i===`
3830
+ `)e.preventDefault(),Me(o,Wc,!1);else if(i===gm)e.preventDefault(),Me(o,ey,void 0);else if(i==null&&e.dataTransfer){let f=e.dataTransfer.getData("text/plain");e.preventDefault(),r.insertRawText(f)}else i!=null&&IL(r,n,i,e.timeStamp,!0)?(e.preventDefault(),Me(o,Gl,i)):ql=i;return wL=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Me(o,Gl,e);break;case"insertFromComposition":Xn(null),Me(o,Gl,e);break;case"insertLineBreak":Xn(null),Me(o,Wc,!1);break;case"insertParagraph":Xn(null),Gc&&!du?(Gc=!1,Me(o,Wc,!1)):Me(o,ey,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Me(o,Py,e);break;case"deleteByComposition":(function(f,p){return f!==p||se(f)||se(p)||!Oi(f)||!Oi(p)})(d,c)&&Me(o,ty,e);break;case"deleteByDrag":case"deleteByCut":Me(o,ty,e);break;case"deleteContent":Me(o,tu,!1);break;case"deleteWordBackward":Me(o,nu,!0);break;case"deleteWordForward":Me(o,nu,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Me(o,ou,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Me(o,ou,!1);break;case"formatStrikeThrough":Me(o,_i,"strikethrough");break;case"formatBold":Me(o,_i,"bold");break;case"formatItalic":Me(o,_i,"italic");break;case"formatUnderline":Me(o,_i,"underline");break;case"historyUndo":Me(o,Ay,void 0);break;case"historyRedo":Me(o,Ey,void 0)}return!0}function E$(e){if(ko(e.target)&&YL(e.target))return!0;let t=Jt(),n=zt(),o=e.data,r=kL(e);if(o!=null&&Ge(n)&&IL(n,r,o,e.timeStamp,!1)){Vc&&(rm(t,o),Vc=!1);let a=n.anchor.getNode(),i=Nr(jo(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;Qp&&!n.isCollapsed()&&Ue(a)&&i.anchorNode!==null&&a.getTextContent().slice(0,l)+o+a.getTextContent().slice(l+d)===rP(i.anchorNode)||Me(t,Gl,o);let c=o.length;Bi&&c>1&&e.inputType==="insertCompositionText"&&!t.isComposing()&&(n.anchor.offset-=c),$v&&t.isComposing()&&(ru=0,Xn(null))}else Wy(!1,t,o!==null?o:void 0),Vc&&(rm(t,o||void 0),Vc=!1);return(function(){Qn();let a=Jt();jk(a)})(),!0}function R$(e){let t=Jt(),n=zt();if(Ge(n)&&!t.isComposing()){let o=n.anchor,r=n.anchor.getNode();Xn(o.key),Sm(NL),(e.timeStamp<ru+30||o.type==="element"||!n.isCollapsed()||r.getFormat()!==n.format||Ue(r)&&r.getStyle()!==n.style)&&Me(t,Gl,Cy)}return!0}function M$(e){return rm(Jt(),e.data),Sm(_L),!0}function rm(e,t){let n=e._compositionKey;if(Xn(null),n!==null&&t!=null){if(t===""){let o=Un(n),r=Us(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&Ue(o)){let a=Nr(jo(e)),i=null,s=null;a!==null&&a.anchorNode===r&&(i=a.anchorOffset,s=a.focusOffset),Gy(o,r.nodeValue,i,s,!0)}return}if(t[t.length-1]===`
3831
+ `){let o=zt();if(Ge(o)||cu(o)){if(Ge(o)){let r=o.focus;o.anchor.set(r.key,r.offset,r.type)}return void Me(e,nm,null)}}}Wy(!0,e,t)}function N$(e){let t=Jt();if(e.key==null)return!0;if(qp){if(Ok(e))return la(t,()=>{rm(t,Vp)}),qp=!1,Vp="",!0;qp=!1,Vp=""}if((function(n){return $t(n,"ArrowRight",{shiftKey:"any"})})(e))Me(t,oL,e);else if((function(n){return $t(n,"ArrowRight",za)})(e))Me(t,rL,e);else if((function(n){return $t(n,"ArrowLeft",{shiftKey:"any"})})(e))Me(t,aL,e);else if((function(n){return $t(n,"ArrowLeft",za)})(e))Me(t,iL,e);else if((function(n){return $t(n,"ArrowUp",{altKey:"any",shiftKey:"any"})})(e))Me(t,sL,e);else if((function(n){return $t(n,"ArrowDown",{altKey:"any",shiftKey:"any"})})(e))Me(t,lL,e);else if((function(n){return $t(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(e))Gc=!0,Me(t,nm,e);else if((function(n){return n.key===" "})(e))Me(t,dL,e);else if((function(n){return kr&&$t(n,"o",{ctrlKey:!0})})(e))e.preventDefault(),Gc=!0,Me(t,Wc,!0);else if((function(n){return $t(n,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(e))Gc=!1,Me(t,nm,e);else if((function(n){return $t(n,"Backspace",{shiftKey:"any"})||kr&&$t(n,"h",{ctrlKey:!0})})(e))Ok(e)?Me(t,cL,e):(e.preventDefault(),Me(t,tu,!0));else if((function(n){return n.key==="Escape"})(e))Me(t,uL,e);else if((function(n){return $t(n,"Delete",{})||kr&&$t(n,"d",{ctrlKey:!0})})(e))(function(n){return n.key==="Delete"})(e)?Me(t,fL,e):(e.preventDefault(),Me(t,tu,!1));else if((function(n){return $t(n,"Backspace",Dk)})(e))e.preventDefault(),Me(t,nu,!0);else if((function(n){return $t(n,"Delete",Dk)})(e))e.preventDefault(),Me(t,nu,!1);else if((function(n){return kr&&$t(n,"Backspace",{metaKey:!0})})(e))e.preventDefault(),Me(t,ou,!0);else if((function(n){return kr&&($t(n,"Delete",{metaKey:!0})||$t(n,"k",{ctrlKey:!0}))})(e))e.preventDefault(),Me(t,ou,!1);else if((function(n){return $t(n,"b",za)})(e))e.preventDefault(),Me(t,_i,"bold");else if((function(n){return $t(n,"u",za)})(e))e.preventDefault(),Me(t,_i,"underline");else if((function(n){return $t(n,"i",za)})(e))e.preventDefault(),Me(t,_i,"italic");else if((function(n){return $t(n,"Tab",{shiftKey:"any"})})(e))Me(t,pL,e);else if((function(n){return $t(n,"z",za)})(e))e.preventDefault(),Me(t,Ay,void 0);else if((function(n){return kr?$t(n,"z",{metaKey:!0,shiftKey:!0}):$t(n,"y",{ctrlKey:!0})||$t(n,"z",{ctrlKey:!0,shiftKey:!0})})(e))e.preventDefault(),Me(t,Ey,void 0);else{let n=t._editorState._selection;n===null||Ge(n)?Fk(e)&&(e.preventDefault(),Me(t,ny,e)):(function(o){return $t(o,"c",za)})(e)?(e.preventDefault(),Me(t,My,e)):(function(o){return $t(o,"x",za)})(e)?(e.preventDefault(),Me(t,Ny,e)):Fk(e)&&(e.preventDefault(),Me(t,ny,e))}return(function(n){return n.ctrlKey||n.shiftKey||n.altKey||n.metaKey})(e)&&t.dispatchCommand(CL,e),!0}function LL(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var jl=new Map;function PL(e){let t=uP(e.target);if(t===null)return;let n=Ky(t.anchorNode);if(n===null)return;iy&&(iy=!1,la(n,()=>{let l=$s(),d=t.anchorNode;(ko(d)||da(d))&&Bo(ym(l,t,n,e))}));let o=Vy(n),r=o[o.length-1],a=r._key,i=jl.get(a),s=i||r;s!==n&&dk(t,s,!1),dk(t,n,!0),n!==r?jl.set(a,n):i&&jl.delete(a)}function ck(e){e._lexicalHandled=!0}function uk(e){return e._lexicalHandled===!0}var fk=()=>{};function _$(e){let t=ry.get(e);if(t===void 0)return void fk();let n=om.get(t);if(n===void 0)return void fk();let o=n-1;o>=0||fe(164),ry.delete(e),om.set(t,o),o===0&&t.removeEventListener("selectionchange",PL);let r=fu(e);Cm(r)?((function(i){if(i._parentEditor!==null){let s=Vy(i),l=s[s.length-1]._key;jl.get(l)===i&&jl.delete(l)}else jl.delete(i._key)})(r),e.__lexicalEditor=null):r&&fe(198);let a=LL(e);for(let i=0;i<a.length;i++)a[i]();e.__lexicalEventHandles=[]}function sy(e,t,n){Qn();let o=e.__key,r=e.getParent();if(r===null)return;let a=(function(s){let l=zt();if(!Ge(l)||!se(s))return l;let{anchor:d,focus:c}=l,f=d.getNode(),p=c.getNode();return um(f,s)&&d.set(s.__key,0,"element"),um(p,s)&&c.set(s.__key,0,"element"),l})(e),i=!1;if(Ge(a)&&t){let s=a.anchor,l=a.focus;s.key===o&&(lm(s,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0),l.key===o&&(lm(l,e,r,e.getPreviousSibling(),e.getNextSibling()),i=!0)}else cu(a)&&t&&e.isSelected()&&e.selectPrevious();if(Ge(a)&&t&&!i){let s=e.getIndexWithinParent();Fi(e),sm(a,r,s,-1)}else Fi(e);n||ur(r)||r.canBeEmpty()||!r.isEmpty()||sy(r,t),t&&a&&io(r)&&r.isEmpty()&&r.selectEnd()}function D$(e){return e}var AL=Symbol.for("ephemeral");function am(e){return e[AL]||!1}var cr=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:t}=gu(this);return t===void 0&&fe(64,this.name),t}static clone(t){fe(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}),ZL(this,t)}getType(){return this.__type}isInline(){fe(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;let n=Un(t);if(n===null)break;t=n.__parent}return!1}isSelected(t){let n=t||zt();if(n==null)return!1;let o=n.getNodes().some(r=>r.__key===this.__key);if(Ue(this))return o;if(Ge(n)&&n.anchor.type==="element"&&n.focus.type==="element"){if(n.isCollapsed())return!1;let r=this.getParent();if(tn(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:Un(t)}getParentOrThrow(){let t=this.getParent();return t===null&&fe(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){let n=t.getParent();if(ur(n))return se(t)||t===this&&tn(t)||fe(194),t;t=n}return null}getTopLevelElementOrThrow(){let t=this.getTopLevelElement();return t===null&&fe(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:Un(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:Un(t)}getNextSiblings(){let t=[],n=this.getNextSibling();for(;n!==null;)t.push(n),n=n.getNextSibling();return t}getCommonAncestor(t){let n=se(this)?this:this.getParent(),o=se(t)?t:t.getParent(),r=n&&o?Xc(n,o):null;return r?r.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){let n=Xc(this,t);return n!==null&&(n.type==="descendant"||(n.type==="branch"?rx(n)===-1:(n.type!=="same"&&n.type!=="ancestor"&&fe(279),!1)))}isParentOf(t){let n=Xc(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=se(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&&fe(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=Jt()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(am(this))return this;let t=Un(this.__key);return t===null&&fe(113),t}getWritable(){if(am(this))return this;Qn();let t=Wa(),n=Jt(),o=t._nodeMap,r=this.__key,a=this.getLatest(),i=n._cloneNotNeeded,s=zt();if(s!==null&&s.setCachedNodes(null),i.has(r))return cm(a),a;let l=Zy(a);return i.add(r),cm(l),o.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,n){fe(70)}updateDOM(t,n,o){fe(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){fe(18,this.name)}updateFromJSON(t){return(function(n,o){let r=n.getWritable(),a=o.$,i=a;for(let s of Yk(r).flatKeys)s in o&&(i!==void 0&&i!==a||(i={...a}),i[s]=o[s]);return(r.__state||i)&&wy(n).updateFromJSON(i),r})(this,t)}static transform(){return null}remove(t){sy(this,!0,t)}replace(t,n){Qn();let o=zt();o!==null&&(o=o.clone()),zv(this,t);let r=this.getLatest(),a=this.__key,i=t.__key,s=t.getWritable(),l=this.getParentOrThrow().getWritable(),d=l.__size;Fi(s);let c=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,g=r.__parent;if(sy(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=g,l.__size=d,n&&(se(this)&&se(s)||fe(139),this.getChildren().forEach(h=>{s.append(h)})),Ge(o)){Bo(o);let h=o.anchor,v=o.focus;h.key===a&&hk(h,s),v.key===a&&hk(v,s)}return Di()===a&&Xn(i),s}insertAfter(t,n=!0){Qn(),zv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.getParent(),i=zt(),s=!1,l=!1;if(a!==null){let m=t.getIndexWithinParent();if(Fi(r),Ge(i)){let g=a.__key,h=i.anchor,v=i.focus;s=h.type==="element"&&h.key===g&&h.offset===m+1,l=v.type==="element"&&v.key===g&&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&&Ge(i)){let m=this.getIndexWithinParent();sm(i,c,m+1);let g=c.__key;s&&i.anchor.set(g,m+2,"element"),l&&i.focus.set(g,m+2,"element")}return t}insertBefore(t,n=!0){Qn(),zv(this,t);let o=this.getWritable(),r=t.getWritable(),a=r.__key;Fi(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=zt();return n&&Ge(c)&&sm(c,this.getParentOrThrow(),d),t}isParentRequired(){return!1}createParentElementNode(){return Ka()}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(se(o))return o.select();if(!Ue(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(se(o))return o.select(0,0);if(!Ue(o)){let a=o.getIndexWithinParent();return r.select(a,a)}return o.select(t,n)}markDirty(){this.getWritable()}reconcileObservedMutation(t,n){this.markDirty()}},O$="historic",F$="history-push",Gp="history-merge",B$="paste",EL="collaboration",z$="skip-collab",RL="skip-scroll-into-view",ML="skip-dom-selection",ly="skip-selection-focus",NL="composition-start",_L="composition-end",Xl=class e extends cr{static getType(){return"linebreak"}static clone(t){return new e(t.__key)}constructor(t){super(t)}getTextContent(){return`
3832
+ `}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&&my(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&zp(r)){let a=o.lastChild;if(a===n||a.previousSibling===n&&zp(a))return!0}}return!1})(t)||(function(n){let o=n.parentElement;if(o!==null&&my(o)){let r=o.firstChild;if(r===n||r.nextSibling===n&&zp(r))return!1;let a=o.lastChild;if(a===n||a.previousSibling===n&&zp(a))return!0}return!1})(t)?null:{conversion:U$,priority:0}}}static importJSON(t){return Yl().updateFromJSON(t)}};function U$(e){return{node:Yl()}}function Yl(){return mu(new Xl)}function Ds(e){return e instanceof Xl}function zp(e){return da(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function _v(e,t){return 16&t?"code":t&xy?"mark":32&t?"sub":64&t?"sup":null}function Dv(e,t){return 1&t?"strong":2&t?"em":"span"}function DL(e,t,n,o,r){let a=o.classList,i=Ql(r,"base");i!==void 0&&a.add(...i),i=Ql(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 mo){let c=mo[d];if(i=Ql(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 OL(e,t,n){let o=t.firstChild,r=n.isComposing(),a=e+(r?Jc:"");if(o==null)t.textContent=a;else{let i=o.nodeValue;if(i!==a)if(r||Bi){let[s,l,d]=(function(c,f){let p=c.length,m=f.length,g=0,h=0;for(;g<p&&g<m&&c[g]===f[g];)g++;for(;h+g<p&&h+g<m&&c[p-h-1]===f[m-h-1];)h++;return[g,p-g-h,f.slice(g,m-h)]})(i,a);l!==0&&o.deleteData(s,l),o.insertData(s,d)}else o.nodeValue=a}}function pk(e,t,n,o,r,a){OL(r,e,t);let i=a.theme.text;i!==void 0&&DL(0,0,o,e,i)}function Up(e,t){let n=document.createElement(t);return n.appendChild(e),n}var Bs=class e extends cr{__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 s$[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Di()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){let n=mo[t];return(this.getFormat()&n)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,n){return su(this.getLatest().__format,t,n)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,n){let o=this.__format,r=_v(0,o),a=Dv(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)),pk(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=_v(0,a),l=_v(0,i),d=Dv(0,a),c=Dv(0,i);if((s===null?d:s)!==(l===null?c:l))return!0;if(s===l&&d!==c){let h=n.firstChild;h==null&&fe(48);let v=document.createElement(c);return pk(v,this,0,i,r,o),n.replaceChild(v,h),!1}let f=n;l!==null&&s!==null&&(f=n.firstChild,f==null&&fe(49)),OL(r,f,this);let p=o.theme.text;p!==void 0&&a!==i&&DL(0,a,i,f,p);let m=t.__style,g=this.__style;return m!==g&&(n.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:q$,priority:0}),b:()=>({conversion:$$,priority:0}),code:()=>({conversion:Ba,priority:0}),em:()=>({conversion:Ba,priority:0}),i:()=>({conversion:Ba,priority:0}),mark:()=>({conversion:Ba,priority:0}),s:()=>({conversion:Ba,priority:0}),span:()=>({conversion:H$,priority:0}),strong:()=>({conversion:Ba,priority:0}),sub:()=>({conversion:Ba,priority:0}),sup:()=>({conversion:Ba,priority:0}),u:()=>({conversion:Ba,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)||fe(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=Up(n,"b")),this.hasFormat("italic")&&(n=Up(n,"i")),this.hasFormat("strikethrough")&&(n=Up(n,"s")),this.hasFormat("underline")&&(n=Up(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"?mo[t]:t,n}setDetail(t){let n=this.getWritable();return n.__detail=typeof t=="string"?r$[t]:t,n}setStyle(t){let n=this.getWritable();return n.__style=t,n}toggleFormat(t){let n=su(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=i$[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=zt(),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(!Ge(a))return zL(s,o,s,r,"text","text");{let l=Di();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=zt();if(r&&Ge(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=Di(),i=o.length;t.sort((k,I)=>k-I),t.push(i);let s=[],l=t.length;for(let k=0,I=0;k<i&&I<=l;I++){let P=t[I];P>k&&(s.push(o.slice(k,P)),k=P)}let d=s.length;if(d===1)return[n];let c=s[0],f=n.getParent(),p,m=n.getFormat(),g=n.getStyle(),h=n.__detail,v=!1,y=null,x=null,C=zt();if(Ge(C)){let[k,I]=C.isBackward()?[C.focus,C.anchor]:[C.anchor,C.focus];k.type==="text"&&k.key===r&&(y=k),I.type==="text"&&I.key===r&&(x=I)}n.isSegmented()?(p=jn(c),p.__format=m,p.__style=g,p.__detail=h,p.__state=tk(n,p),v=!0):p=n.setTextContent(c);let w=[p];for(let k=1;k<d;k++){let I=jn(s[k]);I.__format=m,I.__style=g,I.__detail=h,I.__state=tk(n,I);let P=I.__key;a===r&&Xn(P),w.push(I)}let T=y?y.offset:null,S=x?x.offset:null,L=0;for(let k of w){if(!y&&!x)break;let I=L+k.getTextContentSize();if(y!==null&&T!==null&&T<=I&&T>=L&&(y.set(k.getKey(),T-L,"text"),T<I&&(y=null)),x!==null&&S!==null&&S<=I&&S>=L){x.set(k.getKey(),S-L,"text");break}L=I}if(f!==null){(function(P){let E=P.getPreviousSibling(),_=P.getNextSibling();E!==null&&cm(E),_!==null&&cm(_)})(this);let k=f.getWritable(),I=this.getIndexWithinParent();v?(k.splice(I,0,w),this.remove()):k.splice(I,1,w),Ge(C)&&sm(C,f,I,d-1)}return w}mergeWithSibling(t){let n=t===this.getPreviousSibling();n||t===this.getNextSibling()||fe(50);let o=this.__key,r=t.__key,a=this.__text,i=a.length;Di()===r&&Xn(o);let s=zt();if(Ge(s)){let f=s.anchor,p=s.focus;f!==null&&f.key===r&&Sk(f,n,o,t,i),p!==null&&p.key===r&&Sk(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 H$(e){return{forChild:_y(e.style),node:null}}function $$(e){let t=e,n=t.style.fontWeight==="normal";return{forChild:_y(t.style,n?void 0:"bold"),node:null}}var mk=new WeakMap;function K$(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 q$(e){let t=e;e.parentElement===null&&fe(129);let n=t.textContent||"";if((function(o){let r,a=o.parentNode,i=[o];for(;a!==null&&(r=mk.get(a))===void 0&&!K$(a);)i.push(a),a=a.parentNode;let s=r===void 0?a:r;for(let l=0;l<i.length;l++)mk.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===`
3833
3833
  `||s===`\r
3834
- `?r.push(Yl()):s===" "?r.push(vm()):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=gk(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=gk(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 gk(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===""&&!pP(n)||a!==""&&!a.startsWith("inline"))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(da(n))return n;if(n.nodeName==="BR")return null}}var V$={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Ba(e){let t=V$[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:_y(e.style,t),node:null}}function jn(e=""){return mu(new zs(e))}function Ue(e){return e instanceof zs}function _y(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=>(Ue(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 Jl=class e extends zs{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=Ql(t.theme,"tab");return o!==void 0&&n.classList.add(...o),n}static importJSON(t){return vm().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&$k(126),super.setTextContent(" ")}spliceText(t,n,o,r){return o===""&&n===0||o===" "&&n===1||fe(286),this}setDetail(t){return t!==2&&fe(127),this}setMode(t){return t!=="normal"&&fe(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function vm(){return mu(new Jl)}function Dy(e){return e instanceof Jl}var dy=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:ox(Pr(Ki(this,"next")),Pr(Ki(t,"next")))<0}getNode(){let t=Un(this.key);return t===null&&fe(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,sd()||(Di()===i&&Xn(t),a!==null&&(a.setCachedNodes(null),a.dirty=!0)))}};function Mr(e,t,n){return new dy(e,t,n)}function Ov(e,t){let n=t.__key,o=e.offset,r="element";if(Ue(t)){r="text";let a=t.getTextContentSize();o>a&&(o=a)}else if(!se(t)){let a=t.getNextSibling();if(Ue(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 hk(e,t){if(se(t)){let n=t.getLastDescendant();se(n)||Ue(n)?Ov(e,n):Ov(e,t)}else Ov(e,t)}var im=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(!cu(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(Ue(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=Un(r);a!==null&&o.push(a)}return sd()||(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((zt()||Ks())===this&&t[0]){let n=Zn(t[0],"next");yP($i(n,n))}for(let n of t)n.remove()}};function Ge(e){return e instanceof Us}var Us=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!!Ge(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(Er(d)){let{origin:c}=d;r.length===0?s.add(c):(l.add(c),r.push(c))}else{let{origin:c}=d;se(c)&&l.has(c)||r.push(c)}if(i&&r.push(i.caret.origin),$s(o.focus)&&se(o.focus.origin)&&o.focus.getNodeAtCaret()===null)for(let d=Va(o.focus.origin,"previous");Er(d)&&s.has(d.origin)&&!d.origin.isEmpty()&&d.origin.is(r[r.length-1]);d=ad(d))s.delete(d.origin),r.pop();for(;r.length>1;){let d=r[r.length-1];if(!se(d)||l.has(d)||d.isEmpty()||s.has(d))break;r.pop()}if(r.length===0&&o.isCollapsed()){let d=Pr(o.anchor),c=Pr(o.anchor.getFlipped()),f=m=>qa(m)?m.origin:m.getNodeAtCaret(),p=f(d)||f(c)||(o.anchor.getNodeAtCaret()?d.origin:c.origin);r.push(p)}return r})(ax(yy(this),"next"));return sd()||(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]=cy(this),d="",c=!0;for(let f=0;f<t.length;f++){let p=t[f];if(se(p)&&!p.isInline())c||(d+=`
3835
- `),c=!p.isEmpty();else if(c=!1,Ue(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!tn(p)&&!Os(p)||p===o&&this.isCollapsed()||(d+=p.getTextContent())}return d}applyDOMRange(t){let n=Jt(),o=n.getEditorState()._selection,r=BL(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),Yp(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=su(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=mo[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===`
3834
+ `?r.push(Yl()):s===" "?r.push(vm()):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=gk(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=gk(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 gk(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===""&&!pP(n)||a!==""&&!a.startsWith("inline"))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(da(n))return n;if(n.nodeName==="BR")return null}}var V$={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Ba(e){let t=V$[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:_y(e.style,t),node:null}}function jn(e=""){return mu(new Bs(e))}function Ue(e){return e instanceof Bs}function _y(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=>(Ue(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 Jl=class e extends Bs{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=Ql(t.theme,"tab");return o!==void 0&&n.classList.add(...o),n}static importJSON(t){return vm().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&$k(126),super.setTextContent(" ")}spliceText(t,n,o,r){return o===""&&n===0||o===" "&&n===1||fe(286),this}setDetail(t){return t!==2&&fe(127),this}setMode(t){return t!=="normal"&&fe(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function vm(){return mu(new Jl)}function Dy(e){return e instanceof Jl}var dy=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:ox(Lr(Ki(this,"next")),Lr(Ki(t,"next")))<0}getNode(){let t=Un(this.key);return t===null&&fe(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,sd()||(Di()===i&&Xn(t),a!==null&&(a.setCachedNodes(null),a.dirty=!0)))}};function Rr(e,t,n){return new dy(e,t,n)}function Ov(e,t){let n=t.__key,o=e.offset,r="element";if(Ue(t)){r="text";let a=t.getTextContentSize();o>a&&(o=a)}else if(!se(t)){let a=t.getNextSibling();if(Ue(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 hk(e,t){if(se(t)){let n=t.getLastDescendant();se(n)||Ue(n)?Ov(e,n):Ov(e,t)}else Ov(e,t)}var im=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(!cu(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(Ue(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=Un(r);a!==null&&o.push(a)}return sd()||(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((zt()||$s())===this&&t[0]){let n=Zn(t[0],"next");yP($i(n,n))}for(let n of t)n.remove()}};function Ge(e){return e instanceof zs}var zs=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!!Ge(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;se(c)&&l.has(c)||r.push(c)}if(i&&r.push(i.caret.origin),Hs(o.focus)&&se(o.focus.origin)&&o.focus.getNodeAtCaret()===null)for(let d=Va(o.focus.origin,"previous");Ar(d)&&s.has(d.origin)&&!d.origin.isEmpty()&&d.origin.is(r[r.length-1]);d=ad(d))s.delete(d.origin),r.pop();for(;r.length>1;){let d=r[r.length-1];if(!se(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=>qa(m)?m.origin:m.getNodeAtCaret(),p=f(d)||f(c)||(o.anchor.getNodeAtCaret()?d.origin:c.origin);r.push(p)}return r})(ax(yy(this),"next"));return sd()||(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]=cy(this),d="",c=!0;for(let f=0;f<t.length;f++){let p=t[f];if(se(p)&&!p.isInline())c||(d+=`
3835
+ `),c=!p.isEmpty();else if(c=!1,Ue(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!tn(p)&&!Ds(p)||p===o&&this.isCollapsed()||(d+=p.getTextContent())}return d}applyDOMRange(t){let n=Jt(),o=n.getEditorState()._selection,r=BL(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),Yp(this)}clone(){let t=this.anchor,n=this.focus;return new e(Rr(t.key,t.offset,t.type),Rr(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(t){this.format=su(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=mo[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===`
3836
3836
  `||i===`\r
3837
- `?o.push(Yl()):i===" "?o.push(vm()):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,y,x,C){let w=v.getNode(),T=w.getChildAtIndex(v.offset),S=jn();if(S.setFormat(x),S.setStyle(C),GL(T))T.splice(0,0,[S]);else{let L=io(w)?Ka().append(S):S;T===null?w.append(L):T.insertBefore(L)}v.is(y)&&y.set(S.__key,0,"text"),v.set(S.__key,0,"text")})(i,s,r,a),s.type==="element"&&id(s,Pr(Ki(s,"next")));let l=i.offset,d=s.offset,c=this.getNodes(),f=c.length,p=c[0];Ue(p)||fe(26);let m=p.getTextContent().length,g=p.getParentOrThrow(),h=c[f-1];if(f===1&&s.type==="element"&&(d=m,s.set(i.key,d,"text")),this.isCollapsed()&&l===m&&(Ua(p)||!p.canInsertTextAfter()||!g.canInsertTextAfter()&&p.getNextSibling()===null)){let v=p.getNextSibling();if(Ue(v)&&v.canInsertTextBefore()&&!Ua(v)||(v=jn(),v.setFormat(r),v.setStyle(a),g.canInsertTextAfter()?p.insertAfter(v):g.insertAfter(v)),v.select(0,0),p=v,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&l===0&&(Ua(p)||!p.canInsertTextBefore()||!g.canInsertTextBefore()&&p.getPreviousSibling()===null)){let v=p.getPreviousSibling();if(Ue(v)&&!Ua(v)||(v=jn(),v.setFormat(r),g.canInsertTextBefore()?p.insertBefore(v):g.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=h.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||se(v)&&(!v.canInsertTextBefore()||!v.canInsertTextAfter()))return this.insertText(""),FL(this.anchor,this.focus),void this.insertText(t)}if(f===1){if(Oi(p)){let C=jn(t);return C.select(),void p.replace(C)}let v=p.getFormat(),y=p.getStyle();if(l!==d||v===r&&y===a){if(Dy(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 x=d-l;p=p.spliceText(l,x,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=v,this.style=y,p.isComposing()&&(this.anchor.offset-=t.length))}else{let v=new Set([...p.getParentKeys(),...h.getParentKeys()]),y=se(p)?p:p.getParentOrThrow(),x=se(h)?h:h.getParentOrThrow(),C=h;if(!y.is(x)&&x.isInline())do C=x,x=x.getParentOrThrow();while(x.isInline());if(s.type==="text"&&(d!==0||h.getTextContent()==="")||s.type==="element"&&h.getIndexWithinParent()<d)if(Ue(h)&&!Oi(h)&&d!==h.getTextContentSize()){if(h.isSegmented()){let k=jn(h.getTextContent());h.replace(k),h=k}io(s.getNode())||s.type!=="text"||(h=h.spliceText(0,d,"")),v.add(h.__key)}else{let k=h.getParentOrThrow();k.canBeEmpty()||k.getChildrenSize()!==1?h.remove():k.remove()}else v.add(h.__key);let w=x.getChildren(),T=new Set(c),S=y.is(x),L=y.isInline()&&p.getNextSibling()===null?y:p;for(let k=w.length-1;k>=0;k--){let I=w[k];if(I.is(p)||se(I)&&I.isParentOf(p))break;I.isAttached()&&(!T.has(I)||I.is(C)?S||L.insertAfter(I,!1):I.remove())}if(!S){let k=x,I=null;for(;k!==null;){let P=k.getChildren(),E=P.length;(E===0||P[E-1].is(I))&&(v.delete(k.__key),I=k),k=k.getParent()}}if(Oi(p))if(l===m)p.select();else{let k=jn(t);k.select(),p.replace(k)}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 k=1;k<f;k++){let I=c[k],P=I.__key;v.has(P)||I.remove()}}}removeText(){let t=zt()===this;Yc(this,xP(yy(this))),t&&zt()!==this&&Bo(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)Ue(w)&&r.push(w);let a=w=>{o.forEach(T=>{if(se(T)){let S=T.getFormatFlags(t,w);T.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],g=c.type==="element"?0:c.offset;if(c.type==="text"&&g===m.getTextContentSize()&&(p=1,m=r[1],g=0),m==null)return;let h=m.getFormatFlags(t,n);a(h);let v=i-1,y=r[v],x=f.type==="text"?f.offset:y.getTextContentSize();if(m.is(y)){if(g===x)return;if(Ua(m)||g===0&&x===m.getTextContentSize())m.setFormat(h);else{let w=m.splitText(g,x),T=g===0?w[0]:w[1];T.setFormat(h),c.type==="text"&&c.set(T.__key,0,"text"),f.type==="text"&&f.set(T.__key,x-g,"text")}return void(this.format=h)}g===0||Ua(m)||([,m]=m.splitText(g),g=0),m.setFormat(h);let C=y.getFormatFlags(t,h);x>0&&(x===y.getTextContentSize()||Ua(y)||([y]=y.splitText(x)),y.setFormat(C));for(let w=p+1;w<v;w++){let T=r[w],S=T.getFormatFlags(t,C);T.setFormat(S)}c.type==="text"&&c.set(m.__key,g,"text"),f.type==="text"&&f.set(y.__key,x,"text"),this.format=h|C}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let g=zt();return Ge(g)||fe(134),g.insertNodes(t)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=Qc(n,$a),r=t[t.length-1];if(se(o)&&"__language"in o){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let g=Fv(this);o.splice(g,0,t),r.selectEnd()}return}if(!t.some(g=>(se(g)||tn(g))&&!g.isInline())){se(o)||fe(211,n.constructor.name,n.getType());let g=Fv(this);return o.splice(g,0,t),void r.selectEnd()}let a=(function(g){let h=Ka(),v=null;for(let y=0;y<g.length;y++){let x=g[y],C=Os(x);if(C||tn(x)&&x.isInline()||se(x)&&x.isInline()||Ue(x)||x.isParentRequired()){if(v===null&&(v=x.createParentElementNode(),h.append(v),C))continue;v!==null&&v.append(x)}else h.append(x),v=null}return h})(t),i=a.getLastDescendant(),s=a.getChildren(),l=!se(o)||!o.isEmpty()?this.insertParagraph():null,d=s[s.length-1],c=s[0];var f;se(f=c)&&$a(f)&&!f.isEmpty()&&se(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(se(o)||fe(211,n.constructor.name,n.getType()),o.append(...c.getChildren()),c=s[1]),c&&(o===null&&fe(212,n.constructor.name,n.getType()),(function(g,h){let v=h.getParentOrThrow().getLastChild(),y=h,x=[h];for(;y!==v;)y.getNextSibling()||fe(140),y=y.getNextSibling(),x.push(y);let C=g;for(let w of x)C=C.insertAfter(w)})(o,c));let p=Qc(i,$a);l&&se(p)&&(l.canMergeWhenEmpty()||$a(d))&&(p.append(...l.getChildren()),l.remove()),se(o)&&o.isEmpty()&&o.remove(),i.selectEnd();let m=se(o)?o.getLastChild():null;Os(m)&&p!==o&&m.remove()}insertParagraph(){if(this.anchor.key==="root"){let i=Ka();return Go().splice(this.anchor.offset,0,[i]),i.select(),i}let t=Fv(this),n=Qc(this.anchor.getNode(),$a);se(n)||fe(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=Yl();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]=cy(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(Ue(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(Ue(o)&&(c===o.getTextContentSize()?t.shift():c!==0&&([,o]=o.splitText(c),t[0]=o,l.set(o.getKey(),0,"text"))),Ue(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(Tk(this,t,n,o))return;let r=t==="move",a=Jt(),i=_r(jo(a));if(!i)return;let s=a._blockCursorElement,l=a._rootElement,d=this.focus.getNode();if(l===null||s===null||!se(d)||d.isInline()||d.canBeEmpty()||py(s,a,l),this.dirty){let c=td(a,this.anchor.key),f=td(a,this.focus.key);this.anchor.type==="text"&&(c=Hs(c)),this.focus.type==="text"&&(f=Hs(f)),c&&f&&HL(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=io(f)?f:dP(f);if(this.applyDOMRange(c),this.dirty=!0,!r){let m=this.getNodes(),g=[],h=!1;for(let v=0;v<m.length;v++){let y=m[v];um(y,p)?g.push(y):h=!0}if(h&&g.length>0)if(n){let v=g[0];se(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{let v=g[g.length-1];se(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}i.anchorNode===c.startContainer&&i.anchorOffset===c.startOffset||(function(v){let y=v.focus,x=v.anchor,C=x.key,w=x.offset,T=x.type;x.set(y.key,y.offset,y.type,!0),y.set(C,w,T,!0)})(this)}}o==="lineboundary"&&Tk(this,t,n,o,"decorators")}forwardDeletion(t,n,o){if(!o&&(t.type==="element"&&se(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(se(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=tx(Ki(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(Er(l)){if(!l.origin.isInline()){if(l.origin.isShadowRoot()){if(s.type==="merge-block")break;if(se(a.anchor.origin)&&a.anchor.origin.isEmpty()){let d=Pr(l);Yc(this,$i(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($s(l)){if(se(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(tn(l.origin)){if(!l.origin.isIsolated())if(s.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&se(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let d=Oy();d.add(l.origin.getKey()),Bo(d)}else l.origin.remove();return}break}}if(s.type==="merge-block"){let{caret:l,block:d}=s;return Yc(this,$i(!l.origin.isEmpty()&&d.isEmpty()?dd(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&&yk(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 xk(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 xk(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 g=c.offset,h=f.offset,v=g<h,y=v?g:h,x=v?h:g,C=x-1;y!==C&&(function(w){return!(nP(w)||W$(w))})(p.getTextContent().slice(y,x))&&(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()&&io(o.getParent())&&o.getPreviousSibling()===null&&yk(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 cu(e){return e instanceof im}function vk(e){let t=e.offset;if(e.type==="text")return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function cy(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]:[vk(n),vk(o)]}function yk(e,t){for(let n=t;n;n=n.getParent()){if(se(n)){if(n.collapseAtStart(e))return!0;if(fr(n))break}if(n.getPreviousSibling())break}return!1}var W$=(()=>{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 xk(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 Ck(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=Wl(c),Ue(r))a=Rr(r,i?"next":"previous");else{let p=Wl(e);if(p===null)return null;if(se(p)){let m=o.getElementByKey(p.getKey());m===null&&fe(214),[p,a]=p.getDOMSlot(m).resolveChildIndex(p,m,e,t),se(p)||fe(215),i&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let h=p.getChildAtIndex(a);if(se(h)&&(function(v,y,x){let C=v.getParent();return x===null||C===null||!C.canBeEmpty()||C!==x.getNode()})(h,0,n)){let v=i?h.getLastDescendant():h.getFirstDescendant();v===null?p=h:(h=v,p=se(h)?h:h.getParentOrThrow()),a=0}Ue(h)?(r=h,p=null,a=Rr(h,i?"next":"previous")):h!==p&&i&&!f&&(se(p)||fe(216),a=Math.min(p.getChildrenSize(),a+1))}else{let m=p.getIndexWithinParent();a=t===0&&tn(p)&&Wl(e)===p?m:m+1,p=p.getParentOrThrow()}if(se(p))return Mr(p.__key,a,"element")}}else r=Wl(e);return Ue(r)?Mr(r.__key,Rr(r,a,"clamp"),"text"):null}function bk(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&&se(i)&&i.isInline()){let s=i.getPreviousSibling();Ue(s)&&e.set(s.__key,s.getTextContent().length,"text")}}else se(a)&&!n&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):Ue(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(o===r.getTextContent().length){let a=r.getNextSibling(),i=r.getParent();if(t&&se(a)&&a.isInline())e.set(a.__key,0,"element");else if((n||t)&&a===null&&se(i)&&i.isInline()&&!i.canInsertTextAfter()){let s=i.getNextSibling();Ue(s)&&e.set(s.__key,0,"text")}}}function FL(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);bk(e,o,r),bk(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function BL(e,t,n,o,r,a){if(e===null||n===null||!uu(r,e,n))return null;let i=Ck(e,t,Ge(a)?a.anchor:null,r);if(i===null)return null;let s=Ck(n,o,Ge(a)?a.focus:null,r);if(s===null)return null;if(i.type==="element"&&s.type==="element"){let l=Wl(e),d=Wl(n);if(tn(l)&&tn(d))return null}return FL(i,s),[i,s]}function G$(e){return se(e)&&!e.isInline()}function zL(e,t,n,o,r,a){let i=Wa(),s=new Us(Mr(e,t,r),Mr(n,o,a),0,"");return s.dirty=!0,i._selection=s,s}function UL(){let e=Mr("root",0,"element"),t=Mr("root",0,"element");return new Us(e,t,0,"")}function Oy(){return new im(new Set)}function j$(e,t){return ym(null,e,t,null)}function ym(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=!qv&&(s||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&a&&a.detail===3||i==="drop"||i===void 0),d,c,f,p;if(Ge(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)&&Ge(e)&&!uu(n,d,c))return e.clone();let m=BL(d,f,c,p,n,e);if(m===null)return null;let[g,h]=m,v=0,y="";if(Ge(e)){let x=e.anchor;if(g.key===x.key)v=e.format,y=e.style;else{let C=g.getNode();Ue(C)?(v=C.getFormat(),y=C.getStyle()):se(C)&&(v=C.getTextFormat(),y=C.getTextStyle())}}return new Us(g,h,v,y)}function zt(){return Wa()._selection}function Ks(){return Jt()._editorState._selection}function sm(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"),wk(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 g=c.offset;(n<=g&&o>0||n<g&&o<0)&&c.set(l,Math.max(0,g+o),"element")}if(t.is(m)){let g=p.offset;(n<=g&&o>0||n<g&&o<0)&&p.set(l,Math.max(0,g+o),"element")}}wk(e)}function wk(e){let t=e.anchor,n=t.offset,o=e.focus,r=o.offset,a=t.getNode(),i=o.getNode();if(e.isCollapsed()){if(!se(a))return;let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Ue(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text"),o.set(d.__key,c,"text")}return}if(se(a)){let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Ue(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text")}}if(se(i)){let s=i.getChildrenSize(),l=r>=s,d=l?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(Ue(d)){let c=0;l&&(c=d.getTextContentSize()),o.set(d.__key,c,"text")}}}function lm(e,t,n,o,r){let a=null,i=0,s=null;o!==null?(a=o.__key,Ue(o)?(i=o.getTextContentSize(),s="text"):se(o)&&(i=o.getChildrenSize(),s="element")):r!==null&&(a=r.__key,Ue(r)?s="text":se(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 Sk(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 HL(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function Ik(e,t,n){let o=td(e,t.getKey());if(se(t)){let r=t.getDOMSlot(o);return[r.element,n+r.getFirstChildOffset()]}return[o,n]}function Q$(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(EL)&&f!==a||f!==null&&$y(f))return;if(!Ge(t))return void(e!==null&&uu(n,s,l)&&o.removeAllRanges());let p=t.anchor,m=t.focus,g=p.getNode(),h=m.getNode(),[v,y]=Ik(n,g,p.offset),[x,C]=Ik(n,h,m.offset),w=t.format,T=t.style,S=t.isCollapsed(),L=v,k=x,I=!1;var P,E,_,A,H;if(p.type==="text"?(L=Hs(v),I=g.getFormat()!==w||g.getStyle()!==T):Ge(e)&&e.anchor.type==="text"&&(I=!0),m.type==="text"&&(k=Hs(x)),L!==null&&k!==null&&(S&&(e===null||I||Ge(e)&&(e.format!==w||e.style!==T))&&(P=w,E=T,_=y,A=p.key,H=performance.now(),SL=[P,E,_,A,H]),d!==y||c!==C||s!==L||l!==k||o.type==="Range"&&S||(f!==null&&a.contains(f)||r.has(ly)||a.focus({preventScroll:!0}),p.type==="element"))){if(HL(o,L,y,k,C),!Bi||!t.isCollapsed()||a===null||r.has(ly)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(RL)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let V=Ge(t)&&t.anchor.type==="element"?L.childNodes[y]||null:o.rangeCount>0?o.getRangeAt(0):null;if(V!==null){let J;if(V instanceof Text){let D=document.createRange();D.selectNode(V),J=D.getBoundingClientRect()}else J=V.getBoundingClientRect();(function(D,ne,B){let U=Qy(B),ee=Xy(U);if(U===null||ee===null)return;let{top:j,bottom:Z}=ne,de=0,F=0,X=B;for(;X!==null;){let pe=X===U.body;if(pe)de=0,F=jo(D).innerHeight;else{let re=X.getBoundingClientRect();de=re.top,F=re.bottom}let le=0;if(j<de?le=-(de-j):Z>F&&(le=Z-F),le!==0)if(pe)ee.scrollBy(0,le);else{let re=X.scrollTop;X.scrollTop+=le;let we=X.scrollTop-re;j-=we,Z-=we}if(pe)break;X=pu(X)}})(n,J,a)}}ay=!0}}function X$(e){let t=zt()||Ks();t===null&&(t=Go().selectEnd()),t.insertNodes(e)}function Y$(){let e=zt();return e===null?"":e.getTextContent()}function Fv(e){let t=e;e.isCollapsed()||t.removeText();let n=zt();Ge(n)&&(t=n),Ge(t)||fe(161);let o=t.anchor,r=o.getNode(),a=o.offset;for(;!$a(r);){let i=r;if([r,a]=J$(r,a),i.is(r))break}return a}function J$(e,t){let n=e.getParent();if(!n){let r=Ka();return Go().append(r),r.select(),[Go(),0]}if(Ue(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(!se(e)||t===0)return[n,e.getIndexWithinParent()];let o=e.getChildAtIndex(t);if(o){let r=new Us(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 Tk(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=Ki(e.focus,n?"previous":"next"),i=o==="lineboundary",s=t==="move",l=a,d=r==="decorators-and-blocks";if(!CP(l)){for(let c of l){d=!1;let{origin:f}=c;if(!tn(f)||f.isIsolated()||(l=c,!i||!f.isInline()))break}if(d)for(let c of tx(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Er(c))c.origin.isInline()||(l=c);else{if(se(c.origin))continue;tn(c.origin)&&!c.origin.isInline()&&(l=c)}break}}if(l===a)return!1;if(s&&!i&&tn(l.origin)&&l.origin.isKeyboardSelectable()){let c=Oy();return c.add(l.origin.getKey()),Bo(c),!0}return l=Pr(l),s&&id(e.anchor,l),id(e.focus,l),d||!i}var Yn=null,Jn=null,Fo=!1,Bv=!1,jp=0,kk={characterData:!0,childList:!0,subtree:!0};function sd(){return Fo||Yn!==null&&Yn._readOnly}function Qn(){Fo&&fe(13)}function $L(){jp>99&&fe(14)}function Wa(){return Yn===null&&fe(195,KL()),Yn}function Jt(){return Jn===null&&fe(196,KL()),Jn}function KL(){let e=0,t=new Set,n=Ui.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=fu(r);if(Cm(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 Z$(){return Jn}function Lk(e,t,n){let o=t.__type,r=Uy(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 Pk(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function qL(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 eK(e){return Fy(e,Jt()._nodes)}function Fy(e,t){let n=e.type,o=t.get(n);o===void 0&&fe(17,n);let r=o.klass;e.type!==r.getType()&&fe(18,r.name);let a=r.importJSON(e),i=e.children;if(se(a)&&Array.isArray(i))for(let s=0;s<i.length;s++){let l=Fy(i[s],t);a.append(l)}return a}function Ak(e,t,n){let o=Yn,r=Fo,a=Jn;Yn=t,Fo=!0,Jn=e;try{return n()}finally{Yn=o,Fo=r,Jn=a}}function Ha(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=Fo,f=Jn,p=e._updating,m=e._observer,g=null;if(e._pendingEditorState=null,e._editorState=n,!r&&l&&m!==null){Jn=e,Yn=n,Fo=!1,e._updating=!0;try{let S=e._dirtyType,L=e._dirtyElements,k=e._dirtyLeaves;m.disconnect(),g=x$(a,n,e,S,L,k)}catch(S){if(S instanceof Error&&e._onError(S),Bv)throw S;return jL(e,null,o,n),Qk(e),e._dirtyType=2,Bv=!0,Ha(e,a),void(Bv=!1)}finally{m.observe(o,kk),e._updating=p,Yn=d,Fo=c,Jn=f}}n._readOnly||(n._readOnly=!0);let h=e._dirtyLeaves,v=e._dirtyElements,y=e._normalizedNodes,x=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 k=S._decorators,I=S._pendingDecorators||k,P=L._nodeMap,E;for(E in I)P.has(E)||(I===k&&(I=eP(S)),delete I[E])})(e,n);let w=r?null:_r(jo(e));if(e._editable&&w!==null&&(l||s===null||s.dirty||!s.is(i))&&o!==null&&!x.has(ML)){Jn=e,Yn=n;try{if(m!==null&&m.disconnect(),l||s===null||s.dirty){let S=e._blockCursorElement;S!==null&&py(S,e,o),Q$(i,s,e,w,x,o)}(function(S,L,k){let I=S._blockCursorElement;if(Ge(k)&&k.isCollapsed()&&k.anchor.type==="element"&&L.contains(document.activeElement)){let P=k.anchor,E=P.getNode(),_=P.offset,A=!1,H=null;if(_===E.getChildrenSize())Uv(E.getChildAtIndex(_-1))&&(A=!0);else{let V=E.getChildAtIndex(_);if(V!==null&&Uv(V)){let J=V.getPreviousSibling();(J===null||Uv(J))&&(A=!0,H=S.getElementByKey(V.__key))}}if(A){let V=S.getElementByKey(E.__key);return I===null&&(S._blockCursorElement=I=(function(J){let D=J.theme,ne=document.createElement("div");ne.contentEditable="false",ne.setAttribute("data-lexical-cursor","true");let B=D.blockCursor;if(B!==void 0){if(typeof B=="string"){let U=hu(B);B=D.blockCursor=U}B!==void 0&&ne.classList.add(...B)}return ne})(S._config)),L.style.caretColor="transparent",void(H===null?V.appendChild(I):V.insertBefore(I,H))}}I!==null&&py(I,S,L)})(e,o,s)}finally{m!==null&&m.observe(o,kk),Jn=f,Yn=d}}g!==null&&(function(S,L,k,I,P){let E=Array.from(S._listeners.mutation),_=E.length;for(let A=0;A<_;A++){let[H,V]=E[A];for(let J of V){let D=L.get(J);D!==void 0&&H(D,{dirtyLeaves:I,prevEditorState:P,updateTags:k})}}})(e,g,x,h,a),Ge(s)||s===null||i!==null&&i.is(s)||e.dispatchCommand(Sy,void 0);let T=e._pendingDecorators;T!==null&&(e._decorators=T,e._pendingDecorators=null,jc("decorator",e,!0,T)),(function(S,L,k){let I=Nk(L),P=Nk(k);I!==P&&jc("textcontent",S,!0,P)})(e,t||a,n),jc("update",e,!0,{dirtyElements:v,dirtyLeaves:h,editorState:n,mutatedNodes:g,normalizedNodes:y,prevEditorState:t||a,tags:x}),(function(S,L){if(S._deferred=[],L.length!==0){let k=S._updating;S._updating=!0;try{for(let I=0;I<L.length;I++)L[I]()}finally{S._updating=k}}})(e,C),(function(S){let L=S._updates;if(L.length!==0){let k=L.shift();if(k){let[I,P]=k;xm(S,I,P)}}})(e)}function jc(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 Ek(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&&fe(191),s._flushSync=!0),l&&e._deferred.push(l),qL(e,i.tag)),s==null?xm(e,a,i):a()}}return o}function xm(e,t,n){let o=e._updateTags,r,a=!1,i=!1;n!==void 0&&(r=n.onUpdate,qL(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=VL(l||s),d=!0),l._flushSync=i;let c=Yn,f=Fo,p=Jn,m=e._updating;Yn=l,Fo=!1,e._updating=!0,Jn=e;let g=e._headless||e.getRootElement()===null;zy(null);try{d&&(g?s._selection!==null&&(l._selection=s._selection.clone()):l._selection=(function(x,C){let w=x.getEditorState()._selection,T=_r(jo(x));return Ge(w)||w==null?ym(w,T,x,C):w.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=Ek(e,a),(function(x,C){let w=C.getEditorState()._selection,T=x._selection;if(Ge(T)){let S=T.anchor,L=T.focus,k;if(S.type==="text"&&(k=S.getNode(),k.selectionTransform(w,T)),L.type==="text"){let I=L.getNode();k!==I&&I.selectionTransform(w,T)}}})(l,e),e._dirtyType!==0&&(a?(function(x,C){let w=C._dirtyLeaves,T=x._nodeMap;for(let S of w){let L=T.get(S);Ue(L)&&L.isAttached()&&L.isSimpleText()&&!L.isUnmergeable()&&rk(L)}})(l,e):(function(x,C){let w=C._dirtyLeaves,T=C._dirtyElements,S=x._nodeMap,L=Di(),k=new Map,I=w,P=I.size,E=T,_=E.size;for(;P>0||_>0;){if(P>0){C._dirtyLeaves=new Set;for(let A of I){let H=S.get(A);Ue(H)&&H.isAttached()&&H.isSimpleText()&&!H.isUnmergeable()&&rk(H),H!==void 0&&Pk(H,L)&&Lk(C,H,k),w.add(A)}if(I=C._dirtyLeaves,P=I.size,P>0){jp++;continue}}C._dirtyLeaves=new Set,C._dirtyElements=new Map,E.delete("root")&&E.set("root",!0);for(let A of E){let H=A[0],V=A[1];if(T.set(H,V),!V)continue;let J=S.get(H);J!==void 0&&Pk(J,L)&&Lk(C,J,k)}I=C._dirtyLeaves,P=I.size,E=C._dirtyElements,_=E.size,jp++}C._dirtyLeaves=w,C._dirtyElements=T})(l,e),Ek(e),(function(x,C,w,T){let S=x._nodeMap,L=C._nodeMap,k=[];for(let[I]of T){let P=L.get(I);P!==void 0&&(P.isAttached()||(se(P)&&Wk(P,I,S,L,k,T),S.has(I)||T.delete(I),k.push(I)))}for(let I of k)L.delete(I);for(let I of w){let P=L.get(I);P===void 0||P.isAttached()||(S.has(I)||w.delete(I),L.delete(I))}})(s,l,e._dirtyLeaves,e._dirtyElements)),v!==e._compositionKey&&(l._flushSync=!0);let y=l._selection;if(Ge(y)){let x=l._nodeMap,C=y.anchor.key,w=y.focus.key;x.get(C)!==void 0&&x.get(w)!==void 0||fe(19)}else cu(y)&&y._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 Ha(e)}finally{Yn=c,Fo=f,Jn=p,e._updating=m,jp=0}e._dirtyType!==0||e._deferred.length>0||(function(v,y){let x=y.getEditorState()._selection,C=v._selection;if(C!==null){if(C.dirty||!C.is(x))return!0}else if(x!==null)return!0;return!1})(l,e)?l._flushSync?(l._flushSync=!1,Ha(e)):d&&dK(()=>{Ha(e)}):(l._flushSync=!1,d&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function la(e,t,n){Jn===e&&n===void 0?t():xm(e,t,n)}var uy=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&&fe(222),this.element.insertBefore(t,n),this}removeChild(t){return t.parentElement!==this.element&&fe(223),this.element.removeChild(t),this}replaceChild(t,n){return n.parentElement!==this.element&&fe(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"&&(mm||du||pm);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=Rk(n,o);a.push(r);let i=Rk(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 Rk(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&&fe(225),n.reverse()}var zi=class extends ur{__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 a$[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=Jt()._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(Ue(n)&&t.push(n),se(n)){let o=n.getAllTextNodes();t.push(...o)}n=n.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;se(t);){let n=t.getFirstChild();if(n===null)break;t=n}return t}getLastDescendant(){let t=this.getLastChild();for(;se(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 se(a)&&a.getLastDescendant()||a||null}let r=n[t];return se(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:Un(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&fe(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:Un(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&fe(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(),se(a)&&r!==o-1&&!a.isInline()&&(t+=gm)}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(),se(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=Kv[t];return(this.getFormat()&n)!==0}return!1}hasTextFormat(t){let n=mo[t];return(this.getTextFormat()&n)!==0}getFormatFlags(t,n){return su(this.getLatest().__textFormat,t,n)}getTextStyle(){return this.getLatest().__textStyle}select(t,n){Qn();let o=zt(),r=t,a=n,i=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&n===0){let l=this.getFirstChild();if(Ue(l)||se(l))return l.select(0,0)}else if(!(t!==void 0&&t!==i||n!==void 0&&n!==i)){let l=this.getLastChild();if(Ue(l)||se(l))return l.select()}}r===void 0&&(r=i),a===void 0&&(a=i);let s=this.__key;return Ge(o)?(o.anchor.set(s,r,"element"),o.focus.set(s,a,"element"),o.dirty=!0,o):zL(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!==""?Kv[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){am(this)&&fe(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+n<=r||fe(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 g=0;g<n;g++){m===null&&fe(100);let h=m.getNextSibling(),v=m.__key;Fi(m.getWritable()),l.push(v),m=h}}let p=c;for(let m of o){p!==null&&m.is(p)&&(c=p=p.getPreviousSibling());let g=m.getWritable();g.__parent===i&&f--,Fi(g);let h=m.__key;if(p===null)a.__first=h,g.__prev=null;else{let v=p.getWritable();v.__next=h,g.__prev=v.__key}m.__key===i&&fe(76),g.__parent=i,s.push(h),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 g=p.getWritable();m.__prev=p.__key,g.__next=d.__key}else m.__prev=null}if(a.__size=f,l.length){let m=zt();if(Ge(m)){let g=new Set(l),h=new Set(s),{anchor:v,focus:y}=m;Mk(v,g,h)&&lm(v,v.getNode(),this,c,d),Mk(y,g,h)&&lm(y,y.getNode(),this,c,d),f!==0||this.canBeEmpty()||fr(this)||this.remove()}}return a}getDOMSlot(t){return new uy(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===""||fr(this)||this.getChildren().some(Ue)||(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 se(e){return e instanceof zi}function Mk(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 au=class extends ur{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function tn(e){return e instanceof au}var Zl=class e extends zi{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){fe(51)}getTextContent(){let t=this.__cachedText;return!sd()&&Jt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){fe(52)}replace(t){fe(53)}insertBefore(t){fe(54)}insertAfter(t){fe(55)}updateDOM(t,n){return!1}splice(t,n,o){for(let r of o)se(r)||tn(r)||fe(282);return super.splice(t,n,o)}static importJSON(t){return Go().updateFromJSON(t)}collapseAtStart(){return!0}};function io(e){return e instanceof Zl}function VL(e){return new iu(new Map(e._nodeMap))}function By(){return new iu(new Map([["root",new Zl]]))}function WL(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&fe(130,n.name),se(e)){let o=t.children;Array.isArray(o)||fe(59,n.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let i=WL(r[a]);o.push(i)}}return t}function tK(e){return e instanceof iu}var iu=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 Ak(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 Ak(null,this,()=>({root:WL(Go())}))}},dm=class extends zi{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},ed=class e extends zi{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let n=document.createElement("p"),o=Ql(t.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(t,n,o){return!1}static importDOM(){return{p:t=>({conversion:nK,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 Ka().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(Ue);n?(t.textFormat=n.getFormat(),t.textStyle=n.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,n){let o=Ka();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||Ue(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 nK(e){let t=Ka();if(e.style&&(t.setFormat(e.style.textAlign),mP(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in Kv&&t.setFormat(n)}return{node:t}}function Ka(){return mu(new ed)}function GL(e){return e instanceof ed}var Vl=0,oK=1,rK=2,aK=3,iK=4;function jL(e,t,n,o){let r=e._keyToDOMMap;r.clear(),e._editorState=By(),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 QL(e){let t=new Set,n=new Set,o=e;for(;o;){let{ownNodeConfig:r}=gu(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 ur&&i!==ur?i:void 0}}return t}function sK(e){let t=e||{},n=Z$(),o=t.theme||{},r=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,i=By(),s=t.namespace||(r!==null?r._config.namespace:oP()),l=t.editorState,d=[Zl,zs,Xl,Jl,ed,dm,...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 h=0;h<d.length;h++){let v=d[h],y=null,x=null;if(typeof v!="function"){let T=v;v=T.replace,y=T.with,x=T.withKlass||null}gu(v);let C=v.getType(),w=QL(v);m.set(C,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:y,replaceWithKlass:x,sharedNodeState:Xk(d[h]),transforms:w})}}let g=new Ui(i,r,m,{disableEvents:a,namespace:s,theme:o},c||console.error,(function(h,v){let y=new Map,x=new Set,C=w=>{Object.keys(w).forEach(T=>{let S=y.get(T);S===void 0&&(S=[],y.set(T,S)),S.push(w[T])})};return h.forEach(w=>{let T=w.klass.importDOM;if(T==null||x.has(T))return;x.add(T);let S=T.call(w.klass);S!==null&&C(S)}),v&&C(v),y})(m,f?f.import:void 0),p,e);return l!==void 0&&(g._pendingEditorState=l,g._dirtyType=2),(function(h){h.registerCommand(Iy,A$,Vl),h.registerCommand(Ty,E$,Vl),h.registerCommand(ky,R$,Vl),h.registerCommand(Ly,M$,Vl),h.registerCommand(Ry,N$,Vl)})(g),g}var Ui=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=oP(),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&&fe(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&&fe(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&&fe(37,t.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,n){let o=this._editorState,r=gy(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=gy(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=Un(f);p&&p.markDirty()}},i._pendingEditorState===null?{tag:Gp}: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 Me(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=Ql(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,jL(this,n,t,r),n!==null&&(this._config.disableEvents||_$(n),o!=null&&n.classList.remove(...o)),t!==null){let a=Xy(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,Qk(this),this._updateTags.add(Gp),Ha(this),this._config.disableEvents||(function(s,l){let d=s.ownerDocument;ry.set(s,d);let c=om.get(d)??0;c<1&&d.addEventListener("selectionchange",PL),om.set(d,c+1),s.__lexicalEditor=l;let f=LL(s);for(let p=0;p<oy.length;p++){let[m,g]=oy[p],h=typeof g=="function"?v=>{uk(v)||(ck(v),(l.isEditable()||m==="click")&&g(v,l))}:v=>{if(uk(v))return;ck(v);let y=l.isEditable();switch(m){case"cut":return y&&Me(l,Ny,v);case"copy":return Me(l,My,v);case"paste":return y&&Me(l,Py,v);case"dragstart":return y&&Me(l,gL,v);case"dragover":return y&&Me(l,hL,v);case"dragend":return y&&Me(l,vL,v);case"focus":return y&&Me(l,yL,v);case"blur":return y&&Me(l,xL,v);case"drop":return y&&Me(l,mL,v)}};s.addEventListener(m,h),f.push(()=>{s.removeEventListener(m,h)})}})(t,this),o!=null&&t.classList.add(...o)}else this._window=null,this._updateTags.add(Gp),Ha(this);jc("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&fe(38);let o=t;o._readOnly&&(o=VL(t),o._selection=t._selection?t._selection.clone():null),jk(this);let r=this._pendingEditorState,a=this._updateTags,i=n!==void 0?n.tag:null;r===null||r.isEmpty()||(i!=null&&a.add(i),Ha(this)),this._pendingEditorState=o,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&a.add(i),this._updating||Ha(this)}parseEditorState(t,n){return(function(o,r,a){let i=By(),s=Yn,l=Fo,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,Fo=!1,Jn=r,zy(null);try{let g=r._nodes;Fy(o.root,g),a&&a(),i._readOnly=!0}catch(g){g instanceof Error&&r._onError(g)}finally{r._dirtyElements=c,r._dirtyLeaves=f,r._cloneNotNeeded=p,r._dirtyType=m,Yn=s,Fo=l,Jn=d}return i})(typeof t=="string"?JSON.parse(t):t,this,n)}read(t){return Ha(this),this.getEditorState().read(t,{editor:this})}update(t,n){(function(o,r,a){o._updating?o._updates.push([r,a]):xm(o,r,a)})(this,t,n)}focus(t,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),la(this,()=>{let r=zt(),a=Go();r!==null?r.dirty||Bo(r.clone()):a.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),Sm("focus"),lP(()=>{o.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){let t=this._rootElement;t!==null&&t.blur();let n=_r(this._window);n!==null&&n.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,jc("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};Ui.version="0.41.0+prod.esm";var fy=null;function zy(e){fy=e}var XL=1;function lK(){XL=1}function Uy(e,t){let n=Hy(e,t);return n===void 0&&fe(30,t),n}function Hy(e,t){return e._nodes.get(t)}var dK=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function YL(e){return tn(wm(e))}function $y(e){let t=document.activeElement;if(!ko(t))return!1;let n=t.nodeName;return tn(wm(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&fu(t)==null)}function uu(e,t,n){let o=e.getRootElement();try{return o!==null&&o.contains(t)&&o.contains(n)&&t!==null&&!$y(t)&&Ky(t)===e}catch{return!1}}function Cm(e){return e instanceof Ui}function Ky(e){let t=e;for(;t!=null;){let n=fu(t);if(Cm(n))return n;t=pu(t)}return null}function fu(e){return e?e.__lexicalEditor:null}function cK(e){return n$.test(e)?"rtl":o$.test(e)?"ltr":null}function Oi(e){return Dy(e)||e.isToken()}function Ua(e){return Oi(e)||e.isSegmented()}function da(e){return ld(e)&&e.nodeType===3}function JL(e){return ld(e)&&e.nodeType===9}function Hs(e){let t=e;for(;t!=null;){if(da(t))return t;t=t.firstChild}return null}function su(e,t,n){let o=mo[t];if(n!==null&&(e&o)===(n&o))return e;let r=e^o;return t==="subscript"?r&=~mo.superscript:t==="superscript"?r&=~mo.subscript:t==="lowercase"?(r&=~mo.uppercase,r&=~mo.capitalize):t==="uppercase"?(r&=~mo.lowercase,r&=~mo.capitalize):t==="capitalize"&&(r&=~mo.lowercase,r&=~mo.uppercase),r}function uK(e){return Ue(e)||Os(e)||tn(e)}function ZL(e,t){let n=(function(){let i=fy;return fy=null,i})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);Qn(),$L();let o=Jt(),r=Wa(),a=""+XL++;r._nodeMap.set(a,e),se(e)?o._dirtyElements.set(a,!0):o._dirtyLeaves.add(a),o._cloneNotNeeded.add(a),o._dirtyType=1,e.__key=a}function Fi(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 cm(e){$L(),am(e)&&fe(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,o=Wa(),r=Jt(),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,se(e)?i.set(s,!0):r._dirtyLeaves.add(s)}function Xn(e){Qn();let t=Jt(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let o=Un(n);o!==null&&o.getWritable()}if(e!==null){let o=Un(e);o!==null&&o.getWritable()}}}function Di(){return sd()?null:Jt()._compositionKey}function Un(e,t){let n=(t||Wa())._nodeMap.get(e);return n===void 0?null:n}function qy(e,t){let n=bm(e,Jt());return n!==void 0?Un(n,t):null}function bm(e,t){return e[`__lexicalKey_${t._key}`]}function wm(e,t){let n=e;for(;n!=null;){let o=qy(n,t);if(o!==null)return o;n=pu(n)}return null}function eP(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Nk(e){return e.read(()=>Go().getTextContent())}function Go(){return tP(Wa())}function tP(e){return e._nodeMap.get("root")}function Bo(e){Qn();let t=Wa();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Wl(e){let t=Jt(),n=(function(o,r){let a=o;for(;a!=null;){let i=bm(a,r);if(i!==void 0)return i;a=pu(a)}return null})(e,t);return n===null?e===t.getRootElement()?Un("root"):null:Un(n)}function nP(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Vy(e){let t=[],n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function oP(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function rP(e){return da(e)?e.nodeValue:null}function Wy(e,t,n){let o=_r(jo(t));if(o===null)return;let r=o.anchorNode,{anchorOffset:a,focusOffset:i}=o;if(r!==null){let s=rP(r),l=wm(r);if(s!==null&&Ue(l)){if((s===Jc||s===Cy)&&n){let d=n.length;s=n,a=d,i=d}s!==null&&Gy(l,s,a,i,e)}}}function Gy(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(Jc)&&(s=t.slice(0,-Jc.length)),r)){let d=Cy,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),pm||du||mm)a.remove();else{let h=Jt();setTimeout(()=>{h.update(()=>{a.isAttached()&&a.remove()})},20)}return}let d=a.getParent(),c=Ks(),f=a.getTextContentSize(),p=Di(),m=a.getKey();if(a.isToken()||p!==null&&m===p&&!i||Ge(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 g=zt();if(!Ge(g)||n===null||o===null)return void _k(a,s,g);if(g.setTextNodeRange(a,n,a,o),a.isSegmented()){let h=jn(a.getTextContent());a.replace(h),a=h}_k(a,s,g)}}}function _k(e,t,n){if(e.setTextContent(t),Ge(n)){let o=e.getKey();for(let r of["anchor","focus"]){let a=n[r];a.type==="text"&&a.key===o&&(a.offset=Rr(e,a.offset,"clamp"))}}}function Hp(e,t,n){let o=t[n]||!1;return o==="any"||o===e[n]}function aP(e,t){return Hp(e,t,"altKey")&&Hp(e,t,"ctrlKey")&&Hp(e,t,"shiftKey")&&Hp(e,t,"metaKey")}function $t(e,t,n){if(!aP(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 za={ctrlKey:!Lr,metaKey:Lr},Dk={altKey:Lr,ctrlKey:!Lr};function Ok(e){return e.key==="Backspace"}function Fk(e){return $t(e,"a",za)}function fK(e){let t=Go();if(Ge(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"),Yp(e),e}{let n=t.select(0,t.getChildrenSize());return Bo(Yp(n)),n}}function Ql(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=hu(r);return n[t]=a,a}return r}function jy(e,t,n,o,r){if(n.size===0)return;let a=o.__type,i=o.__key,s=t.get(a);s===void 0&&fe(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 pK(e){let t=e.getType(),n=Wa();if(n._readOnly){let a=gy(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 Bk(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 iP(e,t){let n=e.offset;if(e.type==="element")return Bk(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?Bk(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function sP(e){let t=jo(e).event,n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function Me(e,t,n){return(function(o,r,a){let i=Vy(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,g=!1;if(la(d,()=>{for(let h=0;h<m;h++)if(p[h](a,o))return void(g=!0)}),g)return g}}}return!1})(e,t,n)}function td(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&fe(75,t),n}function pu(e){let t=e.assignedSlot||e.parentElement;return fP(t)?t.host:t}function Qy(e){return JL(e)?e:ko(e)?e.ownerDocument:null}function mK(e){return Jt()._updateTags.has(e)}function Sm(e){Qn(),Jt()._updateTags.add(e)}function lP(e){Qn(),Jt()._deferred.push(e)}function um(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function Xy(e){let t=Qy(e);return t?t.defaultView:null}function jo(e){let t=e._window;return t===null&&fe(78),t}function gK(e){return se(e)&&e.isInline()||tn(e)&&e.isInline()}function dP(e){let t=e.getParentOrThrow();for(;t!==null;){if(fr(t))return t;t=t.getParentOrThrow()}return t}function fr(e){return io(e)||se(e)&&e.isShadowRoot()}function Yy(e){let t=e.constructor.clone(e);return ZL(t,null),t.afterCloneFrom(e),t}function mu(e){let t=Jt(),n=e.getType(),o=Hy(t,n);o===void 0&&fe(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||fe(201,a.name,a.getType(),s.name,s.getType(),e.constructor.name,n):i instanceof e.constructor&&s!==e.constructor||fe(202,s.name,s.getType(),e.constructor.name,n),i.__key===e.__key&&fe(203,e.constructor.name,n,s.name,s.getType()),i}return e}function zv(e,t){!io(e.getParent())||se(t)||tn(t)||fe(99)}function cP(e){let t=Un(e);return t===null&&fe(63,e),t}function Uv(e){return(tn(e)||se(e)&&!e.canBeEmpty())&&!e.isInline()}function py(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;let o=e.parentElement;o!==null&&o.removeChild(e)}function _r(e){return Nr?(e||window).getSelection():null}function uP(e){let t=Xy(e);return t?t.getSelection():null}function hK(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),fr(e)&&fe(102);let o=i=>{let s=i.getParentOrThrow(),l=fr(s),d=i!==n||l?Yy(i):i;if(l)return se(i)&&se(d)||fe(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 vK(e){return ko(e)&&e.tagName==="A"}function ko(e){return ld(e)&&e.nodeType===1}function ld(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function fP(e){return ld(e)&&e.nodeType===11}function pP(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 my(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 $a(e){if(tn(e)&&!e.isInline())return!0;if(!se(e)||fr(e))return!1;let t=e.getFirstChild(),n=t===null||Os(t)||Ue(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&n}function Jy(){return Jt()}var zk=new WeakMap,yK=new Map;function gy(e){if(!e._readOnly&&e.isEmpty())return yK;e._readOnly||fe(192);let t=zk.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),zk.set(e,t)),t}function Zy(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function xK(e){return(t=Zy(e))[AL]=!0,t;var t}function mP(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function CK(e){e.__lexicalUnmanaged=!0}function gP(e){return e.__lexicalUnmanaged===!0}function qc(e,t){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(e,t)&&e[t]!==ur[t]}function gu(e){let t=YT in e.prototype?e.prototype[YT]():void 0,n=(function(i){if(!(i===ur||i.prototype instanceof ur)){let s="<unknown>",l="<unknown>";try{s=i.getType()}catch{}try{Ui.version&&(l=JSON.parse(Ui.version))}catch{}fe(290,i.name,s,l)}return i===au||i===zi||i===ur})(e),o=!n&&qc(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&&(qc(e,"getType")||(e.getType=()=>a),qc(e,"clone")||(e.clone=i=>(zy(i),new e)),qc(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(i=>new e().updateFromJSON(i))),!qc(e,"importDOM")&&r)){let{importDOM:i}=r;i&&(e.importDOM=()=>i)}return{ownNodeConfig:r,ownNodeType:a}}function bK(e){let t=Jy();return Qn(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Qc=(e,t)=>{let n=e;for(;n!=null&&!io(n);){if(t(n))return n;n=n.getParent()}return null},wK={next:"previous",previous:"next"},nd=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return nx({hasNext:$s,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&&fe(263,Array.from(s).join(" "))}else a.insert(l);a=Zn(l,this.direction)}for(let l of s.values())l.remove();return this}},lu=class e extends nd{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Va(t,this.direction)}getParentCaret(t="root"){return Zn(ex(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Vi(this.direction);return Zn(this.getNodeAtCaret(),t)||Va(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)}},SK={root:io,shadowRoot:fr};function Vi(e){return wK[e]}function ex(e,t="root"){return SK[t](e)?null:e}var od=class e extends nd{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 se(this.origin)?Va(this.origin,this.direction):null}getParentCaret(t="root"){return Zn(ex(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Vi(this.direction);return Zn(this.getNodeAtCaret(),t)||Va(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 rd)&&this.direction===t.direction&&this.origin.is(t.origin)}},rd=class e extends nd{type="text";offset;constructor(t,n){super(t),this.offset=n}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Hi(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return Zn(ex(this.getParentAtCaret(),t),this.direction)}getFlipped(){return Hi(this.origin,Vi(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 od||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Zn(this.origin,this.direction)}};function qa(e){return e instanceof rd}function IK(e){return e instanceof nd}function $s(e){return e instanceof od}function Er(e){return e instanceof lu}var TK={next:class extends rd{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends rd{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},kK={next:class extends od{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends od{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},LK={next:class extends lu{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends lu{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 kK[t](e):null}function Hi(e,t,n){return e?new TK[t](e,Rr(e,n)):null}function Rr(e,t,n="error"){let o=e.getTextContentSize(),r=t==="next"?o:t==="previous"?0:t;return(r<0||r>o)&&(n!=="clamp"&&$k(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function hy(e,t){return new fm(e,t)}function Va(e,t){return se(e)?new LK[t](e):null}function hP(e){return e&&e.getChildCaret()||e}function ad(e){return e&&hP(e.getAdjacentCaret())}var vy=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 qa(a)?(function(i,s){let{direction:l,origin:d}=i,c=Rr(d,s==="focus"?Vi(l):l);return hy(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[hy(r,a.offset-r.offset),null]}return[n,o]}iterNodeCarets(t="root"){let n=qa(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=qa(o),a=i=>i.isSameNodeCaret(o)?null:ad(i)||i.getParentCaret(t);return nx({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")}},fm=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 Hi(t.setTextContent(a.slice(0,o)+a.slice(r)),n,o)}};function PK(e){return e instanceof fm}function tx(e){return $i(e,Zn(Go(),e.direction))}function vP(e){return $i(e,e)}function $i(e,t){return e.direction!==t.direction&&fe(265),new vy(e,t,e.direction)}function nx(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 ox(e,t){let n=Xc(e.origin,t.origin);switch(n===null&&fe(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 rx(n)}}function rx(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 $p(e,t){return t.is(e)}function Uk(e){return se(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function Xc(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[o,r]=Uk(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=Uk(t);o;r=o,o=o.getParent()){let a=n.get(o);if(a!==void 0)return a===null?($p(e,o)||fe(276),{commonAncestor:o,type:"ancestor"}):r===null?($p(t,o)||fe(277),{commonAncestor:o,type:"descendant"}):((se(a)||$p(e,a))&&(se(r)||$p(t,r))&&o.is(a.getParent())&&o.is(r.getParent())||fe(278),{a,b:r,commonAncestor:o,type:"branch"})}return null}function Ki(e,t){let{type:n,key:o,offset:r}=e,a=cP(e.key);return n==="text"?(Ue(a)||fe(266,a.getType(),o),Hi(a,t,r)):(se(a)||fe(267,a.getType(),o),bP(a,e.offset,t))}function id(e,t){let{origin:n,direction:o}=t,r=o==="next";qa(t)?e.set(n.getKey(),t.offset,"text"):$s(t)?Ue(n)?e.set(n.getKey(),Rr(n,o),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(Er(t)&&se(n)||fe(268),e.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function yP(e){let t=zt(),n=Ge(t)?t:UL();return Yc(n,e),Bo(n),n}function Yc(e,t){id(e.anchor,t.anchor),id(e.focus,t.focus)}function yy(e){let{anchor:t,focus:n}=e,o=Ki(t,"next"),r=Ki(n,"next"),a=ox(o,r)<=0?"next":"previous";return $i(qi(o,a),qi(r,a))}function dd(e){let{direction:t,origin:n}=e,o=Zn(n,Vi(t)).getNodeAtCaret();return o?Zn(o,t):Va(n.getParentOrThrow(),t)}function Hk(e,t="root"){let n=[e];for(let o=Er(e)?e.getParentCaret(t):e.getSiblingCaret();o!==null;o=o.getParentCaret(t))n.push(dd(o));return n}function Hv(e){return!!e&&e.origin.isAttached()}function xP(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=ax(e,o),i=Hk(a.anchor,n),s=Hk(a.focus.getFlipped(),n),l=new Set,d=[];for(let g of a.iterNodeCarets(n))if(Er(g))l.add(g.origin.getKey());else if($s(g)){let{origin:h}=g;se(h)&&!l.has(h.getKey())||d.push(h)}for(let g of d)g.remove();for(let g of a.getTextSlices()){if(!g)continue;let{origin:h}=g.caret,v=h.getTextContentSize(),y=dd(Zn(h,o)),x=h.getMode();if(Math.abs(g.distance)===v&&r==="removeEmptySlices"||x==="token"&&g.distance!==0)y.remove();else if(g.distance!==0){r="removeEmptySlices";let C=g.removeTextSlice(),w=g.caret.origin;if(x==="segmented"){let T=C.origin,S=jn(T.getTextContent()).setStyle(T.getStyle()).setFormat(T.getFormat());y.replaceOrInsert(S),C=Hi(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 g of i)if(Hv(g)){c=Pr(g);break}for(let g of s)if(Hv(g)){f=Pr(g);break}let p=(function(g,h,v){if(!g||!h)return null;let y=g.getParentAtCaret(),x=h.getParentAtCaret();if(!y||!x)return null;let C=y.getParents().reverse();C.push(y);let w=x.getParents().reverse();w.push(x);let T=Math.min(C.length,w.length),S;for(S=0;S<T&&C[S]===w[S];S++);let L=(P,E)=>{let _;for(let A=S;A<P.length;A++){let H=P[A];if(fr(H))return;!_&&E(H)&&(_=H)}return _},k=L(C,$a),I=k&&L(w,P=>v.has(P.getKey())&&$a(P));return k&&I?[k,I]:null})(c,f,l);if(p){let[g,h]=p;Va(g,"previous").splice(0,h.getChildren());let v=h.getParent();for(h.remove(!0);v&&v.isEmpty();){let y=v;v=v.getParent(),y.remove(!0)}}let m=[c,f,...i,...s].find(Hv);if(m)return vP(qi(Pr(m),e.direction));fe(269,JSON.stringify(i.map(g=>g.origin.__key)))}function Pr(e){let t=(function(r){let a=r;for(;Er(a);){let i=ad(a);if(!Er(i))break;a=i}return a})(e.getLatest()),{direction:n}=t;if(Ue(t.origin))return qa(t)?t:Hi(t.origin,n,n);let o=t.getAdjacentCaret();return $s(o)&&Ue(o.origin)?Hi(o.origin,n,Vi(n)):t}function CP(e){return qa(e)&&e.offset!==Rr(e.origin,e.direction)}function qi(e,t){return e.direction===t?e:e.getFlipped()}function ax(e,t){return e.direction===t?e:$i(qi(e.focus,t),qi(e.anchor,t))}function bP(e,t,n){let o=Va(e,"next");for(let r=0;r<t;r++){let a=o.getAdjacentCaret();if(a===null)break;o=a}return qi(o,n)}function AK(e,t="root"){let n=0,o=e,r=ad(o);for(;r===null;){if(n--,r=o.getParentCaret(t),!r)return null;o=r,r=ad(o)}return r&&[r,n]}function EK(e){let{origin:t,offset:n,direction:o}=e;if(n===Rr(t,o))return e.getSiblingCaret();if(n===Rr(t,Vi(o)))return dd(e.getSiblingCaret());let[r]=t.splitText(n);return Ue(r)||fe(281),qi(Zn(r,"next"),o)}function RK(e,t){return!0}function MK(e,{$copyElementNode:t=Yy,$splitTextPointCaretNext:n=EK,rootMode:o="shadowRoot",$shouldSplit:r=RK}={}){if(qa(e))return n(e);let a=e.getParentCaret(o);if(a){let{origin:i}=a;if(Er(e)&&(!i.canBeEmpty()||!r(i,"first")))return dd(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 NK(e){return e}function _K(...e){return e}function DK(e,t){return[e,t]}function OK(e){return e}function FK(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function hu(...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 BK(e,...t){let n=hu(...t);n.length>0&&e.classList.add(...n)}function zK(e,...t){let n=hu(...t);n.length>0&&e.classList.remove(...n)}function UK(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var M=ix,qre=M.$addUpdateTag,cd=M.$applyNodeReplacement,ud=M.$caretFromPoint,wP=M.$caretRangeFromSelection,Im=M.$cloneWithProperties,SP=M.$cloneWithPropertiesEphemeral,Vre=M.$comparePointCaretNext,Wre=M.$copyNode,IP=M.$create,qs=M.$createLineBreakNode,TP=M.$createNodeSelection,pr=M.$createParagraphNode,Gre=M.$createPoint,Vs=M.$createRangeSelection,kP=M.$createRangeSelectionFromDom,LP=M.$createTabNode,Dr=M.$createTextNode,PP=M.$extendCaretToRange,Ga=M.$findMatchingParent,sx=M.$getAdjacentChildCaret,jre=M.$getAdjacentNode,Ws=M.$getAdjacentSiblingOrParentSiblingCaret,lx=M.$getCaretInDirection,AP=M.$getCaretRange,Qre=M.$getCaretRangeInDirection,EP=M.$getCharacterOffsets,Wi=M.$getChildCaret,Xre=M.$getChildCaretAtIndex,dx=M.$getChildCaretOrSelf,RP=M.$getCollapsedCaretRange,Yre=M.$getCommonAncestor,Jre=M.$getCommonAncestorResultBranchOrder,Tm=M.$getEditor,Zre=M.$getNearestNodeFromDOMNode,eae=M.$getNearestRootOrShadowRoot,fd=M.$getNodeByKey,tae=M.$getNodeByKeyOrThrow,MP=M.$getNodeFromDOMNode,vu=M.$getPreviousSelection,Rt=M.$getRoot,$e=M.$getSelection,ja=M.$getSiblingCaret,km=M.$getState,nae=M.$getStateChange,oae=M.$getTextContent,rae=M.$getTextNodeOffset,aae=M.$getTextPointCaret,iae=M.$getTextPointCaretSlice,sae=M.$getWritableNodeState,NP=M.$hasAncestor,lae=M.$hasUpdateTag,dae=M.$insertNodes,pd=M.$isBlockElementNode,yu=M.$isChildCaret,Lm=M.$isDecoratorNode,_P=M.$isEditorState,We=M.$isElementNode,DP=M.$isExtendableTextPointCaret,cae=M.$isInlineElementOrDecoratorNode,OP=M.$isLeafNode,md=M.$isLineBreakNode,uae=M.$isNodeCaret,cx=M.$isNodeSelection,FP=M.$isParagraphNode,Ne=M.$isRangeSelection,xu=M.$isRootNode,Gs=M.$isRootOrShadowRoot,BP=M.$isSiblingCaret,fae=M.$isTabNode,dt=M.$isTextNode,Pm=M.$isTextPointCaret,pae=M.$isTextPointCaretSlice,ux=M.$isTokenOrSegmented,mae=M.$isTokenOrTab,gae=M.$nodesOfType,zP=M.$normalizeCaret,UP=M.$normalizeSelection__EXPERIMENTAL,hae=M.$onUpdate,HP=M.$parseSerializedNode,vae=M.$removeTextFromCaretRange,$P=M.$rewindSiblingCaret,Am=M.$selectAll,yae=M.$setCompositionKey,xae=M.$setPointFromCaret,Or=M.$setSelection,KP=M.$setSelectionFromCaretRange,Em=M.$setState,qP=M.$splitAtPointCaretNext,VP=M.$splitNode,Cae=M.$updateRangeSelectionFromCaretRange,fx=M.ArtificialNode__DO_NOT_USE,bae=M.BEFORE_INPUT_COMMAND,WP=M.BLUR_COMMAND,Cu=M.CAN_REDO_COMMAND,bu=M.CAN_UNDO_COMMAND,Rm=M.CLEAR_EDITOR_COMMAND,GP=M.CLEAR_HISTORY_COMMAND,jP=M.CLICK_COMMAND,wae=M.COLLABORATION_TAG,Mm=M.COMMAND_PRIORITY_CRITICAL,nn=M.COMMAND_PRIORITY_EDITOR,mr=M.COMMAND_PRIORITY_HIGH,gd=M.COMMAND_PRIORITY_LOW,Sae=M.COMMAND_PRIORITY_NORMAL,Iae=M.COMPOSITION_END_COMMAND,QP=M.COMPOSITION_END_TAG,Tae=M.COMPOSITION_START_COMMAND,XP=M.COMPOSITION_START_TAG,YP=M.CONTROLLED_TEXT_INSERTION_COMMAND,Nm=M.COPY_COMMAND,JP=M.CUT_COMMAND,_m=M.DELETE_CHARACTER_COMMAND,ZP=M.DELETE_LINE_COMMAND,eA=M.DELETE_WORD_COMMAND,kae=M.DRAGEND_COMMAND,Lae=M.DRAGOVER_COMMAND,tA=M.DRAGSTART_COMMAND,nA=M.DROP_COMMAND,Fr=M.DecoratorNode,Pae=M.ElementNode,oA=M.FOCUS_COMMAND,Aae=M.FORMAT_ELEMENT_COMMAND,rA=M.FORMAT_TEXT_COMMAND,Dm=M.HISTORIC_TAG,Qo=M.HISTORY_MERGE_TAG,aA=M.HISTORY_PUSH_TAG,px=M.INDENT_CONTENT_COMMAND,Eae=M.INPUT_COMMAND,mx=M.INSERT_LINE_BREAK_COMMAND,iA=M.INSERT_PARAGRAPH_COMMAND,sA=M.INSERT_TAB_COMMAND,wu=M.INTERNAL_$isBlock,Rae=M.IS_ALL_FORMATTING,Mae=M.IS_BOLD,Nae=M.IS_CODE,_ae=M.IS_HIGHLIGHT,Dae=M.IS_ITALIC,Oae=M.IS_STRIKETHROUGH,Fae=M.IS_SUBSCRIPT,Bae=M.IS_SUPERSCRIPT,zae=M.IS_UNDERLINE,lA=M.KEY_ARROW_DOWN_COMMAND,Om=M.KEY_ARROW_LEFT_COMMAND,Fm=M.KEY_ARROW_RIGHT_COMMAND,dA=M.KEY_ARROW_UP_COMMAND,Bm=M.KEY_BACKSPACE_COMMAND,cA=M.KEY_DELETE_COMMAND,uA=M.KEY_DOWN_COMMAND,zm=M.KEY_ENTER_COMMAND,fA=M.KEY_ESCAPE_COMMAND,Uae=M.KEY_MODIFIER_COMMAND,Hae=M.KEY_SPACE_COMMAND,Um=M.KEY_TAB_COMMAND,pA=M.LineBreakNode,$ae=M.MOVE_TO_END,Kae=M.MOVE_TO_START,qae=M.NODE_STATE_KEY,mA=M.OUTDENT_CONTENT_COMMAND,Hm=M.PASTE_COMMAND,gA=M.PASTE_TAG,hA=M.ParagraphNode,vA=M.REDO_COMMAND,yA=M.REMOVE_TEXT_COMMAND,xA=M.RootNode,Vae=M.SELECTION_CHANGE_COMMAND,CA=M.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,bA=M.SELECT_ALL_COMMAND,Wae=M.SKIP_COLLAB_TAG,wA=M.SKIP_DOM_SELECTION_TAG,gx=M.SKIP_SCROLL_INTO_VIEW_TAG,Gae=M.SKIP_SELECTION_FOCUS_TAG,SA=M.TEXT_TYPE_TO_FORMAT,IA=M.TabNode,$m=M.TextNode,TA=M.UNDO_COMMAND,Su=M.addClassNamesToElement,jae=M.buildImportMap,Km=M.configExtension,kA=M.createCommand,qm=M.createEditor,Qae=M.createSharedNodeState,LA=M.createState,PA=M.declarePeerDependency,Rn=M.defineExtension,Xae=M.flipDirection,Yae=M.getDOMOwnerDocument,hx=M.getDOMSelection,Jae=M.getDOMSelectionFromTarget,AA=M.getDOMTextNode,Zae=M.getEditorPropertyFromDOMNode,eie=M.getNearestEditorFromDOMNode,EA=M.getRegisteredNode,tie=M.getRegisteredNodeOrThrow,nie=M.getStaticNodeConfig,oie=M.getTextDirection,rie=M.getTransformSetFromKlass,RA=M.isBlockDomNode,aie=M.isCurrentlyReadOnlyMode,MA=M.isDOMDocumentNode,NA=M.isDOMNode,iie=M.isDOMTextNode,sie=M.isDOMUnmanaged,vx=M.isDocumentFragment,lie=M.isExactShortcutMatch,_A=M.isHTMLAnchorElement,Vm=M.isHTMLElement,Iu=M.isInlineDomNode,die=M.isLexicalEditor,cie=M.isModifierMatch,uie=M.isSelectionCapturedInDecoratorInput,DA=M.isSelectionWithinEditor,yx=M.makeStepwiseIterator,ca=M.mergeRegister,fie=M.normalizeClassNames,Wm=M.removeClassNamesFromElement,pie=M.removeFromParent,mie=M.resetRandomKey,Br=M.safeCast,gie=M.setDOMUnmanaged,hie=M.setNodeIndentFromDOM,Gm=M.shallowMergeConfig,xx=M.toggleTextFormatType;var Cx={};En(Cx,{LexicalComposer:()=>$K});he();var OA=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,HK=OA?Ce:W,jm={tag:Qo};function $K({initialConfig:e,children:t}){let n=q(()=>{let{theme:o,namespace:r,nodes:a,onError:i,editorState:s,html:l}=e,d=XT(null,o),c=qm({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=Rt();if(m.isEmpty()){let g=pr();m.append(g);let h=OA?document.activeElement:null;($e()!==null||h!==null&&h===f.getRootElement())&&g.select()}},jm);else if(p!==null)switch(typeof p){case"string":{let m=f.parseEditorState(p);f.setEditorState(m,jm);break}case"object":f.setEditorState(p,jm);break;case"function":f.update(()=>{Rt().isEmpty()&&p(f)},jm)}}})(c,s),[c,d]},[]);return HK(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),u(QT.Provider,{value:n,children:t})}var KK=Cx,FA=KK.LexicalComposer;var wx={};En(wx,{$canShowPlaceholder:()=>zA,$canShowPlaceholderCurry:()=>VK,$findTextIntersectionFromCharacters:()=>WK,$isRootTextContentEmpty:()=>bx,$isRootTextContentEmptyCurry:()=>qK,$rootTextContent:()=>BA,registerLexicalTextEntity:()=>jK});function BA(){return Rt().getTextContent()}function bx(e,t=!0){if(e)return!1;let n=BA();return t&&(n=n.trim()),n===""}function qK(e,t){return()=>bx(e,t)}function zA(e){if(!bx(e,!1))return!1;let t=Rt().getChildren(),n=t.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=t[o];if(Lm(r))return!1;if(We(r)){if(!FP(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(!dt(l))return!1}}}return!0}function VK(e){return()=>zA(e)}function WK(e,t){let n=e.getFirstChild(),o=0;e:for(;n!==null;){if(We(n)){let i=n.getFirstChild();if(i!==null){n=i;continue}}else if(dt(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 GK(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 jK(e,t,n,o){let r=i=>i instanceof n,a=i=>{let s=Dr(i.getTextContent());s.setFormat(i.getFormat()),i.replace(s)};return[e.registerNodeTransform($m,i=>{if(!i.isSimpleText())return;let s,l=i.getPreviousSibling(),d=i.getTextContent(),c=i;if(dt(l)){let p=l.getTextContent(),m=t(p+d);if(r(l)){if(m===null||(g=>g.getLatest().__mode)(l)!==0)return void a(l);{let g=m.end-p.length;if(g>0){let h=p+d.slice(0,g);if(l.select(),l.setTextContent(h),g===d.length)i.remove();else{let v=d.slice(g);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 h=c.getNextSibling();if(dt(h)){m=c.getTextContent()+h.getTextContent();let v=t(m);if(v===null)return void(r(h)?a(h):h.markDirty());if(v.start!==0)return}}if(s===null)return;if(s.start===0&&dt(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&&GK(165,"nodeToReplace");let g=o(p);if(g.setFormat(p.getFormat()),p.replace(g),c==null)return;f=0,l=g}}),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();dt(d)&&d.isTextEntity()&&(a(d),a(i));let c=i.getNextSibling();dt(c)&&c.isTextEntity()&&(a(c),r(i)&&a(i))})]}var js=wx,Iie=js.$canShowPlaceholder,Qm=js.$canShowPlaceholderCurry,Tie=js.$findTextIntersectionFromCharacters,kie=js.$isRootTextContentEmpty,Lie=js.$isRootTextContentEmptyCurry,Pie=js.$rootTextContent,Aie=js.registerLexicalTextEntity;var Px={};En(Px,{$addNodeStyle:()=>e3,$cloneWithProperties:()=>Im,$copyBlockFormatIndent:()=>jA,$ensureForwardRangeSelection:()=>GA,$forEachSelectedTextNode:()=>WA,$getComputedStyleForElement:()=>Tx,$getComputedStyleForParent:()=>kx,$getSelectionStyleValueForProperty:()=>l3,$isAtNodeEnd:()=>ZK,$isParentElementRTL:()=>Lx,$isParentRTL:()=>YK,$moveCaretSelection:()=>YA,$moveCharacter:()=>i3,$patchStyleText:()=>t3,$selectAll:()=>Am,$setBlocksType:()=>n3,$shouldOverrideDefaultCharacterSelection:()=>a3,$sliceSelectedTextNodeContent:()=>JK,$trimTextContentFromAnchor:()=>VA,$wrapNodes:()=>r3,createDOMRange:()=>QK,createRectsFromDOMRange:()=>XK,getCSSFromStyleObject:()=>qA,getStyleObjectFromCSS:()=>Jm,trimTextContentFromAnchor:()=>d3});function Ix(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 Ym=new Map;function UA(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function HA(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function QK(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(dt(t)&&(l=UA(l)),dt(o)&&(d=UA(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,c]=HA(l)),d.nodeName==="BR"&&([d,f]=HA(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 XK(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 KA(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 Jm(e){let t=Ym.get(e);return t===void 0&&(t=KA(e),Ym.set(e,t)),t}function qA(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function Tx(e){let t=Tm().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function kx(e){return Tx(xu(e)?e:e.getParentOrThrow())}function YK(e){let t=kx(e);return t!==null&&t.direction==="rtl"}function JK(e,t,n="self"){let o=e.getStartEndPoints();if(t.isSelected(e)&&!ux(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]=EP(e),m=s.is(l),g=t.is(i?l:s),h=t.is(i?s:l),v,y=0;m?(y=f>p?p:f,v=f>p?f:p):g?(y=i?p:f,v=void 0):h&&(y=0,v=i?f:p);let x=t.__text.slice(y,v);x!==t.__text&&(n==="clone"&&(t=SP(t)),t.__text=x)}}return t}function ZK(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return We(t)||Ix(177),e.offset===t.getChildrenSize()}function VA(e,t,n){let o=t.getNode(),r=n;if(We(o)){let a=o.getDescendantByIndex(t.offset);a!==null&&(o=a)}for(;r>0&&o!==null;){if(We(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===""&&We(o)&&!o.isInline()&&(s=`
3837
+ `?o.push(Yl()):i===" "?o.push(vm()):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,y,x,C){let w=v.getNode(),T=w.getChildAtIndex(v.offset),S=jn();if(S.setFormat(x),S.setStyle(C),GL(T))T.splice(0,0,[S]);else{let L=io(w)?Ka().append(S):S;T===null?w.append(L):T.insertBefore(L)}v.is(y)&&y.set(S.__key,0,"text"),v.set(S.__key,0,"text")})(i,s,r,a),s.type==="element"&&id(s,Lr(Ki(s,"next")));let l=i.offset,d=s.offset,c=this.getNodes(),f=c.length,p=c[0];Ue(p)||fe(26);let m=p.getTextContent().length,g=p.getParentOrThrow(),h=c[f-1];if(f===1&&s.type==="element"&&(d=m,s.set(i.key,d,"text")),this.isCollapsed()&&l===m&&(Ua(p)||!p.canInsertTextAfter()||!g.canInsertTextAfter()&&p.getNextSibling()===null)){let v=p.getNextSibling();if(Ue(v)&&v.canInsertTextBefore()&&!Ua(v)||(v=jn(),v.setFormat(r),v.setStyle(a),g.canInsertTextAfter()?p.insertAfter(v):g.insertAfter(v)),v.select(0,0),p=v,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&l===0&&(Ua(p)||!p.canInsertTextBefore()||!g.canInsertTextBefore()&&p.getPreviousSibling()===null)){let v=p.getPreviousSibling();if(Ue(v)&&!Ua(v)||(v=jn(),v.setFormat(r),g.canInsertTextBefore()?p.insertBefore(v):g.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=h.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||se(v)&&(!v.canInsertTextBefore()||!v.canInsertTextAfter()))return this.insertText(""),FL(this.anchor,this.focus),void this.insertText(t)}if(f===1){if(Oi(p)){let C=jn(t);return C.select(),void p.replace(C)}let v=p.getFormat(),y=p.getStyle();if(l!==d||v===r&&y===a){if(Dy(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 x=d-l;p=p.spliceText(l,x,t,!0),p.getTextContent()===""?p.remove():this.anchor.type==="text"&&(this.format=v,this.style=y,p.isComposing()&&(this.anchor.offset-=t.length))}else{let v=new Set([...p.getParentKeys(),...h.getParentKeys()]),y=se(p)?p:p.getParentOrThrow(),x=se(h)?h:h.getParentOrThrow(),C=h;if(!y.is(x)&&x.isInline())do C=x,x=x.getParentOrThrow();while(x.isInline());if(s.type==="text"&&(d!==0||h.getTextContent()==="")||s.type==="element"&&h.getIndexWithinParent()<d)if(Ue(h)&&!Oi(h)&&d!==h.getTextContentSize()){if(h.isSegmented()){let k=jn(h.getTextContent());h.replace(k),h=k}io(s.getNode())||s.type!=="text"||(h=h.spliceText(0,d,"")),v.add(h.__key)}else{let k=h.getParentOrThrow();k.canBeEmpty()||k.getChildrenSize()!==1?h.remove():k.remove()}else v.add(h.__key);let w=x.getChildren(),T=new Set(c),S=y.is(x),L=y.isInline()&&p.getNextSibling()===null?y:p;for(let k=w.length-1;k>=0;k--){let I=w[k];if(I.is(p)||se(I)&&I.isParentOf(p))break;I.isAttached()&&(!T.has(I)||I.is(C)?S||L.insertAfter(I,!1):I.remove())}if(!S){let k=x,I=null;for(;k!==null;){let P=k.getChildren(),E=P.length;(E===0||P[E-1].is(I))&&(v.delete(k.__key),I=k),k=k.getParent()}}if(Oi(p))if(l===m)p.select();else{let k=jn(t);k.select(),p.replace(k)}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 k=1;k<f;k++){let I=c[k],P=I.__key;v.has(P)||I.remove()}}}removeText(){let t=zt()===this;Yc(this,xP(yy(this))),t&&zt()!==this&&Bo(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)Ue(w)&&r.push(w);let a=w=>{o.forEach(T=>{if(se(T)){let S=T.getFormatFlags(t,w);T.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],g=c.type==="element"?0:c.offset;if(c.type==="text"&&g===m.getTextContentSize()&&(p=1,m=r[1],g=0),m==null)return;let h=m.getFormatFlags(t,n);a(h);let v=i-1,y=r[v],x=f.type==="text"?f.offset:y.getTextContentSize();if(m.is(y)){if(g===x)return;if(Ua(m)||g===0&&x===m.getTextContentSize())m.setFormat(h);else{let w=m.splitText(g,x),T=g===0?w[0]:w[1];T.setFormat(h),c.type==="text"&&c.set(T.__key,0,"text"),f.type==="text"&&f.set(T.__key,x-g,"text")}return void(this.format=h)}g===0||Ua(m)||([,m]=m.splitText(g),g=0),m.setFormat(h);let C=y.getFormatFlags(t,h);x>0&&(x===y.getTextContentSize()||Ua(y)||([y]=y.splitText(x)),y.setFormat(C));for(let w=p+1;w<v;w++){let T=r[w],S=T.getFormatFlags(t,C);T.setFormat(S)}c.type==="text"&&c.set(m.__key,g,"text"),f.type==="text"&&f.set(y.__key,x,"text"),this.format=h|C}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();let g=zt();return Ge(g)||fe(134),g.insertNodes(t)}let n=(this.isBackward()?this.focus:this.anchor).getNode(),o=Qc(n,$a),r=t[t.length-1];if(se(o)&&"__language"in o){if("__language"in t[0])this.insertText(t[0].getTextContent());else{let g=Fv(this);o.splice(g,0,t),r.selectEnd()}return}if(!t.some(g=>(se(g)||tn(g))&&!g.isInline())){se(o)||fe(211,n.constructor.name,n.getType());let g=Fv(this);return o.splice(g,0,t),void r.selectEnd()}let a=(function(g){let h=Ka(),v=null;for(let y=0;y<g.length;y++){let x=g[y],C=Ds(x);if(C||tn(x)&&x.isInline()||se(x)&&x.isInline()||Ue(x)||x.isParentRequired()){if(v===null&&(v=x.createParentElementNode(),h.append(v),C))continue;v!==null&&v.append(x)}else h.append(x),v=null}return h})(t),i=a.getLastDescendant(),s=a.getChildren(),l=!se(o)||!o.isEmpty()?this.insertParagraph():null,d=s[s.length-1],c=s[0];var f;se(f=c)&&$a(f)&&!f.isEmpty()&&se(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(se(o)||fe(211,n.constructor.name,n.getType()),o.append(...c.getChildren()),c=s[1]),c&&(o===null&&fe(212,n.constructor.name,n.getType()),(function(g,h){let v=h.getParentOrThrow().getLastChild(),y=h,x=[h];for(;y!==v;)y.getNextSibling()||fe(140),y=y.getNextSibling(),x.push(y);let C=g;for(let w of x)C=C.insertAfter(w)})(o,c));let p=Qc(i,$a);l&&se(p)&&(l.canMergeWhenEmpty()||$a(d))&&(p.append(...l.getChildren()),l.remove()),se(o)&&o.isEmpty()&&o.remove(),i.selectEnd();let m=se(o)?o.getLastChild():null;Ds(m)&&p!==o&&m.remove()}insertParagraph(){if(this.anchor.key==="root"){let i=Ka();return Go().splice(this.anchor.offset,0,[i]),i.select(),i}let t=Fv(this),n=Qc(this.anchor.getNode(),$a);se(n)||fe(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=Yl();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]=cy(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(Ue(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(Ue(o)&&(c===o.getTextContentSize()?t.shift():c!==0&&([,o]=o.splitText(c),t[0]=o,l.set(o.getKey(),0,"text"))),Ue(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(Tk(this,t,n,o))return;let r=t==="move",a=Jt(),i=Nr(jo(a));if(!i)return;let s=a._blockCursorElement,l=a._rootElement,d=this.focus.getNode();if(l===null||s===null||!se(d)||d.isInline()||d.canBeEmpty()||py(s,a,l),this.dirty){let c=td(a,this.anchor.key),f=td(a,this.focus.key);this.anchor.type==="text"&&(c=Us(c)),this.focus.type==="text"&&(f=Us(f)),c&&f&&HL(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=io(f)?f:dP(f);if(this.applyDOMRange(c),this.dirty=!0,!r){let m=this.getNodes(),g=[],h=!1;for(let v=0;v<m.length;v++){let y=m[v];um(y,p)?g.push(y):h=!0}if(h&&g.length>0)if(n){let v=g[0];se(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{let v=g[g.length-1];se(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}i.anchorNode===c.startContainer&&i.anchorOffset===c.startOffset||(function(v){let y=v.focus,x=v.anchor,C=x.key,w=x.offset,T=x.type;x.set(y.key,y.offset,y.type,!0),y.set(C,w,T,!0)})(this)}}o==="lineboundary"&&Tk(this,t,n,o,"decorators")}forwardDeletion(t,n,o){if(!o&&(t.type==="element"&&se(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(se(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=tx(Ki(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(se(a.anchor.origin)&&a.anchor.origin.isEmpty()){let d=Lr(l);Yc(this,$i(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(Hs(l)){if(se(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(tn(l.origin)){if(!l.origin.isIsolated())if(s.type==="merge-next-block"&&(l.origin.isKeyboardSelectable()||!l.origin.isInline())&&se(a.anchor.origin)&&a.anchor.origin.isEmpty()){a.anchor.origin.remove();let d=Oy();d.add(l.origin.getKey()),Bo(d)}else l.origin.remove();return}break}}if(s.type==="merge-block"){let{caret:l,block:d}=s;return Yc(this,$i(!l.origin.isEmpty()&&d.isEmpty()?dd(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&&yk(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 xk(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 xk(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 g=c.offset,h=f.offset,v=g<h,y=v?g:h,x=v?h:g,C=x-1;y!==C&&(function(w){return!(nP(w)||W$(w))})(p.getTextContent().slice(y,x))&&(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()&&io(o.getParent())&&o.getPreviousSibling()===null&&yk(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 cu(e){return e instanceof im}function vk(e){let t=e.offset;if(e.type==="text")return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function cy(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]:[vk(n),vk(o)]}function yk(e,t){for(let n=t;n;n=n.getParent()){if(se(n)){if(n.collapseAtStart(e))return!0;if(ur(n))break}if(n.getPreviousSibling())break}return!1}var W$=(()=>{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 xk(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 Ck(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=Wl(c),Ue(r))a=Er(r,i?"next":"previous");else{let p=Wl(e);if(p===null)return null;if(se(p)){let m=o.getElementByKey(p.getKey());m===null&&fe(214),[p,a]=p.getDOMSlot(m).resolveChildIndex(p,m,e,t),se(p)||fe(215),i&&a>=p.getChildrenSize()&&(a=Math.max(0,p.getChildrenSize()-1));let h=p.getChildAtIndex(a);if(se(h)&&(function(v,y,x){let C=v.getParent();return x===null||C===null||!C.canBeEmpty()||C!==x.getNode()})(h,0,n)){let v=i?h.getLastDescendant():h.getFirstDescendant();v===null?p=h:(h=v,p=se(h)?h:h.getParentOrThrow()),a=0}Ue(h)?(r=h,p=null,a=Er(h,i?"next":"previous")):h!==p&&i&&!f&&(se(p)||fe(216),a=Math.min(p.getChildrenSize(),a+1))}else{let m=p.getIndexWithinParent();a=t===0&&tn(p)&&Wl(e)===p?m:m+1,p=p.getParentOrThrow()}if(se(p))return Rr(p.__key,a,"element")}}else r=Wl(e);return Ue(r)?Rr(r.__key,Er(r,a,"clamp"),"text"):null}function bk(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&&se(i)&&i.isInline()){let s=i.getPreviousSibling();Ue(s)&&e.set(s.__key,s.getTextContent().length,"text")}}else se(a)&&!n&&a.isInline()?e.set(a.__key,a.getChildrenSize(),"element"):Ue(a)&&e.set(a.__key,a.getTextContent().length,"text")}else if(o===r.getTextContent().length){let a=r.getNextSibling(),i=r.getParent();if(t&&se(a)&&a.isInline())e.set(a.__key,0,"element");else if((n||t)&&a===null&&se(i)&&i.isInline()&&!i.canInsertTextAfter()){let s=i.getNextSibling();Ue(s)&&e.set(s.__key,0,"text")}}}function FL(e,t,n){if(e.type==="text"&&t.type==="text"){let o=e.isBefore(t),r=e.is(t);bk(e,o,r),bk(t,!o,r),r&&t.set(e.key,e.offset,e.type)}}function BL(e,t,n,o,r,a){if(e===null||n===null||!uu(r,e,n))return null;let i=Ck(e,t,Ge(a)?a.anchor:null,r);if(i===null)return null;let s=Ck(n,o,Ge(a)?a.focus:null,r);if(s===null)return null;if(i.type==="element"&&s.type==="element"){let l=Wl(e),d=Wl(n);if(tn(l)&&tn(d))return null}return FL(i,s),[i,s]}function G$(e){return se(e)&&!e.isInline()}function zL(e,t,n,o,r,a){let i=Wa(),s=new zs(Rr(e,t,r),Rr(n,o,a),0,"");return s.dirty=!0,i._selection=s,s}function UL(){let e=Rr("root",0,"element"),t=Rr("root",0,"element");return new zs(e,t,0,"")}function Oy(){return new im(new Set)}function j$(e,t){return ym(null,e,t,null)}function ym(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=!qv&&(s||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&a&&a.detail===3||i==="drop"||i===void 0),d,c,f,p;if(Ge(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)&&Ge(e)&&!uu(n,d,c))return e.clone();let m=BL(d,f,c,p,n,e);if(m===null)return null;let[g,h]=m,v=0,y="";if(Ge(e)){let x=e.anchor;if(g.key===x.key)v=e.format,y=e.style;else{let C=g.getNode();Ue(C)?(v=C.getFormat(),y=C.getStyle()):se(C)&&(v=C.getTextFormat(),y=C.getTextStyle())}}return new zs(g,h,v,y)}function zt(){return Wa()._selection}function $s(){return Jt()._editorState._selection}function sm(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"),wk(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 g=c.offset;(n<=g&&o>0||n<g&&o<0)&&c.set(l,Math.max(0,g+o),"element")}if(t.is(m)){let g=p.offset;(n<=g&&o>0||n<g&&o<0)&&p.set(l,Math.max(0,g+o),"element")}}wk(e)}function wk(e){let t=e.anchor,n=t.offset,o=e.focus,r=o.offset,a=t.getNode(),i=o.getNode();if(e.isCollapsed()){if(!se(a))return;let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Ue(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text"),o.set(d.__key,c,"text")}return}if(se(a)){let s=a.getChildrenSize(),l=n>=s,d=l?a.getChildAtIndex(s-1):a.getChildAtIndex(n);if(Ue(d)){let c=0;l&&(c=d.getTextContentSize()),t.set(d.__key,c,"text")}}if(se(i)){let s=i.getChildrenSize(),l=r>=s,d=l?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(Ue(d)){let c=0;l&&(c=d.getTextContentSize()),o.set(d.__key,c,"text")}}}function lm(e,t,n,o,r){let a=null,i=0,s=null;o!==null?(a=o.__key,Ue(o)?(i=o.getTextContentSize(),s="text"):se(o)&&(i=o.getChildrenSize(),s="element")):r!==null&&(a=r.__key,Ue(r)?s="text":se(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 Sk(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 HL(e,t,n,o,r){try{e.setBaseAndExtent(t,n,o,r)}catch{}}function Ik(e,t,n){let o=td(e,t.getKey());if(se(t)){let r=t.getDOMSlot(o);return[r.element,n+r.getFirstChildOffset()]}return[o,n]}function Q$(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(EL)&&f!==a||f!==null&&$y(f))return;if(!Ge(t))return void(e!==null&&uu(n,s,l)&&o.removeAllRanges());let p=t.anchor,m=t.focus,g=p.getNode(),h=m.getNode(),[v,y]=Ik(n,g,p.offset),[x,C]=Ik(n,h,m.offset),w=t.format,T=t.style,S=t.isCollapsed(),L=v,k=x,I=!1;var P,E,_,A,H;if(p.type==="text"?(L=Us(v),I=g.getFormat()!==w||g.getStyle()!==T):Ge(e)&&e.anchor.type==="text"&&(I=!0),m.type==="text"&&(k=Us(x)),L!==null&&k!==null&&(S&&(e===null||I||Ge(e)&&(e.format!==w||e.style!==T))&&(P=w,E=T,_=y,A=p.key,H=performance.now(),SL=[P,E,_,A,H]),d!==y||c!==C||s!==L||l!==k||o.type==="Range"&&S||(f!==null&&a.contains(f)||r.has(ly)||a.focus({preventScroll:!0}),p.type==="element"))){if(HL(o,L,y,k,C),!Bi||!t.isCollapsed()||a===null||r.has(ly)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!r.has(RL)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let V=Ge(t)&&t.anchor.type==="element"?L.childNodes[y]||null:o.rangeCount>0?o.getRangeAt(0):null;if(V!==null){let J;if(V instanceof Text){let D=document.createRange();D.selectNode(V),J=D.getBoundingClientRect()}else J=V.getBoundingClientRect();(function(D,ne,F){let U=Qy(F),ee=Xy(U);if(U===null||ee===null)return;let{top:j,bottom:Z}=ne,de=0,B=0,X=F;for(;X!==null;){let pe=X===U.body;if(pe)de=0,B=jo(D).innerHeight;else{let re=X.getBoundingClientRect();de=re.top,B=re.bottom}let le=0;if(j<de?le=-(de-j):Z>B&&(le=Z-B),le!==0)if(pe)ee.scrollBy(0,le);else{let re=X.scrollTop;X.scrollTop+=le;let we=X.scrollTop-re;j-=we,Z-=we}if(pe)break;X=pu(X)}})(n,J,a)}}ay=!0}}function X$(e){let t=zt()||$s();t===null&&(t=Go().selectEnd()),t.insertNodes(e)}function Y$(){let e=zt();return e===null?"":e.getTextContent()}function Fv(e){let t=e;e.isCollapsed()||t.removeText();let n=zt();Ge(n)&&(t=n),Ge(t)||fe(161);let o=t.anchor,r=o.getNode(),a=o.offset;for(;!$a(r);){let i=r;if([r,a]=J$(r,a),i.is(r))break}return a}function J$(e,t){let n=e.getParent();if(!n){let r=Ka();return Go().append(r),r.select(),[Go(),0]}if(Ue(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(!se(e)||t===0)return[n,e.getIndexWithinParent()];let o=e.getChildAtIndex(t);if(o){let r=new zs(Rr(e.__key,t,"element"),Rr(e.__key,t,"element"),0,""),a=e.insertNewAfter(r);a&&a.append(o,...o.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function Tk(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=Ki(e.focus,n?"previous":"next"),i=o==="lineboundary",s=t==="move",l=a,d=r==="decorators-and-blocks";if(!CP(l)){for(let c of l){d=!1;let{origin:f}=c;if(!tn(f)||f.isIsolated()||(l=c,!i||!f.isInline()))break}if(d)for(let c of tx(a).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Ar(c))c.origin.isInline()||(l=c);else{if(se(c.origin))continue;tn(c.origin)&&!c.origin.isInline()&&(l=c)}break}}if(l===a)return!1;if(s&&!i&&tn(l.origin)&&l.origin.isKeyboardSelectable()){let c=Oy();return c.add(l.origin.getKey()),Bo(c),!0}return l=Lr(l),s&&id(e.anchor,l),id(e.focus,l),d||!i}var Yn=null,Jn=null,Fo=!1,Bv=!1,jp=0,kk={characterData:!0,childList:!0,subtree:!0};function sd(){return Fo||Yn!==null&&Yn._readOnly}function Qn(){Fo&&fe(13)}function $L(){jp>99&&fe(14)}function Wa(){return Yn===null&&fe(195,KL()),Yn}function Jt(){return Jn===null&&fe(196,KL()),Jn}function KL(){let e=0,t=new Set,n=Ui.version;if(typeof window<"u")for(let r of document.querySelectorAll("[contenteditable]")){let a=fu(r);if(Cm(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 Z$(){return Jn}function Lk(e,t,n){let o=t.__type,r=Uy(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 Pk(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function qL(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 eK(e){return Fy(e,Jt()._nodes)}function Fy(e,t){let n=e.type,o=t.get(n);o===void 0&&fe(17,n);let r=o.klass;e.type!==r.getType()&&fe(18,r.name);let a=r.importJSON(e),i=e.children;if(se(a)&&Array.isArray(i))for(let s=0;s<i.length;s++){let l=Fy(i[s],t);a.append(l)}return a}function Ak(e,t,n){let o=Yn,r=Fo,a=Jn;Yn=t,Fo=!0,Jn=e;try{return n()}finally{Yn=o,Fo=r,Jn=a}}function Ha(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=Fo,f=Jn,p=e._updating,m=e._observer,g=null;if(e._pendingEditorState=null,e._editorState=n,!r&&l&&m!==null){Jn=e,Yn=n,Fo=!1,e._updating=!0;try{let S=e._dirtyType,L=e._dirtyElements,k=e._dirtyLeaves;m.disconnect(),g=x$(a,n,e,S,L,k)}catch(S){if(S instanceof Error&&e._onError(S),Bv)throw S;return jL(e,null,o,n),Qk(e),e._dirtyType=2,Bv=!0,Ha(e,a),void(Bv=!1)}finally{m.observe(o,kk),e._updating=p,Yn=d,Fo=c,Jn=f}}n._readOnly||(n._readOnly=!0);let h=e._dirtyLeaves,v=e._dirtyElements,y=e._normalizedNodes,x=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 k=S._decorators,I=S._pendingDecorators||k,P=L._nodeMap,E;for(E in I)P.has(E)||(I===k&&(I=eP(S)),delete I[E])})(e,n);let w=r?null:Nr(jo(e));if(e._editable&&w!==null&&(l||s===null||s.dirty||!s.is(i))&&o!==null&&!x.has(ML)){Jn=e,Yn=n;try{if(m!==null&&m.disconnect(),l||s===null||s.dirty){let S=e._blockCursorElement;S!==null&&py(S,e,o),Q$(i,s,e,w,x,o)}(function(S,L,k){let I=S._blockCursorElement;if(Ge(k)&&k.isCollapsed()&&k.anchor.type==="element"&&L.contains(document.activeElement)){let P=k.anchor,E=P.getNode(),_=P.offset,A=!1,H=null;if(_===E.getChildrenSize())Uv(E.getChildAtIndex(_-1))&&(A=!0);else{let V=E.getChildAtIndex(_);if(V!==null&&Uv(V)){let J=V.getPreviousSibling();(J===null||Uv(J))&&(A=!0,H=S.getElementByKey(V.__key))}}if(A){let V=S.getElementByKey(E.__key);return I===null&&(S._blockCursorElement=I=(function(J){let D=J.theme,ne=document.createElement("div");ne.contentEditable="false",ne.setAttribute("data-lexical-cursor","true");let F=D.blockCursor;if(F!==void 0){if(typeof F=="string"){let U=hu(F);F=D.blockCursor=U}F!==void 0&&ne.classList.add(...F)}return ne})(S._config)),L.style.caretColor="transparent",void(H===null?V.appendChild(I):V.insertBefore(I,H))}}I!==null&&py(I,S,L)})(e,o,s)}finally{m!==null&&m.observe(o,kk),Jn=f,Yn=d}}g!==null&&(function(S,L,k,I,P){let E=Array.from(S._listeners.mutation),_=E.length;for(let A=0;A<_;A++){let[H,V]=E[A];for(let J of V){let D=L.get(J);D!==void 0&&H(D,{dirtyLeaves:I,prevEditorState:P,updateTags:k})}}})(e,g,x,h,a),Ge(s)||s===null||i!==null&&i.is(s)||e.dispatchCommand(Sy,void 0);let T=e._pendingDecorators;T!==null&&(e._decorators=T,e._pendingDecorators=null,jc("decorator",e,!0,T)),(function(S,L,k){let I=Nk(L),P=Nk(k);I!==P&&jc("textcontent",S,!0,P)})(e,t||a,n),jc("update",e,!0,{dirtyElements:v,dirtyLeaves:h,editorState:n,mutatedNodes:g,normalizedNodes:y,prevEditorState:t||a,tags:x}),(function(S,L){if(S._deferred=[],L.length!==0){let k=S._updating;S._updating=!0;try{for(let I=0;I<L.length;I++)L[I]()}finally{S._updating=k}}})(e,C),(function(S){let L=S._updates;if(L.length!==0){let k=L.shift();if(k){let[I,P]=k;xm(S,I,P)}}})(e)}function jc(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 Ek(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&&fe(191),s._flushSync=!0),l&&e._deferred.push(l),qL(e,i.tag)),s==null?xm(e,a,i):a()}}return o}function xm(e,t,n){let o=e._updateTags,r,a=!1,i=!1;n!==void 0&&(r=n.onUpdate,qL(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=VL(l||s),d=!0),l._flushSync=i;let c=Yn,f=Fo,p=Jn,m=e._updating;Yn=l,Fo=!1,e._updating=!0,Jn=e;let g=e._headless||e.getRootElement()===null;zy(null);try{d&&(g?s._selection!==null&&(l._selection=s._selection.clone()):l._selection=(function(x,C){let w=x.getEditorState()._selection,T=Nr(jo(x));return Ge(w)||w==null?ym(w,T,x,C):w.clone()})(e,n&&n.event||null));let v=e._compositionKey;t(),a=Ek(e,a),(function(x,C){let w=C.getEditorState()._selection,T=x._selection;if(Ge(T)){let S=T.anchor,L=T.focus,k;if(S.type==="text"&&(k=S.getNode(),k.selectionTransform(w,T)),L.type==="text"){let I=L.getNode();k!==I&&I.selectionTransform(w,T)}}})(l,e),e._dirtyType!==0&&(a?(function(x,C){let w=C._dirtyLeaves,T=x._nodeMap;for(let S of w){let L=T.get(S);Ue(L)&&L.isAttached()&&L.isSimpleText()&&!L.isUnmergeable()&&rk(L)}})(l,e):(function(x,C){let w=C._dirtyLeaves,T=C._dirtyElements,S=x._nodeMap,L=Di(),k=new Map,I=w,P=I.size,E=T,_=E.size;for(;P>0||_>0;){if(P>0){C._dirtyLeaves=new Set;for(let A of I){let H=S.get(A);Ue(H)&&H.isAttached()&&H.isSimpleText()&&!H.isUnmergeable()&&rk(H),H!==void 0&&Pk(H,L)&&Lk(C,H,k),w.add(A)}if(I=C._dirtyLeaves,P=I.size,P>0){jp++;continue}}C._dirtyLeaves=new Set,C._dirtyElements=new Map,E.delete("root")&&E.set("root",!0);for(let A of E){let H=A[0],V=A[1];if(T.set(H,V),!V)continue;let J=S.get(H);J!==void 0&&Pk(J,L)&&Lk(C,J,k)}I=C._dirtyLeaves,P=I.size,E=C._dirtyElements,_=E.size,jp++}C._dirtyLeaves=w,C._dirtyElements=T})(l,e),Ek(e),(function(x,C,w,T){let S=x._nodeMap,L=C._nodeMap,k=[];for(let[I]of T){let P=L.get(I);P!==void 0&&(P.isAttached()||(se(P)&&Wk(P,I,S,L,k,T),S.has(I)||T.delete(I),k.push(I)))}for(let I of k)L.delete(I);for(let I of w){let P=L.get(I);P===void 0||P.isAttached()||(S.has(I)||w.delete(I),L.delete(I))}})(s,l,e._dirtyLeaves,e._dirtyElements)),v!==e._compositionKey&&(l._flushSync=!0);let y=l._selection;if(Ge(y)){let x=l._nodeMap,C=y.anchor.key,w=y.focus.key;x.get(C)!==void 0&&x.get(w)!==void 0||fe(19)}else cu(y)&&y._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 Ha(e)}finally{Yn=c,Fo=f,Jn=p,e._updating=m,jp=0}e._dirtyType!==0||e._deferred.length>0||(function(v,y){let x=y.getEditorState()._selection,C=v._selection;if(C!==null){if(C.dirty||!C.is(x))return!0}else if(x!==null)return!0;return!1})(l,e)?l._flushSync?(l._flushSync=!1,Ha(e)):d&&dK(()=>{Ha(e)}):(l._flushSync=!1,d&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function la(e,t,n){Jn===e&&n===void 0?t():xm(e,t,n)}var uy=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&&fe(222),this.element.insertBefore(t,n),this}removeChild(t){return t.parentElement!==this.element&&fe(223),this.element.removeChild(t),this}replaceChild(t,n){return n.parentElement!==this.element&&fe(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"&&(mm||du||pm);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=Rk(n,o);a.push(r);let i=Rk(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 Rk(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&&fe(225),n.reverse()}var zi=class extends cr{__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 a$[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=Jt()._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(Ue(n)&&t.push(n),se(n)){let o=n.getAllTextNodes();t.push(...o)}n=n.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;se(t);){let n=t.getFirstChild();if(n===null)break;t=n}return t}getLastDescendant(){let t=this.getLastChild();for(;se(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 se(a)&&a.getLastDescendant()||a||null}let r=n[t];return se(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let t=this.getLatest().__first;return t===null?null:Un(t)}getFirstChildOrThrow(){let t=this.getFirstChild();return t===null&&fe(45,this.__key),t}getLastChild(){let t=this.getLatest().__last;return t===null?null:Un(t)}getLastChildOrThrow(){let t=this.getLastChild();return t===null&&fe(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(),se(a)&&r!==o-1&&!a.isInline()&&(t+=gm)}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(),se(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=Kv[t];return(this.getFormat()&n)!==0}return!1}hasTextFormat(t){let n=mo[t];return(this.getTextFormat()&n)!==0}getFormatFlags(t,n){return su(this.getLatest().__textFormat,t,n)}getTextStyle(){return this.getLatest().__textStyle}select(t,n){Qn();let o=zt(),r=t,a=n,i=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&n===0){let l=this.getFirstChild();if(Ue(l)||se(l))return l.select(0,0)}else if(!(t!==void 0&&t!==i||n!==void 0&&n!==i)){let l=this.getLastChild();if(Ue(l)||se(l))return l.select()}}r===void 0&&(r=i),a===void 0&&(a=i);let s=this.__key;return Ge(o)?(o.anchor.set(s,r,"element"),o.focus.set(s,a,"element"),o.dirty=!0,o):zL(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!==""?Kv[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){am(this)&&fe(324,this.__key,this.__type);let r=this.getChildrenSize(),a=this.getWritable();t+n<=r||fe(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 g=0;g<n;g++){m===null&&fe(100);let h=m.getNextSibling(),v=m.__key;Fi(m.getWritable()),l.push(v),m=h}}let p=c;for(let m of o){p!==null&&m.is(p)&&(c=p=p.getPreviousSibling());let g=m.getWritable();g.__parent===i&&f--,Fi(g);let h=m.__key;if(p===null)a.__first=h,g.__prev=null;else{let v=p.getWritable();v.__next=h,g.__prev=v.__key}m.__key===i&&fe(76),g.__parent=i,s.push(h),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 g=p.getWritable();m.__prev=p.__key,g.__next=d.__key}else m.__prev=null}if(a.__size=f,l.length){let m=zt();if(Ge(m)){let g=new Set(l),h=new Set(s),{anchor:v,focus:y}=m;Mk(v,g,h)&&lm(v,v.getNode(),this,c,d),Mk(y,g,h)&&lm(y,y.getNode(),this,c,d),f!==0||this.canBeEmpty()||ur(this)||this.remove()}}return a}getDOMSlot(t){return new uy(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===""||ur(this)||this.getChildren().some(Ue)||(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 se(e){return e instanceof zi}function Mk(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 au=class extends cr{decorate(t,n){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function tn(e){return e instanceof au}var Zl=class e extends zi{__cachedText;static getType(){return"root"}static clone(){return new e}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){fe(51)}getTextContent(){let t=this.__cachedText;return!sd()&&Jt()._dirtyType!==0||t===null?super.getTextContent():t}remove(){fe(52)}replace(t){fe(53)}insertBefore(t){fe(54)}insertAfter(t){fe(55)}updateDOM(t,n){return!1}splice(t,n,o){for(let r of o)se(r)||tn(r)||fe(282);return super.splice(t,n,o)}static importJSON(t){return Go().updateFromJSON(t)}collapseAtStart(){return!0}};function io(e){return e instanceof Zl}function VL(e){return new iu(new Map(e._nodeMap))}function By(){return new iu(new Map([["root",new Zl]]))}function WL(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&fe(130,n.name),se(e)){let o=t.children;Array.isArray(o)||fe(59,n.name);let r=e.getChildren();for(let a=0;a<r.length;a++){let i=WL(r[a]);o.push(i)}}return t}function tK(e){return e instanceof iu}var iu=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 Ak(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 Ak(null,this,()=>({root:WL(Go())}))}},dm=class extends zi{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}},ed=class e extends zi{static getType(){return"paragraph"}static clone(t){return new e(t.__key)}createDOM(t){let n=document.createElement("p"),o=Ql(t.theme,"paragraph");return o!==void 0&&n.classList.add(...o),n}updateDOM(t,n,o){return!1}static importDOM(){return{p:t=>({conversion:nK,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 Ka().updateFromJSON(t)}exportJSON(){let t=super.exportJSON();if(t.textFormat===void 0||t.textStyle===void 0){let n=this.getChildren().find(Ue);n?(t.textFormat=n.getFormat(),t.textStyle=n.getStyle()):(t.textFormat=this.getTextFormat(),t.textStyle=this.getTextStyle())}return t}insertNewAfter(t,n){let o=Ka();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||Ue(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 nK(e){let t=Ka();if(e.style&&(t.setFormat(e.style.textAlign),mP(e,t)),t.getFormatType()===""){let n=e.getAttribute("align");n&&n&&n in Kv&&t.setFormat(n)}return{node:t}}function Ka(){return mu(new ed)}function GL(e){return e instanceof ed}var Vl=0,oK=1,rK=2,aK=3,iK=4;function jL(e,t,n,o){let r=e._keyToDOMMap;r.clear(),e._editorState=By(),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 QL(e){let t=new Set,n=new Set,o=e;for(;o;){let{ownNodeConfig:r}=gu(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 cr&&i!==cr?i:void 0}}return t}function sK(e){let t=e||{},n=Z$(),o=t.theme||{},r=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,i=By(),s=t.namespace||(r!==null?r._config.namespace:oP()),l=t.editorState,d=[Zl,Bs,Xl,Jl,ed,dm,...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 h=0;h<d.length;h++){let v=d[h],y=null,x=null;if(typeof v!="function"){let T=v;v=T.replace,y=T.with,x=T.withKlass||null}gu(v);let C=v.getType(),w=QL(v);m.set(C,{exportDOM:f&&f.export?f.export.get(v):void 0,klass:v,replace:y,replaceWithKlass:x,sharedNodeState:Xk(d[h]),transforms:w})}}let g=new Ui(i,r,m,{disableEvents:a,namespace:s,theme:o},c||console.error,(function(h,v){let y=new Map,x=new Set,C=w=>{Object.keys(w).forEach(T=>{let S=y.get(T);S===void 0&&(S=[],y.set(T,S)),S.push(w[T])})};return h.forEach(w=>{let T=w.klass.importDOM;if(T==null||x.has(T))return;x.add(T);let S=T.call(w.klass);S!==null&&C(S)}),v&&C(v),y})(m,f?f.import:void 0),p,e);return l!==void 0&&(g._pendingEditorState=l,g._dirtyType=2),(function(h){h.registerCommand(Iy,A$,Vl),h.registerCommand(Ty,E$,Vl),h.registerCommand(ky,R$,Vl),h.registerCommand(Ly,M$,Vl),h.registerCommand(Ry,N$,Vl)})(g),g}var Ui=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=oP(),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&&fe(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&&fe(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&&fe(37,t.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,n){let o=this._editorState,r=gy(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=gy(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=Un(f);p&&p.markDirty()}},i._pendingEditorState===null?{tag:Gp}: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 Me(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=Ql(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,jL(this,n,t,r),n!==null&&(this._config.disableEvents||_$(n),o!=null&&n.classList.remove(...o)),t!==null){let a=Xy(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,Qk(this),this._updateTags.add(Gp),Ha(this),this._config.disableEvents||(function(s,l){let d=s.ownerDocument;ry.set(s,d);let c=om.get(d)??0;c<1&&d.addEventListener("selectionchange",PL),om.set(d,c+1),s.__lexicalEditor=l;let f=LL(s);for(let p=0;p<oy.length;p++){let[m,g]=oy[p],h=typeof g=="function"?v=>{uk(v)||(ck(v),(l.isEditable()||m==="click")&&g(v,l))}:v=>{if(uk(v))return;ck(v);let y=l.isEditable();switch(m){case"cut":return y&&Me(l,Ny,v);case"copy":return Me(l,My,v);case"paste":return y&&Me(l,Py,v);case"dragstart":return y&&Me(l,gL,v);case"dragover":return y&&Me(l,hL,v);case"dragend":return y&&Me(l,vL,v);case"focus":return y&&Me(l,yL,v);case"blur":return y&&Me(l,xL,v);case"drop":return y&&Me(l,mL,v)}};s.addEventListener(m,h),f.push(()=>{s.removeEventListener(m,h)})}})(t,this),o!=null&&t.classList.add(...o)}else this._window=null,this._updateTags.add(Gp),Ha(this);jc("root",this,!1,t,n)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,n){t.isEmpty()&&fe(38);let o=t;o._readOnly&&(o=VL(t),o._selection=t._selection?t._selection.clone():null),jk(this);let r=this._pendingEditorState,a=this._updateTags,i=n!==void 0?n.tag:null;r===null||r.isEmpty()||(i!=null&&a.add(i),Ha(this)),this._pendingEditorState=o,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&a.add(i),this._updating||Ha(this)}parseEditorState(t,n){return(function(o,r,a){let i=By(),s=Yn,l=Fo,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,Fo=!1,Jn=r,zy(null);try{let g=r._nodes;Fy(o.root,g),a&&a(),i._readOnly=!0}catch(g){g instanceof Error&&r._onError(g)}finally{r._dirtyElements=c,r._dirtyLeaves=f,r._cloneNotNeeded=p,r._dirtyType=m,Yn=s,Fo=l,Jn=d}return i})(typeof t=="string"?JSON.parse(t):t,this,n)}read(t){return Ha(this),this.getEditorState().read(t,{editor:this})}update(t,n){(function(o,r,a){o._updating?o._updates.push([r,a]):xm(o,r,a)})(this,t,n)}focus(t,n={}){let o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),la(this,()=>{let r=zt(),a=Go();r!==null?r.dirty||Bo(r.clone()):a.getChildrenSize()!==0&&(n.defaultSelection==="rootStart"?a.selectStart():a.selectEnd()),Sm("focus"),lP(()=>{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,jc("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}};Ui.version="0.41.0+prod.esm";var fy=null;function zy(e){fy=e}var XL=1;function lK(){XL=1}function Uy(e,t){let n=Hy(e,t);return n===void 0&&fe(30,t),n}function Hy(e,t){return e._nodes.get(t)}var dK=typeof queueMicrotask=="function"?queueMicrotask:e=>{Promise.resolve().then(e)};function YL(e){return tn(wm(e))}function $y(e){let t=document.activeElement;if(!ko(t))return!1;let n=t.nodeName;return tn(wm(e))&&(n==="INPUT"||n==="TEXTAREA"||t.contentEditable==="true"&&fu(t)==null)}function uu(e,t,n){let o=e.getRootElement();try{return o!==null&&o.contains(t)&&o.contains(n)&&t!==null&&!$y(t)&&Ky(t)===e}catch{return!1}}function Cm(e){return e instanceof Ui}function Ky(e){let t=e;for(;t!=null;){let n=fu(t);if(Cm(n))return n;t=pu(t)}return null}function fu(e){return e?e.__lexicalEditor:null}function cK(e){return n$.test(e)?"rtl":o$.test(e)?"ltr":null}function Oi(e){return Dy(e)||e.isToken()}function Ua(e){return Oi(e)||e.isSegmented()}function da(e){return ld(e)&&e.nodeType===3}function JL(e){return ld(e)&&e.nodeType===9}function Us(e){let t=e;for(;t!=null;){if(da(t))return t;t=t.firstChild}return null}function su(e,t,n){let o=mo[t];if(n!==null&&(e&o)===(n&o))return e;let r=e^o;return t==="subscript"?r&=~mo.superscript:t==="superscript"?r&=~mo.subscript:t==="lowercase"?(r&=~mo.uppercase,r&=~mo.capitalize):t==="uppercase"?(r&=~mo.lowercase,r&=~mo.capitalize):t==="capitalize"&&(r&=~mo.lowercase,r&=~mo.uppercase),r}function uK(e){return Ue(e)||Ds(e)||tn(e)}function ZL(e,t){let n=(function(){let i=fy;return fy=null,i})();if((t=t||n&&n.__key)!=null)return void(e.__key=t);Qn(),$L();let o=Jt(),r=Wa(),a=""+XL++;r._nodeMap.set(a,e),se(e)?o._dirtyElements.set(a,!0):o._dirtyLeaves.add(a),o._cloneNotNeeded.add(a),o._dirtyType=1,e.__key=a}function Fi(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 cm(e){$L(),am(e)&&fe(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,o=Wa(),r=Jt(),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,se(e)?i.set(s,!0):r._dirtyLeaves.add(s)}function Xn(e){Qn();let t=Jt(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let o=Un(n);o!==null&&o.getWritable()}if(e!==null){let o=Un(e);o!==null&&o.getWritable()}}}function Di(){return sd()?null:Jt()._compositionKey}function Un(e,t){let n=(t||Wa())._nodeMap.get(e);return n===void 0?null:n}function qy(e,t){let n=bm(e,Jt());return n!==void 0?Un(n,t):null}function bm(e,t){return e[`__lexicalKey_${t._key}`]}function wm(e,t){let n=e;for(;n!=null;){let o=qy(n,t);if(o!==null)return o;n=pu(n)}return null}function eP(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Nk(e){return e.read(()=>Go().getTextContent())}function Go(){return tP(Wa())}function tP(e){return e._nodeMap.get("root")}function Bo(e){Qn();let t=Wa();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Wl(e){let t=Jt(),n=(function(o,r){let a=o;for(;a!=null;){let i=bm(a,r);if(i!==void 0)return i;a=pu(a)}return null})(e,t);return n===null?e===t.getRootElement()?Un("root"):null:Un(n)}function nP(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Vy(e){let t=[],n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function oP(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function rP(e){return da(e)?e.nodeValue:null}function Wy(e,t,n){let o=Nr(jo(t));if(o===null)return;let r=o.anchorNode,{anchorOffset:a,focusOffset:i}=o;if(r!==null){let s=rP(r),l=wm(r);if(s!==null&&Ue(l)){if((s===Jc||s===Cy)&&n){let d=n.length;s=n,a=d,i=d}s!==null&&Gy(l,s,a,i,e)}}}function Gy(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(Jc)&&(s=t.slice(0,-Jc.length)),r)){let d=Cy,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),pm||du||mm)a.remove();else{let h=Jt();setTimeout(()=>{h.update(()=>{a.isAttached()&&a.remove()})},20)}return}let d=a.getParent(),c=$s(),f=a.getTextContentSize(),p=Di(),m=a.getKey();if(a.isToken()||p!==null&&m===p&&!i||Ge(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 g=zt();if(!Ge(g)||n===null||o===null)return void _k(a,s,g);if(g.setTextNodeRange(a,n,a,o),a.isSegmented()){let h=jn(a.getTextContent());a.replace(h),a=h}_k(a,s,g)}}}function _k(e,t,n){if(e.setTextContent(t),Ge(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 Hp(e,t,n){let o=t[n]||!1;return o==="any"||o===e[n]}function aP(e,t){return Hp(e,t,"altKey")&&Hp(e,t,"ctrlKey")&&Hp(e,t,"shiftKey")&&Hp(e,t,"metaKey")}function $t(e,t,n){if(!aP(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 za={ctrlKey:!kr,metaKey:kr},Dk={altKey:kr,ctrlKey:!kr};function Ok(e){return e.key==="Backspace"}function Fk(e){return $t(e,"a",za)}function fK(e){let t=Go();if(Ge(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"),Yp(e),e}{let n=t.select(0,t.getChildrenSize());return Bo(Yp(n)),n}}function Ql(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=hu(r);return n[t]=a,a}return r}function jy(e,t,n,o,r){if(n.size===0)return;let a=o.__type,i=o.__key,s=t.get(a);s===void 0&&fe(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 pK(e){let t=e.getType(),n=Wa();if(n._readOnly){let a=gy(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 Bk(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 iP(e,t){let n=e.offset;if(e.type==="element")return Bk(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?Bk(o.getParentOrThrow(),t,o.getIndexWithinParent()+(t?0:1)):r}}return null}function sP(e){let t=jo(e).event,n=t&&t.inputType;return n==="insertFromPaste"||n==="insertFromPasteAsQuotation"}function Me(e,t,n){return(function(o,r,a){let i=Vy(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,g=!1;if(la(d,()=>{for(let h=0;h<m;h++)if(p[h](a,o))return void(g=!0)}),g)return g}}}return!1})(e,t,n)}function td(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&fe(75,t),n}function pu(e){let t=e.assignedSlot||e.parentElement;return fP(t)?t.host:t}function Qy(e){return JL(e)?e:ko(e)?e.ownerDocument:null}function mK(e){return Jt()._updateTags.has(e)}function Sm(e){Qn(),Jt()._updateTags.add(e)}function lP(e){Qn(),Jt()._deferred.push(e)}function um(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function Xy(e){let t=Qy(e);return t?t.defaultView:null}function jo(e){let t=e._window;return t===null&&fe(78),t}function gK(e){return se(e)&&e.isInline()||tn(e)&&e.isInline()}function dP(e){let t=e.getParentOrThrow();for(;t!==null;){if(ur(t))return t;t=t.getParentOrThrow()}return t}function ur(e){return io(e)||se(e)&&e.isShadowRoot()}function Yy(e){let t=e.constructor.clone(e);return ZL(t,null),t.afterCloneFrom(e),t}function mu(e){let t=Jt(),n=e.getType(),o=Hy(t,n);o===void 0&&fe(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||fe(201,a.name,a.getType(),s.name,s.getType(),e.constructor.name,n):i instanceof e.constructor&&s!==e.constructor||fe(202,s.name,s.getType(),e.constructor.name,n),i.__key===e.__key&&fe(203,e.constructor.name,n,s.name,s.getType()),i}return e}function zv(e,t){!io(e.getParent())||se(t)||tn(t)||fe(99)}function cP(e){let t=Un(e);return t===null&&fe(63,e),t}function Uv(e){return(tn(e)||se(e)&&!e.canBeEmpty())&&!e.isInline()}function py(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;let o=e.parentElement;o!==null&&o.removeChild(e)}function Nr(e){return Mr?(e||window).getSelection():null}function uP(e){let t=Xy(e);return t?t.getSelection():null}function hK(e,t){let n=e.getChildAtIndex(t);n==null&&(n=e),ur(e)&&fe(102);let o=i=>{let s=i.getParentOrThrow(),l=ur(s),d=i!==n||l?Yy(i):i;if(l)return se(i)&&se(d)||fe(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 vK(e){return ko(e)&&e.tagName==="A"}function ko(e){return ld(e)&&e.nodeType===1}function ld(e){return typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeType=="number"}function fP(e){return ld(e)&&e.nodeType===11}function pP(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 my(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 $a(e){if(tn(e)&&!e.isInline())return!0;if(!se(e)||ur(e))return!1;let t=e.getFirstChild(),n=t===null||Ds(t)||Ue(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&n}function Jy(){return Jt()}var zk=new WeakMap,yK=new Map;function gy(e){if(!e._readOnly&&e.isEmpty())return yK;e._readOnly||fe(192);let t=zk.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),zk.set(e,t)),t}function Zy(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function xK(e){return(t=Zy(e))[AL]=!0,t;var t}function mP(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,o=Math.round(n/40);t.setIndent(o)}function CK(e){e.__lexicalUnmanaged=!0}function gP(e){return e.__lexicalUnmanaged===!0}function qc(e,t){return(function(n,o){return Object.prototype.hasOwnProperty.call(n,o)})(e,t)&&e[t]!==cr[t]}function gu(e){let t=YT in e.prototype?e.prototype[YT]():void 0,n=(function(i){if(!(i===cr||i.prototype instanceof cr)){let s="<unknown>",l="<unknown>";try{s=i.getType()}catch{}try{Ui.version&&(l=JSON.parse(Ui.version))}catch{}fe(290,i.name,s,l)}return i===au||i===zi||i===cr})(e),o=!n&&qc(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&&(qc(e,"getType")||(e.getType=()=>a),qc(e,"clone")||(e.clone=i=>(zy(i),new e)),qc(e,"importJSON")||(e.importJSON=r&&r.$importJSON||(i=>new e().updateFromJSON(i))),!qc(e,"importDOM")&&r)){let{importDOM:i}=r;i&&(e.importDOM=()=>i)}return{ownNodeConfig:r,ownNodeType:a}}function bK(e){let t=Jy();return Qn(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Qc=(e,t)=>{let n=e;for(;n!=null&&!io(n);){if(t(n))return n;n=n.getParent()}return null},wK={next:"previous",previous:"next"},nd=class{origin;constructor(t){this.origin=t}[Symbol.iterator](){return nx({hasNext:Hs,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&&fe(263,Array.from(s).join(" "))}else a.insert(l);a=Zn(l,this.direction)}for(let l of s.values())l.remove();return this}},lu=class e extends nd{type="child";getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Va(t,this.direction)}getParentCaret(t="root"){return Zn(ex(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Vi(this.direction);return Zn(this.getNodeAtCaret(),t)||Va(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)}},SK={root:io,shadowRoot:ur};function Vi(e){return wK[e]}function ex(e,t="root"){return SK[t](e)?null:e}var od=class e extends nd{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 se(this.origin)?Va(this.origin,this.direction):null}getParentCaret(t="root"){return Zn(ex(this.getParentAtCaret(),t),this.direction)}getFlipped(){let t=Vi(this.direction);return Zn(this.getNodeAtCaret(),t)||Va(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 rd)&&this.direction===t.direction&&this.origin.is(t.origin)}},rd=class e extends nd{type="text";offset;constructor(t,n){super(t),this.offset=n}getLatest(){let t=this.origin.getLatest();return t===this.origin?this:Hi(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return Zn(ex(this.getParentAtCaret(),t),this.direction)}getFlipped(){return Hi(this.origin,Vi(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 od||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Zn(this.origin,this.direction)}};function qa(e){return e instanceof rd}function IK(e){return e instanceof nd}function Hs(e){return e instanceof od}function Ar(e){return e instanceof lu}var TK={next:class extends rd{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends rd{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},kK={next:class extends od{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends od{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},LK={next:class extends lu{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends lu{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 kK[t](e):null}function Hi(e,t,n){return e?new TK[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"&&$k(284,String(t),String(o),e.getKey()),r=r<0?0:o),r}function hy(e,t){return new fm(e,t)}function Va(e,t){return se(e)?new LK[t](e):null}function hP(e){return e&&e.getChildCaret()||e}function ad(e){return e&&hP(e.getAdjacentCaret())}var vy=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 qa(a)?(function(i,s){let{direction:l,origin:d}=i,c=Er(d,s==="focus"?Vi(l):l);return hy(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[hy(r,a.offset-r.offset),null]}return[n,o]}iterNodeCarets(t="root"){let n=qa(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),o=this.focus.getLatest(),r=qa(o),a=i=>i.isSameNodeCaret(o)?null:ad(i)||i.getParentCaret(t);return nx({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")}},fm=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 Hi(t.setTextContent(a.slice(0,o)+a.slice(r)),n,o)}};function PK(e){return e instanceof fm}function tx(e){return $i(e,Zn(Go(),e.direction))}function vP(e){return $i(e,e)}function $i(e,t){return e.direction!==t.direction&&fe(265),new vy(e,t,e.direction)}function nx(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 ox(e,t){let n=Xc(e.origin,t.origin);switch(n===null&&fe(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 rx(n)}}function rx(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 $p(e,t){return t.is(e)}function Uk(e){return se(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function Xc(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};let n=new Map;for(let[o,r]=Uk(e);o;r=o,o=o.getParent())n.set(o,r);for(let[o,r]=Uk(t);o;r=o,o=o.getParent()){let a=n.get(o);if(a!==void 0)return a===null?($p(e,o)||fe(276),{commonAncestor:o,type:"ancestor"}):r===null?($p(t,o)||fe(277),{commonAncestor:o,type:"descendant"}):((se(a)||$p(e,a))&&(se(r)||$p(t,r))&&o.is(a.getParent())&&o.is(r.getParent())||fe(278),{a,b:r,commonAncestor:o,type:"branch"})}return null}function Ki(e,t){let{type:n,key:o,offset:r}=e,a=cP(e.key);return n==="text"?(Ue(a)||fe(266,a.getType(),o),Hi(a,t,r)):(se(a)||fe(267,a.getType(),o),bP(a,e.offset,t))}function id(e,t){let{origin:n,direction:o}=t,r=o==="next";qa(t)?e.set(n.getKey(),t.offset,"text"):Hs(t)?Ue(n)?e.set(n.getKey(),Er(n,o),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(r?1:0),"element"):(Ar(t)&&se(n)||fe(268),e.set(n.getKey(),r?0:n.getChildrenSize(),"element"))}function yP(e){let t=zt(),n=Ge(t)?t:UL();return Yc(n,e),Bo(n),n}function Yc(e,t){id(e.anchor,t.anchor),id(e.focus,t.focus)}function yy(e){let{anchor:t,focus:n}=e,o=Ki(t,"next"),r=Ki(n,"next"),a=ox(o,r)<=0?"next":"previous";return $i(qi(o,a),qi(r,a))}function dd(e){let{direction:t,origin:n}=e,o=Zn(n,Vi(t)).getNodeAtCaret();return o?Zn(o,t):Va(n.getParentOrThrow(),t)}function Hk(e,t="root"){let n=[e];for(let o=Ar(e)?e.getParentCaret(t):e.getSiblingCaret();o!==null;o=o.getParentCaret(t))n.push(dd(o));return n}function Hv(e){return!!e&&e.origin.isAttached()}function xP(e,t="removeEmptySlices"){if(e.isCollapsed())return e;let n="root",o="next",r=t,a=ax(e,o),i=Hk(a.anchor,n),s=Hk(a.focus.getFlipped(),n),l=new Set,d=[];for(let g of a.iterNodeCarets(n))if(Ar(g))l.add(g.origin.getKey());else if(Hs(g)){let{origin:h}=g;se(h)&&!l.has(h.getKey())||d.push(h)}for(let g of d)g.remove();for(let g of a.getTextSlices()){if(!g)continue;let{origin:h}=g.caret,v=h.getTextContentSize(),y=dd(Zn(h,o)),x=h.getMode();if(Math.abs(g.distance)===v&&r==="removeEmptySlices"||x==="token"&&g.distance!==0)y.remove();else if(g.distance!==0){r="removeEmptySlices";let C=g.removeTextSlice(),w=g.caret.origin;if(x==="segmented"){let T=C.origin,S=jn(T.getTextContent()).setStyle(T.getStyle()).setFormat(T.getFormat());y.replaceOrInsert(S),C=Hi(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 g of i)if(Hv(g)){c=Lr(g);break}for(let g of s)if(Hv(g)){f=Lr(g);break}let p=(function(g,h,v){if(!g||!h)return null;let y=g.getParentAtCaret(),x=h.getParentAtCaret();if(!y||!x)return null;let C=y.getParents().reverse();C.push(y);let w=x.getParents().reverse();w.push(x);let T=Math.min(C.length,w.length),S;for(S=0;S<T&&C[S]===w[S];S++);let L=(P,E)=>{let _;for(let A=S;A<P.length;A++){let H=P[A];if(ur(H))return;!_&&E(H)&&(_=H)}return _},k=L(C,$a),I=k&&L(w,P=>v.has(P.getKey())&&$a(P));return k&&I?[k,I]:null})(c,f,l);if(p){let[g,h]=p;Va(g,"previous").splice(0,h.getChildren());let v=h.getParent();for(h.remove(!0);v&&v.isEmpty();){let y=v;v=v.getParent(),y.remove(!0)}}let m=[c,f,...i,...s].find(Hv);if(m)return vP(qi(Lr(m),e.direction));fe(269,JSON.stringify(i.map(g=>g.origin.__key)))}function Lr(e){let t=(function(r){let a=r;for(;Ar(a);){let i=ad(a);if(!Ar(i))break;a=i}return a})(e.getLatest()),{direction:n}=t;if(Ue(t.origin))return qa(t)?t:Hi(t.origin,n,n);let o=t.getAdjacentCaret();return Hs(o)&&Ue(o.origin)?Hi(o.origin,n,Vi(n)):t}function CP(e){return qa(e)&&e.offset!==Er(e.origin,e.direction)}function qi(e,t){return e.direction===t?e:e.getFlipped()}function ax(e,t){return e.direction===t?e:$i(qi(e.focus,t),qi(e.anchor,t))}function bP(e,t,n){let o=Va(e,"next");for(let r=0;r<t;r++){let a=o.getAdjacentCaret();if(a===null)break;o=a}return qi(o,n)}function AK(e,t="root"){let n=0,o=e,r=ad(o);for(;r===null;){if(n--,r=o.getParentCaret(t),!r)return null;o=r,r=ad(o)}return r&&[r,n]}function EK(e){let{origin:t,offset:n,direction:o}=e;if(n===Er(t,o))return e.getSiblingCaret();if(n===Er(t,Vi(o)))return dd(e.getSiblingCaret());let[r]=t.splitText(n);return Ue(r)||fe(281),qi(Zn(r,"next"),o)}function RK(e,t){return!0}function MK(e,{$copyElementNode:t=Yy,$splitTextPointCaretNext:n=EK,rootMode:o="shadowRoot",$shouldSplit:r=RK}={}){if(qa(e))return n(e);let a=e.getParentCaret(o);if(a){let{origin:i}=a;if(Ar(e)&&(!i.canBeEmpty()||!r(i,"first")))return dd(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 NK(e){return e}function _K(...e){return e}function DK(e,t){return[e,t]}function OK(e){return e}function FK(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function hu(...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 BK(e,...t){let n=hu(...t);n.length>0&&e.classList.add(...n)}function zK(e,...t){let n=hu(...t);n.length>0&&e.classList.remove(...n)}function UK(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var M=ix,qre=M.$addUpdateTag,cd=M.$applyNodeReplacement,ud=M.$caretFromPoint,wP=M.$caretRangeFromSelection,Im=M.$cloneWithProperties,SP=M.$cloneWithPropertiesEphemeral,Vre=M.$comparePointCaretNext,Wre=M.$copyNode,IP=M.$create,Ks=M.$createLineBreakNode,TP=M.$createNodeSelection,fr=M.$createParagraphNode,Gre=M.$createPoint,qs=M.$createRangeSelection,kP=M.$createRangeSelectionFromDom,LP=M.$createTabNode,_r=M.$createTextNode,PP=M.$extendCaretToRange,Ga=M.$findMatchingParent,sx=M.$getAdjacentChildCaret,jre=M.$getAdjacentNode,Vs=M.$getAdjacentSiblingOrParentSiblingCaret,lx=M.$getCaretInDirection,AP=M.$getCaretRange,Qre=M.$getCaretRangeInDirection,EP=M.$getCharacterOffsets,Wi=M.$getChildCaret,Xre=M.$getChildCaretAtIndex,dx=M.$getChildCaretOrSelf,RP=M.$getCollapsedCaretRange,Yre=M.$getCommonAncestor,Jre=M.$getCommonAncestorResultBranchOrder,Tm=M.$getEditor,Zre=M.$getNearestNodeFromDOMNode,eae=M.$getNearestRootOrShadowRoot,fd=M.$getNodeByKey,tae=M.$getNodeByKeyOrThrow,MP=M.$getNodeFromDOMNode,vu=M.$getPreviousSelection,Rt=M.$getRoot,$e=M.$getSelection,ja=M.$getSiblingCaret,km=M.$getState,nae=M.$getStateChange,oae=M.$getTextContent,rae=M.$getTextNodeOffset,aae=M.$getTextPointCaret,iae=M.$getTextPointCaretSlice,sae=M.$getWritableNodeState,NP=M.$hasAncestor,lae=M.$hasUpdateTag,dae=M.$insertNodes,pd=M.$isBlockElementNode,yu=M.$isChildCaret,Lm=M.$isDecoratorNode,_P=M.$isEditorState,We=M.$isElementNode,DP=M.$isExtendableTextPointCaret,cae=M.$isInlineElementOrDecoratorNode,OP=M.$isLeafNode,md=M.$isLineBreakNode,uae=M.$isNodeCaret,cx=M.$isNodeSelection,FP=M.$isParagraphNode,Ne=M.$isRangeSelection,xu=M.$isRootNode,Ws=M.$isRootOrShadowRoot,BP=M.$isSiblingCaret,fae=M.$isTabNode,dt=M.$isTextNode,Pm=M.$isTextPointCaret,pae=M.$isTextPointCaretSlice,ux=M.$isTokenOrSegmented,mae=M.$isTokenOrTab,gae=M.$nodesOfType,zP=M.$normalizeCaret,UP=M.$normalizeSelection__EXPERIMENTAL,hae=M.$onUpdate,HP=M.$parseSerializedNode,vae=M.$removeTextFromCaretRange,$P=M.$rewindSiblingCaret,Am=M.$selectAll,yae=M.$setCompositionKey,xae=M.$setPointFromCaret,Dr=M.$setSelection,KP=M.$setSelectionFromCaretRange,Em=M.$setState,qP=M.$splitAtPointCaretNext,VP=M.$splitNode,Cae=M.$updateRangeSelectionFromCaretRange,fx=M.ArtificialNode__DO_NOT_USE,bae=M.BEFORE_INPUT_COMMAND,WP=M.BLUR_COMMAND,Cu=M.CAN_REDO_COMMAND,bu=M.CAN_UNDO_COMMAND,Rm=M.CLEAR_EDITOR_COMMAND,GP=M.CLEAR_HISTORY_COMMAND,jP=M.CLICK_COMMAND,wae=M.COLLABORATION_TAG,Mm=M.COMMAND_PRIORITY_CRITICAL,nn=M.COMMAND_PRIORITY_EDITOR,pr=M.COMMAND_PRIORITY_HIGH,gd=M.COMMAND_PRIORITY_LOW,Sae=M.COMMAND_PRIORITY_NORMAL,Iae=M.COMPOSITION_END_COMMAND,QP=M.COMPOSITION_END_TAG,Tae=M.COMPOSITION_START_COMMAND,XP=M.COMPOSITION_START_TAG,YP=M.CONTROLLED_TEXT_INSERTION_COMMAND,Nm=M.COPY_COMMAND,JP=M.CUT_COMMAND,_m=M.DELETE_CHARACTER_COMMAND,ZP=M.DELETE_LINE_COMMAND,eA=M.DELETE_WORD_COMMAND,kae=M.DRAGEND_COMMAND,Lae=M.DRAGOVER_COMMAND,tA=M.DRAGSTART_COMMAND,nA=M.DROP_COMMAND,Or=M.DecoratorNode,Pae=M.ElementNode,oA=M.FOCUS_COMMAND,Aae=M.FORMAT_ELEMENT_COMMAND,rA=M.FORMAT_TEXT_COMMAND,Dm=M.HISTORIC_TAG,Qo=M.HISTORY_MERGE_TAG,aA=M.HISTORY_PUSH_TAG,px=M.INDENT_CONTENT_COMMAND,Eae=M.INPUT_COMMAND,mx=M.INSERT_LINE_BREAK_COMMAND,iA=M.INSERT_PARAGRAPH_COMMAND,sA=M.INSERT_TAB_COMMAND,wu=M.INTERNAL_$isBlock,Rae=M.IS_ALL_FORMATTING,Mae=M.IS_BOLD,Nae=M.IS_CODE,_ae=M.IS_HIGHLIGHT,Dae=M.IS_ITALIC,Oae=M.IS_STRIKETHROUGH,Fae=M.IS_SUBSCRIPT,Bae=M.IS_SUPERSCRIPT,zae=M.IS_UNDERLINE,lA=M.KEY_ARROW_DOWN_COMMAND,Om=M.KEY_ARROW_LEFT_COMMAND,Fm=M.KEY_ARROW_RIGHT_COMMAND,dA=M.KEY_ARROW_UP_COMMAND,Bm=M.KEY_BACKSPACE_COMMAND,cA=M.KEY_DELETE_COMMAND,uA=M.KEY_DOWN_COMMAND,zm=M.KEY_ENTER_COMMAND,fA=M.KEY_ESCAPE_COMMAND,Uae=M.KEY_MODIFIER_COMMAND,Hae=M.KEY_SPACE_COMMAND,Um=M.KEY_TAB_COMMAND,pA=M.LineBreakNode,$ae=M.MOVE_TO_END,Kae=M.MOVE_TO_START,qae=M.NODE_STATE_KEY,mA=M.OUTDENT_CONTENT_COMMAND,Hm=M.PASTE_COMMAND,gA=M.PASTE_TAG,hA=M.ParagraphNode,vA=M.REDO_COMMAND,yA=M.REMOVE_TEXT_COMMAND,xA=M.RootNode,Vae=M.SELECTION_CHANGE_COMMAND,CA=M.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,bA=M.SELECT_ALL_COMMAND,Wae=M.SKIP_COLLAB_TAG,wA=M.SKIP_DOM_SELECTION_TAG,gx=M.SKIP_SCROLL_INTO_VIEW_TAG,Gae=M.SKIP_SELECTION_FOCUS_TAG,SA=M.TEXT_TYPE_TO_FORMAT,IA=M.TabNode,$m=M.TextNode,TA=M.UNDO_COMMAND,Su=M.addClassNamesToElement,jae=M.buildImportMap,Km=M.configExtension,kA=M.createCommand,qm=M.createEditor,Qae=M.createSharedNodeState,LA=M.createState,PA=M.declarePeerDependency,Rn=M.defineExtension,Xae=M.flipDirection,Yae=M.getDOMOwnerDocument,hx=M.getDOMSelection,Jae=M.getDOMSelectionFromTarget,AA=M.getDOMTextNode,Zae=M.getEditorPropertyFromDOMNode,eie=M.getNearestEditorFromDOMNode,EA=M.getRegisteredNode,tie=M.getRegisteredNodeOrThrow,nie=M.getStaticNodeConfig,oie=M.getTextDirection,rie=M.getTransformSetFromKlass,RA=M.isBlockDomNode,aie=M.isCurrentlyReadOnlyMode,MA=M.isDOMDocumentNode,NA=M.isDOMNode,iie=M.isDOMTextNode,sie=M.isDOMUnmanaged,vx=M.isDocumentFragment,lie=M.isExactShortcutMatch,_A=M.isHTMLAnchorElement,Vm=M.isHTMLElement,Iu=M.isInlineDomNode,die=M.isLexicalEditor,cie=M.isModifierMatch,uie=M.isSelectionCapturedInDecoratorInput,DA=M.isSelectionWithinEditor,yx=M.makeStepwiseIterator,ca=M.mergeRegister,fie=M.normalizeClassNames,Wm=M.removeClassNamesFromElement,pie=M.removeFromParent,mie=M.resetRandomKey,Fr=M.safeCast,gie=M.setDOMUnmanaged,hie=M.setNodeIndentFromDOM,Gm=M.shallowMergeConfig,xx=M.toggleTextFormatType;var Cx={};En(Cx,{LexicalComposer:()=>$K});he();var OA=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,HK=OA?Ce:W,jm={tag:Qo};function $K({initialConfig:e,children:t}){let n=q(()=>{let{theme:o,namespace:r,nodes:a,onError:i,editorState:s,html:l}=e,d=XT(null,o),c=qm({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=Rt();if(m.isEmpty()){let g=fr();m.append(g);let h=OA?document.activeElement:null;($e()!==null||h!==null&&h===f.getRootElement())&&g.select()}},jm);else if(p!==null)switch(typeof p){case"string":{let m=f.parseEditorState(p);f.setEditorState(m,jm);break}case"object":f.setEditorState(p,jm);break;case"function":f.update(()=>{Rt().isEmpty()&&p(f)},jm)}}})(c,s),[c,d]},[]);return HK(()=>{let o=e.editable,[r]=n;r.setEditable(o===void 0||o)},[]),u(QT.Provider,{value:n,children:t})}var KK=Cx,FA=KK.LexicalComposer;var wx={};En(wx,{$canShowPlaceholder:()=>zA,$canShowPlaceholderCurry:()=>VK,$findTextIntersectionFromCharacters:()=>WK,$isRootTextContentEmpty:()=>bx,$isRootTextContentEmptyCurry:()=>qK,$rootTextContent:()=>BA,registerLexicalTextEntity:()=>jK});function BA(){return Rt().getTextContent()}function bx(e,t=!0){if(e)return!1;let n=BA();return t&&(n=n.trim()),n===""}function qK(e,t){return()=>bx(e,t)}function zA(e){if(!bx(e,!1))return!1;let t=Rt().getChildren(),n=t.length;if(n>1)return!1;for(let o=0;o<n;o++){let r=t[o];if(Lm(r))return!1;if(We(r)){if(!FP(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(!dt(l))return!1}}}return!0}function VK(e){return()=>zA(e)}function WK(e,t){let n=e.getFirstChild(),o=0;e:for(;n!==null;){if(We(n)){let i=n.getFirstChild();if(i!==null){n=i;continue}}else if(dt(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 GK(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 jK(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($m,i=>{if(!i.isSimpleText())return;let s,l=i.getPreviousSibling(),d=i.getTextContent(),c=i;if(dt(l)){let p=l.getTextContent(),m=t(p+d);if(r(l)){if(m===null||(g=>g.getLatest().__mode)(l)!==0)return void a(l);{let g=m.end-p.length;if(g>0){let h=p+d.slice(0,g);if(l.select(),l.setTextContent(h),g===d.length)i.remove();else{let v=d.slice(g);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 h=c.getNextSibling();if(dt(h)){m=c.getTextContent()+h.getTextContent();let v=t(m);if(v===null)return void(r(h)?a(h):h.markDirty());if(v.start!==0)return}}if(s===null)return;if(s.start===0&&dt(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&&GK(165,"nodeToReplace");let g=o(p);if(g.setFormat(p.getFormat()),p.replace(g),c==null)return;f=0,l=g}}),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();dt(d)&&d.isTextEntity()&&(a(d),a(i));let c=i.getNextSibling();dt(c)&&c.isTextEntity()&&(a(c),r(i)&&a(i))})]}var Gs=wx,Iie=Gs.$canShowPlaceholder,Qm=Gs.$canShowPlaceholderCurry,Tie=Gs.$findTextIntersectionFromCharacters,kie=Gs.$isRootTextContentEmpty,Lie=Gs.$isRootTextContentEmptyCurry,Pie=Gs.$rootTextContent,Aie=Gs.registerLexicalTextEntity;var Px={};En(Px,{$addNodeStyle:()=>e3,$cloneWithProperties:()=>Im,$copyBlockFormatIndent:()=>jA,$ensureForwardRangeSelection:()=>GA,$forEachSelectedTextNode:()=>WA,$getComputedStyleForElement:()=>Tx,$getComputedStyleForParent:()=>kx,$getSelectionStyleValueForProperty:()=>l3,$isAtNodeEnd:()=>ZK,$isParentElementRTL:()=>Lx,$isParentRTL:()=>YK,$moveCaretSelection:()=>YA,$moveCharacter:()=>i3,$patchStyleText:()=>t3,$selectAll:()=>Am,$setBlocksType:()=>n3,$shouldOverrideDefaultCharacterSelection:()=>a3,$sliceSelectedTextNodeContent:()=>JK,$trimTextContentFromAnchor:()=>VA,$wrapNodes:()=>r3,createDOMRange:()=>QK,createRectsFromDOMRange:()=>XK,getCSSFromStyleObject:()=>qA,getStyleObjectFromCSS:()=>Jm,trimTextContentFromAnchor:()=>d3});function Ix(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 Ym=new Map;function UA(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function HA(e){let t=e.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(e)]}function QK(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(dt(t)&&(l=UA(l)),dt(o)&&(d=UA(d)),t===void 0||o===void 0||l===null||d===null)return null;l.nodeName==="BR"&&([l,c]=HA(l)),d.nodeName==="BR"&&([d,f]=HA(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 XK(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 KA(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 Jm(e){let t=Ym.get(e);return t===void 0&&(t=KA(e),Ym.set(e,t)),t}function qA(e){let t="";for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function Tx(e){let t=Tm().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function kx(e){return Tx(xu(e)?e:e.getParentOrThrow())}function YK(e){let t=kx(e);return t!==null&&t.direction==="rtl"}function JK(e,t,n="self"){let o=e.getStartEndPoints();if(t.isSelected(e)&&!ux(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]=EP(e),m=s.is(l),g=t.is(i?l:s),h=t.is(i?s:l),v,y=0;m?(y=f>p?p:f,v=f>p?f:p):g?(y=i?p:f,v=void 0):h&&(y=0,v=i?f:p);let x=t.__text.slice(y,v);x!==t.__text&&(n==="clone"&&(t=SP(t)),t.__text=x)}}return t}function ZK(e){if(e.type==="text")return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return We(t)||Ix(177),e.offset===t.getChildrenSize()}function VA(e,t,n){let o=t.getNode(),r=n;if(We(o)){let a=o.getDescendantByIndex(t.offset);a!==null&&(o=a)}for(;r>0&&o!==null;){if(We(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===""&&We(o)&&!o.isInline()&&(s=`
3838
3838
 
3839
- `);let l=s.length;if(!dt(o)||r>=l){let d=o.getParent();o.remove(),d==null||d.getChildrenSize()!==0||xu(d)||d.remove(),r-=l+i,o=a}else{let d=o.getKey(),c=e.getEditorState().read(()=>{let m=fd(d);return dt(m)&&m.isSimpleText()?m.getTextContent():null}),f=l-r,p=s.slice(0,f);if(c!==null&&c!==s){let m=vu(),g=o;if(o.isSimpleText())o.setTextContent(c);else{let h=Dr(c);o.replace(h),g=h}if(Ne(m)&&m.isCollapsed()){let h=m.anchor.offset;g.select(h,h)}}else if(o.isSimpleText()){let m=t.key===d,g=t.offset;g<r&&(g=l);let h=m?g-r:0,v=m?g:f;if(m&&h===0){let[y]=o.splitText(h,v);y.remove()}else{let[,y]=o.splitText(h,v);y.remove()}}else{let m=Dr(p);o.replace(m)}r=0}}}function e3(e){let t=e.getStyle(),n=KA(t);Ym.set(t,n)}function Xm(e,t){(Ne(e)?e.isCollapsed():dt(e)||We(e))||Ix(280);let n=Jm(Ne(e)?e.style:dt(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=qA(o);Ne(e)||dt(e)?e.setStyle(r):e.setTextStyle(r),Ym.set(r,o)}function t3(e,t){if(Ne(e)&&e.isCollapsed()){Xm(e,t);let o=e.anchor.getNode();We(o)&&o.isEmpty()&&Xm(o,t)}WA(o=>{Xm(o,t)});let n=e.getNodes();if(n.length>0){let o=new Set;for(let r of n){if(!We(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();o.has(a)||(o.add(a),Xm(r,t))}}}function WA(e){let t=$e();if(!t)return;let n=new Map,o=a=>n.get(a.getKey())||[0,a.getTextContentSize()];if(Ne(t))for(let a of wP(t).getTextSlices())a&&n.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!dt(a)||!a.canHaveFormat())continue;let[i,s]=o(a);s!==i&&(ux(a)||i===0&&s===a.getTextContentSize()?e(a):e(a.splitText(i,s)[i===0?0:1]))}Ne(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&GA(t)}function GA(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 jA(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function n3(e,t,n=jA){if(e===null)return;let o=e.getStartEndPoints(),r=new Map,a=null;if(o){let[i,s]=o;a=Vs(),a.anchor.set(i.key,i.offset,i.type),a.focus.set(s.key,s.offset,s.type);let l=Ga(i.getNode(),wu),d=Ga(s.getNode(),wu);We(l)&&r.set(l.getKey(),l),We(d)&&r.set(d.getKey(),d)}for(let i of e.getNodes())if(We(i)&&wu(i))r.set(i.getKey(),i);else if(o===null){let s=Ga(i,wu);We(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())&&Or(a)}function $A(e){return e.getNode().isAttached()}function o3(e){let t=e;for(;t!==null&&!Gs(t);){let n=t.getLatest(),o=t.getParent();n.getChildrenSize()===0&&t.remove(!0),t=o}}function r3(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];Gs(c)?(Sx(e,l,l.length,t,n),l=[],s=c):s===null||s!==null&&NP(c,s)?l.push(c):(Sx(e,l,l.length,t,n),l=[c])}Sx(e,l,l.length,t,n)}function Sx(e,t,n,o,r=null){if(t.length===0)return;let a=t[0],i=new Map,s=[],l=We(a)?a:a.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let d=!1;for(;l!==null;){let g=l.getPreviousSibling();if(g!==null){l=g,d=!0;break}if(l=l.getParentOrThrow(),Gs(l))break}let c=new Set;for(let g=0;g<n;g++){let h=t[g];We(h)&&h.getChildrenSize()===0&&c.add(h.getKey())}let f=new Set;for(let g=0;g<n;g++){let h=t[g],v=h.getParent();if(v!==null&&v.isInline()&&(v=v.getParent()),v!==null&&OP(h)&&!f.has(h.getKey())){let y=v.getKey();if(i.get(y)===void 0){let x=o();x.setFormat(v.getFormatType()),x.setIndent(v.getIndent()),s.push(x),i.set(y,x),v.getChildren().forEach(C=>{x.append(C),f.add(C.getKey()),We(C)&&C.getChildrenKeys().forEach(w=>f.add(w))}),o3(v)}}else if(c.has(h.getKey())){We(h)||Ix(179);let y=o();y.setFormat(h.getFormatType()),y.setIndent(h.getIndent()),s.push(y),h.remove(!0)}}if(r!==null)for(let g=0;g<s.length;g++){let h=s[g];r.append(h)}let p=null;if(Gs(l))if(d)if(r!==null)l.insertAfter(r);else for(let g=s.length-1;g>=0;g--){let h=s[g];l.insertAfter(h)}else{let g=l.getFirstChild();if(We(g)&&(l=g),g===null)if(r)l.append(r);else for(let h=0;h<s.length;h++){let v=s[h];l.append(v),p=v}else if(r!==null)g.insertBefore(r);else for(let h=0;h<s.length;h++){let v=s[h];g.insertBefore(v),p=v}}else if(r)l.insertAfter(r);else for(let g=s.length-1;g>=0;g--){let h=s[g];l.insertAfter(h),p=h}let m=vu();Ne(m)&&$A(m.anchor)&&$A(m.focus)?Or(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function QA(e){let t=XA(e);return t!==null&&t.writingMode==="vertical-rl"}function XA(e){let t=e.anchor.getNode();return We(t)?Tx(t):kx(t)}function a3(e,t){let n=QA(e)?!t:t;Lx(e)&&(n=!n);let o=ud(e.focus,n?"previous":"next");if(DP(o))return!1;for(let r of PP(o)){if(yu(r))return!r.origin.isInline();if(!We(r.origin)){if(Lm(r.origin))return!0;break}}return!1}function YA(e,t,n,o){e.modify(t?"extend":"move",n,o)}function Lx(e){let t=XA(e);return t!==null&&t.direction==="rtl"}function i3(e,t,n){let o=Lx(e),r;r=QA(e)||o?!n:n,YA(e,t,r,"character")}function s3(e,t,n){let o=Jm(e.getStyle());return o!==null&&o[t]||n}function l3(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(Ne(e)&&e.isCollapsed()&&e.style!==""){let c=Jm(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))&&dt(f)){let p=s3(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var d3=VA;var pn=Px,JA=pn.$addNodeStyle,Nie=pn.$cloneWithProperties,_ie=pn.$copyBlockFormatIndent,Die=pn.$ensureForwardRangeSelection,Oie=pn.$forEachSelectedTextNode,Fie=pn.$getComputedStyleForElement,Bie=pn.$getComputedStyleForParent,zie=pn.$getSelectionStyleValueForProperty,Uie=pn.$isAtNodeEnd,Hie=pn.$isParentElementRTL,$ie=pn.$isParentRTL,Kie=pn.$moveCaretSelection,Ax=pn.$moveCharacter,qie=pn.$patchStyleText,Vie=pn.$selectAll,Wie=pn.$setBlocksType,Ex=pn.$shouldOverrideDefaultCharacterSelection,Zm=pn.$sliceSelectedTextNodeContent,Gie=pn.$trimTextContentFromAnchor,jie=pn.$wrapNodes,Qie=pn.createDOMRange,ZA=pn.createRectsFromDOMRange,Xie=pn.getCSSFromStyleObject,Yie=pn.getStyleObjectFromCSS,Jie=pn.trimTextContentFromAnchor;var _x={};En(_x,{$descendantsMatching:()=>W3,$dfs:()=>P3,$dfsIterator:()=>dE,$filter:()=>U3,$findMatchingParent:()=>Ga,$firstToLastIterator:()=>G3,$getAdjacentCaret:()=>A3,$getAdjacentSiblingOrParentSiblingCaret:()=>Ws,$getDepth:()=>uE,$getNearestBlockElementAncestorOrThrow:()=>_3,$getNearestNodeOfType:()=>N3,$getNextRightPreorderNode:()=>M3,$getNextSiblingOrParentSibling:()=>R3,$handleIndentAndOutdent:()=>H3,$insertFirst:()=>$3,$insertNodeToNearestRoot:()=>F3,$insertNodeToNearestRootAtCaret:()=>pE,$isEditorIsNestedEditor:()=>q3,$lastToFirstIterator:()=>Nx,$restoreEditorState:()=>O3,$reverseDfs:()=>E3,$reverseDfsIterator:()=>fE,$splitNode:()=>VP,$unwrapAndFilterDescendants:()=>V3,$unwrapNode:()=>j3,$wrapNodeInElement:()=>B3,CAN_USE_BEFORE_INPUT:()=>x3,CAN_USE_DOM:()=>iE,IS_ANDROID:()=>C3,IS_ANDROID_CHROME:()=>b3,IS_APPLE:()=>w3,IS_APPLE_WEBKIT:()=>S3,IS_CHROME:()=>I3,IS_FIREFOX:()=>sE,IS_IOS:()=>T3,IS_SAFARI:()=>k3,addClassNamesToElement:()=>Su,calculateZoomLevel:()=>K3,isBlockDomNode:()=>RA,isHTMLAnchorElement:()=>_A,isHTMLElement:()=>Vm,isInlineDomNode:()=>Iu,isMimeType:()=>lE,makeStateWrapper:()=>Q3,markSelection:()=>aE,mediaFileReader:()=>L3,mergeRegister:()=>ca,objectKlassEquals:()=>z3,positionNodeOnRange:()=>rE,registerNestedElementResolver:()=>D3,removeClassNamesFromElement:()=>Wm,selectionAlwaysOnDisplay:()=>y3});function eg(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,c3=zr&&"documentMode"in document?document.documentMode:null,nE=zr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),u3=zr&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),f3=!(!zr||!("InputEvent"in window)||c3)&&"getTargetRanges"in new window.InputEvent("input"),p3=zr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),m3=zr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,oE=zr&&/Android/.test(navigator.userAgent),Mx=zr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),g3=zr&&oE&&Mx,h3=zr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&nE&&!Mx;function ua(e){return`${e}px`}var v3={attributes:!0,characterData:!0,childList:!0,subtree:!0};function rE(e,t,n){let o=null,r=null,a=null,i=[],s=document.createElement("div");function l(){o===null&&eg(182),r===null&&eg(183);let{left:f,top:p}=r.getBoundingClientRect(),m=ZA(e,t);var g,h;s.isConnected||(h=s,(g=r).insertBefore(h,g.firstChild));let v=!1;for(let y=0;y<m.length;y++){let x=m[y],C=i[y]||document.createElement("div"),w=C.style;w.position!=="absolute"&&(w.position="absolute",v=!0);let T=ua(x.left-f);w.left!==T&&(w.left=T,v=!0);let S=ua(x.top-p);w.top!==S&&(C.style.top=S,v=!0);let L=ua(x.width);w.width!==L&&(C.style.width=L,v=!0);let k=ua(x.height);w.height!==k&&(C.style.height=k,v=!0),C.parentNode!==s&&(s.append(C),v=!0),i[y]=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(!Vm(m))return d();d(),o=p,r=m,a=new MutationObserver(g=>{let h=e.getRootElement(),v=h&&h.parentElement;if(h!==o||v!==r)return f();for(let y of g)if(!s.contains(y.target))return l()}),a.observe(m,v3),l()});return()=>{c(),d()}}function eE(e,t,n){if(e.type!=="text"&&We(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[AA(n)||n,e.offset]}function aE(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(!Ne(f))return n=null,r=null,a=null,s=null,l(),void(l=()=>{});let[p,m]=(function(k){let I=k.getStartEndPoints();return k.isBackward()?[I[1],I[0]]:I})(f),g=p.getNode(),h=g.getKey(),v=p.offset,y=m.getNode(),x=y.getKey(),C=m.offset,w=e.getElementByKey(h),T=e.getElementByKey(x),S=n===null||w!==o||v!==r||h!==n.getKey(),L=a===null||T!==i||C!==s||x!==a.getKey();if((S||L)&&w!==null&&T!==null){let k=(function(I,P,E,_,A,H,V){let J=(I._window?I._window.document:document).createRange();return J.setStart(...eE(P,E,_)),J.setEnd(...eE(A,H,V)),J})(e,p,g,w,m,y,T);l(),l=rE(e,k,I=>{if(t===void 0)for(let P of I){let E=P.style;E.background!=="Highlight"&&(E.background="Highlight"),E.color!=="HighlightText"&&(E.color="HighlightText"),E.marginTop!==ua(-1.5)&&(E.marginTop=ua(-1.5)),E.paddingTop!==ua(4)&&(E.paddingTop=ua(4)),E.paddingBottom!==ua(0)&&(E.paddingBottom=ua(0))}else t(I)})}n=g,o=w,r=v,a=y,i=T,s=C})}return d(e.getEditorState()),ca(e.registerUpdateListener(({editorState:c})=>d(c)),()=>{l()})}function y3(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=aE(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var x3=f3,iE=zr,C3=oE,b3=g3,w3=nE,S3=h3,I3=Mx,sE=u3,T3=m3,k3=p3;function lE(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function L3(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()}),lE(l,t)?d.readAsDataURL(l):i()};i()})}function P3(e,t){return Array.from(dE(e,t))}function A3(e){return e?e.getAdjacentCaret():null}function E3(e,t){return Array.from(fE(e,t))}function dE(e,t){return cE("next",e,t)}function tE(e,t){let n=Ws(ja(e,t));return n&&n[0]}function cE(e,t,n){let o=Rt(),r=t||o,a=We(r)?Wi(r,e):ja(r,e),i=uE(r),s=n?sx(dx(ja(n,e)))||tE(n,e):tE(r,e),l=i;return yx({hasNext:d=>d!==null,initial:a,map:d=>({depth:l,node:d.origin}),step:d=>{if(d.isSameNodeCaret(s))return null;yu(d)&&l++;let c=Ws(d);return!c||c[0].isSameNodeCaret(s)?null:(l+=c[1],c[0])}})}function R3(e){let t=Ws(ja(e,"next"));return t&&[t[0].origin,t[1]]}function uE(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function M3(e){let t=dx(ja(e,"previous")),n=Ws(t,"root");return n&&n[0].origin}function fE(e,t){return cE("previous",e,t)}function N3(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function _3(e){let t=Ga(e,n=>We(n)&&!n.isInline());return We(t)||eg(4,e.__key),t}function D3(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 O3(e,t){let n=new Map,o=e._pendingEditorState;for(let[a,i]of t._nodeMap)n.set(a,Im(i));o&&(o._nodeMap=n),e._dirtyType=2;let r=t._selection;Or(r===null?null:r.clone())}function F3(e){let t=$e()||vu(),n;if(Ne(t))n=ud(t.focus,"next");else{if(t!=null){let i=t.getNodes(),s=i[i.length-1];s&&(n=ja(s,"next"))}n=n||Wi(Rt(),"previous").getFlipped().insert(pr())}let o=pE(e,n),r=sx(o),a=yu(r)?zP(r):o;return KP(RP(a)),e.getLatest()}function pE(e,t,n){let o=lx(t,"next");for(let r=o;r;r=qP(r,n))o=r;return Pm(o)&&eg(283),o.insert(e.isInline()?pr().append(e):e),lx(ja(e.getLatest(),"next"),t.direction)}function B3(e,t){let n=t();return e.replace(n),n.append(e),n}function z3(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function U3(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 H3(e){let t=$e();if(!Ne(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=Ga(a,d=>We(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 $3(e,t){Wi(e,"next").insert(t)}var Rx=!(sE||!iE)&&void 0;function K3(e,t=!1){let n=1;if((function(){if(Rx===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"),Rx=o.getBoundingClientRect().width===r.width,document.body.removeChild(o)}return Rx})()||t)for(;e;)n*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return n}function q3(e){return e._parentEditor!==null}function V3(e,t){return mE(e,t,null)}function mE(e,t,n){let o=!1;for(let r of Nx(e))t(r)?n!==null&&n(r):(o=!0,We(r)&&mE(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function W3(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(We(r))for(let a of Nx(r))o.push(a);return n}function G3(e){return gE(Wi(e,"next"))}function Nx(e){return gE(Wi(e,"previous"))}function gE(e){return yx({hasNext:BP,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function j3(e){$P(ja(e,"next")).splice(1,e.getChildren())}function Q3(e){let t=o=>km(o,e),n=(o,r)=>Em(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 Qe=_x,ose=Qe.$descendantsMatching,rse=Qe.$dfs,ase=Qe.$dfsIterator,ise=Qe.$filter,sse=Qe.$findMatchingParent,lse=Qe.$firstToLastIterator,dse=Qe.$getAdjacentCaret,cse=Qe.$getAdjacentSiblingOrParentSiblingCaret,use=Qe.$getDepth,hE=Qe.$getNearestBlockElementAncestorOrThrow,fse=Qe.$getNearestNodeOfType,pse=Qe.$getNextRightPreorderNode,mse=Qe.$getNextSiblingOrParentSibling,vE=Qe.$handleIndentAndOutdent,gse=Qe.$insertFirst,hse=Qe.$insertNodeToNearestRoot,vse=Qe.$insertNodeToNearestRootAtCaret,yse=Qe.$isEditorIsNestedEditor,xse=Qe.$lastToFirstIterator,Cse=Qe.$restoreEditorState,bse=Qe.$reverseDfs,wse=Qe.$reverseDfsIterator,Sse=Qe.$splitNode,Ise=Qe.$unwrapAndFilterDescendants,Tse=Qe.$unwrapNode,kse=Qe.$wrapNodeInElement,Lse=Qe.CAN_USE_BEFORE_INPUT,Pse=Qe.CAN_USE_DOM,Ase=Qe.IS_ANDROID,Ese=Qe.IS_ANDROID_CHROME,Rse=Qe.IS_APPLE,Mse=Qe.IS_APPLE_WEBKIT,Nse=Qe.IS_CHROME,_se=Qe.IS_FIREFOX,Dse=Qe.IS_IOS,Ose=Qe.IS_SAFARI,Fse=Qe.addClassNamesToElement,Bse=Qe.calculateZoomLevel,Dx=Qe.isBlockDomNode,zse=Qe.isHTMLAnchorElement,yE=Qe.isHTMLElement,Use=Qe.isInlineDomNode,Hse=Qe.isMimeType,$se=Qe.makeStateWrapper,Kse=Qe.markSelection,qse=Qe.mediaFileReader,Qa=Qe.mergeRegister,Tu=Qe.objectKlassEquals,Vse=Qe.positionNodeOnRange,Wse=Qe.registerNestedElementResolver,Gse=Qe.removeClassNamesFromElement,jse=Qe.selectionAlwaysOnDisplay;var Ox={};En(Ox,{ContentEditable:()=>Y3,ContentEditableElement:()=>bE});he();var CE=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?Ce:W;function X3({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:g,id:h,role:v="textbox",spellCheck:y=!0,style:x,tabIndex:C,"data-testid":w,...T},S){let[L,k]=Q(e.isEditable()),I=R(E=>{E&&E.ownerDocument&&E.ownerDocument.defaultView?e.setRootElement(E):e.setRootElement(null)},[e]),P=q(()=>(function(...E){return _=>{for(let A of E)typeof A=="function"?A(_):A!=null&&(A.current=_)}})(S,I),[I,S]);return CE(()=>(k(e.isEditable()),e.registerEditableListener(E=>{k(E)})),[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:g,contentEditable:L,"data-testid":w,id:h,ref:P,role:v,spellCheck:y,style:x,tabIndex:C,...T})}var bE=Wn(X3);function xE(e){return e.getEditorState().read(Qm(e.isComposing()))}var Y3=Wn(J3);function J3(e,t){let{placeholder:n,...o}=e,[r]=fn();return b(ke,{children:[u(bE,{editor:r,...o,ref:t}),n!=null&&u(Z3,{editor:r,content:n})]})}function Z3({content:e,editor:t}){let n=(function(i){let[s,l]=Q(()=>xE(i));return CE(()=>{function d(){let c=xE(i);l(c)}return d(),Qa(i.registerUpdateListener(()=>{d()}),i.registerEditableListener(()=>{d()}))},[i]),s})(t),[o,r]=Q(t.isEditable());if(Ce(()=>(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 wE=Ox,SE=wE.ContentEditable,tle=wE.ContentEditableElement;he();var eq=bt(null),Fx={didCatch:!1,error:null},tg=class extends Aa{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Fx}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(Fx))}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t,n){let{didCatch:o}=this.state,{resetKeys:r}=this.props;o&&n.error!==null&&tq(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(Fx))}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=De(o,l);else if(r!==void 0)s=r;else throw i}return De(eq.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}};function tq(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var Bx={};En(Bx,{LexicalErrorBoundary:()=>nq});function nq({children:e,onError:t}){return u(tg,{fallback:u("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var oq=Bx,IE=oq.LexicalErrorBoundary;var Zx={};En(Zx,{$createHorizontalRuleNode:()=>Jx,$isDecoratorTextNode:()=>BE,$isHorizontalRuleNode:()=>qE,AutoFocusExtension:()=>iq,ClearEditorExtension:()=>sq,DecoratorTextExtension:()=>pq,DecoratorTextNode:()=>Pu,EditorStateExtension:()=>ag,HorizontalRuleExtension:()=>Iq,HorizontalRuleNode:()=>Xs,INSERT_HORIZONTAL_RULE_COMMAND:()=>wq,InitialStateExtension:()=>$E,LexicalBuilder:()=>xd,NodeSelectionExtension:()=>jx,TabIndentationExtension:()=>Tq,applyFormatFromStyle:()=>dq,applyFormatToDom:()=>cq,batch:()=>EE,buildEditorFromExtensions:()=>vq,computed:()=>NE,configExtension:()=>Km,declarePeerDependency:()=>PA,defineExtension:()=>Rn,effect:()=>ji,getExtensionDependencyFromEditor:()=>xq,getKnownTypesAndNodes:()=>lq,getPeerDependencyFromEditor:()=>KE,getPeerDependencyFromEditorOrThrow:()=>Cq,namedSignals:()=>sg,registerClearEditor:()=>OE,registerTabIndentation:()=>WE,safeCast:()=>Br,shallowMergeConfig:()=>Gm,signal:()=>yd,untracked:()=>qx,watchedSignal:()=>Xx});var rq=Symbol.for("preact-signals");function ig(){if(Gi>1)return void Gi--;let e,t=!1;for(;Lu!==void 0;){let n=Lu;for(Lu=void 0,Vx++;n!==void 0;){let o=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&RE(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(Vx=0,Gi--,t)throw e}function EE(e){if(Gi>0)return e();Gi++;try{return e()}finally{ig()}}var Kt,Lu;function qx(e){let t=Kt;Kt=void 0;try{return e()}finally{Kt=t}}var Gi=0,Vx=0,rg=0;function TE(e){if(Kt===void 0)return;let t=e.n;return t===void 0||t.t!==Kt?(t={i:0,S:e,p:Kt.s,n:void 0,t:Kt,e:void 0,x:void 0,r:t},Kt.s!==void 0&&(Kt.s.n=t),Kt.s=t,e.n=t,32&Kt.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=Kt.s,t.n=void 0,Kt.s.n=t,Kt.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 yd(e,t){return new Lo(e,t)}function RE(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 kE(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 ME(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 Qs(e,t){Lo.call(this,void 0),this.x=e,this.s=void 0,this.g=rg-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function NE(e,t){return new Qs(e,t)}function _E(e){let t=e.u;if(e.u=void 0,typeof t=="function"){Gi++;let n=Kt;Kt=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Qx(e),o}finally{Kt=n,ig()}}}function Qx(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,_E(e)}function aq(e){if(Kt!==this)throw new Error("Out-of-order effect");ME(this),Kt=e,this.f&=-2,8&this.f&&Qx(this),ig()}function vd(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 ji(e,t){let n=new vd(e,t);try{n.c()}catch(r){throw n.d(),r}let o=n.d.bind(n);return o[Symbol.dispose]=o,o}function sg(e,t={}){let n={};for(let o in e){let r=t[o],a=yd(r===void 0?e[o]:r);n[o]=a}return n}Lo.prototype.brand=rq,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:qx(()=>{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&&qx(()=>{var o;(o=this.Z)==null||o.call(this)}))}},Lo.prototype.subscribe=function(e){return ji(()=>{let t=this.value,n=Kt;Kt=void 0;try{e(t)}finally{Kt=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=Kt;Kt=void 0;try{return this.value}finally{Kt=e}},Object.defineProperty(Lo.prototype,"value",{get(){let e=TE(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Vx>100)throw new Error("Cycle detected");this.v=e,this.i++,rg++,Gi++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{ig()}}}}),Qs.prototype=new Lo,Qs.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===rg))return!0;if(this.g=rg,this.f|=1,this.i>0&&!RE(this))return this.f&=-2,!0;let e=Kt;try{kE(this),Kt=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 Kt=e,ME(this),this.f&=-2,!0},Qs.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)},Qs.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)}},Qs.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(Qs.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=TE(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),vd.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()}},vd.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,_E(this),kE(this),Gi++;let e=Kt;return Kt=this,aq.bind(this,e)},vd.prototype.N=function(){2&this.f||(this.f|=2,this.o=Lu,Lu=this)},vd.prototype.d=function(){this.f|=8,1&this.f||Qx(this)},vd.prototype.dispose=function(){this.d()};var iq=Rn({build:(e,t,n)=>sg(t),config:Br({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){let o=n.getOutput();return ji(()=>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 DE(){let e=Rt(),t=$e(),n=pr();e.clear(),e.append(n),t!==null&&n.select(),Ne(t)&&(t.format=0)}function OE(e,t=DE){return e.registerCommand(Rm,n=>(e.update(t),!0),nn)}var sq=Rn({build:(e,t,n)=>sg(t),config:Br({$onClear:DE}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return ji(()=>OE(e,o.value))}});function lq(e){let t=new Set,n=new Set;for(let o of FE(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function FE(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var zx=LA("format",{parse:e=>typeof e=="number"?e:0}),Pu=class extends Fr{$config(){return this.config("decorator-text",{extends:Fr,stateConfigs:[{flat:!0,stateConfig:zx}]})}getFormat(){return km(this,zx)}getFormatFlags(t,n){return xx(this.getFormat(),t,n)}hasFormat(t){let n=SA[t];return(this.getFormat()&n)!==0}setFormat(t){return Em(this,zx,t)}toggleFormat(t){let n=this.getFormat(),o=xx(n,t,null);return this.setFormat(o)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function BE(e){return e instanceof Pu}function dq(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 cq(e,t,n=fq){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=uq(t,o));return t}function uq(e,t){let n=document.createElement(t);return n.appendChild(e),n}var fq={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},pq=Rn({name:"@lexical/extension/DecoratorText",nodes:()=>[Pu],register:(e,t,n)=>e.registerCommand(rA,o=>{let r=$e();if(cx(r)||Ne(r))for(let a of r.getNodes())BE(a)&&a.toggleFormat(o);return!1},gd)});function Xx(e,t){let n;return yd(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var ag=Rn({build:e=>Xx(()=>e.getEditorState(),t=>e.registerUpdateListener(n=>{t.value=n.editorState})),name:"@lexical/extension/EditorState"});function Gt(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 zE(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]=zE(n[r],o[r]);return e}return t}var Yx=0,Wx=1,UE=2,Ux=3,ng=4,hd=5,Hx=6,ku=7;function $x(e){return e.id===Yx}function HE(e){return e.id===UE}function mq(e){return(function(t){return t.id===Wx})(e)||Gt(305,String(e.id),String(Wx)),Object.assign(e,{id:UE})}var gq=new Set,Gx=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,n){this.builder=t,this.extension=n,this.configs=new Set,this.state={id:Yx}}mergeConfigs(){let t=this.extension.config||{},n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Gm;for(let o of this.configs)t=n(t,o);return t}init(t){let n=this.state;HE(n)||Gt(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:Ux,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:ng,initResult:l,registerState:d})})(a,i,r)}build(t){let n=this.state,o;n.id!==ng&&Gt(307,String(n.id),String(hd)),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:hd,output:i,registerState:s})})(n,o,r)}register(t,n){this._signal=n;let o=this.state;o.id!==hd&&Gt(308,String(o.id),String(hd));let r=this.extension.register&&this.extension.register(t,o.config,o.registerState);return this.state=(function(a){return Object.assign(a,{id:Hx})})(o),()=>{let a=this.state;a.id!==ku&&Gt(309,String(o.id),String(ku)),this.state=(function(i){return Object.assign(i,{id:hd})})(a),r&&r()}}afterRegistration(t){let n=this.state,o;return n.id!==Hx&&Gt(310,String(n.id),String(Hx)),this.extension.afterRegistration&&(o=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(r){return Object.assign(r,{id:ku})})(n),o}getSignal(){return this._signal===void 0&&Gt(311),this._signal}getInitResult(){this.extension.init===void 0&&Gt(312,this.extension.name);let t=this.state;return(function(n){return n.id>=ng})(t)||Gt(313,String(t.id),String(ng)),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>=Ux})(t)||Gt(314,String(t.id),String(Ux)),{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&&Gt(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Gt(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){let t=this.state;return(function(n){return n.id>=ku})(t)||Gt(316,String(t.id),String(ku)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||gq}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>=hd})(t)||Gt(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},LE={tag:Qo};function hq(){let e=Rt();e.isEmpty()&&e.append(pr())}var $E=Rn({config:Br({setOptions:LE,updateOptions:LE}),init:({$initialEditorState:e=hq})=>({$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(_P(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:[xA,$m,pA,IA,hA]}),PE=Symbol.for("@lexical/extension/LexicalBuilder");function vq(...e){return xd.fromExtensions(e).buildEditor()}function AE(){}function yq(e){throw e}function og(e){return Array.isArray(e)?e:[e]}var Kx="0.41.0+prod.esm",xd=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=Kx,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[og($E)];for(let o of t)n.push(og(o));return new e(n)}static maybeFromEditor(t){let n=t[PE];return n&&(n.PACKAGE_VERSION!==Kx&&Gt(292,n.PACKAGE_VERSION,Kx),n instanceof e||Gt(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Gt(294),n}constructEditor(){let{$initialEditorState:t,onError:n,...o}=this.buildCreateEditorArgs(),r=Object.assign(qm({...o,...n?{onError:a=>{n(a,r)}}:{}}),{[PE]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=AE;function n(){try{t()}finally{t=AE}}let o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=ca(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&&Gt(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&&Gt(296);let n=og(t),[o]=n;typeof o.name!="string"&&Gt(297,typeof o.name);let r=this.extensionNameMap.get(o.name);if(r!==void 0&&r.extension!==o&&Gt(298,o.name),!r){r=new Gx(this,o),this.extensionNameMap.set(o.name,r);let a=this.conflicts.get(o.name);typeof a=="string"&&Gt(299,o.name,a);for(let i of o.conflictsWith||[])this.extensionNameMap.has(i)&&Gt(299,o.name,i),this.conflicts.set(i,o.name);for(let i of o.dependencies||[]){let s=og(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(HE(a))return;let i=o.extension.name;var s;$x(a)||Gt(300,i,r||"[unknown]"),$x(s=a)||Gt(304,String(s.id),String(Yx)),a=Object.assign(s,{id:Wx}),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=mq(a),o.state=a,t.push(o)};for(let o of this.extensionNameMap.values())$x(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&&Gt(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 ca(...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 FE(f)){if(typeof p!="function"){let m=o.get(p.replace);m&&Gt(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&&zE(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=yq),t}};function xq(e,t){let n=xd.fromEditor(e).getExtensionRep(t);return n===void 0&&Gt(303,t.name),n.getExtensionDependency()}function KE(e,t){let n=xd.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function Cq(e,t){let n=KE(e,t);return n===void 0&&Gt(291,t),n}var bq=new Set,jx=Rn({build(e,t,n){let o=n.getDependency(ag).output,r=yd({watchedNodeKeys:new Map}),a=Xx(()=>{},()=>ji(()=>{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=fd(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=NE(()=>(a.value||bq).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:[ag],name:"@lexical/extension/NodeSelection"}),wq=kA("INSERT_HORIZONTAL_RULE_COMMAND"),Xs=class e extends Fr{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return Jx().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:Sq,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return Su(n,t.theme.hr),n}getTextContent(){return`
3840
- `}isInline(){return!1}updateDOM(){return!1}};function Sq(){return{node:Jx()}}function Jx(){return IP(Xs)}function qE(e){return e instanceof Xs}var Iq=Rn({dependencies:[ag,jx],name:"@lexical/extension/HorizontalRule",nodes:()=>[Xs],register(e,t,n){let{watchNodeKey:o}=n.getDependency(jx).output,r=yd({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return ca(e.registerCommand(jP,i=>{if(NA(i.target)){let s=MP(i.target);if(qE(s))return(function(l,d=!1){let c=$e(),f=l.isSelected(),p=l.getKey(),m;d&&cx(c)?m=c:(m=TP(),Or(m)),f?m.delete(p):m.add(p)})(s,i.shiftKey),!0}return!1},gd),e.registerMutationListener(Xs,(i,s)=>{EE(()=>{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:yd(m),selectedSignal:o(c)}))}l&&(r.value={nodeSelections:d})})}),ji(()=>{let i=[];for(let{domNode:s,selectedSignal:l}of r.value.nodeSelections.values())i.push(ji(()=>{let d=s.value;d&&(l.value?Su(d,a):Wm(d,a))}));return ca(...i)}))}});function VE(e){return e.canBeEmpty()}function WE(e,t,n=VE){return ca(e.registerCommand(Um,o=>{let r=$e();if(!Ne(r))return!1;o.preventDefault();let a=(function(i){if(i.getNodes().filter(p=>pd(p)&&p.canIndent()).length>0)return!0;let s=i.anchor,l=i.focus,d=l.isBefore(s)?l:s,c=d.getNode(),f=hE(c);if(f.canIndent()){let p=f.getKey(),m=Vs();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=UP(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?mA:px:sA;return e.dispatchCommand(a,void 0)},nn),e.registerCommand(px,()=>{let o=typeof t=="number"?t:t?t.peek():null,r=$e();if(!Ne(r))return!1;let a=typeof n=="function"?n:n.peek();return vE(i=>{if(a(i)){let s=i.getIndent()+1;(!o||s<o)&&i.setIndent(s)}})},Mm))}var Tq=Rn({build:(e,t,n)=>sg(t),config:Br({$canIndent:VE,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){let{disabled:o,maxIndent:r,$canIndent:a}=n.getOutput();return ji(()=>{if(!o.value)return WE(e,r,a)})}});var Tt=Zx,ule=Tt.$createHorizontalRuleNode,fle=Tt.$isDecoratorTextNode,ple=Tt.$isHorizontalRuleNode,mle=Tt.AutoFocusExtension,gle=Tt.ClearEditorExtension,hle=Tt.DecoratorTextExtension,vle=Tt.DecoratorTextNode,yle=Tt.EditorStateExtension,xle=Tt.HorizontalRuleExtension,Cle=Tt.HorizontalRuleNode,ble=Tt.INSERT_HORIZONTAL_RULE_COMMAND,wle=Tt.InitialStateExtension,GE=Tt.LexicalBuilder,Sle=Tt.NodeSelectionExtension,Ile=Tt.TabIndentationExtension,Tle=Tt.applyFormatFromStyle,kle=Tt.applyFormatToDom,jE=Tt.batch,Lle=Tt.buildEditorFromExtensions,Ple=Tt.computed,Ale=Tt.configExtension,Ele=Tt.declarePeerDependency,Rle=Tt.defineExtension,Au=Tt.effect,Mle=Tt.getExtensionDependencyFromEditor,Nle=Tt.getKnownTypesAndNodes,QE=Tt.getPeerDependencyFromEditor,_le=Tt.getPeerDependencyFromEditorOrThrow,lg=Tt.namedSignals,Dle=Tt.registerClearEditor,Ole=Tt.registerTabIndentation,Fle=Tt.safeCast,Ble=Tt.shallowMergeConfig,zle=Tt.signal,Ule=Tt.untracked,Hle=Tt.watchedSignal;var eC={};En(eC,{HistoryExtension:()=>dg,SharedHistoryExtension:()=>Pq,createEmptyHistoryState:()=>JE,registerHistory:()=>YE});function kq(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(!(Ne(a)&&Ne(i)&&i.isCollapsed()&&a.isCollapsed()))return 0;let s=(function(y,x,C){let w=y._nodeMap,T=[];for(let S of x){let L=w.get(S);L!==void 0&&T.push(L)}for(let[S,L]of C){if(!L)continue;let k=w.get(S);k===void 0||xu(k)||T.push(k)}return T})(t,n,o);if(s.length===0)return 0;if(s.length>1){let y=t._nodeMap,x=y.get(a.anchor.key),C=y.get(i.anchor.key);return x&&C&&!e._nodeMap.has(x.__key)&&dt(x)&&x.__text.length===1&&a.anchor.offset===1?2:0}let l=s[0],d=e._nodeMap.get(l.__key);if(!dt(d)||!dt(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 g=p.offset,h=m.offset,v=f.length-c.length;return v===1&&h===g-1?2:v===-1&&h===g+1?3:v===-1&&h===g?4:0}function Lq(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(XP)&&(r=n,a=o,i=s),p.has(Dm))return o=0,n=m,2;p.has(QP)&&i&&(n=r,o=a,s=i);let g=kq(s,l,c,f,e.isComposing()),h=(()=>{let v=d===null||d.editor===e,y=p.has(aA);if(!y&&v&&p.has(Qo))return 0;if(g===1)return 2;if(s===null)return 1;let x=l._selection;if(!(c.size>0||f.size>0))return x!==null?0:2;let C=typeof t=="number"?t:t.peek();return y===!1&&g!==0&&g===o&&m<n+C&&v||c.size===1&&(function(w,T,S){let L=T._nodeMap.get(w),k=S._nodeMap.get(w),I=T._selection,P=S._selection;return!(Ne(I)&&Ne(P)&&I.anchor.type==="element"&&I.focus.type==="element"&&P.anchor.type==="text"&&P.focus.type==="text"||!dt(L)||!dt(k)||L.__parent!==k.__parent)&&JSON.stringify(T.read(()=>L.exportJSON()))===JSON.stringify(S.read(()=>k.exportJSON()))})(Array.from(c)[0],s,l)?0:1})();return n=m,o=g,h}}function XE(e){e.undoStack=[],e.redoStack=[],e.current=null}function YE(e,t,n){let o=Lq(e,n);return Qa(e.registerCommand(TA,()=>((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(Cu,!0)),l.length===0&&a.dispatchCommand(bu,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:Dm})}})(e,t),!0),nn),e.registerCommand(vA,()=>((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(bu,!0));let c=s.pop();s.length===0&&a.dispatchCommand(Cu,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:Dm})}})(e,t),!0),nn),e.registerCommand(Rm,()=>(XE(t),!1),nn),e.registerCommand(GP,()=>(XE(t),e.dispatchCommand(Cu,!1),e.dispatchCommand(bu,!1),!0),nn),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 g=o(i,a,c,s,l,d);if(g===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand(Cu,!1)),c!==null&&(p.push({...c}),e.dispatchCommand(bu,!0));else if(g===2)return;t.current={editor:e,editorState:a}}))}function JE(){return{current:null,redoStack:[],undoStack:[]}}var dg=Rn({build:(e,{delay:t,createInitialHistoryState:n,disabled:o})=>lg({delay:t,disabled:o,historyState:n(e)}),config:Br({createInitialHistoryState:JE,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,n)=>{let o=n.getOutput();return Au(()=>o.disabled.value?void 0:YE(e,o.historyState.value,o.delay))}}),Pq=Rn({dependencies:[Km(dg,{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(dg),r=(function(i){return i?QE(i,dg.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return Au(()=>jE(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var cg=eC,Wle=cg.HistoryExtension,Gle=cg.SharedHistoryExtension,ug=cg.createEmptyHistoryState,ZE=cg.registerHistory;var tC={};En(tC,{HistoryPlugin:()=>Aq,createEmptyHistoryState:()=>ug});he();function Aq({delay:e,externalHistoryState:t}){let[n]=fn();return(function(o,r,a=1e3){let i=q(()=>r||ug(),[r]);W(()=>ZE(o,i,a),[a,o,i])})(n,t,e),null}var eR=tC,tR=eR.HistoryPlugin,nR=eR.createEmptyHistoryState;var nC={};En(nC,{OnChangePlugin:()=>Rq});he();var Eq=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?Ce:W;function Rq({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=fn();return Eq(()=>{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(Qo)||s.isEmpty()||n(r,o,l)})},[o,e,t,n]),null}var Mq=nC,oR=Mq.OnChangePlugin;var oC={};En(oC,{useLexicalEditable:()=>Dq});he();var Nq=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?Ce:W;function _q(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function Dq(){return(function(e){let[t]=fn(),n=q(()=>e(t),[t,e]),[o,r]=Q(()=>n.initialValueFn()),a=N(o);return Nq(()=>{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})(_q)}var Oq=oC,rR=Oq.useLexicalEditable;var rC={};En(rC,{ReactProviderExtension:()=>Fq});var Fq=Rn({name:"@lexical/react/ReactProvider"});var Bq=rC,aR=Bq.ReactProviderExtension;var aC={};En(aC,{DragonExtension:()=>zq,registerDragonSupport:()=>iR});function iR(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 g=$e();if(Ne(g)){let h=g.anchor,v=h.getNode(),y=0,x=0;if(dt(v)&&d>=0&&c>=0&&(y=d,x=d+c,g.setTextNodeRange(v,y,v,x)),y===x&&f===""||(g.insertRawText(f),v=h.getNode()),dt(v)){y=p,x=p+m;let C=v.getTextContentSize();y=y>C?C:y,x=x>C?C:x,g.setTextNodeRange(v,y,v,x)}o.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}var zq=Rn({build:(e,t,n)=>lg(t),config:Br({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>Au(()=>n.getOutput().disabled.value?void 0:iR(e))});var sR=aC,lR=sR.DragonExtension,dR=sR.registerDragonSupport;var iC={};En(iC,{$generateHtmlFromNodes:()=>Hq,$generateNodesFromDOM:()=>Uq});function Uq(e,t){let n=MA(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!uR.has(a.nodeName)){let i=fR(a,e,r,!1);i!==null&&(o=o.concat(i))}return(function(a){for(let i of a)i.getNextSibling()instanceof fx&&i.insertAfter(qs());for(let i of a){let s=i.getChildren();for(let l of s)i.insertBefore(l);i.remove()}})(r),o}function Hq(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=Rt().getChildren();for(let r=0;r<o.length;r++)cR(e,o[r],n,t);return n.innerHTML}function cR(e,t,n,o=null){let r=o===null||t.isSelected(o),a=We(t)&&t.excludeFromCopy("html"),i=t;o!==null&&dt(t)&&(i=Zm(o,t,"clone"));let s=We(i)?i.getChildren():[],l=EA(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 g=s[m],h=cR(e,g,p,o);!r&&We(t)&&h&&t.extractWithChild(g,o,"html")&&(r=!0)}if(r&&!a){if((yE(c)||vx(c))&&c.append(p),n.append(c),f){let m=f.call(i,c);m&&(vx(c)?c.replaceChildren(m):c.replaceWith(m))}}else n.append(p);return r}var uR=new Set(["STYLE","SCRIPT"]);function fR(e,t,n,o,r=new Map,a){let i=[];if(uR.has(e.nodeName))return i;let s=null,l=(function(g,h){let{nodeName:v}=g,y=h._htmlConversions.get(v.toLowerCase()),x=null;if(y!==void 0)for(let C of y){let w=C(g);w!==null&&(x===null||(x.priority||0)<=(w.priority||0))&&(x=w)}return x!==null?x.conversion:null})(e,t),d=l?l(e):null,c=null;if(d!==null){c=d.after;let g=d.node;if(s=Array.isArray(g)?g[g.length-1]:g,s!==null){for(let[,h]of r)if(s=h(s,a),!s)break;s&&i.push(...Array.isArray(g)?g:[s])}d.forChild!=null&&r.set(e.nodeName,d.forChild)}let f=e.childNodes,p=[],m=(s==null||!Gs(s))&&(s!=null&&pd(s)||o);for(let g=0;g<f.length;g++)p.push(...fR(f[g],t,n,m,new Map(r),s));return c!=null&&(p=c(p)),Dx(e)&&(p=$q(e,p,m?()=>{let g=new fx;return n.push(g),g}:pr)),s==null?p.length>0?i=i.concat(p):Dx(e)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:Iu(g.nextSibling)&&Iu(g.previousSibling)})(e)&&(i=i.concat(qs())):We(s)&&s.append(...p),i}function $q(e,t,n){let o=e.style.textAlign,r=[],a=[];for(let i=0;i<t.length;i++){let s=t[i];if(pd(s))o&&!s.getFormat()&&s.setFormat(o),r.push(s);else if(a.push(s),i===t.length-1||i<t.length-1&&pd(t[i+1])){let l=n();l.setFormat(o),l.append(...a),r.push(l),a=[]}}return r}var pR=iC,mR=pR.$generateHtmlFromNodes,gR=pR.$generateNodesFromDOM;var lC={};En(lC,{$generateJSONFromSelectedNodes:()=>CR,$generateNodesFromSerializedNodes:()=>bR,$getClipboardDataFromSelection:()=>SR,$getHtmlContent:()=>vR,$getLexicalContent:()=>yR,$insertDataTransferForPlainText:()=>Kq,$insertDataTransferForRichText:()=>qq,$insertGeneratedNodes:()=>sC,copyToClipboard:()=>Vq,setLexicalClipboardDataTransfer:()=>IR});function fg(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 vR(e,t=$e()){return t==null&&fg(166),Ne(t)&&t.isCollapsed()||t.getNodes().length===0?"":mR(e,t)}function yR(e,t=$e()){return t==null&&fg(166),Ne(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(CR(e,t))}function Kq(e,t){let n=e.getData("text/plain")||e.getData("text/uri-list");n!=null&&t.insertRawText(n)}function qq(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 sC(n,bR(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 sC(n,gR(n,s),t)}catch(s){console.error(s)}let i=a||e.getData("text/uri-list");if(i!=null)if(Ne(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(Ne(d)){let c=s[l];c===`
3839
+ `);let l=s.length;if(!dt(o)||r>=l){let d=o.getParent();o.remove(),d==null||d.getChildrenSize()!==0||xu(d)||d.remove(),r-=l+i,o=a}else{let d=o.getKey(),c=e.getEditorState().read(()=>{let m=fd(d);return dt(m)&&m.isSimpleText()?m.getTextContent():null}),f=l-r,p=s.slice(0,f);if(c!==null&&c!==s){let m=vu(),g=o;if(o.isSimpleText())o.setTextContent(c);else{let h=_r(c);o.replace(h),g=h}if(Ne(m)&&m.isCollapsed()){let h=m.anchor.offset;g.select(h,h)}}else if(o.isSimpleText()){let m=t.key===d,g=t.offset;g<r&&(g=l);let h=m?g-r:0,v=m?g:f;if(m&&h===0){let[y]=o.splitText(h,v);y.remove()}else{let[,y]=o.splitText(h,v);y.remove()}}else{let m=_r(p);o.replace(m)}r=0}}}function e3(e){let t=e.getStyle(),n=KA(t);Ym.set(t,n)}function Xm(e,t){(Ne(e)?e.isCollapsed():dt(e)||We(e))||Ix(280);let n=Jm(Ne(e)?e.style:dt(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=qA(o);Ne(e)||dt(e)?e.setStyle(r):e.setTextStyle(r),Ym.set(r,o)}function t3(e,t){if(Ne(e)&&e.isCollapsed()){Xm(e,t);let o=e.anchor.getNode();We(o)&&o.isEmpty()&&Xm(o,t)}WA(o=>{Xm(o,t)});let n=e.getNodes();if(n.length>0){let o=new Set;for(let r of n){if(!We(r)||!r.canBeEmpty()||r.getChildrenSize()!==0)continue;let a=r.getKey();o.has(a)||(o.add(a),Xm(r,t))}}}function WA(e){let t=$e();if(!t)return;let n=new Map,o=a=>n.get(a.getKey())||[0,a.getTextContentSize()];if(Ne(t))for(let a of wP(t).getTextSlices())a&&n.set(a.caret.origin.getKey(),a.getSliceIndices());let r=t.getNodes();for(let a of r){if(!dt(a)||!a.canHaveFormat())continue;let[i,s]=o(a);s!==i&&(ux(a)||i===0&&s===a.getTextContentSize()?e(a):e(a.splitText(i,s)[i===0?0:1]))}Ne(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&GA(t)}function GA(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 jA(e,t){let n=e.getFormatType(),o=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),o!==t.getIndent()&&t.setIndent(o)}function n3(e,t,n=jA){if(e===null)return;let o=e.getStartEndPoints(),r=new Map,a=null;if(o){let[i,s]=o;a=qs(),a.anchor.set(i.key,i.offset,i.type),a.focus.set(s.key,s.offset,s.type);let l=Ga(i.getNode(),wu),d=Ga(s.getNode(),wu);We(l)&&r.set(l.getKey(),l),We(d)&&r.set(d.getKey(),d)}for(let i of e.getNodes())if(We(i)&&wu(i))r.set(i.getKey(),i);else if(o===null){let s=Ga(i,wu);We(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 $A(e){return e.getNode().isAttached()}function o3(e){let t=e;for(;t!==null&&!Ws(t);){let n=t.getLatest(),o=t.getParent();n.getChildrenSize()===0&&t.remove(!0),t=o}}function r3(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];Ws(c)?(Sx(e,l,l.length,t,n),l=[],s=c):s===null||s!==null&&NP(c,s)?l.push(c):(Sx(e,l,l.length,t,n),l=[c])}Sx(e,l,l.length,t,n)}function Sx(e,t,n,o,r=null){if(t.length===0)return;let a=t[0],i=new Map,s=[],l=We(a)?a:a.getParentOrThrow();l.isInline()&&(l=l.getParentOrThrow());let d=!1;for(;l!==null;){let g=l.getPreviousSibling();if(g!==null){l=g,d=!0;break}if(l=l.getParentOrThrow(),Ws(l))break}let c=new Set;for(let g=0;g<n;g++){let h=t[g];We(h)&&h.getChildrenSize()===0&&c.add(h.getKey())}let f=new Set;for(let g=0;g<n;g++){let h=t[g],v=h.getParent();if(v!==null&&v.isInline()&&(v=v.getParent()),v!==null&&OP(h)&&!f.has(h.getKey())){let y=v.getKey();if(i.get(y)===void 0){let x=o();x.setFormat(v.getFormatType()),x.setIndent(v.getIndent()),s.push(x),i.set(y,x),v.getChildren().forEach(C=>{x.append(C),f.add(C.getKey()),We(C)&&C.getChildrenKeys().forEach(w=>f.add(w))}),o3(v)}}else if(c.has(h.getKey())){We(h)||Ix(179);let y=o();y.setFormat(h.getFormatType()),y.setIndent(h.getIndent()),s.push(y),h.remove(!0)}}if(r!==null)for(let g=0;g<s.length;g++){let h=s[g];r.append(h)}let p=null;if(Ws(l))if(d)if(r!==null)l.insertAfter(r);else for(let g=s.length-1;g>=0;g--){let h=s[g];l.insertAfter(h)}else{let g=l.getFirstChild();if(We(g)&&(l=g),g===null)if(r)l.append(r);else for(let h=0;h<s.length;h++){let v=s[h];l.append(v),p=v}else if(r!==null)g.insertBefore(r);else for(let h=0;h<s.length;h++){let v=s[h];g.insertBefore(v),p=v}}else if(r)l.insertAfter(r);else for(let g=s.length-1;g>=0;g--){let h=s[g];l.insertAfter(h),p=h}let m=vu();Ne(m)&&$A(m.anchor)&&$A(m.focus)?Dr(m.clone()):p!==null?p.selectEnd():e.dirty=!0}function QA(e){let t=XA(e);return t!==null&&t.writingMode==="vertical-rl"}function XA(e){let t=e.anchor.getNode();return We(t)?Tx(t):kx(t)}function a3(e,t){let n=QA(e)?!t:t;Lx(e)&&(n=!n);let o=ud(e.focus,n?"previous":"next");if(DP(o))return!1;for(let r of PP(o)){if(yu(r))return!r.origin.isInline();if(!We(r.origin)){if(Lm(r.origin))return!0;break}}return!1}function YA(e,t,n,o){e.modify(t?"extend":"move",n,o)}function Lx(e){let t=XA(e);return t!==null&&t.direction==="rtl"}function i3(e,t,n){let o=Lx(e),r;r=QA(e)||o?!n:n,YA(e,t,r,"character")}function s3(e,t,n){let o=Jm(e.getStyle());return o!==null&&o[t]||n}function l3(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(Ne(e)&&e.isCollapsed()&&e.style!==""){let c=Jm(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))&&dt(f)){let p=s3(f,t,n);if(o===null)o=p;else if(o!==p){o="";break}}}return o===null?n:o}var d3=VA;var pn=Px,JA=pn.$addNodeStyle,Nie=pn.$cloneWithProperties,_ie=pn.$copyBlockFormatIndent,Die=pn.$ensureForwardRangeSelection,Oie=pn.$forEachSelectedTextNode,Fie=pn.$getComputedStyleForElement,Bie=pn.$getComputedStyleForParent,zie=pn.$getSelectionStyleValueForProperty,Uie=pn.$isAtNodeEnd,Hie=pn.$isParentElementRTL,$ie=pn.$isParentRTL,Kie=pn.$moveCaretSelection,Ax=pn.$moveCharacter,qie=pn.$patchStyleText,Vie=pn.$selectAll,Wie=pn.$setBlocksType,Ex=pn.$shouldOverrideDefaultCharacterSelection,Zm=pn.$sliceSelectedTextNodeContent,Gie=pn.$trimTextContentFromAnchor,jie=pn.$wrapNodes,Qie=pn.createDOMRange,ZA=pn.createRectsFromDOMRange,Xie=pn.getCSSFromStyleObject,Yie=pn.getStyleObjectFromCSS,Jie=pn.trimTextContentFromAnchor;var _x={};En(_x,{$descendantsMatching:()=>W3,$dfs:()=>P3,$dfsIterator:()=>dE,$filter:()=>U3,$findMatchingParent:()=>Ga,$firstToLastIterator:()=>G3,$getAdjacentCaret:()=>A3,$getAdjacentSiblingOrParentSiblingCaret:()=>Vs,$getDepth:()=>uE,$getNearestBlockElementAncestorOrThrow:()=>_3,$getNearestNodeOfType:()=>N3,$getNextRightPreorderNode:()=>M3,$getNextSiblingOrParentSibling:()=>R3,$handleIndentAndOutdent:()=>H3,$insertFirst:()=>$3,$insertNodeToNearestRoot:()=>F3,$insertNodeToNearestRootAtCaret:()=>pE,$isEditorIsNestedEditor:()=>q3,$lastToFirstIterator:()=>Nx,$restoreEditorState:()=>O3,$reverseDfs:()=>E3,$reverseDfsIterator:()=>fE,$splitNode:()=>VP,$unwrapAndFilterDescendants:()=>V3,$unwrapNode:()=>j3,$wrapNodeInElement:()=>B3,CAN_USE_BEFORE_INPUT:()=>x3,CAN_USE_DOM:()=>iE,IS_ANDROID:()=>C3,IS_ANDROID_CHROME:()=>b3,IS_APPLE:()=>w3,IS_APPLE_WEBKIT:()=>S3,IS_CHROME:()=>I3,IS_FIREFOX:()=>sE,IS_IOS:()=>T3,IS_SAFARI:()=>k3,addClassNamesToElement:()=>Su,calculateZoomLevel:()=>K3,isBlockDomNode:()=>RA,isHTMLAnchorElement:()=>_A,isHTMLElement:()=>Vm,isInlineDomNode:()=>Iu,isMimeType:()=>lE,makeStateWrapper:()=>Q3,markSelection:()=>aE,mediaFileReader:()=>L3,mergeRegister:()=>ca,objectKlassEquals:()=>z3,positionNodeOnRange:()=>rE,registerNestedElementResolver:()=>D3,removeClassNamesFromElement:()=>Wm,selectionAlwaysOnDisplay:()=>y3});function eg(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 Br=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,c3=Br&&"documentMode"in document?document.documentMode:null,nE=Br&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),u3=Br&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),f3=!(!Br||!("InputEvent"in window)||c3)&&"getTargetRanges"in new window.InputEvent("input"),p3=Br&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),m3=Br&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,oE=Br&&/Android/.test(navigator.userAgent),Mx=Br&&/^(?=.*Chrome).*/i.test(navigator.userAgent),g3=Br&&oE&&Mx,h3=Br&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&nE&&!Mx;function ua(e){return`${e}px`}var v3={attributes:!0,characterData:!0,childList:!0,subtree:!0};function rE(e,t,n){let o=null,r=null,a=null,i=[],s=document.createElement("div");function l(){o===null&&eg(182),r===null&&eg(183);let{left:f,top:p}=r.getBoundingClientRect(),m=ZA(e,t);var g,h;s.isConnected||(h=s,(g=r).insertBefore(h,g.firstChild));let v=!1;for(let y=0;y<m.length;y++){let x=m[y],C=i[y]||document.createElement("div"),w=C.style;w.position!=="absolute"&&(w.position="absolute",v=!0);let T=ua(x.left-f);w.left!==T&&(w.left=T,v=!0);let S=ua(x.top-p);w.top!==S&&(C.style.top=S,v=!0);let L=ua(x.width);w.width!==L&&(C.style.width=L,v=!0);let k=ua(x.height);w.height!==k&&(C.style.height=k,v=!0),C.parentNode!==s&&(s.append(C),v=!0),i[y]=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(!Vm(m))return d();d(),o=p,r=m,a=new MutationObserver(g=>{let h=e.getRootElement(),v=h&&h.parentElement;if(h!==o||v!==r)return f();for(let y of g)if(!s.contains(y.target))return l()}),a.observe(m,v3),l()});return()=>{c(),d()}}function eE(e,t,n){if(e.type!=="text"&&We(t)){let o=t.getDOMSlot(n);return[o.element,o.getFirstChildOffset()+e.offset]}return[AA(n)||n,e.offset]}function aE(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(!Ne(f))return n=null,r=null,a=null,s=null,l(),void(l=()=>{});let[p,m]=(function(k){let I=k.getStartEndPoints();return k.isBackward()?[I[1],I[0]]:I})(f),g=p.getNode(),h=g.getKey(),v=p.offset,y=m.getNode(),x=y.getKey(),C=m.offset,w=e.getElementByKey(h),T=e.getElementByKey(x),S=n===null||w!==o||v!==r||h!==n.getKey(),L=a===null||T!==i||C!==s||x!==a.getKey();if((S||L)&&w!==null&&T!==null){let k=(function(I,P,E,_,A,H,V){let J=(I._window?I._window.document:document).createRange();return J.setStart(...eE(P,E,_)),J.setEnd(...eE(A,H,V)),J})(e,p,g,w,m,y,T);l(),l=rE(e,k,I=>{if(t===void 0)for(let P of I){let E=P.style;E.background!=="Highlight"&&(E.background="Highlight"),E.color!=="HighlightText"&&(E.color="HighlightText"),E.marginTop!==ua(-1.5)&&(E.marginTop=ua(-1.5)),E.paddingTop!==ua(4)&&(E.paddingTop=ua(4)),E.paddingBottom!==ua(0)&&(E.paddingBottom=ua(0))}else t(I)})}n=g,o=w,r=v,a=y,i=T,s=C})}return d(e.getEditorState()),ca(e.registerUpdateListener(({editorState:c})=>d(c)),()=>{l()})}function y3(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=aE(e,t))};return document.addEventListener("selectionchange",o),()=>{n!==null&&n(),document.removeEventListener("selectionchange",o)}}var x3=f3,iE=Br,C3=oE,b3=g3,w3=nE,S3=h3,I3=Mx,sE=u3,T3=m3,k3=p3;function lE(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function L3(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()}),lE(l,t)?d.readAsDataURL(l):i()};i()})}function P3(e,t){return Array.from(dE(e,t))}function A3(e){return e?e.getAdjacentCaret():null}function E3(e,t){return Array.from(fE(e,t))}function dE(e,t){return cE("next",e,t)}function tE(e,t){let n=Vs(ja(e,t));return n&&n[0]}function cE(e,t,n){let o=Rt(),r=t||o,a=We(r)?Wi(r,e):ja(r,e),i=uE(r),s=n?sx(dx(ja(n,e)))||tE(n,e):tE(r,e),l=i;return yx({hasNext:d=>d!==null,initial:a,map:d=>({depth:l,node:d.origin}),step:d=>{if(d.isSameNodeCaret(s))return null;yu(d)&&l++;let c=Vs(d);return!c||c[0].isSameNodeCaret(s)?null:(l+=c[1],c[0])}})}function R3(e){let t=Vs(ja(e,"next"));return t&&[t[0].origin,t[1]]}function uE(e){let t=-1;for(let n=e;n!==null;n=n.getParent())t++;return t}function M3(e){let t=dx(ja(e,"previous")),n=Vs(t,"root");return n&&n[0].origin}function fE(e,t){return cE("previous",e,t)}function N3(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function _3(e){let t=Ga(e,n=>We(n)&&!n.isInline());return We(t)||eg(4,e.__key),t}function D3(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 O3(e,t){let n=new Map,o=e._pendingEditorState;for(let[a,i]of t._nodeMap)n.set(a,Im(i));o&&(o._nodeMap=n),e._dirtyType=2;let r=t._selection;Dr(r===null?null:r.clone())}function F3(e){let t=$e()||vu(),n;if(Ne(t))n=ud(t.focus,"next");else{if(t!=null){let i=t.getNodes(),s=i[i.length-1];s&&(n=ja(s,"next"))}n=n||Wi(Rt(),"previous").getFlipped().insert(fr())}let o=pE(e,n),r=sx(o),a=yu(r)?zP(r):o;return KP(RP(a)),e.getLatest()}function pE(e,t,n){let o=lx(t,"next");for(let r=o;r;r=qP(r,n))o=r;return Pm(o)&&eg(283),o.insert(e.isInline()?fr().append(e):e),lx(ja(e.getLatest(),"next"),t.direction)}function B3(e,t){let n=t();return e.replace(n),n.append(e),n}function z3(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function U3(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 H3(e){let t=$e();if(!Ne(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=Ga(a,d=>We(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 $3(e,t){Wi(e,"next").insert(t)}var Rx=!(sE||!iE)&&void 0;function K3(e,t=!1){let n=1;if((function(){if(Rx===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"),Rx=o.getBoundingClientRect().width===r.width,document.body.removeChild(o)}return Rx})()||t)for(;e;)n*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return n}function q3(e){return e._parentEditor!==null}function V3(e,t){return mE(e,t,null)}function mE(e,t,n){let o=!1;for(let r of Nx(e))t(r)?n!==null&&n(r):(o=!0,We(r)&&mE(r,t,n||(a=>r.insertAfter(a))),r.remove());return o}function W3(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(We(r))for(let a of Nx(r))o.push(a);return n}function G3(e){return gE(Wi(e,"next"))}function Nx(e){return gE(Wi(e,"previous"))}function gE(e){return yx({hasNext:BP,initial:e.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function j3(e){$P(ja(e,"next")).splice(1,e.getChildren())}function Q3(e){let t=o=>km(o,e),n=(o,r)=>Em(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 Qe=_x,ose=Qe.$descendantsMatching,rse=Qe.$dfs,ase=Qe.$dfsIterator,ise=Qe.$filter,sse=Qe.$findMatchingParent,lse=Qe.$firstToLastIterator,dse=Qe.$getAdjacentCaret,cse=Qe.$getAdjacentSiblingOrParentSiblingCaret,use=Qe.$getDepth,hE=Qe.$getNearestBlockElementAncestorOrThrow,fse=Qe.$getNearestNodeOfType,pse=Qe.$getNextRightPreorderNode,mse=Qe.$getNextSiblingOrParentSibling,vE=Qe.$handleIndentAndOutdent,gse=Qe.$insertFirst,hse=Qe.$insertNodeToNearestRoot,vse=Qe.$insertNodeToNearestRootAtCaret,yse=Qe.$isEditorIsNestedEditor,xse=Qe.$lastToFirstIterator,Cse=Qe.$restoreEditorState,bse=Qe.$reverseDfs,wse=Qe.$reverseDfsIterator,Sse=Qe.$splitNode,Ise=Qe.$unwrapAndFilterDescendants,Tse=Qe.$unwrapNode,kse=Qe.$wrapNodeInElement,Lse=Qe.CAN_USE_BEFORE_INPUT,Pse=Qe.CAN_USE_DOM,Ase=Qe.IS_ANDROID,Ese=Qe.IS_ANDROID_CHROME,Rse=Qe.IS_APPLE,Mse=Qe.IS_APPLE_WEBKIT,Nse=Qe.IS_CHROME,_se=Qe.IS_FIREFOX,Dse=Qe.IS_IOS,Ose=Qe.IS_SAFARI,Fse=Qe.addClassNamesToElement,Bse=Qe.calculateZoomLevel,Dx=Qe.isBlockDomNode,zse=Qe.isHTMLAnchorElement,yE=Qe.isHTMLElement,Use=Qe.isInlineDomNode,Hse=Qe.isMimeType,$se=Qe.makeStateWrapper,Kse=Qe.markSelection,qse=Qe.mediaFileReader,Qa=Qe.mergeRegister,Tu=Qe.objectKlassEquals,Vse=Qe.positionNodeOnRange,Wse=Qe.registerNestedElementResolver,Gse=Qe.removeClassNamesFromElement,jse=Qe.selectionAlwaysOnDisplay;var Ox={};En(Ox,{ContentEditable:()=>Y3,ContentEditableElement:()=>bE});he();var CE=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?Ce:W;function X3({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:g,id:h,role:v="textbox",spellCheck:y=!0,style:x,tabIndex:C,"data-testid":w,...T},S){let[L,k]=Q(e.isEditable()),I=R(E=>{E&&E.ownerDocument&&E.ownerDocument.defaultView?e.setRootElement(E):e.setRootElement(null)},[e]),P=q(()=>(function(...E){return _=>{for(let A of E)typeof A=="function"?A(_):A!=null&&(A.current=_)}})(S,I),[I,S]);return CE(()=>(k(e.isEditable()),e.registerEditableListener(E=>{k(E)})),[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:g,contentEditable:L,"data-testid":w,id:h,ref:P,role:v,spellCheck:y,style:x,tabIndex:C,...T})}var bE=Wn(X3);function xE(e){return e.getEditorState().read(Qm(e.isComposing()))}var Y3=Wn(J3);function J3(e,t){let{placeholder:n,...o}=e,[r]=fn();return b(ke,{children:[u(bE,{editor:r,...o,ref:t}),n!=null&&u(Z3,{editor:r,content:n})]})}function Z3({content:e,editor:t}){let n=(function(i){let[s,l]=Q(()=>xE(i));return CE(()=>{function d(){let c=xE(i);l(c)}return d(),Qa(i.registerUpdateListener(()=>{d()}),i.registerEditableListener(()=>{d()}))},[i]),s})(t),[o,r]=Q(t.isEditable());if(Ce(()=>(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 wE=Ox,SE=wE.ContentEditable,tle=wE.ContentEditableElement;he();var eq=bt(null),Fx={didCatch:!1,error:null},tg=class extends Aa{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Fx}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(Fx))}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t,n){let{didCatch:o}=this.state,{resetKeys:r}=this.props;o&&n.error!==null&&tq(t.resetKeys,r)&&(this.props.onReset?.({next:r,prev:t.resetKeys,reason:"keys"}),this.setState(Fx))}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=De(o,l);else if(r!==void 0)s=r;else throw i}return De(eq.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}};function tq(e=[],t=[]){return e.length!==t.length||e.some((n,o)=>!Object.is(n,t[o]))}var Bx={};En(Bx,{LexicalErrorBoundary:()=>nq});function nq({children:e,onError:t}){return u(tg,{fallback:u("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}var oq=Bx,IE=oq.LexicalErrorBoundary;var Zx={};En(Zx,{$createHorizontalRuleNode:()=>Jx,$isDecoratorTextNode:()=>BE,$isHorizontalRuleNode:()=>qE,AutoFocusExtension:()=>iq,ClearEditorExtension:()=>sq,DecoratorTextExtension:()=>pq,DecoratorTextNode:()=>Pu,EditorStateExtension:()=>ag,HorizontalRuleExtension:()=>Iq,HorizontalRuleNode:()=>Qs,INSERT_HORIZONTAL_RULE_COMMAND:()=>wq,InitialStateExtension:()=>$E,LexicalBuilder:()=>xd,NodeSelectionExtension:()=>jx,TabIndentationExtension:()=>Tq,applyFormatFromStyle:()=>dq,applyFormatToDom:()=>cq,batch:()=>EE,buildEditorFromExtensions:()=>vq,computed:()=>NE,configExtension:()=>Km,declarePeerDependency:()=>PA,defineExtension:()=>Rn,effect:()=>ji,getExtensionDependencyFromEditor:()=>xq,getKnownTypesAndNodes:()=>lq,getPeerDependencyFromEditor:()=>KE,getPeerDependencyFromEditorOrThrow:()=>Cq,namedSignals:()=>sg,registerClearEditor:()=>OE,registerTabIndentation:()=>WE,safeCast:()=>Fr,shallowMergeConfig:()=>Gm,signal:()=>yd,untracked:()=>qx,watchedSignal:()=>Xx});var rq=Symbol.for("preact-signals");function ig(){if(Gi>1)return void Gi--;let e,t=!1;for(;Lu!==void 0;){let n=Lu;for(Lu=void 0,Vx++;n!==void 0;){let o=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&RE(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(Vx=0,Gi--,t)throw e}function EE(e){if(Gi>0)return e();Gi++;try{return e()}finally{ig()}}var Kt,Lu;function qx(e){let t=Kt;Kt=void 0;try{return e()}finally{Kt=t}}var Gi=0,Vx=0,rg=0;function TE(e){if(Kt===void 0)return;let t=e.n;return t===void 0||t.t!==Kt?(t={i:0,S:e,p:Kt.s,n:void 0,t:Kt,e:void 0,x:void 0,r:t},Kt.s!==void 0&&(Kt.s.n=t),Kt.s=t,e.n=t,32&Kt.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=Kt.s,t.n=void 0,Kt.s.n=t,Kt.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 yd(e,t){return new Lo(e,t)}function RE(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 kE(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 ME(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 js(e,t){Lo.call(this,void 0),this.x=e,this.s=void 0,this.g=rg-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function NE(e,t){return new js(e,t)}function _E(e){let t=e.u;if(e.u=void 0,typeof t=="function"){Gi++;let n=Kt;Kt=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Qx(e),o}finally{Kt=n,ig()}}}function Qx(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,_E(e)}function aq(e){if(Kt!==this)throw new Error("Out-of-order effect");ME(this),Kt=e,this.f&=-2,8&this.f&&Qx(this),ig()}function vd(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 ji(e,t){let n=new vd(e,t);try{n.c()}catch(r){throw n.d(),r}let o=n.d.bind(n);return o[Symbol.dispose]=o,o}function sg(e,t={}){let n={};for(let o in e){let r=t[o],a=yd(r===void 0?e[o]:r);n[o]=a}return n}Lo.prototype.brand=rq,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:qx(()=>{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&&qx(()=>{var o;(o=this.Z)==null||o.call(this)}))}},Lo.prototype.subscribe=function(e){return ji(()=>{let t=this.value,n=Kt;Kt=void 0;try{e(t)}finally{Kt=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=Kt;Kt=void 0;try{return this.value}finally{Kt=e}},Object.defineProperty(Lo.prototype,"value",{get(){let e=TE(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Vx>100)throw new Error("Cycle detected");this.v=e,this.i++,rg++,Gi++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{ig()}}}}),js.prototype=new Lo,js.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===rg))return!0;if(this.g=rg,this.f|=1,this.i>0&&!RE(this))return this.f&=-2,!0;let e=Kt;try{kE(this),Kt=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 Kt=e,ME(this),this.f&=-2,!0},js.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)},js.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)}},js.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(js.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");let e=TE(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),vd.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()}},vd.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,_E(this),kE(this),Gi++;let e=Kt;return Kt=this,aq.bind(this,e)},vd.prototype.N=function(){2&this.f||(this.f|=2,this.o=Lu,Lu=this)},vd.prototype.d=function(){this.f|=8,1&this.f||Qx(this)},vd.prototype.dispose=function(){this.d()};var iq=Rn({build:(e,t,n)=>sg(t),config:Fr({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){let o=n.getOutput();return ji(()=>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 DE(){let e=Rt(),t=$e(),n=fr();e.clear(),e.append(n),t!==null&&n.select(),Ne(t)&&(t.format=0)}function OE(e,t=DE){return e.registerCommand(Rm,n=>(e.update(t),!0),nn)}var sq=Rn({build:(e,t,n)=>sg(t),config:Fr({$onClear:DE}),name:"@lexical/extension/ClearEditor",register(e,t,n){let{$onClear:o}=n.getOutput();return ji(()=>OE(e,o.value))}});function lq(e){let t=new Set,n=new Set;for(let o of FE(e)){let r=typeof o=="function"?o:o.replace;t.add(r.getType()),n.add(r)}return{nodes:n,types:t}}function FE(e){return(typeof e.nodes=="function"?e.nodes():e.nodes)||[]}var zx=LA("format",{parse:e=>typeof e=="number"?e:0}),Pu=class extends Or{$config(){return this.config("decorator-text",{extends:Or,stateConfigs:[{flat:!0,stateConfig:zx}]})}getFormat(){return km(this,zx)}getFormatFlags(t,n){return xx(this.getFormat(),t,n)}hasFormat(t){let n=SA[t];return(this.getFormat()&n)!==0}setFormat(t){return Em(this,zx,t)}toggleFormat(t){let n=this.getFormat(),o=xx(n,t,null);return this.setFormat(o)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function BE(e){return e instanceof Pu}function dq(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 cq(e,t,n=fq){for(let[o,r]of Object.entries(n))e.hasFormat(r)&&(t=uq(t,o));return t}function uq(e,t){let n=document.createElement(t);return n.appendChild(e),n}var fq={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},pq=Rn({name:"@lexical/extension/DecoratorText",nodes:()=>[Pu],register:(e,t,n)=>e.registerCommand(rA,o=>{let r=$e();if(cx(r)||Ne(r))for(let a of r.getNodes())BE(a)&&a.toggleFormat(o);return!1},gd)});function Xx(e,t){let n;return yd(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}var ag=Rn({build:e=>Xx(()=>e.getEditorState(),t=>e.registerUpdateListener(n=>{t.value=n.editorState})),name:"@lexical/extension/EditorState"});function Gt(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 zE(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]=zE(n[r],o[r]);return e}return t}var Yx=0,Wx=1,UE=2,Ux=3,ng=4,hd=5,Hx=6,ku=7;function $x(e){return e.id===Yx}function HE(e){return e.id===UE}function mq(e){return(function(t){return t.id===Wx})(e)||Gt(305,String(e.id),String(Wx)),Object.assign(e,{id:UE})}var gq=new Set,Gx=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,n){this.builder=t,this.extension=n,this.configs=new Set,this.state={id:Yx}}mergeConfigs(){let t=this.extension.config||{},n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Gm;for(let o of this.configs)t=n(t,o);return t}init(t){let n=this.state;HE(n)||Gt(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:Ux,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:ng,initResult:l,registerState:d})})(a,i,r)}build(t){let n=this.state,o;n.id!==ng&&Gt(307,String(n.id),String(hd)),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:hd,output:i,registerState:s})})(n,o,r)}register(t,n){this._signal=n;let o=this.state;o.id!==hd&&Gt(308,String(o.id),String(hd));let r=this.extension.register&&this.extension.register(t,o.config,o.registerState);return this.state=(function(a){return Object.assign(a,{id:Hx})})(o),()=>{let a=this.state;a.id!==ku&&Gt(309,String(o.id),String(ku)),this.state=(function(i){return Object.assign(i,{id:hd})})(a),r&&r()}}afterRegistration(t){let n=this.state,o;return n.id!==Hx&&Gt(310,String(n.id),String(Hx)),this.extension.afterRegistration&&(o=this.extension.afterRegistration(t,n.config,n.registerState)),this.state=(function(r){return Object.assign(r,{id:ku})})(n),o}getSignal(){return this._signal===void 0&&Gt(311),this._signal}getInitResult(){this.extension.init===void 0&&Gt(312,this.extension.name);let t=this.state;return(function(n){return n.id>=ng})(t)||Gt(313,String(t.id),String(ng)),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>=Ux})(t)||Gt(314,String(t.id),String(Ux)),{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&&Gt(315,this.extension.name,t.name),n.getExtensionInitDependency()}getDependency(t){let n=this.builder.getExtensionRep(t);return n===void 0&&Gt(315,this.extension.name,t.name),n.getExtensionDependency()}getState(){let t=this.state;return(function(n){return n.id>=ku})(t)||Gt(316,String(t.id),String(ku)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||gq}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>=hd})(t)||Gt(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}},LE={tag:Qo};function hq(){let e=Rt();e.isEmpty()&&e.append(fr())}var $E=Rn({config:Fr({setOptions:LE,updateOptions:LE}),init:({$initialEditorState:e=hq})=>({$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(_P(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:[xA,$m,pA,IA,hA]}),PE=Symbol.for("@lexical/extension/LexicalBuilder");function vq(...e){return xd.fromExtensions(e).buildEditor()}function AE(){}function yq(e){throw e}function og(e){return Array.isArray(e)?e:[e]}var Kx="0.41.0+prod.esm",xd=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=Kx,this.roots=t;for(let n of t)this.addExtension(n)}static fromExtensions(t){let n=[og($E)];for(let o of t)n.push(og(o));return new e(n)}static maybeFromEditor(t){let n=t[PE];return n&&(n.PACKAGE_VERSION!==Kx&&Gt(292,n.PACKAGE_VERSION,Kx),n instanceof e||Gt(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Gt(294),n}constructEditor(){let{$initialEditorState:t,onError:n,...o}=this.buildCreateEditorArgs(),r=Object.assign(qm({...o,...n?{onError:a=>{n(a,r)}}:{}}),{[PE]:this});for(let a of this.sortedExtensionReps())a.build(r);return r}buildEditor(){let t=AE;function n(){try{t()}finally{t=AE}}let o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=ca(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&&Gt(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&&Gt(296);let n=og(t),[o]=n;typeof o.name!="string"&&Gt(297,typeof o.name);let r=this.extensionNameMap.get(o.name);if(r!==void 0&&r.extension!==o&&Gt(298,o.name),!r){r=new Gx(this,o),this.extensionNameMap.set(o.name,r);let a=this.conflicts.get(o.name);typeof a=="string"&&Gt(299,o.name,a);for(let i of o.conflictsWith||[])this.extensionNameMap.has(i)&&Gt(299,o.name,i),this.conflicts.set(i,o.name);for(let i of o.dependencies||[]){let s=og(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(HE(a))return;let i=o.extension.name;var s;$x(a)||Gt(300,i,r||"[unknown]"),$x(s=a)||Gt(304,String(s.id),String(Yx)),a=Object.assign(s,{id:Wx}),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=mq(a),o.state=a,t.push(o)};for(let o of this.extensionNameMap.values())$x(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&&Gt(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 ca(...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 FE(f)){if(typeof p!="function"){let m=o.get(p.replace);m&&Gt(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&&zE(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=yq),t}};function xq(e,t){let n=xd.fromEditor(e).getExtensionRep(t);return n===void 0&&Gt(303,t.name),n.getExtensionDependency()}function KE(e,t){let n=xd.fromEditor(e).extensionNameMap.get(t);return n?n.getExtensionDependency():void 0}function Cq(e,t){let n=KE(e,t);return n===void 0&&Gt(291,t),n}var bq=new Set,jx=Rn({build(e,t,n){let o=n.getDependency(ag).output,r=yd({watchedNodeKeys:new Map}),a=Xx(()=>{},()=>ji(()=>{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=fd(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=NE(()=>(a.value||bq).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:[ag],name:"@lexical/extension/NodeSelection"}),wq=kA("INSERT_HORIZONTAL_RULE_COMMAND"),Qs=class e extends Or{static getType(){return"horizontalrule"}static clone(t){return new e(t.__key)}static importJSON(t){return Jx().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:Sq,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){let n=document.createElement("hr");return Su(n,t.theme.hr),n}getTextContent(){return`
3840
+ `}isInline(){return!1}updateDOM(){return!1}};function Sq(){return{node:Jx()}}function Jx(){return IP(Qs)}function qE(e){return e instanceof Qs}var Iq=Rn({dependencies:[ag,jx],name:"@lexical/extension/HorizontalRule",nodes:()=>[Qs],register(e,t,n){let{watchNodeKey:o}=n.getDependency(jx).output,r=yd({nodeSelections:new Map}),a=e._config.theme.hrSelected??"selected";return ca(e.registerCommand(jP,i=>{if(NA(i.target)){let s=MP(i.target);if(qE(s))return(function(l,d=!1){let c=$e(),f=l.isSelected(),p=l.getKey(),m;d&&cx(c)?m=c:(m=TP(),Dr(m)),f?m.delete(p):m.add(p)})(s,i.shiftKey),!0}return!1},gd),e.registerMutationListener(Qs,(i,s)=>{EE(()=>{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:yd(m),selectedSignal:o(c)}))}l&&(r.value={nodeSelections:d})})}),ji(()=>{let i=[];for(let{domNode:s,selectedSignal:l}of r.value.nodeSelections.values())i.push(ji(()=>{let d=s.value;d&&(l.value?Su(d,a):Wm(d,a))}));return ca(...i)}))}});function VE(e){return e.canBeEmpty()}function WE(e,t,n=VE){return ca(e.registerCommand(Um,o=>{let r=$e();if(!Ne(r))return!1;o.preventDefault();let a=(function(i){if(i.getNodes().filter(p=>pd(p)&&p.canIndent()).length>0)return!0;let s=i.anchor,l=i.focus,d=l.isBefore(s)?l:s,c=d.getNode(),f=hE(c);if(f.canIndent()){let p=f.getKey(),m=qs();if(m.anchor.set(p,0,"element"),m.focus.set(p,0,"element"),m=UP(m),m.anchor.is(d))return!0}return!1})(r)?o.shiftKey?mA:px:sA;return e.dispatchCommand(a,void 0)},nn),e.registerCommand(px,()=>{let o=typeof t=="number"?t:t?t.peek():null,r=$e();if(!Ne(r))return!1;let a=typeof n=="function"?n:n.peek();return vE(i=>{if(a(i)){let s=i.getIndent()+1;(!o||s<o)&&i.setIndent(s)}})},Mm))}var Tq=Rn({build:(e,t,n)=>sg(t),config:Fr({$canIndent:VE,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){let{disabled:o,maxIndent:r,$canIndent:a}=n.getOutput();return ji(()=>{if(!o.value)return WE(e,r,a)})}});var Tt=Zx,ule=Tt.$createHorizontalRuleNode,fle=Tt.$isDecoratorTextNode,ple=Tt.$isHorizontalRuleNode,mle=Tt.AutoFocusExtension,gle=Tt.ClearEditorExtension,hle=Tt.DecoratorTextExtension,vle=Tt.DecoratorTextNode,yle=Tt.EditorStateExtension,xle=Tt.HorizontalRuleExtension,Cle=Tt.HorizontalRuleNode,ble=Tt.INSERT_HORIZONTAL_RULE_COMMAND,wle=Tt.InitialStateExtension,GE=Tt.LexicalBuilder,Sle=Tt.NodeSelectionExtension,Ile=Tt.TabIndentationExtension,Tle=Tt.applyFormatFromStyle,kle=Tt.applyFormatToDom,jE=Tt.batch,Lle=Tt.buildEditorFromExtensions,Ple=Tt.computed,Ale=Tt.configExtension,Ele=Tt.declarePeerDependency,Rle=Tt.defineExtension,Au=Tt.effect,Mle=Tt.getExtensionDependencyFromEditor,Nle=Tt.getKnownTypesAndNodes,QE=Tt.getPeerDependencyFromEditor,_le=Tt.getPeerDependencyFromEditorOrThrow,lg=Tt.namedSignals,Dle=Tt.registerClearEditor,Ole=Tt.registerTabIndentation,Fle=Tt.safeCast,Ble=Tt.shallowMergeConfig,zle=Tt.signal,Ule=Tt.untracked,Hle=Tt.watchedSignal;var eC={};En(eC,{HistoryExtension:()=>dg,SharedHistoryExtension:()=>Pq,createEmptyHistoryState:()=>JE,registerHistory:()=>YE});function kq(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(!(Ne(a)&&Ne(i)&&i.isCollapsed()&&a.isCollapsed()))return 0;let s=(function(y,x,C){let w=y._nodeMap,T=[];for(let S of x){let L=w.get(S);L!==void 0&&T.push(L)}for(let[S,L]of C){if(!L)continue;let k=w.get(S);k===void 0||xu(k)||T.push(k)}return T})(t,n,o);if(s.length===0)return 0;if(s.length>1){let y=t._nodeMap,x=y.get(a.anchor.key),C=y.get(i.anchor.key);return x&&C&&!e._nodeMap.has(x.__key)&&dt(x)&&x.__text.length===1&&a.anchor.offset===1?2:0}let l=s[0],d=e._nodeMap.get(l.__key);if(!dt(d)||!dt(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 g=p.offset,h=m.offset,v=f.length-c.length;return v===1&&h===g-1?2:v===-1&&h===g+1?3:v===-1&&h===g?4:0}function Lq(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(XP)&&(r=n,a=o,i=s),p.has(Dm))return o=0,n=m,2;p.has(QP)&&i&&(n=r,o=a,s=i);let g=kq(s,l,c,f,e.isComposing()),h=(()=>{let v=d===null||d.editor===e,y=p.has(aA);if(!y&&v&&p.has(Qo))return 0;if(g===1)return 2;if(s===null)return 1;let x=l._selection;if(!(c.size>0||f.size>0))return x!==null?0:2;let C=typeof t=="number"?t:t.peek();return y===!1&&g!==0&&g===o&&m<n+C&&v||c.size===1&&(function(w,T,S){let L=T._nodeMap.get(w),k=S._nodeMap.get(w),I=T._selection,P=S._selection;return!(Ne(I)&&Ne(P)&&I.anchor.type==="element"&&I.focus.type==="element"&&P.anchor.type==="text"&&P.focus.type==="text"||!dt(L)||!dt(k)||L.__parent!==k.__parent)&&JSON.stringify(T.read(()=>L.exportJSON()))===JSON.stringify(S.read(()=>k.exportJSON()))})(Array.from(c)[0],s,l)?0:1})();return n=m,o=g,h}}function XE(e){e.undoStack=[],e.redoStack=[],e.current=null}function YE(e,t,n){let o=Lq(e,n);return Qa(e.registerCommand(TA,()=>((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(Cu,!0)),l.length===0&&a.dispatchCommand(bu,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:Dm})}})(e,t),!0),nn),e.registerCommand(vA,()=>((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(bu,!0));let c=s.pop();s.length===0&&a.dispatchCommand(Cu,!1),i.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:Dm})}})(e,t),!0),nn),e.registerCommand(Rm,()=>(XE(t),!1),nn),e.registerCommand(GP,()=>(XE(t),e.dispatchCommand(Cu,!1),e.dispatchCommand(bu,!1),!0),nn),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 g=o(i,a,c,s,l,d);if(g===1)f.length!==0&&(t.redoStack=[],e.dispatchCommand(Cu,!1)),c!==null&&(p.push({...c}),e.dispatchCommand(bu,!0));else if(g===2)return;t.current={editor:e,editorState:a}}))}function JE(){return{current:null,redoStack:[],undoStack:[]}}var dg=Rn({build:(e,{delay:t,createInitialHistoryState:n,disabled:o})=>lg({delay:t,disabled:o,historyState:n(e)}),config:Fr({createInitialHistoryState:JE,delay:300,disabled:typeof window>"u"}),name:"@lexical/history/History",register:(e,t,n)=>{let o=n.getOutput();return Au(()=>o.disabled.value?void 0:YE(e,o.historyState.value,o.delay))}}),Pq=Rn({dependencies:[Km(dg,{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(dg),r=(function(i){return i?QE(i,dg.name):null})(e._parentEditor);if(!r)return()=>{};let a=r.output;return Au(()=>jE(()=>{o.delay.value=a.delay.value,o.historyState.value=a.historyState.value,o.disabled.value=a.disabled.value}))}});var cg=eC,Wle=cg.HistoryExtension,Gle=cg.SharedHistoryExtension,ug=cg.createEmptyHistoryState,ZE=cg.registerHistory;var tC={};En(tC,{HistoryPlugin:()=>Aq,createEmptyHistoryState:()=>ug});he();function Aq({delay:e,externalHistoryState:t}){let[n]=fn();return(function(o,r,a=1e3){let i=q(()=>r||ug(),[r]);W(()=>ZE(o,i,a),[a,o,i])})(n,t,e),null}var eR=tC,tR=eR.HistoryPlugin,nR=eR.createEmptyHistoryState;var nC={};En(nC,{OnChangePlugin:()=>Rq});he();var Eq=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?Ce:W;function Rq({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){let[o]=fn();return Eq(()=>{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(Qo)||s.isEmpty()||n(r,o,l)})},[o,e,t,n]),null}var Mq=nC,oR=Mq.OnChangePlugin;var oC={};En(oC,{useLexicalEditable:()=>Dq});he();var Nq=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?Ce:W;function _q(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function Dq(){return(function(e){let[t]=fn(),n=q(()=>e(t),[t,e]),[o,r]=Q(()=>n.initialValueFn()),a=N(o);return Nq(()=>{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})(_q)}var Oq=oC,rR=Oq.useLexicalEditable;var rC={};En(rC,{ReactProviderExtension:()=>Fq});var Fq=Rn({name:"@lexical/react/ReactProvider"});var Bq=rC,aR=Bq.ReactProviderExtension;var aC={};En(aC,{DragonExtension:()=>zq,registerDragonSupport:()=>iR});function iR(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 g=$e();if(Ne(g)){let h=g.anchor,v=h.getNode(),y=0,x=0;if(dt(v)&&d>=0&&c>=0&&(y=d,x=d+c,g.setTextNodeRange(v,y,v,x)),y===x&&f===""||(g.insertRawText(f),v=h.getNode()),dt(v)){y=p,x=p+m;let C=v.getTextContentSize();y=y>C?C:y,x=x>C?C:x,g.setTextNodeRange(v,y,v,x)}o.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}var zq=Rn({build:(e,t,n)=>lg(t),config:Fr({disabled:typeof window>"u"}),name:"@lexical/dragon",register:(e,t,n)=>Au(()=>n.getOutput().disabled.value?void 0:iR(e))});var sR=aC,lR=sR.DragonExtension,dR=sR.registerDragonSupport;var iC={};En(iC,{$generateHtmlFromNodes:()=>Hq,$generateNodesFromDOM:()=>Uq});function Uq(e,t){let n=MA(t)?t.body.childNodes:t.childNodes,o=[],r=[];for(let a of n)if(!uR.has(a.nodeName)){let i=fR(a,e,r,!1);i!==null&&(o=o.concat(i))}return(function(a){for(let i of a)i.getNextSibling()instanceof fx&&i.insertAfter(Ks());for(let i of a){let s=i.getChildren();for(let l of s)i.insertBefore(l);i.remove()}})(r),o}function Hq(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=Rt().getChildren();for(let r=0;r<o.length;r++)cR(e,o[r],n,t);return n.innerHTML}function cR(e,t,n,o=null){let r=o===null||t.isSelected(o),a=We(t)&&t.excludeFromCopy("html"),i=t;o!==null&&dt(t)&&(i=Zm(o,t,"clone"));let s=We(i)?i.getChildren():[],l=EA(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 g=s[m],h=cR(e,g,p,o);!r&&We(t)&&h&&t.extractWithChild(g,o,"html")&&(r=!0)}if(r&&!a){if((yE(c)||vx(c))&&c.append(p),n.append(c),f){let m=f.call(i,c);m&&(vx(c)?c.replaceChildren(m):c.replaceWith(m))}}else n.append(p);return r}var uR=new Set(["STYLE","SCRIPT"]);function fR(e,t,n,o,r=new Map,a){let i=[];if(uR.has(e.nodeName))return i;let s=null,l=(function(g,h){let{nodeName:v}=g,y=h._htmlConversions.get(v.toLowerCase()),x=null;if(y!==void 0)for(let C of y){let w=C(g);w!==null&&(x===null||(x.priority||0)<=(w.priority||0))&&(x=w)}return x!==null?x.conversion:null})(e,t),d=l?l(e):null,c=null;if(d!==null){c=d.after;let g=d.node;if(s=Array.isArray(g)?g[g.length-1]:g,s!==null){for(let[,h]of r)if(s=h(s,a),!s)break;s&&i.push(...Array.isArray(g)?g:[s])}d.forChild!=null&&r.set(e.nodeName,d.forChild)}let f=e.childNodes,p=[],m=(s==null||!Ws(s))&&(s!=null&&pd(s)||o);for(let g=0;g<f.length;g++)p.push(...fR(f[g],t,n,m,new Map(r),s));return c!=null&&(p=c(p)),Dx(e)&&(p=$q(e,p,m?()=>{let g=new fx;return n.push(g),g}:fr)),s==null?p.length>0?i=i.concat(p):Dx(e)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:Iu(g.nextSibling)&&Iu(g.previousSibling)})(e)&&(i=i.concat(Ks())):We(s)&&s.append(...p),i}function $q(e,t,n){let o=e.style.textAlign,r=[],a=[];for(let i=0;i<t.length;i++){let s=t[i];if(pd(s))o&&!s.getFormat()&&s.setFormat(o),r.push(s);else if(a.push(s),i===t.length-1||i<t.length-1&&pd(t[i+1])){let l=n();l.setFormat(o),l.append(...a),r.push(l),a=[]}}return r}var pR=iC,mR=pR.$generateHtmlFromNodes,gR=pR.$generateNodesFromDOM;var lC={};En(lC,{$generateJSONFromSelectedNodes:()=>CR,$generateNodesFromSerializedNodes:()=>bR,$getClipboardDataFromSelection:()=>SR,$getHtmlContent:()=>vR,$getLexicalContent:()=>yR,$insertDataTransferForPlainText:()=>Kq,$insertDataTransferForRichText:()=>qq,$insertGeneratedNodes:()=>sC,copyToClipboard:()=>Vq,setLexicalClipboardDataTransfer:()=>IR});function fg(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 vR(e,t=$e()){return t==null&&fg(166),Ne(t)&&t.isCollapsed()||t.getNodes().length===0?"":mR(e,t)}function yR(e,t=$e()){return t==null&&fg(166),Ne(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(CR(e,t))}function Kq(e,t){let n=e.getData("text/plain")||e.getData("text/uri-list");n!=null&&t.insertRawText(n)}function qq(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 sC(n,bR(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 sC(n,gR(n,s),t)}catch(s){console.error(s)}let i=a||e.getData("text/uri-list");if(i!=null)if(Ne(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(Ne(d)){let c=s[l];c===`
3841
3841
  `||c===`\r
3842
- `?d.insertParagraph():c===" "?d.insertNodes([LP()]):d.insertText(c)}}}else t.insertRawText(i)}function sC(e,t,n){e.dispatchCommand(CA,{nodes:t,selection:n})||(n.insertNodes(t),(function(o){if(Ne(o)&&o.isCollapsed()){let r=o.anchor,a=null,i=ud(r,"previous");if(i)if(Pm(i))a=i.origin;else{let s=AP(i,Wi(Rt(),"next").getFlipped());for(let l of s){if(dt(l.origin)){a=l.origin;break}if(We(l.origin)&&!l.origin.isInline())break}}if(a&&dt(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 xR(e,t,n,o=[]){let r=t===null||n.isSelected(t),a=We(n)&&n.excludeFromCopy("html"),i=n;t!==null&&dt(i)&&(i=Zm(t,i,"clone"));let s=We(i)?i.getChildren():[],l=(function(d){let c=d.exportJSON(),f=d.constructor;if(c.type!==f.getType()&&fg(58,f.name),We(d)){let p=c.children;Array.isArray(p)||fg(59,f.name)}return c})(i);dt(i)&&i.getTextContentSize()===0&&(r=!1);for(let d=0;d<s.length;d++){let c=s[d],f=xR(e,t,c,l.children);!r&&We(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 CR(e,t){let n=[],o=Rt().getChildren();for(let r=0;r<o.length;r++)xR(e,t,o[r],n);return{namespace:e._config.namespace,nodes:n}}function bR(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n],r=HP(o);dt(r)&&JA(r),t.push(r)}return t}var Cd=null;async function Vq(e,t,n){if(Cd!==null)return!1;if(t!==null)return new Promise((d,c)=>{e.update(()=>{d(hR(e,t,n))})});let o=e.getRootElement(),r=e._window||window,a=r.document,i=hx(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(Nm,p=>(Tu(p,ClipboardEvent)&&(f(),Cd!==null&&(r.clearTimeout(Cd),Cd=null),d(hR(e,p,n))),!0),Mm);Cd=r.setTimeout(()=>{f(),Cd=null,d(!1)},50),a.execCommand("copy"),s.remove()})}function hR(e,t,n){if(n===void 0){let r=hx(e._window),a=$e();if(!a||a.isCollapsed()||!r)return!1;let i=r.anchorNode,s=r.focusNode;if(i!==null&&s!==null&&!DA(e,i,s))return!1;n=SR(a)}t.preventDefault();let o=t.clipboardData;return o!==null&&(IR(o,n),!0)}var wR=[["text/html",vR],["application/x-lexical-editor",yR]];function SR(e=$e()){let t={"text/plain":e?e.getTextContent():""};if(e){let n=Tm();for(let[o,r]of wR){let a=r(n,e);a!==null&&(t[o]=a)}}return t}function IR(e,t){for(let[n]of wR)t[n]===void 0&&e.setData(n,"");for(let n in t){let o=t[n];o!==void 0&&e.setData(n,o)}}var fa=lC,Cde=fa.$generateJSONFromSelectedNodes,bde=fa.$generateNodesFromSerializedNodes,wde=fa.$getClipboardDataFromSelection,TR=fa.$getHtmlContent,Sde=fa.$getLexicalContent,dC=fa.$insertDataTransferForPlainText,Ide=fa.$insertDataTransferForRichText,Tde=fa.$insertGeneratedNodes,kde=fa.copyToClipboard,Lde=fa.setLexicalClipboardDataTransfer;var cC={};En(cC,{PlainTextExtension:()=>Jq,registerPlainText:()=>PR});var Ys=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Wq=Ys&&"documentMode"in document?document.documentMode:null,Gq=Ys&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),jq=!(!Ys||!("InputEvent"in window)||Wq)&&"getTargetRanges"in new window.InputEvent("input"),Qq=Ys&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),kR=Ys&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Xq=Ys&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Yq=Ys&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Gq&&!Xq;function LR(e,t){t.update(()=>{if(e!==null){let n=Tu(e,KeyboardEvent)?null:e.clipboardData,o=$e();if(o!==null&&!o.isCollapsed()&&n!=null){e.preventDefault();let r=TR(t);r!==null&&n.setData("text/html",r),n.setData("text/plain",o.getTextContent())}}})}function PR(e){return Qa(e.registerCommand(_m,t=>{let n=$e();return!!Ne(n)&&(n.deleteCharacter(t),!0)},nn),e.registerCommand(eA,t=>{let n=$e();return!!Ne(n)&&(n.deleteWord(t),!0)},nn),e.registerCommand(ZP,t=>{let n=$e();return!!Ne(n)&&(n.deleteLine(t),!0)},nn),e.registerCommand(YP,t=>{let n=$e();if(!Ne(n))return!1;if(typeof t=="string")n.insertText(t);else{let o=t.dataTransfer;if(o!=null)dC(o,n);else{let r=t.data;r&&n.insertText(r)}}return!0},nn),e.registerCommand(yA,()=>{let t=$e();return!!Ne(t)&&(t.removeText(),!0)},nn),e.registerCommand(mx,t=>{let n=$e();return!!Ne(n)&&(n.insertLineBreak(t),!0)},nn),e.registerCommand(iA,()=>{let t=$e();return!!Ne(t)&&(t.insertLineBreak(),!0)},nn),e.registerCommand(Om,t=>{let n=$e();if(!Ne(n))return!1;let o=t,r=o.shiftKey;return!!Ex(n,!0)&&(o.preventDefault(),Ax(n,r,!0),!0)},nn),e.registerCommand(Fm,t=>{let n=$e();if(!Ne(n))return!1;let o=t,r=o.shiftKey;return!!Ex(n,!1)&&(o.preventDefault(),Ax(n,r,!1),!0)},nn),e.registerCommand(Bm,t=>{let n=$e();return!!Ne(n)&&(!kR||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(_m,!0))},nn),e.registerCommand(cA,t=>{let n=$e();return!!Ne(n)&&(t.preventDefault(),e.dispatchCommand(_m,!1))},nn),e.registerCommand(zm,t=>{let n=$e();if(!Ne(n))return!1;if(t!==null){if((kR||Qq||Yq)&&jq)return!1;t.preventDefault()}return e.dispatchCommand(mx,!1)},nn),e.registerCommand(bA,()=>(Am(),!0),nn),e.registerCommand(Nm,t=>{let n=$e();return!!Ne(n)&&(LR(t,e),!0)},nn),e.registerCommand(JP,t=>{let n=$e();return!!Ne(n)&&((function(o,r){LR(o,r),r.update(()=>{let a=$e();Ne(a)&&a.removeText()})})(t,e),!0)},nn),e.registerCommand(Hm,t=>{let n=$e();return!!Ne(n)&&((function(o,r){o.preventDefault(),r.update(()=>{let a=$e(),i=Tu(o,ClipboardEvent)?o.clipboardData:null;i!=null&&Ne(a)&&dC(i,a)},{tag:gA})})(t,e),!0)},nn),e.registerCommand(nA,t=>{let n=$e();return!!Ne(n)&&(t.preventDefault(),!0)},nn),e.registerCommand(tA,t=>{let n=$e();return!!Ne(n)&&(t.preventDefault(),!0)},nn))}var Jq=Rn({conflictsWith:["@lexical/rich-text"],dependencies:[lR],name:"@lexical/plain-text",register:PR});var AR=cC,_de=AR.PlainTextExtension,ER=AR.registerPlainText;var fC={};En(fC,{PlainTextPlugin:()=>nV});he();var pg=qd(_c(),1);function Zq(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 uC=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?Ce:W;function eV({editor:e,ErrorBoundary:t}){return(function(n,o){let[r,a]=Q(()=>n.getDecorators());return uC(()=>n.registerDecoratorListener(i=>{(0,pg.flushSync)(()=>{a(i)})}),[n]),W(()=>{a(n.getDecorators())},[n]),q(()=>{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(Eh,{fallback:null,children:r[d]})}),f=n.getElementByKey(d);f!==null&&i.push((0,pg.createPortal)(c,f,d))}return i},[o,r,n])})(e,t)}function tV({editor:e,ErrorBoundary:t}){return(function(n){let o=GE.maybeFromEditor(n);if(o&&o.hasExtensionByName(aR.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])o.hasExtensionByName(r)&&Zq(320,r);return!0}return!1})(e)?null:u(eV,{editor:e,ErrorBoundary:t})}function RR(e){return e.getEditorState().read(Qm(e.isComposing()))}function nV({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[o]=fn();return(function(r){uC(()=>Qa(ER(r),dR(r)),[r])})(o),b(ke,{children:[e,u(oV,{content:t}),u(tV,{editor:o,ErrorBoundary:n})]})}function oV({content:e}){let[t]=fn(),n=(function(r){let[a,i]=Q(()=>RR(r));return uC(()=>{function s(){let l=RR(r);i(l)}return s(),Qa(r.registerUpdateListener(()=>{s()}),r.registerEditableListener(()=>{s()}))},[r]),a})(t),o=rR();return n?typeof e=="function"?e(o):e:null}var rV=fC,MR=rV.PlainTextPlugin;function aV(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function iV(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function sV(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function Eu(e){return`[${iV(aV(e))}](${sV(e)})`}he();var lV=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s)/g,dV=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g;var cV=new RegExp("(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,512})\\]\\(([^)\\s]+)\\)(?=\\s)","g"),uV=/^[A-Za-z][A-Za-z0-9+.-]*:/,fV=/^[A-Za-z]:[\\/]/,pV=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function mV(e){let t=[];for(let n of e.matchAll(cV)){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=uV.test(s)&&!fV.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(dV)){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&&pV.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 Ru(e,t={}){let n=mV(e);for(let o of e.matchAll(lV)){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 gV(e){return e.replace(/\r\n/g,`
3843
- `).replace(/^\n+|\n+$/g,"")}function hV(e){return gV(e.text).length>0}function NR(e){return!hV(e)}function vV(e,t){return e.lineStart===e.lineEnd?t("pendingContext.terminalLine",{line:e.lineStart}):t("pendingContext.terminalLines",{start:e.lineStart,end:e.lineEnd})}function _R(e,t){return t("pendingContext.terminalLabel",{terminal:e.terminalLabel,range:vV(e,t)})}function DR(e,t,n){return e<=n&&n<t}function OR(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 FR(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 yV(e,t){return FR(e,n=>n.type!=="text"?!1:t(n.text,n.promptOffset))}function xV(e,t){return yV(e,(n,o)=>{for(let r of Ru(n))if(r.type==="mention"&&t(r,o)===!0)return!0;return!1})}function CV(e){let t=[];if(!e)return t;let n=Ru(e),o=0;for(let r of n)r.start<o||(r.start>o&&OR(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&&OR(t,e.slice(o)),t}function pC(e,t,n){return!e||t>=n?!1:xV(e,(o,r)=>{let a=r+o.start,i=r+o.end,s=a-1,l=i;return!!(s>=0&&/\s/.test(e[s]??"")&&DR(t,n,s)||l<e.length&&/\s/.test(e[l]??"")&&DR(t,n,l))})}function Js(e,t=[]){if(!e)return[];let n=[],o=0;return FR(e,r=>r.type==="text"?(n.push(...CV(r.text)),!1):(n.push({type:"terminal-context",context:t[o]??null}),o+=1,!1)),n}function zR(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:e.modifierKey?"steer":"foreground"}var BR=e=>e.type!=="text";function mC(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function bV(e){return e===" "||e===`
3844
- `||e===" "||e==="\r"||e==="\uFFFC"}function wV(e,t){let n=t-1;for(;n>=0&&!bV(e[n]??"");)n-=1;return n+1}function Xo(e,t){let n=mC(e,t),o=Js(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 UR(e){return e.type==="text"?e.text.length:1}function HR(e,t){let n=e.reduce((o,r)=>o+UR(r),0);return Number.isFinite(t)?Math.max(0,Math.min(n,Math.floor(t))):n}function gr(e,t){return HR(Js(e),t)}function Po(e,t){let n=mC(e,t),o=Js(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 Mu(e,t,n){let o=Js(e);if(!o.some(BR))return!1;let r=HR(o,t),a=0;for(let i of o){if(BR(i)&&(n==="left"&&r===a+1||n==="right"&&r===a))return!0;a+=UR(i)}return!1}function Ao(e,t){let n=mC(e,t),o=e.lastIndexOf(`
3845
- `,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=wV(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 $R(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}}function KR(e){return/mac|iphone|ipad|ipod/i.test(e)}function Nu(){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 gC(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function qR(e){let t=gC(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}var VR="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",WR=`${VR} border border-border/70 bg-accent/40 text-foreground`,SV=`${WR} text-[12px]`,pa=`${WR} text-[0.86em] select-none`,bd="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-['']",hr="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",GR="truncate leading-tight",vr="block self-center truncate leading-tight select-none",jR=`${VR} select-none border border-fuchsia-500/25 bg-fuchsia-500/12 text-[0.86em] text-fuchsia-700 dark:text-fuchsia-300`,QR='<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>',mg="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";he();he();var XR=bt(null),YR=XR.Provider;function jt(){let e=Ut(XR);if(e===null)throw new Error("Composer API has not been provided.");return e}var gg=ve(function(t){let n=jt().pierreIcons,o=n.useSpriteReady();Vd(n.ensureSprite,[n]);let r=q(()=>n.resolveForEntry(t.pathValue,t.kind),[n,t.kind,t.pathValue]);return o?u("svg",{"aria-hidden":"true","data-file-icon":r.symbolId,className:K("size-4 shrink-0",t.className),children:u("use",{href:`#${r.symbolId}`})}):t.kind==="directory"?u(vi,{className:K("size-4 shrink-0 text-icon-muted",t.className)}):u(tc,{className:K("size-4 shrink-0 text-icon-muted",t.className)})});var JR=pa;function ZR(e){return b(ke,{children:[u(gg,{pathValue:e.path,kind:qR(e.path),theme:e.theme,className:hr}),u("span",{className:e.selectable?GR:vr,children:e.label})]})}function eM(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Je,{children:[u(et,{render:b("span",{className:K(pa,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0,children:[u(qo,{className:K(hr,"size-icon-1",o&&"opacity-100")}),u("span",{className:vr,children:t})]})}),u(Ze,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}function tM({context:e}){let{t}=ye(),n=_R(e,t),o=NR(e),r=o?t("pendingContext.terminalExpired",{label:n}):e.text;return u(eM,{label:n,tooltipText:r,expired:o})}function IV(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 TV(e){return e.replaceAll("\\","/")}function ma(e){let t=e.displayName?.trim();return t||IV(e.name)}function nM(e,t){return t?e.filter(n=>n.enabled):[]}function oM(e,t){let n=new Set(t.map(o=>o.name.trim().toLowerCase()));return e.filter(o=>!n.has(o.name.trim().toLowerCase()))}function rM(e){let t=TV(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"}}he();function kV(e){return(e.comment??e.text).replace(/\s+/g," ").trim()}var Xi=class e extends Fr{__quote;__source;static getType(){return"composer-quote"}static clone(t){return new e(t.__quote,t.__source,t.__key)}static importJSON(t){return _u(t.quote,t.source).updateFromJSON(t)}constructor(t,n,o){super(o),this.__quote=t,this.__source=n}exportJSON(){return{...super.exportJSON(),quote:this.__quote,source:this.__source,type:"composer-quote",version:1}}createDOM(){let t=document.createElement("span");return t.className=bd,t}updateDOM(){return!1}getTextContent(){return this.__source}isInline(){return!0}decorate(){return u(LV,{nodeKey:this.getKey(),quote:this.__quote,source:this.__source})}};function _u(e,t){return cd(new Xi(e,t))}function LV(e){let{t}=ye(),[n]=fn(),o=Oa(),r=o?.data.assistantQuotes??null,[a,i]=Q(!1),[s,l]=Q(e.quote.comment??""),[d,c]=Ht(op,o?.threadKey??"",null);W(()=>{d===null||d!==e.source||(c(null),l(e.quote.comment??""),i(!0))},[d,e.quote.comment,e.source,c]);let f=kV(e.quote),p=()=>{if(i(!1),r===null)return;let m=r.withComment(e.quote,s),g=r.serialize(m);g!==null&&n.update(()=>{let h=fd(e.nodeKey);h instanceof Xi&&h.replace(_u(m,g))})};return b(wi,{open:a,onOpenChange:m=>{m&&l(e.quote.comment??""),i(m)},children:[u(Ii,{render:b("span",{className:pa,contentEditable:!1,spellCheck:!1,role:"button",tabIndex:-1,"data-composer-quote-chip":"true","aria-label":t("composer.quote.chipLabel",{text:f}),children:[u(Na,{"aria-hidden":"true",className:hr}),u("span",{className:vr,children:f})]})}),u(Si,{side:"top",align:"start",className:"w-96 max-w-[calc(100vw-2rem)]",children:b("div",{className:"flex flex-col gap-2",children:[u("div",{className:"line-clamp-6 whitespace-pre-wrap border-l-2 border-border ps-2 text-muted-foreground text-sm",children:e.quote.text}),u(cS,{value:s,autoFocus:!0,rows:3,placeholder:t("composer.quote.commentPlaceholder"),"aria-label":t("composer.quote.commentLabel"),onChange:m=>l(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.metaKey||m.ctrlKey)&&(m.preventDefault(),p())}}),b("div",{className:"flex justify-end gap-2",children:[u(ie,{size:"sm",variant:"ghost",onClick:()=>i(!1),children:t("composer.cancel")}),u(ie,{size:"sm",onClick:p,disabled:r===null,children:t("composer.quote.saveComment")})]})]})})]})}function aM(e,t){return e.registerCommand(Hm,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=t.readQuotes?.()??null,a=r?.collect(o)??[],i=Ru(`${o}
3842
+ `?d.insertParagraph():c===" "?d.insertNodes([LP()]):d.insertText(c)}}}else t.insertRawText(i)}function sC(e,t,n){e.dispatchCommand(CA,{nodes:t,selection:n})||(n.insertNodes(t),(function(o){if(Ne(o)&&o.isCollapsed()){let r=o.anchor,a=null,i=ud(r,"previous");if(i)if(Pm(i))a=i.origin;else{let s=AP(i,Wi(Rt(),"next").getFlipped());for(let l of s){if(dt(l.origin)){a=l.origin;break}if(We(l.origin)&&!l.origin.isInline())break}}if(a&&dt(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 xR(e,t,n,o=[]){let r=t===null||n.isSelected(t),a=We(n)&&n.excludeFromCopy("html"),i=n;t!==null&&dt(i)&&(i=Zm(t,i,"clone"));let s=We(i)?i.getChildren():[],l=(function(d){let c=d.exportJSON(),f=d.constructor;if(c.type!==f.getType()&&fg(58,f.name),We(d)){let p=c.children;Array.isArray(p)||fg(59,f.name)}return c})(i);dt(i)&&i.getTextContentSize()===0&&(r=!1);for(let d=0;d<s.length;d++){let c=s[d],f=xR(e,t,c,l.children);!r&&We(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 CR(e,t){let n=[],o=Rt().getChildren();for(let r=0;r<o.length;r++)xR(e,t,o[r],n);return{namespace:e._config.namespace,nodes:n}}function bR(e){let t=[];for(let n=0;n<e.length;n++){let o=e[n],r=HP(o);dt(r)&&JA(r),t.push(r)}return t}var Cd=null;async function Vq(e,t,n){if(Cd!==null)return!1;if(t!==null)return new Promise((d,c)=>{e.update(()=>{d(hR(e,t,n))})});let o=e.getRootElement(),r=e._window||window,a=r.document,i=hx(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(Nm,p=>(Tu(p,ClipboardEvent)&&(f(),Cd!==null&&(r.clearTimeout(Cd),Cd=null),d(hR(e,p,n))),!0),Mm);Cd=r.setTimeout(()=>{f(),Cd=null,d(!1)},50),a.execCommand("copy"),s.remove()})}function hR(e,t,n){if(n===void 0){let r=hx(e._window),a=$e();if(!a||a.isCollapsed()||!r)return!1;let i=r.anchorNode,s=r.focusNode;if(i!==null&&s!==null&&!DA(e,i,s))return!1;n=SR(a)}t.preventDefault();let o=t.clipboardData;return o!==null&&(IR(o,n),!0)}var wR=[["text/html",vR],["application/x-lexical-editor",yR]];function SR(e=$e()){let t={"text/plain":e?e.getTextContent():""};if(e){let n=Tm();for(let[o,r]of wR){let a=r(n,e);a!==null&&(t[o]=a)}}return t}function IR(e,t){for(let[n]of wR)t[n]===void 0&&e.setData(n,"");for(let n in t){let o=t[n];o!==void 0&&e.setData(n,o)}}var fa=lC,Cde=fa.$generateJSONFromSelectedNodes,bde=fa.$generateNodesFromSerializedNodes,wde=fa.$getClipboardDataFromSelection,TR=fa.$getHtmlContent,Sde=fa.$getLexicalContent,dC=fa.$insertDataTransferForPlainText,Ide=fa.$insertDataTransferForRichText,Tde=fa.$insertGeneratedNodes,kde=fa.copyToClipboard,Lde=fa.setLexicalClipboardDataTransfer;var cC={};En(cC,{PlainTextExtension:()=>Jq,registerPlainText:()=>PR});var Xs=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Wq=Xs&&"documentMode"in document?document.documentMode:null,Gq=Xs&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),jq=!(!Xs||!("InputEvent"in window)||Wq)&&"getTargetRanges"in new window.InputEvent("input"),Qq=Xs&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),kR=Xs&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Xq=Xs&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Yq=Xs&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Gq&&!Xq;function LR(e,t){t.update(()=>{if(e!==null){let n=Tu(e,KeyboardEvent)?null:e.clipboardData,o=$e();if(o!==null&&!o.isCollapsed()&&n!=null){e.preventDefault();let r=TR(t);r!==null&&n.setData("text/html",r),n.setData("text/plain",o.getTextContent())}}})}function PR(e){return Qa(e.registerCommand(_m,t=>{let n=$e();return!!Ne(n)&&(n.deleteCharacter(t),!0)},nn),e.registerCommand(eA,t=>{let n=$e();return!!Ne(n)&&(n.deleteWord(t),!0)},nn),e.registerCommand(ZP,t=>{let n=$e();return!!Ne(n)&&(n.deleteLine(t),!0)},nn),e.registerCommand(YP,t=>{let n=$e();if(!Ne(n))return!1;if(typeof t=="string")n.insertText(t);else{let o=t.dataTransfer;if(o!=null)dC(o,n);else{let r=t.data;r&&n.insertText(r)}}return!0},nn),e.registerCommand(yA,()=>{let t=$e();return!!Ne(t)&&(t.removeText(),!0)},nn),e.registerCommand(mx,t=>{let n=$e();return!!Ne(n)&&(n.insertLineBreak(t),!0)},nn),e.registerCommand(iA,()=>{let t=$e();return!!Ne(t)&&(t.insertLineBreak(),!0)},nn),e.registerCommand(Om,t=>{let n=$e();if(!Ne(n))return!1;let o=t,r=o.shiftKey;return!!Ex(n,!0)&&(o.preventDefault(),Ax(n,r,!0),!0)},nn),e.registerCommand(Fm,t=>{let n=$e();if(!Ne(n))return!1;let o=t,r=o.shiftKey;return!!Ex(n,!1)&&(o.preventDefault(),Ax(n,r,!1),!0)},nn),e.registerCommand(Bm,t=>{let n=$e();return!!Ne(n)&&(!kR||navigator.language!=="ko-KR")&&(t.preventDefault(),e.dispatchCommand(_m,!0))},nn),e.registerCommand(cA,t=>{let n=$e();return!!Ne(n)&&(t.preventDefault(),e.dispatchCommand(_m,!1))},nn),e.registerCommand(zm,t=>{let n=$e();if(!Ne(n))return!1;if(t!==null){if((kR||Qq||Yq)&&jq)return!1;t.preventDefault()}return e.dispatchCommand(mx,!1)},nn),e.registerCommand(bA,()=>(Am(),!0),nn),e.registerCommand(Nm,t=>{let n=$e();return!!Ne(n)&&(LR(t,e),!0)},nn),e.registerCommand(JP,t=>{let n=$e();return!!Ne(n)&&((function(o,r){LR(o,r),r.update(()=>{let a=$e();Ne(a)&&a.removeText()})})(t,e),!0)},nn),e.registerCommand(Hm,t=>{let n=$e();return!!Ne(n)&&((function(o,r){o.preventDefault(),r.update(()=>{let a=$e(),i=Tu(o,ClipboardEvent)?o.clipboardData:null;i!=null&&Ne(a)&&dC(i,a)},{tag:gA})})(t,e),!0)},nn),e.registerCommand(nA,t=>{let n=$e();return!!Ne(n)&&(t.preventDefault(),!0)},nn),e.registerCommand(tA,t=>{let n=$e();return!!Ne(n)&&(t.preventDefault(),!0)},nn))}var Jq=Rn({conflictsWith:["@lexical/rich-text"],dependencies:[lR],name:"@lexical/plain-text",register:PR});var AR=cC,_de=AR.PlainTextExtension,ER=AR.registerPlainText;var fC={};En(fC,{PlainTextPlugin:()=>nV});he();var pg=qd(_c(),1);function Zq(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 uC=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?Ce:W;function eV({editor:e,ErrorBoundary:t}){return(function(n,o){let[r,a]=Q(()=>n.getDecorators());return uC(()=>n.registerDecoratorListener(i=>{(0,pg.flushSync)(()=>{a(i)})}),[n]),W(()=>{a(n.getDecorators())},[n]),q(()=>{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(Eh,{fallback:null,children:r[d]})}),f=n.getElementByKey(d);f!==null&&i.push((0,pg.createPortal)(c,f,d))}return i},[o,r,n])})(e,t)}function tV({editor:e,ErrorBoundary:t}){return(function(n){let o=GE.maybeFromEditor(n);if(o&&o.hasExtensionByName(aR.name)){for(let r of["@lexical/plain-text","@lexical/rich-text"])o.hasExtensionByName(r)&&Zq(320,r);return!0}return!1})(e)?null:u(eV,{editor:e,ErrorBoundary:t})}function RR(e){return e.getEditorState().read(Qm(e.isComposing()))}function nV({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[o]=fn();return(function(r){uC(()=>Qa(ER(r),dR(r)),[r])})(o),b(ke,{children:[e,u(oV,{content:t}),u(tV,{editor:o,ErrorBoundary:n})]})}function oV({content:e}){let[t]=fn(),n=(function(r){let[a,i]=Q(()=>RR(r));return uC(()=>{function s(){let l=RR(r);i(l)}return s(),Qa(r.registerUpdateListener(()=>{s()}),r.registerEditableListener(()=>{s()}))},[r]),a})(t),o=rR();return n?typeof e=="function"?e(o):e:null}var rV=fC,MR=rV.PlainTextPlugin;function aV(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function iV(e){return e.replaceAll("\\","\\\\").replaceAll("[","\\[").replaceAll("]","\\]")}function sV(e){return encodeURI(e).replaceAll("(","%28").replaceAll(")","%29").replaceAll("#","%23").replaceAll("?","%3F").replaceAll("\\","%5C")}function Eu(e){return`[${iV(aV(e))}](${sV(e)})`}he();var lV=/(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s)/g,dV=/(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g;var cV=new RegExp("(^|\\s)\\[((?:\\\\.|[^\\]\\\\]){0,512})\\]\\(([^)\\s]+)\\)(?=\\s)","g"),uV=/^[A-Za-z][A-Za-z0-9+.-]*:/,fV=/^[A-Za-z]:[\\/]/,pV=/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;function mV(e){let t=[];for(let n of e.matchAll(cV)){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=uV.test(s)&&!fV.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(dV)){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&&pV.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 Ru(e,t={}){let n=mV(e);for(let o of e.matchAll(lV)){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 gV(e){return e.replace(/\r\n/g,`
3843
+ `).replace(/^\n+|\n+$/g,"")}function hV(e){return gV(e.text).length>0}function NR(e){return!hV(e)}function vV(e,t){return e.lineStart===e.lineEnd?t("pendingContext.terminalLine",{line:e.lineStart}):t("pendingContext.terminalLines",{start:e.lineStart,end:e.lineEnd})}function _R(e,t){return t("pendingContext.terminalLabel",{terminal:e.terminalLabel,range:vV(e,t)})}function DR(e,t,n){return e<=n&&n<t}function OR(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 FR(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 yV(e,t){return FR(e,n=>n.type!=="text"?!1:t(n.text,n.promptOffset))}function xV(e,t){return yV(e,(n,o)=>{for(let r of Ru(n))if(r.type==="mention"&&t(r,o)===!0)return!0;return!1})}function CV(e){let t=[];if(!e)return t;let n=Ru(e),o=0;for(let r of n)r.start<o||(r.start>o&&OR(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&&OR(t,e.slice(o)),t}function pC(e,t,n){return!e||t>=n?!1:xV(e,(o,r)=>{let a=r+o.start,i=r+o.end,s=a-1,l=i;return!!(s>=0&&/\s/.test(e[s]??"")&&DR(t,n,s)||l<e.length&&/\s/.test(e[l]??"")&&DR(t,n,l))})}function Ys(e,t=[]){if(!e)return[];let n=[],o=0;return FR(e,r=>r.type==="text"?(n.push(...CV(r.text)),!1):(n.push({type:"terminal-context",context:t[o]??null}),o+=1,!1)),n}function zR(e){return e.isMobileViewport?null:e.modifierKey&&e.shiftKey?e.isDraftThread?"background":null:e.shiftKey?null:e.modifierKey?"steer":"foreground"}var BR=e=>e.type!=="text";function mC(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function bV(e){return e===" "||e===`
3844
+ `||e===" "||e==="\r"||e==="\uFFFC"}function wV(e,t){let n=t-1;for(;n>=0&&!bV(e[n]??"");)n-=1;return n+1}function Xo(e,t){let n=mC(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 UR(e){return e.type==="text"?e.text.length:1}function HR(e,t){let n=e.reduce((o,r)=>o+UR(r),0);return Number.isFinite(t)?Math.max(0,Math.min(n,Math.floor(t))):n}function mr(e,t){return HR(Ys(e),t)}function Po(e,t){let n=mC(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 Mu(e,t,n){let o=Ys(e);if(!o.some(BR))return!1;let r=HR(o,t),a=0;for(let i of o){if(BR(i)&&(n==="left"&&r===a+1||n==="right"&&r===a))return!0;a+=UR(i)}return!1}function Ao(e,t){let n=mC(e,t),o=e.lastIndexOf(`
3845
+ `,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=wV(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 $R(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}}function KR(e){return/mac|iphone|ipad|ipod/i.test(e)}function Nu(){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 gC(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)}function qR(e){let t=gC(e);return t.startsWith(".")&&!t.slice(1).includes(".")?"directory":t.includes(".")?"file":"directory"}var VR="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",WR=`${VR} border border-border/70 bg-accent/40 text-foreground`,SV=`${WR} text-[12px]`,pa=`${WR} text-[0.86em] select-none`,bd="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-['']",gr="block size-[1.17em] shrink-0 self-center opacity-85 [&>svg]:block",GR="truncate leading-tight",hr="block self-center truncate leading-tight select-none",jR=`${VR} select-none border border-fuchsia-500/25 bg-fuchsia-500/12 text-[0.86em] text-fuchsia-700 dark:text-fuchsia-300`,QR='<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>',mg="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";he();he();var XR=bt(null),YR=XR.Provider;function jt(){let e=Ut(XR);if(e===null)throw new Error("Composer API has not been provided.");return e}var gg=ve(function(t){let n=jt().pierreIcons,o=n.useSpriteReady();Vd(n.ensureSprite,[n]);let r=q(()=>n.resolveForEntry(t.pathValue,t.kind),[n,t.kind,t.pathValue]);return o?u("svg",{"aria-hidden":"true","data-file-icon":r.symbolId,className:K("size-4 shrink-0",t.className),children:u("use",{href:`#${r.symbolId}`})}):t.kind==="directory"?u(vi,{className:K("size-4 shrink-0 text-icon-muted",t.className)}):u(tc,{className:K("size-4 shrink-0 text-icon-muted",t.className)})});var JR=pa;function ZR(e){return b(ke,{children:[u(gg,{pathValue:e.path,kind:qR(e.path),theme:e.theme,className:gr}),u("span",{className:e.selectable?GR:hr,children:e.label})]})}function eM(e){let{label:t,tooltipText:n,expired:o=!1}=e;return b(Je,{children:[u(et,{render:b("span",{className:K(pa,o&&"border-destructive/35 bg-destructive/8 text-destructive"),"data-terminal-context-expired":o?"true":void 0,children:[u(qo,{className:K(gr,"size-icon-1",o&&"opacity-100")}),u("span",{className:hr,children:t})]})}),u(Ze,{side:"top",className:"max-w-80 whitespace-pre-wrap leading-tight",children:n})]})}function tM({context:e}){let{t}=ye(),n=_R(e,t),o=NR(e),r=o?t("pendingContext.terminalExpired",{label:n}):e.text;return u(eM,{label:n,tooltipText:r,expired:o})}function IV(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 TV(e){return e.replaceAll("\\","/")}function ma(e){let t=e.displayName?.trim();return t||IV(e.name)}function nM(e,t){return t?e.filter(n=>n.enabled):[]}function oM(e,t){let n=new Set(t.map(o=>o.name.trim().toLowerCase()));return e.filter(o=>!n.has(o.name.trim().toLowerCase()))}function rM(e){let t=TV(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"}}he();function kV(e){return(e.comment??e.text).replace(/\s+/g," ").trim()}var Xi=class e extends Or{__quote;__source;static getType(){return"composer-quote"}static clone(t){return new e(t.__quote,t.__source,t.__key)}static importJSON(t){return _u(t.quote,t.source).updateFromJSON(t)}constructor(t,n,o){super(o),this.__quote=t,this.__source=n}exportJSON(){return{...super.exportJSON(),quote:this.__quote,source:this.__source,type:"composer-quote",version:1}}createDOM(){let t=document.createElement("span");return t.className=bd,t}updateDOM(){return!1}getTextContent(){return this.__source}isInline(){return!0}decorate(){return u(LV,{nodeKey:this.getKey(),quote:this.__quote,source:this.__source})}};function _u(e,t){return cd(new Xi(e,t))}function LV(e){let{t}=ye(),[n]=fn(),o=Oa(),r=o?.data.assistantQuotes??null,[a,i]=Q(!1),[s,l]=Q(e.quote.comment??""),[d,c]=Ht(op,o?.threadKey??"",null);W(()=>{d===null||d!==e.source||(c(null),l(e.quote.comment??""),i(!0))},[d,e.quote.comment,e.source,c]);let f=kV(e.quote),p=()=>{if(i(!1),r===null)return;let m=r.withComment(e.quote,s),g=r.serialize(m);g!==null&&n.update(()=>{let h=fd(e.nodeKey);h instanceof Xi&&h.replace(_u(m,g))})};return b(wi,{open:a,onOpenChange:m=>{m&&l(e.quote.comment??""),i(m)},children:[u(Ii,{render:b("span",{className:pa,contentEditable:!1,spellCheck:!1,role:"button",tabIndex:-1,"data-composer-quote-chip":"true","aria-label":t("composer.quote.chipLabel",{text:f}),children:[u(Na,{"aria-hidden":"true",className:gr}),u("span",{className:hr,children:f})]})}),u(Si,{side:"top",align:"start",className:"w-96 max-w-[calc(100vw-2rem)]",children:b("div",{className:"flex flex-col gap-2",children:[u("div",{className:"line-clamp-6 whitespace-pre-wrap border-l-2 border-border ps-2 text-muted-foreground text-sm",children:e.quote.text}),u(cS,{value:s,autoFocus:!0,rows:3,placeholder:t("composer.quote.commentPlaceholder"),"aria-label":t("composer.quote.commentLabel"),onChange:m=>l(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.metaKey||m.ctrlKey)&&(m.preventDefault(),p())}}),b("div",{className:"flex justify-end gap-2",children:[u(ie,{size:"sm",variant:"ghost",onClick:()=>i(!1),children:t("composer.cancel")}),u(ie,{size:"sm",onClick:p,disabled:r===null,children:t("composer.quote.saveComment")})]})]})})]})}function aM(e,t){return e.registerCommand(Hm,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=t.readQuotes?.()??null,a=r?.collect(o)??[],i=Ru(`${o}
3846
3846
  `).filter(m=>m.type==="mention"&&m.end<=o.length&&!a.some(g=>m.start<g.end&&g.start<m.end));if(i.length===0&&a.length===0)return!1;let s=[...i.map(m=>({start:m.start,end:m.end,isMention:!0,create:()=>t.createMentionNode(m.value,m.source)})),...a.map(m=>({start:m.start,end:m.end,isMention:!1,create:()=>r.createNode(m)}))].sort((m,g)=>m.start-g.start),l=$e();if(!Ne(l))return!1;let d=[],c=m=>{let g=m.split(`
3847
- `);for(let h=0;h<g.length;h+=1){let v=g[h]??"";v.length>0&&d.push(Dr(v)),h<g.length-1&&d.push(qs())}},f=s[0];if(f?.isMention&&f.start===0){let m=l.isBackward()?l.focus:l.anchor,g=t.getExpandedAbsoluteOffsetForPoint(m.getNode(),m.offset),h=Rt().getTextContent().slice(g-1,g);h.length>0&&!/\s/.test(h)&&d.push(Dr(" "))}let p=0;for(let m of s)m.start<p||(m.start>p&&c(o.slice(p,m.start)),d.push(m.create()),p=m.end);return p<o.length?c(o.slice(p)):s.at(-1)?.isMention&&d.push(Dr(" ")),l.insertNodes(d),n.preventDefault(),!0},mr)}var wd=new Map,PV=32;function iM(e,t){for(wd.delete(e),wd.set(e,t);wd.size>PV;){let n=wd.keys().next().value;if(n===void 0)break;wd.delete(n)}}function AV(e){return{anchor:e.length,focus:e.length}}function Xa(e,t,n){let o=wd.get(e);if(o)return iM(e,o),o;let r={cursor:n?.cursor??t.length,expandedCursor:n?.expandedCursor??t.length,selection:n?{anchor:n.cursor,focus:n.cursor}:AV(t),history:nR()};return iM(e,r),r}function Sd(e,t,n){let o=Xa(e,t);o.cursor=n.cursor,o.expandedCursor=n.expandedCursor,o.selection=n.selection}function sM(e,t,n,o){let r=Xa(e,t);r.cursor=n,r.expandedCursor=o}function lM(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 EV=`composer-editor-${Math.random().toString(36).slice(2)}`,RV=[["(",")"],["[","]"],["{","}"],["'","'"],['"','"'],["\u201C","\u201D"],["`","`"],["<",">"],["\xAB","\xBB"],["*","*"],["_","_"]],mM=new Map(RV),dM=mM.get("`")??null,gM=bt({onRemoveTerminalContext:()=>{}});function MV(e){let t=OV(),n=u("span",{className:JR,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:u(ZR,{path:e.path,label:gC(e.path),theme:t})});return b(Je,{children:[u(et,{render:n}),u(Ze,{side:"top",className:"max-w-120 whitespace-normal leading-tight wrap-anywhere",children:e.path})]})}var Du=class e extends Fr{__path;__source;static getType(){return"composer-mention"}static clone(t){return new e(t.__path,t.__source,t.__key)}static importJSON(t){return xC(t.path,t.source).updateFromJSON(t)}constructor(t,n=Eu(t),o){super(o),this.__path=t,this.__source=n}exportJSON(){return{...super.exportJSON(),path:this.__path,source:this.__source,type:"composer-mention",version:1}}createDOM(){let t=document.createElement("span");return t.className=bd,t}updateDOM(){return!1}getTextContent(){return this.__source}isInline(){return!0}decorate(){return u(MV,{path:this.__path})}};function xC(e,t){return cd(new Du(e,t))}function NV(e){let t=e.shortDescription?.trim();return t||e.description?.trim()||null}function Ou(e){return new Map(e.map(t=>[t.name,{label:ma(t),description:NV(t)}]))}function _V(e){let t=b("span",{className:jR,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[u("span",{"aria-hidden":"true",className:hr,dangerouslySetInnerHTML:{__html:QR}}),u("span",{className:vr,children:e.skillLabel})]});return e.skillDescription?b(Je,{children:[u(et,{render:t}),u(Ze,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:e.skillDescription})]}):t}var Fu=class e extends Fr{__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 hM(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=bd,t}updateDOM(){return!1}getTextContent(){return`$${this.__skillName}`}isInline(){return!0}decorate(){return u(_V,{skillLabel:this.__skillLabel,skillDescription:this.__skillDescription})}};function hM(e,t,n){return cd(new Fu(e,t,n))}function DV(e){return u(tM,{context:e.context})}var Zs=class e extends Fr{__context;static getType(){return"composer-terminal-context"}static clone(t){return new e(t.__context,t.__key)}static importJSON(t){return vM(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=bd,t}updateDOM(){return!1}getTextContent(){return"\uFFFC"}isInline(){return!0}decorate(){return u(DV,{context:this.__context})}};function vM(e){return cd(new Zs(e))}function Ya(e){return e instanceof Du||e instanceof Fu||e instanceof Zs||e instanceof Xi}function OV(){return document.documentElement.classList.contains("dark")?"dark":"light"}function FV(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function BV(e){return e.map(t=>[t.name,t.displayName??"",t.shortDescription??"",t.description??"",t.path,t.scope??"",t.enabled?"1":"0"].join("")).join("")}function hg(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function yg(e){return e instanceof Xi?e.getTextContentSize():1}function yM(e){return e.getTextContentSize()}function zV(e,t,n){return t+(n>0?yg(e):0)}function UV(e,t,n){return t+(n>0?yM(e):0)}function HV(e,t){let n=e.getParent();if(!n||!We(n))return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===yg(e)?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=yg(e),null)}function xg(e){return Ya(e)?yg(e):dt(e)?e.getTextContentSize():md(e)?1:We(e)?e.getChildren().reduce((t,n)=>t+xg(n),0):0}function vC(e){return Ya(e)?yM(e):dt(e)?e.getTextContentSize():md(e)?1:We(e)?e.getChildren().reduce((t,n)=>t+vC(n),0):0}function Bu(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!We(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=xg(l))}o=r}if(dt(e))return n+Math.min(t,e.getTextContentSize());if(Ya(e))return zV(e,n,t);if(md(e))return n+Math.min(t,1);if(We(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+=xg(s))}return n}return n}function Cg(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!We(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=vC(l))}o=r}if(dt(e))return n+Math.min(t,e.getTextContentSize());if(Ya(e))return UV(e,n,t);if(md(e))return n+Math.min(t,1);if(We(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+=vC(s))}return n}return n}function bg(e,t){if(Ya(e))return HV(e,t);if(dt(e)){let n=e.getTextContentSize();return t.value<=n?{key:e.getKey(),offset:t.value,type:"text"}:(t.value-=n,null)}if(md(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(We(e)){let n=e.getChildren();for(let o of n){let r=bg(o,t);if(r)return r}if(t.value===0)return{key:e.getKey(),offset:n.length,type:"element"}}return null}function wg(){return Rt().getChildren().reduce((n,o)=>n+xg(o),0)}function el(e){let t=Rt(),n=wg(),r={value:Math.max(0,Math.min(e,n))},a=bg(t,r)??{key:t.getKey(),offset:t.getChildren().length,type:"element"},i=Vs();i.anchor.set(a.key,a.offset,a.type),i.focus.set(a.key,a.offset,a.type),Or(i)}function vg(e,t){let n=Rt(),o=wg(),r=Math.max(0,Math.min(e,o)),a=Math.max(0,Math.min(t,o)),i={value:r},s={value:a},l=bg(n,i)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},d=bg(n,s)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},c=Vs();c.anchor.set(l.key,l.offset,l.type),c.focus.set(d.key,d.offset,d.type),Or(c)}function cM(e){if(!Ne(e))return null;let t=e.anchor.getNode(),n=e.focus.getNode(),o=Cg(t,e.anchor.offset),r=Cg(n,e.focus.offset);return{start:Math.min(o,r),end:Math.max(o,r)}}function uM(e){return Ne(e)?e.getNodes().some(t=>Ya(t)):!1}function zu(e){let t=$e();if(!Ne(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=Bu(n,t.anchor.offset),r=wg();return Math.max(0,Math.min(o,r))}function fM(e){let t=$e();if(!Ne(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=Cg(n,t.anchor.offset),r=Rt().getTextContent().length;return Math.max(0,Math.min(o,r))}function hC(e){let t=$e();return Ne(t)?{anchor:Bu(t.anchor.getNode(),t.anchor.offset),focus:Bu(t.focus.getNode(),t.focus.offset)}:e}function pM(e,t){let n=t.split(`
3848
- `);for(let o=0;o<n.length;o+=1){let r=n[o]??"";r.length>0&&e.append(Dr(r)),o<n.length-1&&e.append(qs())}}function $V(e,t,n){let o=0;for(let r of n?.collect(t)??[])pM(e,t.slice(o,r.start)),e.append(_u(r.quote,r.source)),o=r.end;pM(e,t.slice(o))}function CC(e,t,n,o){let r=Rt();r.clear();let a=pr();r.append(a);let i=Js(e,t);for(let s of i){if(s.type==="mention"){a.append(xC(s.path,s.source));continue}if(s.type==="skill"){let l=n.get(s.name);a.append(hM(s.name,l?.label??ma({name:s.name}),l?.description??null));continue}if(s.type==="terminal-context"){s.context&&a.append(vM(s.context));continue}$V(a,s.text,o)}}function yC(e){return e instanceof Zs?[e.__context.id]:We(e)?e.getChildren().flatMap(t=>yC(t)):[]}function KV(){let[e]=fn();return W(()=>{let t=r=>{if(r.inputType!=="insertText"||!r.data||r.isComposing)return;let a=r.data;e.getEditorState().read(()=>{let s=$e();if(!Ne(s)||!s.isCollapsed()||s.anchor.type!=="element")return!1;let l=s.anchor.getNode();return We(l)&&Ya(l.getChildAtIndex(s.anchor.offset))})&&(r.preventDefault(),r.stopImmediatePropagation(),e.update(()=>{let s=$e();Ne(s)&&s.insertText(a)},{discrete:!0}))},n=null,o=e.registerRootListener((r,a)=>{a?.removeEventListener("beforeinput",t,!0),r?.addEventListener("beforeinput",t,!0),n=r});return()=>{n?.removeEventListener("beforeinput",t,!0),o()}},[e]),null}function qV(e){let[t]=fn();return W(()=>{let n=(l,d)=>{if(!e.onCommandKeyDown||!d)return!1;if(l==="Enter"&&(d.isComposing||d.keyCode===229))return d.stopPropagation(),!0;let c=e.onCommandKeyDown(l,d);return c&&(d.preventDefault(),d.stopPropagation()),c},o=t.registerCommand(lA,l=>n("ArrowDown",l),mr),r=t.registerCommand(dA,l=>n("ArrowUp",l),mr),a=t.registerCommand(zm,l=>n("Enter",l),mr),i=t.registerCommand(Um,l=>n("Tab",l),mr),s=t.registerCommand(fA,l=>n("Escape",l),mr);return()=>{o(),r(),a(),i(),s()}},[t,e]),null}function VV(){let[e]=fn();return W(()=>{let t=e.registerCommand(Om,o=>{let r=null;if(e.getEditorState().read(()=>{let i=$e();if(!Ne(i)||!i.isCollapsed())return;let s=zu(0);if(s<=0)return;let l=Rt().getTextContent();Mu(l,s,"left")&&(r=s-1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{el(a)}),!0},mr),n=e.registerCommand(Fm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=$e();if(!Ne(i)||!i.isCollapsed())return;let s=zu(0),l=wg();if(s>=l)return;let d=Rt().getTextContent();Mu(d,s,"right")&&(r=s+1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{el(a)}),!0},mr);return()=>{t(),n()}},[e]),null}function WV(){let[e]=fn();return W(()=>e.registerCommand(uA,t=>{if(!KR(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(()=>{Or(kP(o,e))}),!0)},mr),[e]),null}function GV(){let[e]=fn();return W(()=>e.registerUpdateListener(({editorState:t})=>{let n=null;t.read(()=>{let o=$e();if(!Ne(o)||!o.isCollapsed())return;let r=o.anchor.getNode();if(!Ya(r)||o.anchor.offset===0)return;n=Bu(r,0)+1}),n!==null&&queueMicrotask(()=>{e.update(()=>{el(n)})})}),[e]),null}function jV(){let[e]=fn(),{onRemoveTerminalContext:t}=wt(gM);return W(()=>e.registerCommand(Bm,n=>{let o=$e();if(!Ne(o)||!o.isCollapsed())return!1;let r=o.anchor.getNode(),a=zu(0),i=s=>{if(!Ya(s))return!1;let l=Bu(s,0);return s.remove(),s instanceof Zs?(t(s.__context.id),el(a)):el(l),n?.preventDefault(),!0};if(i(r))return!0;if(dt(r)){if(o.anchor.offset>0)return!1;if(i(r.getPreviousSibling()))return!0;let s=r.getParent();if(We(s)){let l=r.getIndexWithinParent();if(l>0&&i(s.getChildAtIndex(l-1)))return!0}return!1}if(We(r)){let s=o.anchor.offset-1;if(s>=0&&i(r.getChildAtIndex(s)))return!0}return!1},mr),[e,t]),null}function QV(){let[e]=fn();return W(()=>{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(Ne(d)&&!d.isCollapsed())for(let c of d.getNodes())c instanceof Fr&&l.add(c.getKey())}),l},a=e.registerUpdateListener(()=>{o(n?r():new Set)}),i=e.registerCommand(oA,()=>(n=!0,o(r()),!1),gd),s=e.registerCommand(WP,()=>(n=!1,o(new Set),!1),gd);return()=>{a(),i(),s()}},[e]),null}function XV(){let[e]=fn(),t=N(null);return t.current=Oa()?.data.assistantQuotes??null,W(()=>aM(e,{createMentionNode:xC,getExpandedAbsoluteOffsetForPoint:Cg,readQuotes:()=>{let n=t.current;return n===null?null:{collect:o=>n.collect(o),createNode:o=>_u(o.quote,o.source)}}}),[e]),null}function YV(e){let[t]=fn(),n=N(e.terminalContexts),o=N(Ou(e.skills)),r=N(null);r.current=Oa()?.data.assistantQuotes??null;let a=N(null),i=N(null);W(()=>{n.current=e.terminalContexts},[e.terminalContexts]),W(()=>{o.current=Ou(e.skills)},[e.skills]);let s=Mh(l=>{let d=mM.get(l),c=a.current;if(!d)return a.current=null,!1;let f=!1;return t.update(()=>{let p=c??(()=>{let v=$e();if(!Ne(v)||v.isCollapsed()||uM(v))return null;let y=cM(v);if(!y||y.start===y.end)return null;let x=Rt().getTextContent();return pC(x,y.start,y.end)?null:{value:x,expandedStart:y.start,expandedEnd:y.end}})();if(!p||!d)return;let m=p.value.slice(p.expandedStart,p.expandedEnd),g=`${p.value.slice(0,p.expandedStart)}${l}${m}${d}${p.value.slice(p.expandedEnd)}`;CC(g,n.current,o.current,r.current);let h=Po(g,p.expandedStart);vg(h+l.length,h+l.length+m.length),f=!0,a.current=null}),f});return W(()=>{let l=h=>{if(i.current){if(h.key==="Dead"||h.key===" "||h.code==="Space")return;i.current=null}if(h.defaultPrevented||h.isComposing||h.metaKey||h.ctrlKey){a.current=null,i.current=null;return}t.getEditorState().read(()=>{let v=$e();if(!Ne(v)||v.isCollapsed()){a.current=null,i.current=null;return}if(uM(v)){a.current=null,i.current=null;return}let y=cM(v);if(!y||y.start===y.end){a.current=null,i.current=null;return}let x=Rt().getTextContent();if(pC(x,y.start,y.end)){a.current=null,i.current=null;return}let C={value:x,expandedStart:y.start,expandedEnd:y.end};a.current=C,i.current=null})},d=h=>{if(h.inputType==="insertCompositionText"&&h.data==="`"&&dM!==null&&a.current){i.current=a.current;return}if(i.current||h.inputType==="insertCompositionText")return;if(typeof h.data!="string"){a.current=null;return}let v=h.inputType==="insertText"?h.data:null;if(!v||v.length!==1){a.current=null;return}s(v)&&(h.preventDefault(),h.stopPropagation(),h.stopImmediatePropagation())},c=h=>{queueMicrotask(()=>{t.update(()=>{let v=i.current;if(!v)return;let y=Rt().getTextContent(),x=dM;if(x===null){i.current=null;return}let C=`${v.value.slice(0,v.expandedStart)}\`${v.value.slice(v.expandedEnd)}`;if(y!==C){h?.finalAttempt&&(a.current=null,i.current=null);return}let w=v.value.slice(v.expandedStart,v.expandedEnd),T=Po(y,v.expandedStart);vg(T,T+1);let S=$e();if(!Ne(S)){a.current=null,i.current=null;return}S.insertText(`\`${w}${x}`),vg(T+1,T+1+w.length),a.current=null,i.current=null},{tag:Qo})})},f=h=>{let v=h;(v.inputType==="insertText"||v.inputType==="insertCompositionText")&&c()},p=()=>{c({finalAttempt:!0})},m=null,g=t.registerRootListener((h,v)=>{v?.removeEventListener("keydown",l),v?.removeEventListener("beforeinput",d,!0),v?.removeEventListener("input",f),v?.removeEventListener("compositionend",p),h?.addEventListener("keydown",l),h?.addEventListener("beforeinput",d,!0),h?.addEventListener("input",f),h?.addEventListener("compositionend",p),m=h});return()=>{m&&(m.removeEventListener("keydown",l),m.removeEventListener("beforeinput",d,!0),m.removeEventListener("input",f),m.removeEventListener("compositionend",p)),g()}},[t]),null}function JV({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,ariaLabel:l,onRemoveTerminalContext:d,onChange:c,onCommandKeyDown:f,onPaste:p,editorRef:m}){let[g]=fn(),h=N(c);h.current=c;let v=gr(t,n),y=Xa(e,t,{cursor:v,expandedCursor:Xo(t,v)}),x=gr(t,y.cursor),C=FV(o),w=N(C),T=BV(r),S=N(T),L=N(Ou(r)),k=N(null);k.current=Oa()?.data.assistantQuotes??null;let I=N({value:t,cursor:x,expandedCursor:y.expandedCursor,selection:y.selection,terminalContextIds:o.map(D=>D.id)}),P=N(e),E=y.history,_=N(!1),A=q(()=>({onRemoveTerminalContext:d}),[d]);Ce(()=>{L.current=Ou(r)},[r]),W(()=>{g.setEditable(!a)},[a,g]),Ce(()=>{let D=gr(t,n),ne=I.current,B=P.current,U=B!==e,ee=w.current!==C,j=S.current!==T;if(!U&&ne.value===t&&ne.cursor===D&&!ee&&!j)return;if(U){let we=ne.selection;g.getEditorState().read(()=>{we=hC(we)}),Sd(B,ne.value,{cursor:ne.cursor,expandedCursor:ne.expandedCursor,selection:we})}let Z=Xa(e,t),de=U?Z.selection:{anchor:D,focus:D};I.current={value:t,cursor:U?Z.cursor:D,expandedCursor:U?Z.expandedCursor:Xo(t,D),selection:de,terminalContextIds:o.map(we=>we.id)},P.current=e,w.current=C,S.current=T;let F=g.getRootElement(),X=!!(F&&document.activeElement===F);if(!U&&ne.value===t&&!ee&&!j&&!X)return;let pe=U?Xa(B,ne.value).history:null;_.current=!0;let le=t==="",re=()=>g.update(()=>{let we=U||ne.value!==t||ee||j;we&&CC(t,o,L.current,k.current),U?vg(de.anchor,de.focus):(we||X)&&el(D)},{discrete:!0,tag:le?[Qo,gx,wA]:Qo});pe?lM(pe,re):re(),le&&X&&requestAnimationFrame(()=>setTimeout(()=>{document.activeElement===g.getRootElement()&&g.update(()=>{let we=$e();Ne(we)&&(we.dirty=!0)},{tag:[Qo,gx]})},0)),Sd(e,t,I.current),queueMicrotask(()=>{_.current=!1})},[n,e,g,T,o,C,t]);let H=R(D=>{let ne=g.getRootElement();if(!ne)return;let B=gr(I.current.value,D);ne.focus({preventScroll:!0}),g.update(()=>{el(B)}),I.current={value:I.current.value,cursor:B,expandedCursor:Xo(I.current.value,B),selection:{anchor:B,focus:B},terminalContextIds:I.current.terminalContextIds},Sd(P.current,I.current.value,{cursor:I.current.cursor,expandedCursor:I.current.expandedCursor,selection:I.current.selection}),h.current(I.current.value,B,I.current.expandedCursor,!1,I.current.terminalContextIds)},[g]),V=R(()=>{let D=I.current;return g.getEditorState().read(()=>{let ne=Rt().getTextContent(),B=gr(ne,I.current.cursor),U=gr(ne,zu(B)),ee=hg(ne,I.current.expandedCursor),j=hg(ne,fM(ee)),Z=yC(Rt()),de=hC(I.current.selection);D={value:ne,cursor:U,expandedCursor:j,selection:de,terminalContextIds:Z}}),I.current=D,Sd(P.current,D.value,D),D},[g]);rr(m,()=>({focus:()=>{H(I.current.cursor)},focusAt:H,focusAtEnd:()=>{H(Po(I.current.value,I.current.value.length))},readSnapshot:V}),[H,V]);let J=R(D=>{D.read(()=>{let ne=Rt().getTextContent(),B=gr(ne,I.current.cursor),U=gr(ne,zu(B)),ee=hg(ne,I.current.expandedCursor),j=hg(ne,fM(ee)),Z=yC(Rt()),de=hC(I.current.selection),F=I.current;if(F.value===ne&&F.cursor===U&&F.expandedCursor===j&&F.selection.anchor===de.anchor&&F.selection.focus===de.focus&&F.terminalContextIds.length===Z.length&&F.terminalContextIds.every((pe,le)=>pe===Z[le])||_.current)return;I.current={value:ne,cursor:U,expandedCursor:j,selection:de,terminalContextIds:Z},Sd(P.current,ne,{cursor:U,expandedCursor:j,selection:de});let X=Mu(ne,U,"left")||Mu(ne,U,"right");h.current(ne,U,j,X,Z)})},[]);return u(gM,{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(MR,{contentEditable:u(SE,{className:K("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,...l?{"aria-label":l}:{},placeholder:u("span",{}),onPaste:p}),placeholder:o.length>0?null:u("div",{className:"pointer-events-none absolute inset-0 leading-relaxed text-placeholder",children:i}),ErrorBoundary:IE}),u(oR,{onChange:J}),u(qV,{...f?{onCommandKeyDown:f}:{}}),u(KV,{}),u(YV,{terminalContexts:o,skills:r}),u(WV,{}),u(VV,{}),u(GV,{}),u(jV,{}),u(XV,{}),u(QV,{}),u(tR,{externalHistoryState:E},e)]})})}function ZV(e){let[t]=fn(),n=N(e),o=N(e),[r,a]=Q(e.documentKey);r===e.documentKey&&(n.current=e),o.current=e,Ce(()=>{r===e.documentKey||t.isComposing()||a(e.documentKey)},[r,t,e.documentKey]),W(()=>{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(JV,{...i})}function Sg({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,ariaLabel:l,onRemoveTerminalContext:d,onChange:c,onCommandKeyDown:f,onPaste:p,editorRef:m}){let g=N(t),h=N(o),v=N(Ou(r)),y=N(Oa()?.data.assistantQuotes??null),x=q(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[Du,Fu,Zs,Xi],editorState:()=>{CC(g.current,h.current,v.current,y.current)},onError:C=>{throw C}}),[]);return u(FA,{initialConfig:x,children:u(ZV,{documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,onRemoveTerminalContext:d,onChange:c,onPaste:p,editorRef:m,...f?{onCommandKeyDown:f}:{},...s?{className:s}:{},...l?{ariaLabel:l}:{}})},EV)}function Uu(e,t,n){let o=e.trim().length-t;return o<=0?null:n("composer.promptTooLong",{count:o,excess:o.toLocaleString("en-US"),max:t.toLocaleString("en-US")})}function bC(e){return e.submissionTarget==="provider-turn"?Uu(e.providerInput??e.prompt,e.maxInputChars,e.t):null}function xM(e){let t=e.disabledReason??bC(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}}var go=new Map;function e4(e,t,n){return`${e}\0${t}\0${n??"none"}`}function wC(e,t){go.delete(e),go.set(e,t)}function Id(e,t){if(go.get(e)===t){if(t.operationLeases>0){t.disposeRequested=!0;return}t.releaseAuthorityWatch?.(),t.releaseAuthorityWatch=void 0,go.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 t4(e){if(go.size<=100)return;let t=Array.from(go);for(let[n,o]of t){if(go.size<=100)return;n===e||o.committed||o.listeners.size>0||o.operationLeases>0||Id(n,o)}for(let[n,o]of t){if(go.size<=100)return;n===e||o.listeners.size>0||o.operationLeases>0||Id(n,o)}}function Ig(){queueMicrotask(()=>t4())}function CM(e,t,n,o,r=void 0){let a=n.management?.revision??null,i=e4(e,n.intentId,a),s=go.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.management?.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 go.set(i,d),l}function bM(e,t){let n=go.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:()=>Id(e,n)})),n.committed=!0,wC(e,n),n.listeners.add(t),Ig(),()=>{n.listeners.delete(t),Ig()}):()=>{}}function tl(e,t){let n=go.get(e);if(!n)return;n.committed=!0;let o=t(n.state);if(o!==n.state){n.state=o,wC(e,n);for(let r of n.listeners)r()}}function Tg(e){return go.get(e)?.state}function wM(e){let t=go.get(e);if(!t)return null;t.committed=!0,t.operationLeases+=1,wC(e,t);let n=!1;return()=>{if(!n){if(n=!0,t.operationLeases=Math.max(0,t.operationLeases-1),t.operationLeases===0&&t.disposeRequested){Id(e,t);return}Ig()}}}function kg(e){let t=go.get(e);t&&Id(e,t)}function SM(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 go)r.state.inputKey===e&&n.get(r.state.intentId)!==r.state.revision&&Id(o,r);Ig()}var n4=[],o4=[],r4=()=>{};function IM({entry:e,current:t,inputKey:n,environmentId:o,unavailable:r,attachments:a,watchEditorAuthority:i,onEdit:s,onClose:l}){let{t:d}=ao(),c=CM(n,o,e,a,i),f=$o(D=>bM(c.key,D),()=>Tg(c.key)??c,()=>Tg(c.key)??c),{key:p,text:m,retained:g,added:h,saving:v,error:y}=f,x=N(null),[C,w]=Q(()=>m.length),T=Oa()?.data.assistantQuotes??null,S=D=>Uu(T?T.expandForProvider(D):D,a.limits.maxInputChars,d),L=S(m),k=N(null),I=a.useUploadStatuses(),P=q(()=>g.map(D=>D.id),[g]),E=a.useAssetUrls(o,P),_=!t?.management||t.management.revision!==e.management?.revision;W(()=>{t===void 0&&(kg(p),l())},[t,p,l]);let A=()=>{v||(kg(p),l())},H=D=>{if(v||r||_)return;let ne=null,B=[...h];for(let U of D){let ee=U.type||"application/octet-stream";if(g.length+B.length>=a.limits.maxAttachments||U.size===0||U.size>a.maxAttachmentBytes(ee)){ne=d("turnQueue.attachmentLimit",{name:U.name,count:a.limits.maxAttachments,size:a.formatAttachmentSize(a.maxAttachmentBytes(ee))});continue}let j=a.makeImageAttachment({id:a.randomUUID(),name:U.name,mimeType:ee,sizeBytes:U.size,file:U});B.push(j),a.startUpload({environmentId:o,image:j})}tl(p,U=>({...U,added:B,error:ne}))},V=async()=>{let D=Tg(p);if(!D||D.saving||r||_||!D.text.trim()&&D.retained.length+D.added.length===0||S(D.text)!==null)return;let ne=wM(p);if(ne!==null){tl(p,B=>({...B,saving:!0,error:null}));try{await a.awaitUploads(D.added.map(U=>U.id));let B=a.getUploadedAttachments({environmentId:o,images:D.added});if(!B)throw new Error(d("turnQueue.uploadFailed"));await s(e,{text:D.text,attachments:[...D.retained,...B]}),kg(p),l()}catch(B){tl(p,U=>({...U,saving:!1,error:B instanceof Error?B.message:d("turnQueue.actionFailed")}))}finally{ne()}}},J=[...g.map((D,ne)=>({...D,previewUrl:E[ne],added:!1})),...h.map(D=>({...D,added:!0}))];return u($f,{open:!0,onOpenChange:D=>{D||A()},children:b(Wf,{className:"max-w-2xl","data-queued-message-editor":!0,initialFocus:()=>(x.current?.focusAtEnd(),!1),children:[b(Vf,{children:[u(Gf,{children:d("turnQueue.editTitle")}),u(Kf,{children:d("turnQueue.editDescription")})]}),b("div",{className:"max-h-[60dvh] space-y-3 overflow-y-auto px-6 pb-4",onDragOver:D=>{D.dataTransfer.types.includes("Files")&&D.preventDefault()},onDrop:D=>{D.dataTransfer.files.length&&(D.preventDefault(),D.stopPropagation(),H(Array.from(D.dataTransfer.files)))},children:[u("div",{className:"rounded-lg border border-input bg-background px-3 py-2 focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/24",children:u(Sg,{editorRef:x,documentKey:`queue-editor\0${p}`,value:m,cursor:C,terminalContexts:n4,skills:o4,disabled:v,placeholder:d("turnQueue.editText"),ariaLabel:d("turnQueue.editText"),className:"max-h-[40dvh]",onRemoveTerminalContext:r4,onChange:(D,ne)=>{w(ne),tl(p,B=>({...B,text:D}))},onCommandKeyDown:(D,ne)=>D!=="Enter"||!(ne.metaKey||ne.ctrlKey)?!1:(V(),!0),onPaste:D=>{D.clipboardData.files.length&&(D.preventDefault(),H(Array.from(D.clipboardData.files)))}})}),L?u("p",{role:"alert",className:"text-sm text-destructive-foreground",children:L}):null,u("ul",{className:"flex flex-wrap gap-2",children:J.map(D=>b("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2 py-1.5",children:[D.type==="image"&&D.previewUrl?u("img",{src:D.previewUrl,alt:D.name,className:"size-12 rounded object-cover"}):u(wo,{className:"size-4 shrink-0"}),b("div",{className:"min-w-0 text-xs",children:[u("p",{className:"max-w-48 break-words",children:D.name}),u("p",{className:"text-muted-foreground",children:a.formatAttachmentSize(D.sizeBytes)}),D.added&&I.get(D.id)!=="ready"?u("p",{children:d(I.get(D.id)==="failed"?"turnQueue.uploadFailed":"turnQueue.uploading")}):null,D.added&&I.get(D.id)==="failed"?u(ie,{size:"xs",variant:"ghost",disabled:v||r||_,onClick:()=>{let ne=h.find(B=>B.id===D.id);ne&&a.retryUpload({environmentId:o,image:ne})},children:d("turnQueue.retryUpload")}):null]}),u(ie,{size:"icon-xs",variant:"ghost","aria-label":d("turnQueue.removeAttachment",{name:D.name}),disabled:v||_,onClick:()=>{D.added?(a.releaseUpload(D.id),D.previewUrl&&URL.revokeObjectURL(D.previewUrl),tl(p,ne=>({...ne,added:ne.added.filter(B=>B.id!==D.id)}))):tl(p,ne=>({...ne,retained:ne.retained.filter(B=>B.id!==D.id)}))},children:u(en,{className:"size-3.5"})})]},D.id))}),u("input",{ref:k,type:"file",multiple:!0,className:"hidden","aria-label":d("turnQueue.addAttachments"),onChange:D=>{H(Array.from(D.target.files??[])),D.target.value=""}}),b(ie,{size:"sm",variant:"outline",disabled:v||r||_,onClick:()=>k.current?.click(),children:[u(wo,{className:"size-4"}),d("turnQueue.addAttachments")]}),_?u("p",{role:"alert",className:"text-sm text-muted-foreground",children:d("turnQueue.editStale")}):null,y?u("p",{role:"alert",className:"text-sm text-destructive-foreground",children:y}):null]}),b(qf,{children:[u(ie,{variant:"ghost",disabled:v,onClick:A,children:d("turnQueue.discardEdit")}),u(ie,{disabled:v||r||_||L!==null||!m.trim()&&J.length===0,onClick:()=>{V()},children:d(v?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}function TM(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 kM(e,t,n){if(t===n)return null;let o={intentId:t,beforeIntentId:n,previousOrder:e.map(a=>a.intentId)};return TM(e,o).every((a,i)=>a.intentId===e[i]?.intentId)?null:o}function LM(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:TM(e,t),settled:!1}}he();he();function a4({entry:e,unavailable:t,onCancel:n}){let{t:o}=ao(),r=N(!1),[a,i]=Q(!1),[s,l]=Q(!1),[d,c]=Q(!1);W(()=>{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(ie,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>{f()},children:o("turnQueue.confirmAbandon")}),u(ie,{size:"xs",variant:"ghost",disabled:a,onClick:()=>c(!1),children:o("turnQueue.keepWaiting")})]})]}):u(ie,{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 PM({entries:e,unavailable:t,onCancel:n}){let{t:o}=ao(),[r,a]=Q(!1),i=Jr();return e.length===0?null:b("div",{className:"min-w-0 basis-full space-y-2",children:[u(ie,{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(a4,{entry:s,unavailable:t,onCancel:n},s.intentId))}):null]})}function SC({queue:e,unavailable:t=!1,onResume:n,entries:o,onCancel:r}){let{t:a}=ao(),i=N(!1),[s,l]=Q(!1),[d,c]=Q(!1),f=N(!1),[p,m]=Q(!1),[g,h]=Q(!1),[v,y]=Q(null);W(()=>{e.paused||c(!1)},[e.paused]);let x=o?.[0];W(()=>{m(!1),y(null)},[x?.intentId,x?.status,x?.deliveryCertainty]);let C=e.deliveryUncertain||e.blocked||e.reconciling;if(!e.paused&&!C)return null;let w=r!==void 0&&x?.action==="abandon"&&(e.reconciling||e.deliveryUncertain),T=async()=>{if(f.current||t||r===void 0||x===void 0)return;let I=x;f.current=!0,h(!0),y(null);try{await r(I),m(!1)}catch{y(I.intentId)}finally{f.current=!1,h(!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"),k=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===x?.intentId?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.actionFailed")}):null]}),e.paused?u(ie,{size:"xs",variant:"outline",disabled:s,softDisabled:t,onClick:()=>{k()},children:a(s?"turnQueue.resuming":"turnQueue.resume")}):null,w?b(ke,{children:[u(ie,{size:"xs",variant:"outline",disabled:g,softDisabled:t,onClick:()=>m(!0),children:a("turnQueue.stopWaiting")}),u(pS,{open:p,onOpenChange:I=>{I||m(!1)},children:b(yS,{className:"max-w-lg",children:[b(vS,{children:[u(xS,{children:a("turnQueue.stopWaiting")}),u(gS,{children:a("turnQueue.abandonDescription")})]}),b(hS,{children:[u(mS,{render:u(ie,{variant:"ghost"}),children:a("turnQueue.keepWaiting")}),u(ie,{variant:"outline",disabled:g||t,onClick:()=>{T()},children:a(g?"turnQueue.cancelling":"turnQueue.confirmAbandon")})]})]})})]}):null,r&&o?u(PM,{entries:o.filter(I=>I.status!=="queued"),unavailable:t,onCancel:r}):null]})}var i4=[VT,qT],s4=[];function l4({submission:e}){let{t}=ao();return b("li",{"data-queue-pending-message":e.messageId,className:"flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",children:[u("span",{"aria-hidden":"true",className:"grid size-6 shrink-0 place-items-center",children:u("span",{className:"size-1.5 rounded-full bg-muted-foreground/60"})}),b("div",{className:"min-w-0 flex-1",children:[u("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:ov(e.text)||t("turnQueue.attachmentsOnly")}),e.attachmentNames.length?b("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(wo,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:e.attachmentNames.join(", ")})]}):null]}),u("span",{role:"status",className:"w-[5.25rem] shrink-0 text-end text-muted-foreground",children:t("primaryActions.sendingButtonLabel")})]})}function d4({entry:e,disabled:t,dropPosition:n,dragPosition:o,feedback:r,reducedMotion:a,children:i}){let{t:s}=ao(),{attributes:l,listeners:d,setNodeRef:c,setActivatorNodeRef:f,transform:p,transition:m,isDragging:g}=HT({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":g||void 0,"data-queue-feedback":r,style:{transform:Mi.Transform.toString(p),transition:m},className:K("relative flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",g&&"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:K("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(ie,{ref:f,size:"icon-xs",variant:"ghost",className:K("shrink-0 touch-none cursor-grab text-muted-foreground active:cursor-grabbing",(g||r==="saved")&&"bg-primary/10 text-primary"),...l,...d,"aria-label":s("turnQueue.reorderMessage"),title:s("turnQueue.reorderMessage"),softDisabled:t,children:r==="saved"?u(ro,{className:"size-3.5"}):u(ac,{className:"size-3.5"})}),i,g&&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 AM({inputKey:e,entries:t,pendingSubmissions:n=s4,environmentId:o,unavailable:r,attachments:a,actions:i,onCancel:s}){let{t:l}=ao(),d=Bp("(prefers-reduced-motion: reduce)"),[c,f]=Ht("turn-queue:editing",e,null),[p,m]=Ht("turn-queue:pending",e,!1),g=St("turn-queue:pending-ref",e,!1),[h,v]=Ht("turn-queue:error",e,null),[y,x]=Ht("turn-queue:drag",e,null),[C,w]=Ht("turn-queue:move",e,null),T=St("turn-queue:reorder-ref",e,!1),[S,L]=Ht("turn-queue:feedback",e,null),k=pT(Pv($l,{activationConstraint:{distance:5}}),Pv(Hl,{coordinateGetter:$T,scrollBehavior:d?"auto":"smooth"})),I=q(()=>t.filter(B=>B.waiting),[t]),P=C?LM(I,C.preview):null,E=P?.entries??I,_=E.length+n.length,A=r||p||C!==null,H=E.findIndex(B=>B.intentId===y?.activeId),V=E.findIndex(B=>B.intentId===y?.overId);W(()=>{SM(e,t)},[t,e]),W(()=>{C!==null&&(r||C.acknowledged&&P?.settled)&&(T.current=!1,w(null),!r&&I.some(B=>B.intentId===C.preview.intentId)&&L({intentId:C.preview.intentId,kind:"saved"}))},[I,C,P?.settled,r]),W(()=>{if(S===null||S.kind==="failed")return;let B=window.setTimeout(()=>L(U=>U===S?null:U),1600);return()=>window.clearTimeout(B)},[S]);let J=async B=>{if(!(g.current||T.current||r)){g.current=!0,m(!0),v(null),L(null);try{await B()}catch(U){v(U instanceof Error?U.message:l("turnQueue.actionFailed"))}finally{g.current=!1,m(!1)}}},D=(B,U)=>J(async()=>{let ee=kM(I,B.intentId,U);if(!(ee===null||!B.management?.canReorder)){T.current=!0,w({preview:ee,acknowledged:!1});try{await i.onReorder(B,U),w(j=>j?.preview===ee?{...j,acknowledged:!0}:j)}catch(j){throw T.current=!1,w(null),L({intentId:B.intentId,kind:"failed"}),j}}}),ne=r?l("turnQueue.disconnected"):C!==null?l("turnQueue.saving"):y!==null?`${l("turnQueue.dragStarted")} ${V+1}/${E.length}`:S?.kind==="saved"?l("common.action.done"):S?.kind==="cancelled"?l("turnQueue.dragCancelled"):"";return b(ke,{children:[_>0?b("section",{"aria-label":l("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:l("turnQueue.queued",{count:_})}),u("span",{role:"status","aria-live":y===null?"polite":"off","data-queue-reorder-status":C?"saving":S?.kind,className:K("min-w-0 truncate",S?.kind==="saved"&&"text-primary"),children:ne})]}),u(ET,{sensors:k,collisionDetection:hT,modifiers:i4,accessibility:{screenReaderInstructions:{draggable:l("turnQueue.dragInstructions")},announcements:{onDragStart:()=>l("turnQueue.dragStarted"),onDragOver:({over:B})=>{let U=E.findIndex(ee=>ee.intentId===B?.id);return U<0?void 0:`${l("turnQueue.dragStarted")} ${U+1}/${E.length}`},onDragEnd:()=>l("turnQueue.dragFinished"),onDragCancel:()=>l("turnQueue.dragCancelled")}},onDragStart:({active:B})=>{let U=E.find(ee=>ee.intentId===B.id);!U?.management?.canReorder||A||(v(null),L(null),x({activeId:U.intentId,overId:U.intentId}))},onDragOver:({over:B})=>{let U=E.find(ee=>ee.intentId===B?.id);U&&x(ee=>ee&&{...ee,overId:U.intentId})},onDragCancel:()=>{y&&L({intentId:y.activeId,kind:"cancelled"}),x(null)},onDragEnd:({active:B,over:U})=>{if(x(null),!U||B.id===U.id)return;let ee=E.findIndex(F=>F.intentId===B.id),j=E.findIndex(F=>F.intentId===U.id),Z=E[ee];if(!Z?.management?.canReorder||j<0)return;let de=E[j+(ee<j?1:0)]?.intentId??null;D(Z,de)},children:u(zT,{items:E.map(B=>B.intentId),strategy:OT,children:b("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:[E.map((B,U)=>b(d4,{entry:B,disabled:!B.management?.canReorder||A,reducedMotion:d,feedback:S?.intentId===B.intentId?S.kind:void 0,dropPosition:B.intentId===y?.overId&&H!==V?H<V?"after":"before":void 0,dragPosition:B.intentId===y?.activeId?`${V+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:ov(B.text??"")||l("turnQueue.attachmentsOnly")}),B.attachmentNames.length?b("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(wo,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:B.attachmentNames.join(", ")})]}):null,B.pendingAction?u("p",{className:"text-muted-foreground",children:l(B.pendingAction==="steer"?"turnQueue.steering":"turnQueue.interrupting")}):null,B.failure?u("p",{role:"alert",className:"text-destructive-foreground",children:B.failure}):null]}),b("div",{className:K("flex shrink-0 items-center gap-0.5",B.intentId===y?.activeId&&"invisible"),children:[u(ie,{size:"icon-xs",variant:"ghost",disabled:!B.management||A||y!==null,"aria-label":l("turnQueue.editMessage"),title:l("turnQueue.editMessage"),onClick:()=>f(B),children:u(pc,{className:"size-3.5"})}),B.management?.canSteer?u(ie,{size:"icon-xs",variant:"ghost",disabled:A||y!==null,"aria-label":l("turnQueue.steer"),title:l("turnQueue.steerDescription"),onClick:()=>{J(()=>i.onRun(B,"steer"))},children:u(mc,{className:"size-3.5"})}):null,b(_o,{children:[u(Oo,{render:u(ie,{size:"icon-xs",variant:"ghost",disabled:A||!B.management||y!==null,"aria-label":l("turnQueue.messageActions")}),children:u(ir,{className:"size-4"})}),b(Do,{align:"end",children:[b(sr,{disabled:!B.management?.canReorder||U===0,onClick:()=>{D(B,E[U-1].intentId)},children:[u(Qd,{className:"size-4"}),l("turnQueue.moveUp")]}),b(sr,{disabled:!B.management?.canReorder||U===E.length-1,onClick:()=>{D(B,E[U+2]?.intentId??null)},children:[u(Gd,{className:"size-4"}),l("turnQueue.moveDown")]}),B.management?.canSteer?u(sr,{onClick:()=>{J(()=>i.onRun(B,"steer"))},children:l("turnQueue.steer")}):null,u(sr,{disabled:!B.management?.canRun,onClick:()=>{J(()=>i.onRun(B,"interrupt"))},children:l(B.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),u(_a,{}),u(sr,{disabled:B.action!=="cancel",onClick:()=>{J(()=>s(B))},children:l("turnQueue.cancelMessage")})]})]})]})]},B.intentId)),n.map(B=>u(l4,{submission:B},B.messageId))]})})},e),h?u("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:h}):null]}):null,c?u(IM,{entry:c,current:t.find(B=>B.intentId===c.intentId),inputKey:e,environmentId:o,unavailable:A,attachments:a,watchEditorAuthority:i.watchEditorAuthority,onEdit:i.onEdit,onClose:()=>f(null)},`${e}\0${c.intentId}\0${c.management?.revision??"none"}`):null]})}function EM({data:e,target:t,inputKey:n,attachments:o}){let r=e.useQueue({target:t,threadKey:n}),{environmentId:a,threadId:i}=t,s=e.queue,l=q(()=>{let c={environmentId:a,threadId:i};return{actions:{onEdit:(p,m)=>s.edit(c,p,m),onReorder:(p,m)=>s.reorder(c,p,m),onRun:(p,m)=>s.run(c,p,m),watchEditorAuthority:s.watchEditorAuthority},onCancel:p=>s.cancel(c,p),onResume:()=>s.resume(c)}},[s,a,i]),d=q(()=>({data:e,target:t,threadKey:`${n}\0queue-editor`}),[e,t,n]);return b(ke,{children:[u(Sp,{value:d,children:u(AM,{inputKey:n,actions:l.actions,attachments:o,entries:r.entries,pendingSubmissions:r.pendingSubmissions,environmentId:a,onCancel:l.onCancel,unavailable:r.unavailable})}),u(SC,{entries:r.entries,onCancel:l.onCancel,onResume:l.onResume,queue:r.state,unavailable:r.unavailable})]})}he();function Td(e){return e.id??e.label}function IC(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?[Td(o)]:[]})))}var RM=ve(function(t){let n=t.data.useQuestions(t.target);return n.pending.length===0?null:u("div",{"data-async-question-stack":!0,className:"mx-auto mb-2 flex max-h-[45vh] w-full max-w-3xl flex-col gap-2 overflow-y-auto overscroll-contain",children:n.pending.toReversed().map(o=>u(u4,{pending:o,actions:n},o.requestId))})});function c4(e,t,n){let o={};for(let r of e.questions){let a=n[r.id]?.trim()??"",i=t[r.id]??[];if(a.length>0)o[r.id]=a;else if(i.length>0)o[r.id]=r.multiSelect?i:i[0];else return null}return o}var u4=ve(function(t){let{pending:n,actions:o}=t,{t:r}=ye(),[a,i]=Q({}),[s,l]=Q({}),[d,c]=Q(!1),[f,p]=Q(null),m=c4(n,a,s),g=y=>{c(!0),p(null),y().then(x=>{c(!1),p(x)})},h=()=>{m===null||d||g(()=>o.answer(n.requestId,m))},v=(y,x,C)=>i(w=>{let T=w[y]??[],S=T.includes(x)?T.filter(L=>L!==x):C?[...T,x]:[x];return{...w,[y]:S}});return b("section",{"data-async-question":n.requestId,"aria-label":r("asyncQuestion.title"),className:"overflow-hidden rounded-xl border border-border/60 bg-background/95 px-3 py-2 text-sm shadow-xs",children:[b("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[u(Ci,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"font-medium",children:r("asyncQuestion.title")})]}),n.questions.map(y=>{let x=a[y.id]??[],C=s[y.id]??"";return b("div",{className:"mt-2","data-async-question-item":y.id,children:[u("p",{className:"whitespace-pre-wrap break-words text-foreground/85",children:y.question}),y.multiSelect?u("p",{className:"mt-0.5 text-xs text-secondary-label",children:r("pendingUserInput.selectOneOrMore")}):null,y.options.length>0?u("div",{className:"mt-1.5 flex flex-wrap gap-1",children:y.options.map(w=>{let T=Td(w),S=C.trim().length===0&&x.includes(T);return b(ie,{size:"xs",variant:S?"secondary":"outline","aria-pressed":S,disabled:d,onClick:()=>v(y.id,T,y.multiSelect===!0),children:[S?u(ro,{"aria-hidden":!0,className:"size-icon-1"}):null,w.label]},T)})}):null,u(kl,{type:"text",value:C,disabled:d,placeholder:r("asyncQuestion.answerPlaceholder"),"aria-label":r("asyncQuestion.answerLabel",{question:y.question}),className:"mt-1.5 h-8",onChange:w=>l(T=>({...T,[y.id]:w.target.value})),onKeyDown:w=>{w.key!=="Enter"||w.nativeEvent.isComposing||(w.preventDefault(),h())}})]},y.id)}),f?u("p",{role:"alert",className:"mt-1.5 text-xs text-destructive-foreground",children:f}):null,b("div",{className:K("mt-2 flex items-center justify-end gap-1"),children:[u(ie,{size:"xs",variant:"ghost",disabled:d,onClick:()=>g(()=>o.dismiss(n.requestId)),children:r("asyncQuestion.dismiss")}),u(ie,{size:"xs",disabled:d||m===null,onClick:h,children:r("asyncQuestion.answer")})]})]})});he();var TC=220,f4={opacity:0,transform:"translate3d(0, 4rem, 0)"},p4={opacity:0,transform:"translate3d(0, 7rem, 0)"},MM={opacity:1,transform:"none"},NM={transition:`transform ${TC}ms ease-in, opacity ${TC}ms ease-in`},m4={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function DM({className:e,items:t}){let{t:n}=ye(),[o,r]=Q(null),a=N(null),i=o!==null&&t.some(m=>m.id===o)?o:null;if(W(()=>()=>{a.current&&clearTimeout(a.current)},[]),t.length===0)return null;let s=t[0];if(!s)return null;let l=t.slice(1),d=l.length>0,c=d&&i!==s.id,f=l[0],p=m=>{!m.onDismiss||i||(r(m.id),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,m.onDismiss?.()},TC))};return u("div",{className:K("group/banner-stack chat-composer-drawer-slot",e),"data-composer-banner-drawer":"true",children:b("div",{className:K("relative flex flex-col-reverse",d?"group-hover/banner-stack:z-50 group-focus-within/banner-stack:z-50":null),children:[c&&f?u("div",{className:K("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)]",m4[f.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:K("relative z-10",i===s.id?"pointer-events-none":null),style:{...NM,...i===s.id?f4:MM},children:u(_M,{item:s,attached:!0,exiting:i===s.id,onDismissRequest:()=>p(s)})}),d?u("div",{"data-composer-banner-stack-expanded-items":"true",className:K("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:K("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:l.map(m=>u("div",{className:K(i===m.id?"pointer-events-none":null),style:{...NM,...i===m.id?p4:MM},children:u(_M,{item:m,attached:!1,exiting:i===m.id,onDismissRequest:()=>p(m)})},m.id))})})}):null]})})}function _M({item:e,attached:t,exiting:n,onDismissRequest:o}){let{t:r}=ye(),a=e.onDismiss&&!e.actions;return e.presentation==="compact"?b(bc,{variant:e.variant,role:"status",className:K("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($h,{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(wc,{className:K("shrink-0",e.actionClassName),children:[e.actions,e.onDismiss?u(ie,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissNotice"),disabled:n,onClick:o,children:u(en,{})}):null]}):null]}):b(bc,{variant:e.variant,className:K(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($h,{children:e.title}),e.description?u(Qf,{children:e.description}):null,e.actions||e.onDismiss?b(wc,{className:K(e.actionClassName,a?"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(ie,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissWarning"),disabled:n,onClick:o,children:u(en,{})}):null]}):null]})}he();var OM=bt(!1),FM=OM.Provider;function BM(){return Ut(OM)}function zM({belowSlot:e,composer:t,data:n,draftHero:o,onOverlayElementChange:r,queue:a,questions:i,target:s,threadKey:l}){let d=n.useComposerBanners({target:s,threadKey:l}),c=u(DM,{className:"relative z-0",items:d.items});return b("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,i,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}),c]}):c,b("div",{"data-chat-composer-stack":"true",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:u(FM,{value:d.items.length>0,children:t})})}),u("div",{className:"min-h-0",children:e})]})]}),u("div",{"aria-hidden":!0,className:"h-[calc(env(safe-area-inset-bottom)+1rem)] sm:h-[calc(env(safe-area-inset-bottom)+1.25rem)]"})]}),d.overlay]})}function UM(e,t){let n=e!==null&&e!=="plan-follow-up";return{showTopDrawer:e!==null&&(n||!t),showCollapsedPromptRow:t&&!n,hasBlocking:n}}var g4=["image/gif","image/jpeg","image/png","image/webp"],h4=new Set(g4);function kC(e){return h4.has(e.toLowerCase())}function v4(e){return kC(e)?"image":"file"}var y4=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function LC(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||y4.has(t)?"text":"file"}function PC(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 AC(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return v4(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t}}he();he();var EC=ve(function(t){let{t:n}=ye();if(t.count===0)return null;let o=t.placement==="inline",r=u("span",{className:K("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(ie,{size:"micro",variant:"ghost-muted","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:K("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(Sl,{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:K("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(Sl,{className:"size-3 shrink-0","aria-hidden":"true"}),n("stash.label"),r]})});he();function $M(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 HM({className:e,steps:t}){return t.length<=1?null:u("span",{"aria-hidden":!0,className:K("flex w-10 shrink-0 items-center gap-0.5",e),children:$M(t).map(({key:n,step:o})=>u("span",{className:K("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 RC=ve(function({expanded:t,hasTrailingShoulder:n=!1,onDismiss:o,onToggle:r,placement:a="tab",progress:i,steps:s}){let{t:l}=ye();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(ie,{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(fs,{"aria-hidden":!0,className:"size-3 shrink-0"}),u("span",{children:l("tasksBadge.label")}),u(HM,{steps:s}),b("span",{className:K("font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]})]}),u(ie,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(en,{"aria-hidden":!0,className:"size-2.5"})})]}):b("div",{className:K("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(fs,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"shrink-0",children:l("tasksBadge.label")}),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:K("shrink-0 font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]}),u(HM,{className:"w-20",steps:s})]}),u(ie,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(en,{"aria-hidden":!0,className:"size-3"})})]})}),KM=ve(function({onDismiss:t,onCollapse:n,progress:o,steps:r}){let{t:a}=ye();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(fs,{"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(ie,{size:"icon-micro",variant:"ghost-muted","aria-label":a("tasksBadge.dismissLabel"),className:"shrink-0",onClick:t,onPointerDown:i=>i.preventDefault(),children:u(en,{"aria-hidden":!0,className:"size-3"})})]}),u("div",{className:"space-y-px px-3 pb-4 sm:px-4",role:"list",children:$M(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:K("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:K("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?Da(s.durationMs):s.status==="inProgress"?a("tasksBadge.now"):null})]},i))})]})});var x4={"start-failed":"attachments.uploadFailure.startFailed","not-connected":"attachments.uploadFailure.notConnected",rejected:"attachments.uploadFailure.rejected","timed-out":"attachments.uploadFailure.timedOut",cancelled:"attachments.uploadFailure.cancelled",failed:"attachments.uploadFailure.failed"};function Lg(e,t){let n=e.code===void 0?void 0:x4[e.code];return n===void 0?e.reason:t(n,{status:e.httpStatus??""})}function qM(e,t){let n=0,o=0;for(let r of e.imageIds){let a=e.uploadsByImageId[r];a?.status==="failed"&&a.environmentId===e.environmentId?o+=1:(a?.status!=="ready"||a.environmentId!==e.environmentId)&&(n+=1)}return o>0?t("attachments.retryOrRemoveFailed",{count:o}):n>0?t("attachments.stillUploading",{count:n}):null}function Pg(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0));return`${Math.floor(t*100)}%`}function VM(e){switch(e){case"image":return us;case"pdf":return cs;case"text":return ds;case"file":return wo}}function C4(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(`
3849
- `)}function b4({context:e,onRemove:t}){let{t:n}=ye(),o=jt().elementContext,r=o.formatLabel(e),a=o.formatSourceLabel(e);return b(Je,{children:[u(et,{render:b("span",{className:K(pa,"pr-1"),children:[u(ta,{className:K(hr,"size-icon-1")}),u("span",{className:vr,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:mg,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(e.id)},children:u(en,{className:"size-3","aria-hidden":!0})})]})}),u(Ze,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:C4(e,o.formatLabel,o.formatSourceLabel)})]})}function WM({contexts:e,onRemove:t,className:n}){return e.length===0?null:u("div",{className:K("flex flex-wrap gap-1.5",n),children:e.map(o=>u(b4,{context:o,onRemove:t},o.id))})}function GM({comments:e,onRemove:t,className:n}){let{t:o}=ye();return e.length===0?null:u("div",{className:K("flex flex-wrap gap-1.5",n),children:e.map(r=>{let a=`${r.filePath} ${r.rangeLabel}`,i=b("span",{className:K(pa,"pr-1"),children:[u(ps,{className:K(hr,"size-icon-1")}),u("span",{className:vr,children:a}),u("button",{type:"button","aria-label":o("pendingContext.removeReviewComment",{label:a}),className:mg,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(r.id)},children:u(en,{className:"size-3","aria-hidden":!0})})]},r.id);return r.text.length===0?i:b(Je,{children:[u(et,{render:i}),u(Ze,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:r.text})]},r.id)})})}function Ag(e){let{t}=ye(),n=t(e.tooltipKey,{count:e.count});return b(Je,{children:[u(et,{render:b("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground",children:[e.icon,e.count]})}),u(Ze,{side:"top",children:n})]})}function jM({annotations:e,images:t,onRemove:n,onExpandImage:o,uploadsByImageId:r,onRetryUpload:a,className:i}){let{t:s}=ye(),l=jt().elementContext;if(e.length===0)return null;let d=new Map(t.map(c=>[c.id,c]));return u("div",{className:K("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(g=>{let h=l.normalizeSelection(g.element);return h?[{id:g.id,label:l.formatLabel(h)}]:[]});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(ta,{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:K("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:g,label:h})=>u("span",{className:"max-w-40 truncate font-mono text-secondary-label text-[10px]",children:h},g)),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(Ag,{icon:u(ta,{className:"size-3"}),count:c.elements.length,tooltipKey:"previewAnnotation.elementCount"}):null,c.regions.length>0?u(Ag,{icon:u(nc,{className:"size-3"}),count:c.regions.length,tooltipKey:"previewAnnotation.regionCount"}):null,c.strokes.length>0?u(Ag,{icon:u(na,{className:"size-3"}),count:c.strokes.length,tooltipKey:"previewAnnotation.drawingCount"}):null,c.styleChanges.length>0?u(Ag,{icon:u(gs,{className:"size-3"}),count:c.styleChanges.length,tooltipKey:"previewAnnotation.styleChangeCount"}):null,p?.status==="uploading"?u("span",{className:"text-[10px] text-secondary-label",children:Pg(p.progress)}):null,p?.status==="failed"&&f&&a?b(Je,{children:[u(et,{render:u(ie,{size:"icon-micro",variant:"ghost-muted","aria-label":s("attachments.retryUpload",{name:f.name}),onClick:()=>a(f)}),children:u(vs,{className:"size-3"})}),u(Ze,{side:"top",children:Lg(p,s)})]}):null]})]})]}),u(ie,{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(en,{className:"size-3"})})]},c.id)})})}he();function QM(e,t){let n=t?.hasWideActions?780:620;return e!==null&&e<n}function XM(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function YM(e,t){let n=jt().pane.useVisible(),[o,r]=Q(null);Ce(()=>{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),g=Number.parseFloat(m.paddingLeft)||0,h=Number.parseFloat(m.paddingRight)||0;r(Math.round(p.contentRect.width+g+h))});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=QM(o,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&XM(o,{hasWideActions:t})}}he();he();var JM={recent:"slashMenu.sections.recent",builtIn:"slashMenu.sections.builtIn",provider:"slashMenu.sections.provider",skills:"slashMenu.sections.skills"},ZM=ve(function(t){let{t:n}=ye(),o=N(null);return Ce(()=>{if(!t.activeItemId||!o.current)return;o.current.querySelector(`[data-composer-item-id="${CSS.escape(t.activeItemId)}"]`)?.scrollIntoView({block:"nearest"})},[t.activeItemId]),u(Yf,{autoHighlight:!1,mode:"none",onItemHighlighted:r=>{t.onHighlightedItemChange(typeof r=="string"?r:null)},children:u("div",{ref:o,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(ep,{className:"max-h-72 scroll-pb-6",children:u(Jf,{children:t.items.map((r,a)=>u(w4,{sectionTitle:r.section!==void 0&&t.items[a-1]?.section!==r.section?r.section:null,item:r,triggerKind:t.triggerKind,resolvedTheme:t.resolvedTheme,isActive:t.activeItemId===r.id,onHighlight:t.onHighlightedItemChange,onSelect:t.onSelect},r.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"?n("composer.searchingSkills"):n("composer.searchingFiles"):t.emptyStateText??(t.triggerKind==="skill"?n("composer.noSkillsFound"):t.triggerKind==="path"?n("composer.noMatchingFiles"):n("composer.noMatchingCommand"))})})})})}),w4=ve(function(t){let{t:n}=ye(),o=t.item.type==="skill"?rM(t.item.skill):null,r=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return b(ke,{children:[t.sectionTitle!==null?u("div",{role:"presentation","data-composer-menu-section":t.sectionTitle,className:"px-3 pt-2 pb-1 text-xs text-secondary-label",children:n(JM[t.sectionTitle]??JM.recent)}):null,b(Zf,{value:t.item.id,"data-composer-item-id":t.item.id,className:K("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:a=>{a.preventDefault()},onClick:()=>{t.onSelect(t.item)},children:[t.item.type==="path"?u(gg,{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:r?b(ke,{children:[u("span",{className:"text-secondary-label",children:"/skill:"}),ma(r)]}):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}),o?u(T4,{kind:o,showSkillSuffix:t.triggerKind==="skill"}):null]})]})]})}),S4={app:Xd,repo:vi,project:vi,personal:oa,system:gc,other:uc},I4={app:"slashMenu.skillSource.app",repo:"slashMenu.skillSource.repo",project:"slashMenu.skillSource.project",personal:"slashMenu.skillSource.personal",system:"slashMenu.skillSource.system",other:"slashMenu.skillSource.other"};function T4(e){let{t}=ye(),n=S4[e.kind],o=t(I4[e.kind]);return b(ra,{className:"ms-auto",variant:"secondary",children:[u(n,{"aria-hidden":"true",className:"text-current"}),e.showSkillSuffix?t("slashMenu.skillSourceWithSuffix",{source:o}):o]})}he();function k4(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function eN(e,t){let n=k4(e);if(!n)return"";let o=Date.now()-n.getTime();if(o<0)return t("relativeTime.justNow");let r=Math.floor(o/1e3);if(r<60)return t("relativeTime.justNow");let a=Math.floor(r/60);if(a<60)return t("relativeTime.minutesAgo",{count:a});let i=Math.floor(a/60);return i<24?t("relativeTime.hoursAgo",{count:i}):t("relativeTime.daysAgo",{count:Math.floor(i/24)})}var tN=90;function nN(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function L4(e,t){let n=e.prompt.trim().replace(/\s+/g," ");if(n.length>0)return n.length>tN?`${n.slice(0,tN)}\u2026`:n;let o=e.attachments.length+e.droppedImageNames.length;return o>0?t("stash.imageCountLabel",{count:o}):t("stash.emptyEntry")}var oN=ve(function(t){let{entries:n,onRestore:o,onDelete:r,onClose:a}=t,{t:i}=ye(),s=jt(),l=N(null),[d,c]=Q(n[0]?.id??null),f=n.find(p=>p.id===d)??n[0];return W(()=>{let p=m=>{let g=l.current;g&&m.composedPath().includes(g)||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]),W(()=>{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(y=>y.id===d),g=p.key==="ArrowDown"?1:-1,v=((m>=0?m:g===1?-1:0)+g+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(Yf,{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(ie,{variant:"ghost-muted",size:"icon-micro","aria-label":i("stash.closeLabel"),onPointerDown:p=>p.preventDefault(),onClick:a,children:u(en,{className:"size-3"})})}),u(ep,{className:"max-h-64 scroll-pb-6",children:u(Jf,{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(Zf,{value:p.id,className:K("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:L4(p,i)}),p.pendingImageCount?u("span",{className:"shrink-0 text-[10px] text-secondary-label",children:i("stash.savingImage",{count:p.pendingImageCount})}):nN(p)>0?u("span",{className:"shrink-0 text-[10px] text-warning-foreground",children:i("stash.imagesDropped",{count:nN(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:eN(p.createdAt,i)}),u(ie,{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(en,{className:"stroke-2"})})]},p.id))})})]})})});he();function ho(e,t){let n=e.trim();return n?t?.trimLeadingPattern?n.replace(t.trimLeadingPattern,"").toLowerCase():n.toLowerCase():""}function P4(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 MC(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function A4(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+MC(t,n);if(e.boundaryBase!==void 0){let o=A4(t,n,e.boundaryMarkers??[" ","-","_","/"]);if(o!==null)return e.boundaryBase+o*2+MC(t,n)}if(e.includesBase!==void 0){let o=t.indexOf(n);if(o!==-1)return e.includesBase+o*2+MC(t,n)}if(e.fuzzyBase!==void 0){let o=P4(t,n);if(o!==null)return e.fuzzyBase+o}return null}function E4(e,t){let n=e.score-t.score;return n!==0?n:e.tieBreaker.localeCompare(t.tieBreaker)}function R4(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;E4(t,a)<0?o=r:n=r+1}return n}function Eg(e,t,n){if(n<=0)return;let o=R4(e,t);if(e.length<n){e.splice(o,0,t);return}o>=n||(e.splice(o,0,t),e.pop())}function NC(e,t){let n=e.name.toLowerCase(),o=ma(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 rN(e,t,n=Number.POSITIVE_INFINITY){let o=e.filter(i=>i.enabled),r=ho(t,{trimLeadingPattern:/^\$+/});if(!r)return o;let a=[];for(let i of o){let s=NC(i,r);s!==null&&Eg(a,{item:i,score:s,tieBreaker:`${ma(i).toLowerCase()}\0${i.name}`},n)}return a.map(i=>i.item)}function M4(e,t){if(e.type==="skill"){if(t==="skill")return 0;let a=t.startsWith("skill:")?t.slice(6):t,i=a?NC(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 aN(e,t,n=[]){let o=ho(t,{trimLeadingPattern:/^\/+/});if(!o)return[...e];let r=[];for(let a of e){let i=M4(a,o);if(i===null)continue;let s=n.includes(a.id)?i-1:i;Eg(r,{item:a,score:s,tieBreaker:a.type==="slash-command"?`0\0${a.command}`:a.type==="provider-slash-command"?`1\0${a.command.name}\0${a.provider}`:`2\0${a.skill.name}\0${a.provider}`},Number.POSITIVE_INFINITY)}return r.map(a=>a.item)}function iN(e,t){let n=new Map(e.map(s=>[s.id,s])),o=t.map(s=>n.get(s)).filter(s=>s!==void 0).slice(0,3).map(s=>({...s,section:"recent"})),r=new Set(o.map(s=>s.id)),a=e.filter(s=>!r.has(s.id)),i=s=>s.type==="slash-command"?"builtIn":s.type==="provider-slash-command"?"provider":"skills";return[...o,...a.map(s=>({...s,section:i(s)}))]}function _C(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}var sN=(e,t,n)=>n.endsWith(" ")&&e[t]===" "?t+1:t;function Rg(e){return e===null?null:`${e.kind}:${e.rangeStart}:${e.rangeEnd}:${e.query}`}function lN({prompt:e,selectedProvider:t,selectedProviderStatus:n,planModeUiEnabled:o,showSkillsInSlashMenu:r,recentSlashCommandIds:a,environmentId:i,gitCwd:s,useComposerPathSearch:l,readComposerSnapshot:d,applyPromptReplacement:c,onInteractionModeChange:f,onOpenModelPicker:p,onSlashCommandUsed:m}){let{t:g}=ye(),[h,v]=Q(()=>Ao(e,e.length)),[y,x]=Q(null),[C,w]=Q(null),[T,S]=Q(null),L=y!==null&&Rg(h)===y?null:h,k=L?.kind==="path"?L.query:"",I=L?.kind==="path",P=l({environmentId:i,cwd:I?s:null,query:I?k:null}),E=q(()=>{if(!L)return[];if(L.kind==="path")return P.entries.map(ee=>({id:`path:${ee.kind}:${ee.path}`,type:"path",path:ee.path,pathKind:ee.kind,label:N4(ee.path),description:ee.path.slice(0,Math.max(0,ee.path.lastIndexOf("/")))}));if(L.kind==="slash-command"){let ee=[{id:"slash:model",type:"slash-command",command:"model",label:"/model",description:g("composer.switchModelDesc")},...o?[{id:"slash:plan",type:"slash-command",command:"plan",label:"/plan",description:g("composer.planDesc")},{id:"slash:default",type:"slash-command",command:"default",label:"/default",description:g("composer.defaultDesc")}]:[]],j=nM(n?.skills??[],r),Z=oM(n?.slashCommands??[],j).map(pe=>({id:`provider-slash-command:${t}:${pe.name}`,type:"provider-slash-command",provider:t,command:pe,label:`/${pe.name}`,description:pe.description??pe.input?.hint??g("composer.runProviderCommand")})),de=L.query.trim().toLowerCase(),F=j.map(pe=>({id:`skill:${t}:${pe.name}`,type:"skill",provider:t,skill:pe,label:`/skill:${pe.name}`,description:pe.shortDescription??pe.description??(pe.scope?g("composer.skillScopeDescription",{scope:pe.scope}):"")})),X=[...ee,...Z,...F];return de===""?iN(X,a):aN(X,de,a)}return L.kind==="skill"?rN(n?.skills??[],L.query).map(ee=>({id:`skill:${t}:${ee.name}`,type:"skill",provider:t,skill:ee,label:ma(ee),description:ee.shortDescription??ee.description??(ee.scope?g("composer.skillScopeDescription",{scope:ee.scope}):g("composer.runProviderSkill"))})):[]},[L,o,a,t,n,r,g,P.entries]),_=!!L,A=L?`${L.kind}:${L.query.trim().toLowerCase()}`:null,H=q(()=>{let ee=_C({items:E,highlightedItemId:C,currentSearchKey:A,highlightedSearchKey:T});return E.find(j=>j.id===ee)??null},[E,C,A,T]),V=R(()=>{let ee=d(),j=Ao(ee.value,ee.expandedCursor),Z=y!==null&&Rg(j)===y?null:j;return{snapshot:ee,trigger:Z}},[d,y]),J=R(ee=>{let{snapshot:j,trigger:Z}=V();if(!Z)return;if((ee.type==="slash-command"||ee.type==="provider-slash-command"||ee.type==="skill")&&m?.(ee.id),ee.type==="path"){let pe=`${Eu(ee.path)} `,le=sN(j.value,Z.rangeEnd,pe);c(Z.rangeStart,le,pe,{expectedText:j.value.slice(Z.rangeStart,le)})&&w(null);return}if(ee.type==="slash-command"){if(ee.command==="model"){c(Z.rangeStart,Z.rangeEnd,"",{expectedText:j.value.slice(Z.rangeStart,Z.rangeEnd),focusEditorAfterReplace:!1})&&(w(null),p());return}f(ee.command==="plan"?"plan":"default"),c(Z.rangeStart,Z.rangeEnd,"",{expectedText:j.value.slice(Z.rangeStart,Z.rangeEnd)})&&w(null);return}let de=ee.type==="provider-slash-command"?`/${ee.command.name} `:`$${ee.skill.name} `,F=sN(j.value,Z.rangeEnd,de);c(Z.rangeStart,F,de,{expectedText:j.value.slice(Z.rangeStart,F)})&&w(null)},[c,f,p,m,V]);W(()=>{if(!_){w(null),S(null);return}let ee=_C({items:E,highlightedItemId:C,currentSearchKey:A,highlightedSearchKey:T});w(j=>j===ee?j:ee),S(j=>j===A?j:A)},[C,T,E,_,A]);let D=R(ee=>{w(ee),S(A)},[A]),ne=R(()=>{let{trigger:ee}=V();return ee===null?!1:(x(Rg(ee)),w(null),!0)},[V]),B=R((ee,j)=>{let Z=Xo(ee,j),de=Ao(ee,Z);v(de);let F=Rg(de);x(X=>X!==null&&X!==F?null:X),w(null),S(null)},[]),U=R(()=>{w(null)},[]);return{composerTrigger:h,menuTrigger:L,composerMenuItems:E,composerMenuOpen:_,composerMenuSearchKey:A,activeComposerMenuItem:H,resolveActiveComposerTrigger:V,onSelectComposerItem:J,onComposerMenuItemHighlighted:D,onMenuEscape:ne,resetForDocumentChange:B,dismissTrigger:U,workspaceEntries:P,highlightedItemId:C,setTrigger:v,setHighlightedItemId:w,setHighlightedSearchKey:S}}function N4(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function _4(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width&&e.overlap===t.overlap}function dN(e){let t=jt(),n=Af(),o=t.pane.useActive(),[r,a]=Q(null);return Ce(()=>{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,h=(Number.parseFloat(window.getComputedStyle(c??i).getPropertyValue("--chat-composer-drawer-inset"))||1.375)*m,v=m+1,y={bottom:window.innerHeight-p.top-v,left:p.left+h,maxHeight:Math.max(96,p.top-24+v),width:Math.max(0,p.width-h*2),overlap:v};a(x=>x&&_4(x,y)?x:y)};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:n,"data-composer-drawer-layer":"true",style:{position:"fixed",zIndex:45,pointerEvents:"auto",clipPath:`inset(0 0 ${r.overlap}px 0)`,bottom:r.bottom,left:r.left,maxHeight:r.maxHeight,width:r.width},children:e.children}),document.body)}var D4=[],O4=[],F4=e=>e.prompt,B4=(e,t)=>{let n=new Map(e.map(o=>[o.id,o]));return t.flatMap(o=>{let r=n.get(o);return r?[r]:[]})},z4=(e,t)=>e.length===t.length&&e.every((n,o)=>n.id===t[o]),cN=ve(function(t){let{handleRef:n,api:o,composerDraftTarget:r,composerDocumentKey:a,promptRef:i,editorRef:s,menuAnchor:l,resolvedTheme:d,selectedProvider:c,selectedProviderStatus:f,planModeUiEnabled:p,showSkillsInSlashMenu:m,recentSlashCommandIds:g,environmentId:h,gitCwd:v,onSlashCommandUsed:y,onOpenModelPicker:x,onInteractionModeChange:C,onToggleInteractionMode:w,activePendingProgress:T,activePendingRequestId:S,hasPendingUserInputs:L,changeUserInputCustomAnswer:k,terminalContexts:I,showTerminalContexts:P,showEditor:E,isApprovalState:_,editorClassName:A,placeholder:H,disabled:V,onPaste:J,onSubmit:D,isMobileViewport:ne,isDraftRoute:B,stashMenuOpen:U,stashEntries:ee,onRestoreStashEntry:j,onDeleteStashEntry:Z,onCloseStashMenu:de,onPromptEdited:F,onUnclaimedEscape:X}=t,{t:pe}=ye(),le=o.draft.useThreadDraftSelector(r,F4),re=o.draft.useStore,we=re(Se=>Se.setPrompt),Xe=re(Se=>Se.setTerminalContexts),ot=re(Se=>Se.removeTerminalContext),at=Po(le,le.length),je=Xa(a,le,{cursor:at,expandedCursor:le.length}),[oe,Te]=Q(()=>({documentKey:a,cursor:je.cursor})),Y=oe.documentKey===a?oe.cursor:je.cursor,me=R(Se=>{Te(Re=>{let qe=Re.documentKey===a?Re.cursor:Xa(a,i.current).cursor,pt=typeof Se=="function"?Se(qe):Se,st=i.current,it=Xo(st,pt);return sM(a,st,pt,it),Re.documentKey===a&&Re.cursor===pt?Re:{documentKey:a,cursor:pt}})},[a,i]),ge=N(!1),G=N(!1),Ye=N([]),vt=N(null),Mt=R(Se=>{we(r,Se)},[r,we]),Dt=R((Se,Re,qe,pt,st)=>{k(Se,Re,qe,pt,st),i.current=Re},[k,i]),Nt=R((Se,Re,qe,pt)=>{let st=i.current,it=Math.max(0,Math.min(st.length,Se)),kt=Math.max(it,Math.min(st.length,Re));if(pt?.expectedText!==void 0&&st.slice(it,kt)!==pt.expectedText)return!1;let Vt=$R(i.current,Se,Re,qe),Pe=Po(Vt.text,Vt.cursor),Et=Xo(Vt.text,Pe);i.current=Vt.text;let mt=T?.activeQuestion;return mt&&L?Dt(mt.id,Vt.text,Pe,Et,!1):Mt(Vt.text),me(Pe),sn(Ao(Vt.text,Et)),pt?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{s.current?.focusAt(Pe)}),!0},[T?.activeQuestion,s,L,Dt,i,me,Mt]),Ot=R(()=>{let Se=s.current?.readSnapshot();return Se||{value:i.current,cursor:Y,expandedCursor:Xo(i.current,Y),terminalContextIds:I.map(Re=>Re.id)}},[Y,s,i,I]),At=lN({prompt:le,selectedProvider:c,selectedProviderStatus:f,planModeUiEnabled:p,showSkillsInSlashMenu:m,recentSlashCommandIds:g,environmentId:h,gitCwd:v,useComposerPathSearch:o.pathSearch.useComposerPathSearch,readComposerSnapshot:Ot,applyPromptReplacement:Nt,onInteractionModeChange:C,onOpenModelPicker:x,onSlashCommandUsed:y}),{composerTrigger:xt,composerMenuItems:_t,composerMenuOpen:Xt,activeComposerMenuItem:mn,resolveActiveComposerTrigger:Hn,onComposerMenuItemHighlighted:yt,onMenuEscape:qt,workspaceEntries:an,highlightedItemId:kn,setTrigger:sn,setHighlightedItemId:Cn}=At,$n=xt?.kind??null,$=xt?.kind==="path"?xt.query:"",ae=T?T.customAnswer:le,ce=_?"":ae,Le=At.resetForDocumentChange;W(()=>{Le(ae,Y)},[a,Le,ae,Y]),G.current=Xt,Ye.current=_t,vt.current=mn;let ze=$n==="path"&&$.length>0&&an.isPending===!0,ft=q(()=>pe($n==="skill"?"composer.noSkillsFound":$n==="path"?"composer.noMatchingFiles":"composer.noMatchingCommand"),[$n]),gn=R(Se=>{let Re=I.findIndex(st=>st.id===Se);if(Re<0)return;let qe=o.terminalContext.removeInlinePlaceholder(i.current,Re);i.current=qe.prompt,Mt(qe.prompt),ot(r,Se);let pt=Po(qe.prompt,qe.cursor);me(pt),sn(Ao(qe.prompt,qe.cursor))},[o.terminalContext,r,i,ot,me,Mt,I,sn]);Ce(()=>{i.current=le,me(Se=>gr(le,Se))},[a,le,i,me]),W(()=>{F(le)},[F,le]),W(()=>{Xt&&de()},[Xt,de]);let lt=N(null);W(()=>{let Se=T?.customAnswer;if(typeof Se!="string"){if(lt.current!==null){i.current=le;let kt=Po(le,le.length);me(kt),sn(Ao(le,Xo(le,kt)))}lt.current=null;return}let Re=S,qe=T?.activeQuestion?.id??null,pt=lt.current?.requestId!==Re||lt.current?.questionId!==qe,st=i.current!==Se;if(lt.current={requestId:Re,questionId:qe},!pt&&!st)return;i.current=Se;let it=Po(Se,Se.length);me(it),sn(Ao(Se,Xo(Se,it))),Cn(null)},[T?.customAnswer,T?.activeQuestion?.id,S,le,i]);let hn=R((Se,Re,qe,pt,st)=>{if(T?.activeQuestion&&L){if(T.activeQuestion.allowFreeform===!1)return;me(Re),sn(pt?null:Ao(Se,qe)),Dt(T.activeQuestion.id,Se,Re,qe,pt);return}i.current=Se,Mt(Se),z4(I,st)||Xe(r,B4(I,st)),me(Re),sn(pt?null:Ao(Se,qe))},[T?.activeQuestion,L,Dt,i,me,Mt,r,I,Xe,sn]),Ft=At.onSelectComposerItem,rt=R(Se=>{ge.current||(ge.current=!0,window.requestAnimationFrame(()=>{ge.current=!1}),Ft(Se))},[Ft]),Zt=R(Se=>{if(_t.length===0)return;let Re=_t.findIndex(kt=>kt.id===kn),st=((Re>=0?Re:Se==="ArrowDown"?-1:0)+(Se==="ArrowDown"?1:-1)+_t.length)%_t.length,it=_t[st];Cn(it?.id??null)},[kn,_t,Cn]),ln=(Se,Re)=>{if(Se==="Escape")return Re.isComposing||Re.keyCode===229?!1:qt()||(X?.()??!1);if(Se==="Tab"&&Re.shiftKey)return p?(w(),!0):!1;let{trigger:qe}=Hn();if(G.current||qe!==null){let it=Ye.current,kt=vt.current??it[0];if(Se==="ArrowDown"&&it.length>0)return Zt("ArrowDown"),!0;if(Se==="ArrowUp"&&it.length>0)return Zt("ArrowUp"),!0;if((Se==="Enter"||Se==="Tab")&&kt)return rt(kt),!0}let st=Se==="Enter"?zR({isMobileViewport:ne,shiftKey:Re.shiftKey,modifierKey:Re.metaKey||Re.ctrlKey,isDraftThread:B}):null;return st?(D(void 0,st),!0):!1};return rr(n,()=>({readSnapshot:Ot,readDraftPrompt:()=>le,applyPromptReplacement:Nt,syncCursor:(Se,Re)=>{me(Se),sn(Re)},resetCursorState:Se=>{let Re=Se?.prompt??i.current,qe=gr(Re,Se?.cursor??0);Cn(null),me(qe),sn(Se?.detectTrigger?Ao(Re,Xo(Re,qe)):null)}}),[Nt,le,i,Ot,me,Cn,sn]),b(ke,{children:[U&&!Xt&&!_&&u(dN,{anchor:l,children:u(oN,{entries:ee,onRestore:j,onDelete:Z,onClose:de})}),Xt&&!_&&u(dN,{anchor:l,children:u(ZM,{items:_t,resolvedTheme:d,isLoading:ze,triggerKind:$n,emptyStateText:ft,activeItemId:mn?.id??null,onHighlightedItemChange:yt,onSelect:rt})}),E?u(Sg,{editorRef:s,documentKey:a,value:ce,cursor:Y,terminalContexts:P?I:D4,skills:f?.skills??O4,...A?{className:A}:{},onRemoveTerminalContext:gn,onChange:hn,onCommandKeyDown:ln,onPaste:J,placeholder:H,disabled:V}):null]})});he();function uN(e){return e==="ready"}function fN(e){return e==="ready"||e==="unchecked"||e==="checking"}function pN(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 Mg(e){return e.enabled&&fN(e.readiness)}function Hu(e){return e.enabled}function mN(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 gN=e=>e.enabled;function hN(e,t){let n=e.find(o=>o.instanceId===t);if(n)return n.driverKind}var vN="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 Yo({className:e,size:t="sm",variant:n="ghost",...o}){return u(ie,{className:K(vN,e),size:t,variant:n,...o})}function Jo({icon:e,className:t,opticalSize:n="default"}){return u(e,{"aria-hidden":"true",className:K("shrink-0",n==="large"?"size-4.5":"size-4",t),"data-composer-control-icon":!0})}function ga(){return u(rn,{"aria-hidden":"true",className:"-mx-0.5 size-icon-2 shrink-0 text-icon-muted","data-composer-control-chevron":!0,strokeWidth:2.25})}function Ng({className:e,size:t="sm",variant:n="ghost",...o}){return u(uS,{className:K(vN,e),icon:u(ga,{}),size:t,variant:n,...o})}function DC(e,t){if(!e)return t("composer.agentPickerLabel");let n=e.agentName?.trim(),o=e.displayName.trim();return n?!o||o===n?n:`${n} \xB7 ${o}`:o}function OC(e,t){let n=e.filter(Hu),o=t.lockedProvider;if(o==null||o.length===0)return n;let r=t.lockedContinuationGroupKey;return n.filter(a=>a.driverKind===o&&(!r||a.continuationGroupKey===r))}var FC=ve(function(t){let{t:n}=ye(),o=t.instanceEntries.filter(Hu),r=t.unavailableInstanceId??null,a=r===null?null:t.instanceEntries.find(c=>c.instanceId===r)??null,i=t.notChosen===!0&&r===null,s=r!==null||i?null:o.find(c=>c.instanceId===t.activeInstanceId)??null,l=t.lockedProvider!=null&&t.lockedProvider.length>0,d=r!==null||i?OC(t.instanceEntries,t):o;return b(_o,{children:[b(Oo,{render:u(Yo,{"aria-label":n("composer.agentPickerLabel"),"data-composer-agent-picker":"true",disabled:t.disabled||l&&r===null||d.length===0,className:K("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-36 shrink-0":"max-w-44 shrink")}),children:[r!==null?u(Pn,{"aria-hidden":"true",className:"size-4 shrink-0 text-warning"}):i?null:s?u(Sr,{driver:s.driverKind,displayName:s.displayName,accentColor:s.accentColor,className:"size-4",iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,r!==null?b("span",{className:"min-w-0 truncate text-warning","data-composer-agent-unavailable":"true",children:[a===null?r:DC(a,n)," \xB7 ",n("composer.agentUnavailableBadge")]}):i?u("span",{className:"min-w-0 truncate","data-composer-agent-not-chosen":"true",children:n("composer.agentChoosePlaceholder")}):u("span",{className:"min-w-0 truncate",children:DC(s,n)}),u(ga,{})]}),u(Do,{align:"start",children:u(Ir,{value:r!==null||i?"":t.activeInstanceId,onValueChange:c=>{!c||r===null&&!i&&c===t.activeInstanceId||t.onInstanceChange(c)},children:d.map(c=>u(Vo,{value:c.instanceId,children:DC(c,n)},c.instanceId))})})]})});function yN(e){return u(FC,{...e})}function xN(e){return e.machineUnavailable?"machineDisconnected":e.sessionStarted&&e.sessionDisconnected?"settled":"default"}function CN(e){switch(e){case"machineDisconnected":return"composer.disconnectedPlaceholder";case"settled":return"composer.idlePlaceholder";case"default":return null}}he();he();he();var nb=qd(IN(),1),i_=qd(_c(),1),s_=qd(_c(),1);Wn(function(t,n){return De("div",{ref:n,...t})});var Kg=Wn(function(t,n){return De("div",{ref:n,...t})}),yr=Kg,ti={OS:"web"};function nl(e,t){return t===void 0?e:Math.max(0,Math.min(t,e))}function ob(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 l_(){return"normal"}function Q4(e){var t;return(t=e?.horizontalRTLScrollType)!=null?t:l_()}function X4(e){var t;return(t=e?.rtl)!=null?t:!1}function oi(e){return rb(e?.props)}function rb(e){return!!e?.horizontal&&X4(e)}function ab(e){return e?.horizontal?(rb(e)?e.stylePaddingLeft:e.stylePaddingRight)||0:e?.stylePaddingBottom||0}function Y4(e,t){var n;return(n=ob(e,t))!=null?n:0}function TN(e,t){return t&&(oi(e)?t.left:t.right)||0}function J4(e,t,n,o){return!oi(e)||o===void 0||!Number.isFinite(o)?t:Math.max(0,o-t-n)}function ib(e,t,n){if(!e||!oi(e))return t;let o=ob(e,n),r=nl(t,o),a=Q4(e);return a==="negative"?r===0?0:-r:a==="inverted"?o===void 0?r:nl(o-r,o):r}function Z4(e,t,n){if(!oi(e))return e.horizontalRTLScrollType=void 0,t;let o=ob(e,n);if(t<0)return e.horizontalRTLScrollType="negative",nl(-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 nl(a,o);if(i==="normal")return nl(r,o);if(!e.hasScrolled){let f=l_();return e.horizontalRTLScrollType=f,nl(r,o)}let s=e.scroll,l=Math.abs(r-s),c=Math.abs(a-s)+.5<l;return e.horizontalRTLScrollType=c?"inverted":"normal",nl(c?a:r,o)}var eW=e=>e,qg=bt(null),d_="\0",tW=0;function nW({children:e}){let[t]=Q(()=>({animatedScrollY:eW(0),columnWrapperStyle:void 0,containerLayoutTriggers:new Map,contextNum:tW++,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 De(qg.Provider,{value:t},e)}function $r(){return Ut(qg)}function c_(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=be(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(Za(e,i,r));return()=>{for(let i of a)i()}}}}function oW(e){return e.length===1?e[0]:e.join(d_)}function rW(e){return e.split(d_)}function Za(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 be(e,t){let{values:n}=e;return n.get(t)}function Be(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 aW(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 iW(e,t,n){let{positionListeners:o}=e,r=o.get(t);if(r)for(let a of r)a(n)}function er(e){let t=Ut(qg),n=oW(e),{subscribe:o,get:r}=q(()=>c_(t,rW(n)),[t,n]);return(0,nb.useSyncExternalStore)(o,r,r)}function sW(e,t){let n=Ut(qg),{subscribe:o,get:r}=q(()=>c_(n,[e]),[n,e]),a=R(()=>t(r()[0]),[r,t]);return(0,nb.useSyncExternalStore)(o,a,a)}function lW(e){return Math.max(0,e??0)}function rl(e,t){var n;let o=e.state,{props:r}=o,a=r.horizontal,i=r.contentInset,s=i??o.nativeContentInset,l=(a?TN(o,s):s?.bottom)||0,d=lW(t??r.contentInsetEndAdjustment),c=be(e,"anchoredEndSpaceSize"),f=r.anchoredEndSpace&&c?c:0,p=(n=o.contentInsetOverride)!=null?n:void 0,m=l+d;if(p){let g={bottom:0,left:0,right:0,...s,...p};return Math.max(((a?TN(o,g):g.bottom)||0)+d,f)}return Math.max(m,f)}function vo(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=rl(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 Ld=({children:e})=>De(Kg,{style:{alignItems:"center",flexDirection:"row",justifyContent:"space-between"}},e);ve(function(){let t=$r(),[n=0,o=0,r=0,a=0,i=0,s=0,l=!1]=er(["totalSize","scrollAdjust","debugRawScroll","debugComputedScroll","numContainers","numContainersPooled","isAtEnd"]),d=vo(t),[,c]=Ea(f=>f+1,0);return dW(()=>{c()},100),De(Kg,{pointerEvents:"none",style:{backgroundColor:"#FFFFFFCC",borderRadius:4,padding:4,paddingBottom:4,paddingLeft:4,position:"absolute",right:0,top:0}},De(Ld,null,De(yr,null,"TotalSize:"),De(yr,null,n.toFixed(2))),De(Ld,null,De(yr,null,"ContentSize:"),De(yr,null,d.toFixed(2))),De(Ld,null,De(yr,null,"At end:"),De(yr,null,String(l))),De(Ld,null,De(yr,null,"ScrollAdjust:"),De(yr,null,o.toFixed(2))),De(Ld,null,De(yr,null,"RawScroll: "),De(yr,null,r.toFixed(2))),De(Ld,null,De(yr,null,"ComputedScroll: "),De(yr,null,a.toFixed(2))))});function dW(e,t){W(()=>{let n=setInterval(e,t);return()=>clearInterval(n)},[t])}var sb=!0,u_=new WeakMap;function cW(e){return u_.get(e)}function uW(e,t){u_.set(e,t)}var fW=typeof __DEV__<"u"?__DEV__:void 0,kN,LN=typeof process<"u"&&typeof process.env=="object"&&process.env?(kN="production")!=null?kN:process.env.MODE:void 0,PN=typeof LN=="string"?LN.toLowerCase()!=="production":void 0,AN,Zo=(AN=PN??fW)!=null?AN:!1,Pd=-1e7,f_=1,pW=Zo&&!1,mW=Zo&&!1;function Vg({scheduledWork:e}){e.cancel("checkFinishedScrollFrame"),e.cancel("checkFinishedScrollRetryFrame"),e.cancel("checkFinishedScrollFallback"),e.cancel("platformScrollCompletion")}function p_(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 gW(e){Vg(e),e.scheduledWork.cancel("imperativeScrollReady"),e.scrollingTo=void 0,e.scrollTargetPinnedRange=void 0,p_(e)}function hW(e,t,n){return{...t,nativeEvent:{...t.nativeEvent,contentOffset:e.props.horizontal?{x:n,y:0}:{x:0,y:n}}}}function vW(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,hW(i,s,(o=(n=t??i.scrollPending)!=null?n:i.scroll)!=null?o:0)))}var zC=1;function yW(e){return!!(e?.didDispatchNativeScroll||e?.didRetrySilentInitialScroll||e?.watchdog)}function EN(e){e.initialScrollSession=void 0}function VC(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 _g(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=VC({bootstrap:e.initialScrollSession.kind==="bootstrap"?e.initialScrollSession.bootstrap:void 0,completion:e.initialScrollSession.completion,kind:t,previousDataLength:e.initialScrollSession.previousDataLength})):e.initialScrollSession=VC({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){_g(e).didDispatchNativeScroll=!0},markSilentInitialScrollRetry(e){_g(e).didRetrySilentInitialScroll=!0},resetFlags(e){if(!e.initialScrollSession)return;let t=_g(e,e.initialScrollSession.kind);t.didDispatchNativeScroll=void 0,t.didRetrySilentInitialScroll=void 0}},lo={clear(e){lo.set(e,void 0)},didReachTarget(e,t){return Math.abs(e-t.targetOffset)<=zC},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>zC},isAtZeroTargetOffset(e){return e<=zC},set(e,t){var n,o;if(!t&&!((o=(n=e.initialScrollSession)==null?void 0:n.completion)!=null&&o.watchdog))return;let r=_g(e);r.watchdog=t?{startScroll:t.startScroll,targetOffset:t.targetOffset}:void 0}};function ni(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&&!yW(l))return EN(e);let f=(a=(r=t.previousDataLength)!=null?r:i?.previousDataLength)!=null?a:0;return e.initialScrollSession=VC({bootstrap:c,completion:l,kind:s,previousDataLength:f}),e.initialScrollSession}var xW=1.3;function WC(e,t,n){let o=Math.abs(e);return!t&&n>0&&o>=n*xW||!t&&n<=0&&o>0}var m_=(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?WC(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 CW(e,t){let n=e.state;t==="start"?(n.isStartReached=!1,n.startReachedSnapshot=void 0):(n.isEndReached=!1,n.endReachedSnapshot=void 0)}function g_(e){let t=e.state;if(!t.edgeReachedGate)return;let n=vo(e),o=n-t.scroll-t.scrollLength-rl(e),r=n<t.scrollLength,a=t.props.onStartReachedThreshold*t.scrollLength,i=t.props.onEndReachedThreshold*t.scrollLength,s=WC(t.scroll,!1,a),l=WC(o,r,i);s&&l&&(t.edgeReachedGate=void 0)}function h_(e,t,n,o){return!e.state.edgeReachedGate||n===t||!!o}function v_(e){e.state.edgeReachedGate="closed"}function RN(e){e.state.edgeReachedGate&&(e.state.edgeReachedGate="prepared")}function bW(e,t){let n=e.state;if(n.edgeReachedGate!=="prepared")return;let o=t<0?"start":"end";return n.edgeReachedGate="closed",CW(e,o),o}function qu(e){return!!e?.initialScroll&&!e.didFinishInitialScroll}function y_(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=vo(e);if(g_(e),f>0&&a){let p=rl(e),m=f-s-i-p,g=f<i;Be(e,"isAtEnd",g||m<=f_),Be(e,"isNearEnd",g||m<=c*i),Be(e,"isWithinMaintainScrollAtEndThreshold",g||m<=d*i),qu(r)||l||(r.isEndReached=m_(m,g,c*i,r.isEndReached,r.endReachedSnapshot,{contentSize:f,dataLength:(o=r.props.data)==null?void 0:o.length,scrollPosition:s},v=>{var y,x;h_(e,"end",t,n)&&(v_(e),(x=(y=r.props).onEndReached)==null||x.call(y,{distanceFromEnd:v}))},v=>{r.endReachedSnapshot=v}))}}function wW(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;g_(e),r&&p>0&&s>p&&d&&(d.contentSize!==c||d.dataLength!==f)&&(o.isStartReached=!1,o.startReachedSnapshot=void 0),Be(e,"isAtStart",s<=f_),Be(e,"isNearStart",s<=p),qu(o)||o.scrollingTo||(o.isStartReached=m_(s,!1,p,o.isStartReached,d,{contentSize:c,dataLength:f,scrollPosition:s},g=>{var h,v;h_(e,"start",t,n)&&(v_(e),(v=(h=o.props).onStartReached)==null||v.call(h,{distanceFromStart:g}))},g=>{o.startReachedSnapshot=g}))}function Gg(e,t){let n=!e.state.edgeReachedGate;y_(e,t,n),wW(e,t,n)}function x_(e){var t,n;let o=e.state;(t=o.props)!=null&&t.data&&((n=o.triggerCalculateItemsInView)==null||n.call(o,{forceFullItemPositions:!0})),Gg(e)}var SW=6,IW=3,TW=250;function C_(e){e.state.scheduledWork.cancel("adaptiveRender")}function MN(e,t){let n=e.state;C_(e),t<=0?ju(e,"normal","scroll"):n.scheduledWork.timeout(()=>ju(e,"normal","scroll"),t,"adaptiveRender")}function ju(e,t,n){var o,r;be(e,"adaptiveRender")!==t&&(Be(e,"adaptiveRender",t),(r=(o=e.state.props.adaptiveRender)==null?void 0:o.onChange)==null||r.call(o,t,n))}function lb(e){var t,n;C_(e);let o=(n=(t=e.state.props.adaptiveRender)==null?void 0:t.initialMode)!=null?n:"normal";be(e,"adaptiveRender")!==o&&ju(e,o,"initial")}function kW(e,t,n){var o,r,a;let i=e.state,s=i.props.adaptiveRender,l=be(e,"adaptiveRender");if(be(e,"readyToRender"))if(s){let d=(o=s.enterVelocity)!=null?o:SW,c=(r=s.exitVelocity)!=null?r:IW,f=(a=s.exitDelay)!=null?a:TW,p=l==="light"?c:d,m=n?.forceLight||Math.abs(t)>p?"light":"normal",g=i.scheduledWork.has("adaptiveRender")?"normal":l;m!==g&&(m==="light"?(ju(e,"light","scroll"),MN(e,f)):l==="light"&&MN(e,f))}else lb(e)}var db=50;function b_(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"&&!be(e,"readyToRender")&&!a?Math.min(o,db):o}function w_(e){let{state:t}=e;t.props.drawDistance<=db||t.scheduledWork.has("fullDrawDistancePrewarm")||t.scheduledWork.frame(()=>{var n;return(n=t.triggerCalculateItemsInView)==null?void 0:n.call(t)},"fullDrawDistancePrewarm")}function cb(e,{resetLayout:t,resetInitialScroll:n}){let{state:o}=e;t&&(o.didContainersLayout=!1,o.queuedInitialLayout=!1),n&&(o.didFinishInitialScroll=!1),Be(e,"readyToRender",!1),lb(e)}function ub(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&&!be(e,"readyToRender")&&(Be(e,"readyToRender",!0),ju(e,"normal","ready"),o.props.drawDistance>db&&w_(e),o.didLoad||(o.didLoad=!0,a&&a({elapsedTimeInMs:Date.now()-r})))}var LW=2e3;function NN(e,t){e.scroll=t,e.scrollPending=t,e.scrollPrev=t}function S_(e){e.scheduledWork.cancel("preservedInitialScroll")}function Ad(e){S_(e),e.clearPreservedInitialScrollOnNextFinish=void 0,e.initialScroll=void 0,ni(e)}function _N(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&&(Vg(r),r.scrollingTo=void 0,r.scrollTargetPinnedRange=void 0),Wg.resetFlags(r),ni(r,{bootstrap:null}),Ed(e))}function Ed(e,t){var n,o,r;let a=e.state;if(t?.resolvedOffset!==void 0)NN(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)&&NN(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;lo.clear(a),t?.preserveTarget&&a.initialScroll?(a.clearPreservedInitialScrollOnNextFinish=void 0,ni(a),S_(a),t?.schedulePreservedTargetClear&&a.scheduledWork.timeout(()=>{var g;!a.didFinishInitialScroll||(g=a.scrollingTo)!=null&&g.isInitialScroll||!a.initialScroll||Ad(a)},LW,"preservedInitialScroll")):Ad(a),t?.recalculateItems&&x_(e),ub(e,{didInitialScroll:!0}),p&&vW(e,m),(f=t?.onFinished)==null||f.call(t)};if(t?.waitForCompletionFrame){requestAnimationFrame(i);return}i()}function jg(e,t){let n=e.state;return t!==void 0&&n.positions[t]||0}function PW(e){let{state:t}=e;return(t.props.horizontal?(oi(t)?t.props.stylePaddingRight:t.props.stylePaddingLeft)||0:be(e,"stylePaddingTop")||0)+(be(e,"alignItemsAtEndPadding")||0)+(be(e,"headerSize")||0)}function Qt(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 AW(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 EW(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-AW(e)-rl(e)):0}function ll(e){let t=be(e,"alignItemsAtEndPadding")||0,n=EW(e);t!==n&&Be(e,"alignItemsAtEndPadding",n)}function Vu(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&&Be(e,"totalSize",i),ll(e)):o&&e.values.get("totalSize")!==i&&Be(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&&Vu(e,t,s,o),a.set(t,n)}function I_(e){return typeof e=="function"}function Qg(e){return Array.isArray(e)}var DN=new Set;function ol(e,t){Zo&&!DN.has(e)&&(DN.add(e),console.warn(`[legend-list] ${t}`))}function Qu(e){return Math.floor(e*8)/8}function Wu(e){return e==null}function ON(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 Ku(e,t,n){return ON(e,n)+ON(t,n)}function jC(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=be(e,"numContainers");for(let i=0;i<a;i++)if(be(e,`containerItemKey${i}`)===t)return i;return-1}function T_(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 k_(e,t){let n=Qt(e.state,t);return T_(e,n,t,e.state.props.data[t])}function RW(e,t,n){for(let o=t;o<=n;o++)if(k_(e,o)===void 0)return!1;return!0}function yo(e,t,n,o,r,a,i,s){var l,d,c,f;let p=e.state,{sizes:m,averageSizes:g,props:{estimatedItemSize:h,getItemType:v},scrollingTo:y}=p,x=p.sizesKnown.get(t);if(x!==void 0)return x;let C,w=m.get(t);if(a&&w!==void 0)return w;if(C=T_(e,t,n,o,s),C!==void 0)return GC(e,t,C,i),C;let T=(d=s?.itemType)!=null?d:v&&(l=v(o,n))!=null?l:"";if(r&&!y){let S=(c=g[T])==null?void 0:c.avg;S!==void 0&&(C=Qu(S))}if(C===void 0&&w!==void 0)return w;if(C===void 0&&r&&y){let S=(f=y.averageSizeSnapshot)==null?void 0:f[T];S!==void 0&&(C=Qu(S))}return C===void 0&&(C=h+e.scrollAxisGap),GC(e,t,C,i),C}function fb(e,t){if(t===void 0||t<0)return;let n=Qt(e.state,t);return yo(e,n,t,e.state.props.data[t])}function Xg(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=PW(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:yo(e,Qt(r,a),a,r.props.data[a]),m=Math.max(0,p-(c?0:e.scrollAxisGap)),g=rl(e);if(l-=s*(r.scrollLength-g-m),!c&&a===r.props.data.length-1){let h=be(e,"footerSize")||0;l+=h}}return l}function Yi(e,t,n){let o=e.state,r=vo(e),a=t;if(Number.isFinite(r)&&Number.isFinite(o.scrollLength)&&ti.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 Xu(e){var t,n;let o=e.state;if(o?.scrollingTo){Vg(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&&Vu(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;Ed(e,{onFinished:()=>{r?.()},preserveTarget:i&&o.props.data.length===0||s,recalculateItems:!0,schedulePreservedTargetClear:s,syncObservedOffset:i,waitForCompletionFrame:!!a.waitForInitialScrollCompletionFrame});return}x_(e),r?.()}}var MW=80,NW=1500,_W=320,DW=1;function OW(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?vo(e):void 0,m=f?ib(r,s,p):0,g=f?0:s;if(l.scrollTo({animated:c,x:m,y:g}),c){let h=(o=(n=l.getScrollEventTarget)==null?void 0:n.call(l))!=null?o:null;FW(e,{readOffset:()=>l.getCurrentScrollOffset(),target:h,targetOffset:s})}else{r.scroll=s;let h=r.scrollingTo;r.scheduledWork.timeout(()=>{h===r.scrollingTo&&Xu(e)},100,"platformScrollCompletion")}}function FW(e,t){let{readOffset:n,target:o,targetOffset:r}=t;if(!o){Xu(e);return}let a="onscrollend"in o,i,s=!1,{scheduledWork:l,scrollingTo:d}=e.state,c=setTimeout(()=>m("max"),NW),f=()=>{o.removeEventListener("scroll",g),a&&o.removeEventListener("scrollend",h),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 y=n(),x=Math.abs(y-r)<=DW;v==="scrollend"&&!x||(l.cancel("platformScrollCompletion"),Xu(e))},g=()=>{i!==void 0&&clearTimeout(i),i=setTimeout(()=>m("idle"),MW)},h=()=>m("scrollend");o.addEventListener("scroll",g),a?o.addEventListener("scrollend",h):i=setTimeout(()=>m("idle"),_W),l.register("platformScrollCompletion",p)}function Rd(e){let t=e.state,{didContainersLayout:n,pendingNativeMVCPAdjust:o,refScroller:r,props:{maintainScrollAtEnd:a}}=t,s=!!(be(e,"isWithinMaintainScrollAtEndThreshold")&&a&&n);if(o)return t.pendingMaintainScrollAtEnd=s,!1;if(s){if(t.pendingMaintainScrollAtEnd=!1,vo(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=be(e,"isWithinMaintainScrollAtEndThreshold"),m=t.scroll!==f;if(p||!m){t.maintainingScrollAtEnd=c;let g=r.current;if(t.props.horizontal&&oi(t)){let h=vo(e),v=Y4(t,h),y=ib(t,v,h);g?.scrollTo({animated:a.animated,x:y,y:0})}else g?.scrollToEnd({animated:a.animated});setTimeout(()=>{t.maintainingScrollAtEnd===c&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd&&Rd(e))},a.animated?500:0)}else t.maintainingScrollAtEnd===d&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd=!1)})}return!0}return t.pendingMaintainScrollAtEnd=!1,!1}function dl(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,be(e,"readyToRender")?r():(o.adjustingFromInitialMount=(o.adjustingFromInitialMount||0)+1,requestAnimationFrame(r))}}var Eo=.1,BW=300,zW=2,UW=1;function HW(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 $W(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)<=Eo&&d?.id===n?d.quietPasses+1:0;if(!r&&c>=zW){e.mvcpAnchorLock=void 0;return}e.mvcpAnchorLock={expiresAt:a+BW,id:n,position:o,quietPasses:c}}}function KW(e,t,n,o,r,a){return!1}function qW(e,t,n){if(Math.abs(t)<=Eo)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 VW(e,t){return e<0?-t:t}function UC(e,t,n){let o=e.state;o.pendingNativeMVCPAdjust=void 0;let r=t-n;Math.abs(r)>Eo&&dl(e,r)}function WW(e){let t=e.state,n=t.pendingNativeMVCPAdjust;if(!n||Math.abs(n.manualApplied)>Eo)return;let o=vo(e),r=qW(t,n.amount,o);if(Math.abs(r)<=Eo)return;let a=n.amount-r;Math.abs(a)<=Eo||(n.manualApplied=a,dl(e,a),n.furthestProgressTowardAmount=0)}function GW(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>Eo||r>0&&a<-Eo,s=VW(r,a);if(Math.abs(r)<=Eo)return n.pendingNativeMVCPAdjust=void 0,!0;if(i)return n.pendingNativeMVCPAdjust=void 0,!1;if(s+Eo>=Math.abs(r))return UC(e,r,a),!0;let l=Math.max(0,vo(e)-n.scrollLength);return Math.abs(t-l)<=UW||n.pendingMaintainScrollAtEnd&&be(e,"isWithinMaintainScrollAtEndThreshold")&&s>Eo?(UC(e,r,a),!0):s>o.furthestProgressTowardAmount+Eo?(o.furthestProgressTowardAmount=s,!1):(o.furthestProgressTowardAmount>Eo&&s<o.furthestProgressTowardAmount-Eo&&(n.pendingNativeMVCPAdjust=void 0),!1)}function jW(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=HW(n,c,i,d),m,g,h=[],v=f?.index,y=f?.viewPosition,x=v!==void 0&&n.props.data.length>0&&v>=n.props.data.length-1&&(y??0)>0,C=t?i:s,w=n.indexByKey,T=n.scroll;if(vo(e),C){if(p&&v===void 0?(g=p.id,m=p.position):v!==void 0?g=Qt(n,v):o.length>0&&n.didContainersLayout&&!t&&(g=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],k=w.get(L);if(k!==void 0){let I=r[k];I!==void 0&&h.push({id:L,position:I})}}if(g!==void 0&&m===void 0){let S=w.get(g);S!==void 0&&(m=r[S])}return()=>{let S=0,L=p?.id,k,I=!1,P=n.props.data;if(t&&i&&v===void 0&&g!==void 0&&p?.id===g&&l!==void 0&&g!==void 0){let A=w.get(g);if(A!==void 0){let H=P[A];I=H===void 0||!l(H,A,P),I&&p?.id===g&&(n.mvcpAnchorLock=void 0)}}if(t&&i&&v===void 0&&(()=>{if(g===void 0||I)return!0;let A=w.get(g);return A===void 0||r[A]===void 0})())for(let A=0;A<h.length;A++){let{id:H,position:V}=h[A],J=w.get(H);if(J!==void 0&&l){let ne=P[J];if(ne===void 0||!l(ne,J,P))continue}let D=J!==void 0?r[J]:void 0;if(D!==void 0){S=D-V,L=H,k=D;break}}if(!I&&g!==void 0&&m!==void 0){let A=w.get(g),H=A!==void 0?r[A]:void 0;if(H!==void 0){let V=vo(e),J=H-m;if(J!==0&&x&&n.scroll+n.scrollLength>V)if(J>0)J=Math.max(0,V-n.scroll-n.scrollLength);else{let D=Math.max(0,V-n.scrollLength);n.scroll=D,n.scrollPending=D,J=0}S=J,L=g,k=H}}if(y&&y>0){let A=yo(e,g,v,n.props.data[v]),H=f?.itemSize;if(A!==void 0&&H!==void 0&&A!==H){let V=A-H;V!==0&&(S+=V*y,f.itemSize=A)}}if($W(n,{anchorId:L,anchorPosition:k,dataChanged:t,now:d,positionDiff:S}),KW()){n.pendingNativeMVCPAdjust={amount:S,furthestProgressTowardAmount:0,manualApplied:0,startScroll:T},WW(e);return}Math.abs(S)>Eo&&((n.maintainingScrollAtEnd==="pending-animated"||n.maintainingScrollAtEnd==="animated")&&be(e,"isWithinMaintainScrollAtEndThreshold")||dl(e,S))}}}var FN=1e3,QW=200,Yg=e=>{let{scrollHistory:t}=e,n=t.length-1;if(n<1)return 0;let o=t[n];if(Date.now()-o.time>FN)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>FN)break;if(c===0||f<=0)continue;let m=o.time-l.time,g=Math.exp(-m/QW);a+=c/f*g,i+=g}return i>0?a/i:0};function XW(e){let t=e.mvcpAnchorLock;return t?Date.now()>t.expiresAt?(e.mvcpAnchorLock=void 0,!1):!0:!1}function tf(e){return e.dataChangeNeedsScrollUpdate||XW(e)}function al(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(),g=s!==void 0&&Math.abs(m-s)>.1;if(g&&(d.length=0),a.lastScrollAdjustForHistory=m,c===void 0&&!(d.length===0&&t===a.scroll)&&(g||d.push({scroll:t,time:p})),d.length>5&&d.shift(),i&&!c){let{lt:I,gt:P}=i;if(I&&t<I||P&&t>P){a.ignoreScrollFromMVCPIgnored=!0;return}}a.scrollPrev=f,a.scrollPrevTime=a.scrollTime,a.scroll=t,a.scrollTime=p;let h=Math.abs(t-f),y=!!o?.fromNativeScrollEvent&&h>.1&&!g&&c===void 0&&!a.pendingNativeMVCPAdjust?bW(e,t-f):void 0,x=GW(e,t),C=a.scrollLength,w=C>0&&c===void 0&&h>C&&!a.pendingNativeMVCPAdjust,T=Yg(a);kW(e,T,{forceLight:w});let S=a.scrollLastCalculate;if(tf(a)||x||y!==void 0||n||S===void 0||Math.abs(a.scroll-S)>2){a.scrollLastCalculate=a.scroll,a.ignoreScrollFromMVCPIgnored=!1,a.lastScrollDelta=h;let I=()=>{var E;let _={doMVCP:c!==void 0,scrollVelocity:T};w&&(_.drawDistanceMode="visible-first"),(E=a.triggerCalculateItemsInView)==null||E.call(a,_),Gg(e,y)};w?(a.mvcpAnchorLock=void 0,a.pendingNativeMVCPAdjust=void 0,a.userScrollAnchorReset={keys:new Set},a.scheduledWork.cancel("mvcpRecalculate"),(0,s_.flushSync)(I),w_(e)):I();let P=!!a.pendingMaintainScrollAtEnd||!!((r=a.props.maintainScrollAtEnd)!=null&&r.onDataChange);x&&P&&(a.pendingMaintainScrollAtEnd=!1,Rd(e)),a.dataChangeNeedsScrollUpdate=!1,a.lastScrollDelta=0}}function YW(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 JW(e,t){var n;let{isInitialScroll:o,requestedOffset:r,targetOffset:a}=t,i=lo.get(e),s=!e.didFinishInitialScroll&&(o||!!i)&&lo.hasNonZeroTargetOffset(a),l=!e.didFinishInitialScroll&&!!i&&lo.isAtZeroTargetOffset(r);if(s){e.hasScrolled=!1,lo.set(e,{startScroll:(n=i?.startScroll)!=null?n:e.scroll,targetOffset:a});return}l&&lo.clear(e)}function ZW(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 BN(e,t){var n;let o=e.state.positions[t];if(o===void 0)return;let r=(n=fb(e,t))!=null?n:0;return o+(Number.isFinite(r)?r:0)}function eG(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)):ZW(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=BN(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=BN(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 tG(e,t,n){let o=eG(e,t,n);o?(e.state.scrollTargetPinnedRange=o,e.state.scrollForNextCalculateItemsInView=void 0):e.state.scrollTargetPinnedRange=void 0}function Jg(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;Vg(r);let g=f?c:Xg(e,c,s),h=!!d&&((n=r.initialScrollSession)==null?void 0:n.kind)==="offset",v=Yi(e,g,s),y=h?g:v;if(r.scrollHistory.length=0,!a){d&&Wg.resetFlags(r);let x=YW(r);r.scrollingTo={...s,...x?{averageSizeSnapshot:x}:{},targetOffset:v,waitForInitialScrollCompletionFrame:p},d||tG(e,v,s.index)}r.scrollPending=v,JW(r,{isInitialScroll:d,requestedOffset:y,targetOffset:v}),!d&&!a&&Math.abs(r.scroll-v)>1&&(l?r.scrollTargetPinnedRange&&((o=r.triggerCalculateItemsInView)==null||o.call(r)):al(e,v,!0,{markHasScrolled:!1})),i||!d||ti.OS==="android"?OW(e,{animated:l,horizontal:m,offset:y}):r.scroll=y}function L_(e,t){return t<=0?-1:e>=t?t-1:e<0?0:e}function Dg(e,{index:t,viewOffset:n=0,animated:o=!0,forceScroll:r,isInitialScroll:a,viewPosition:i}){let s=e.state,{data:l}=s.props;t=L_(t,l.length);let d=fb(e,t),c=jg(e,t);t===l.length-1&&i===void 0&&(i=1),s.scrollForNextCalculateItemsInView=void 0,Jg(e,{animated:o,forceScroll:r,index:t,isInitialScroll:a,itemSize:d,offset:c,viewOffset:n,viewPosition:i??0})}function Zg(e,t){let{forceScroll:n,resolvedOffset:o,target:r,waitForCompletionFrame:a}=t,i=r.index,s=i!==void 0?L_(i,e.state.props.data.length):void 0,l=fb(e,s);Jg(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 il(e,t,n){var o;let{state:r}=e;r.clearPreservedInitialScrollOnNextFinish=void 0,r.scheduledWork.cancel("preservedInitialScroll"),r.initialScroll=t,n?.resetDidFinish&&cb(e,{resetInitialScroll:!0}),ni(r,{kind:((o=r.initialScrollSession)==null?void 0:o.kind)==="offset"?"offset":"bootstrap"})}function Hr(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?jg(e,t.index):0,i=Xg(e,a,t);return Yi(e,i,t)}function P_(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 nG(e,t){var n,o,r;let a=e.state,i=P_(a,{requiresMeasuredLayout:!0});if(!i)return!1;let{initialScroll:s,isInitialScrollInProgress:l,queuedInitialLayout:d}=i,c=l?i.scrollingTo:void 0,f=Hr(e,s),p=c?(n=c.targetOffset)!=null?n:c.offset:void 0,m=s.contentOffset===void 0||Math.abs(s.contentOffset-f)>1,g=p!==void 0&&Math.abs(p-f)>1,h=p!==void 0&&Math.abs(a.scroll-f)<=1&&Math.abs(a.scrollPending-f)<=1;if(!t?.forceScroll&&!m&&l&&!g||t?.forceScroll&&h)return!1;m&&((o=a.initialScrollSession)==null?void 0:o.kind)!=="offset"&&il(e,{...s,contentOffset:f});let v=(r=t?.forceScroll)!=null?r:!!d||l&&m;return Zg(e,{forceScroll:v,resolvedOffset:f,target:s}),!0}function oG(e,t){var n,o;let r=e.state,a=P_(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 Zg(e,{forceScroll:f,resolvedOffset:l,target:i}),!0}function Yu(e,t){var n;return((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset"?oG(e,{forceScroll:t?.forceScroll}):nG(e,{forceScroll:t?.forceScroll})}function Gu(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=Qt(e,a);if(i===void 0||!e.sizesKnown.has(i))return!1}}return o}var eh=1,rG=8,aG=24,iG="LegendList bootstrap initial scroll aborted after exceeding convergence bounds.";function xr(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?e.initialScrollSession.bootstrap:void 0}function cl(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="offset"}function sG(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 lG(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 dG(e){let{mountFrameCount:t,maxFrames:n=rG,maxPasses:o=aG,passCount:r}=e;return t>=n||r>=o}function A_(e,t){return dG(t)?(Zo&&console.warn(iG),wG(e),!0):!1}function Ju(e){var t;let n=xr(e),o=n?.frameHandle;o!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o),n&&(n.frameHandle=void 0),ni(e,{bootstrap:null,kind:(t=e.initialScrollSession)==null?void 0:t.kind})}function E_(e,t){var n,o,r;let a=xr(e);ni(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 cG(e,t){var n,o,r;let a=xr(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,ni(e,{bootstrap:a,kind:"bootstrap"})):t?.scroll!==void 0&&E_(e,{scroll:t.scroll,seedContentOffset:t.seedContentOffset,targetIndexSeed:t.targetIndexSeed})}function QC(e){requestAnimationFrame(()=>{var t;xr(e)&&((t=e.triggerCalculateItemsInView)==null||t.call(e,{forceFullItemPositions:!0}))})}function pb(e){let t=e.state,n=xr(t);if(!n||n.frameHandle!==void 0)return;let o=()=>{let r=xr(t);r&&(r.frameHandle=void 0,r.mountFrameCount+=1,!A_(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})&&pb(e))};n.frameHandle=requestAnimationFrame(o)}function zg(e,t){cG(e.state,t),pb(e),QC(e.state)}function mb(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 uG(e){return!!e?.preserveForBottomPadding}function sl(e){return!!e?.preserveForFooterLayout}function R_(e){return!!(e&&e.viewPosition===1&&(uG(e)||sl(e)))}function fG(e){let{dataLength:t,footerSize:n,initialScrollAtEnd:o,stylePaddingEnd:r,target:a}=e,i=sl(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 pG(e,t){return e.index===t.index&&e.preserveForBottomPadding===t.preserveForBottomPadding&&e.preserveForFooterLayout===t.preserveForFooterLayout&&e.viewOffset===t.viewOffset&&e.viewPosition===t.viewPosition}function Ug(e,t){let{dataLength:n,stylePaddingEnd:o,target:r}=t;if(!sl(r))return;let a=mb({dataLength:n,footerSize:0,preserveForFooterLayout:void 0,stylePaddingEnd:o});il(e,a)}function mG(e){Ad(e)}function gb(e,t,n=eh){let o=e.state;if(!o.didFinishInitialScroll)return!1;let r=Zu(o);return Math.abs(r-Hr(e,t))>n}function Zu(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 M_(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||cl(n))return;let r=typeof n.lastNativeScroll=="number"&&Number.isFinite(n.lastNativeScroll)?n.lastNativeScroll:Zu(n);return Hr(e,o)-r}function N_(e){return M_(e)===void 0?!1:(__(e,{}),!0)}function __(e,t){let n=e.state;n.preservedEndAnchorCorrection=t,requestAnimationFrame(()=>{var o;let r=n.preservedEndAnchorCorrection;if(r!==t)return;let a=M_(e);if(a===void 0||Math.abs(a)<=eh){n.preservedEndAnchorCorrection=void 0;return}(!r.lastRequestTime||((o=n.lastNativeScrollTime)!=null?o:0)>r.lastRequestTime)&&(r.lastRequestTime=Date.now(),dl(e,a)),__(e,t)})}function gG(e){var t;let n=e.state,o=n.initialScroll;!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||o?.viewPosition!==1||n.preservedEndAnchorCorrection||gb(e,o)&&(R_(o)&&be(e,"isAtEnd")||(sl(o)?Ug(e,{dataLength:n.props.data.length,stylePaddingEnd:ab(n.props),target:o}):mG(n)))}function hG(e,t){var n,o,r;let{initialScrollAtEnd:a,target:i}=t,s=e.state,l=Hr(e,i),d=l===0&&!a&&(cl(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?(Ju(s),Ed(e,{resolvedOffset:l})):c?(Ju(s),Ed(e,{preserveTarget:!0,resolvedOffset:l})):(E_(s,{scroll:l,seedContentOffset:0,targetIndexSeed:i.index}),pb(e))}function vG(e,t){let{dataLength:n,didDataChange:o,initialScrollAtEnd:r,previousDataLength:a,stylePaddingEnd:i}=t,s=e.state,l=s.initialScroll;if(cl(s)||!l)return;let d=!!(s.didFinishInitialScroll&&a===0&&n>0&&l.index!==void 0),c=xr(s);if(!r&&o&&n>0&&s.didFinishInitialScroll&&!c&&!d){Ad(s);return}let p=n>0&&(r||R_(l));if(!(!o&&!d&&!p)){if(p){let m=r?mb({dataLength:n,footerSize:be(e,"footerSize")||0,preserveForFooterLayout:sl(l),stylePaddingEnd:i}):fG({dataLength:n,footerSize:be(e,"footerSize")||0,initialScrollAtEnd:r,stylePaddingEnd:i,target:l});if(!d&&gb(e,l)){Ug(e,{dataLength:n,stylePaddingEnd:i,target:l});return}if(!pG(l,m)||c||d||o){il(e,m,{resetDidFinish:d}),zg(e,{scroll:Hr(e,m),seedContentOffset:d&&!c?Zu(s):void 0,targetIndexSeed:m.index});return}}o&&(c||d)&&(il(e,l,{resetDidFinish:d}),zg(e,{scroll:Hr(e,l),seedContentOffset:d&&!c?Zu(s):void 0,targetIndexSeed:l.index}))}}function yG(e,t){let{dataLength:n,footerSize:o,initialScrollAtEnd:r,stylePaddingEnd:a}=t,i=e.state;if(!r)return;let s=i.initialScroll;if(!(cl(i)||n===0||!s||!(xr(i)||sl(s))))if(gb(e,s))Ug(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let d=mb({dataLength:n,footerSize:o,preserveForFooterLayout:sl(s),stylePaddingEnd:a});if(!(s.index!==d.index||s.viewPosition!==d.viewPosition||s.viewOffset!==d.viewOffset))Ug(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let f=!!i.didFinishInitialScroll;il(e,d,{resetDidFinish:f}),zg(e,{scroll:Hr(e,d),targetIndexSeed:d.index})}}}function xG(e){var t,n,o;let r=e.state,a=r.initialScroll,i=xr(r);if(a&&r.props.data.length>0&&!cl(r)&&(i||a.viewPosition===1)){let s=Hr(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:Zu(r),c=s-d;if(Math.abs(c)>eh){if(r.didFinishInitialScroll)N_(e);else if(l){let f=lo.get(r);l.offset=s,l.targetOffset=s,r.initialScroll={...a,contentOffset:s},r.hasScrolled=!1,lo.set(r,{startScroll:(o=f?.startScroll)!=null?o:r.scroll,targetOffset:s}),dl(e,c)}}}else zg(e,{scroll:s,targetIndexSeed:a.index})}}function CG(e){var t,n;let o=e.state,r=xr(o),a=o.initialScroll;if(!r||!a||cl(o)||(t=o.scrollingTo)!=null&&t.isInitialScroll||(r.passCount+=1,A_(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=Hr(e,a),s=Gu(o,o.startBuffered,o.endBuffered),l=Math.abs(r.scroll-i)>1,{data:d}=o.props,c=lG({dataLength:d.length,getSize:h=>{var v,y;let x=(v=o.idCache[h])!=null?v:Qt(o,h);return(y=o.sizes.get(x))!=null?y:yo(e,x,h,d[h])},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(h=>{var v;let y=(v=o.idCache[h])!=null?v:Qt(o,h);return o.sizesKnown.has(y)}),p=r.previousResolvedOffset,m=r.visibleIndices;if(r.previousResolvedOffset=i,r.visibleIndices=c,l){r.scroll=i,QC(o);return}if(!s||!f)return;if(!(p!==void 0&&Math.abs(p-i)<=eh&&sG(m,c))){QC(o);return}Ju(o),Zg(e,{forceScroll:!0,resolvedOffset:i,target:a,waitForCompletionFrame:ti.OS==="web"})}function bG(e,t){var n;let o=e.state;Ju(o);let r=!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;Ed(e,{preserveTarget:r,recalculateItems:!0,resolvedOffset:t,schedulePreservedTargetClear:r})}function wG(e){var t,n,o,r;let a=e.state,i=xr(a),s=a.initialScroll;i&&s&&!cl(a)&&a.refScroller.current?(Ju(a),Zg(e,{forceScroll:!0,resolvedOffset:i.scroll,target:s,waitForCompletionFrame:ti.OS==="web"})):bG(e,(r=(o=(n=(t=xr(a))==null?void 0:t.scroll)!=null?n:a.scrollPending)!=null?o:a.scroll)!=null?r:0)}function D_(e,t,n,o){return{dataChangeEpoch:e.dataChangeEpoch,getFixedItemSize:e.props.getFixedItemSize,getItemType:e.props.getItemType,itemData:n,itemIndex:t,itemType:o}}function SG(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=D_(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 O_(e){for(let t of e.containerItemMetadata.values())t.didResolveFixedItemSize=!1,t.fixedItemSize=void 0}var IG=20,TG=1,kG=1,HC=16;function hb(e,t){let n=e.state.scrollingTo;t?.onlyIfAligned&&(!n?.isInitialScroll||n.animated||!vb(e,n).isAtResolvedTarget)||e.state.scheduledWork.frame(()=>RG(e),"checkFinishedScrollFrame")}function LG(e,t){let{clampedTargetOffset:n,scrollingTo:o}=t;return!o.isInitialScroll||e.hasScrolled||n<=TG}function PG(e,t){return!!t?.isInitialScroll&&Wg.didDispatchNativeScroll(e)&&!e.hasScrolled}function F_(e){var t;return(t=lo.get(e))==null?void 0:t.targetOffset}function B_(e){let t=F_(e);return!e.didFinishInitialScroll&&lo.hasNonZeroTargetOffset(t)}function zN(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 lo.hasNonZeroTargetOffset(r)&&Wg.didDispatchNativeScroll(e)&&!e.hasScrolled||lo.isAtZeroTargetOffset(r)||Math.abs(e.scroll-r)>1||Math.abs(e.scrollPending-r)>1?!1:!!t.waitForInitialScrollCompletionFrame||B_(e)}function UN(e){var t;let{state:n}=e;return!!((t=n.scrollingTo)!=null&&t.isInitialScroll)&&n.props.data.length>0&&vo(e)<=n.scrollLength&&n.scrollPending<=kG}function AG(e,t){return t.index===e.state.props.data.length-1&&t.viewPosition===1}function EG(e,t){var n;let o=t.index,a=AG(e,t)&&o!==void 0?Xg(e,jg(e,o),t):(n=t.targetOffset)!=null?n:Yi(e,t.offset-(t.viewOffset||0),t);return Yi(e,a,t)}function vb(e,t){let{state:n}=e,o=n.scrollPending,r=n.scrollAdjustHandler.getAdjust(),a=EG(e,t),i=Yi(e,o,t),s=Math.abs(o-a),l=a+r,d=Math.abs(o-l),c=!t.animated||ti.OS==="ios";return{clampedTargetOffset:a,isAtResolvedTarget:Math.abs(o-i)<1&&(s<1||c&&d<1)}}function RG(e){let t=e.state.scrollingTo;if(!t)return;let{state:n}=e,o=vb(e,t);o.isAtResolvedTarget&&LG(n,{clampedTargetOffset:o.clampedTargetOffset,scrollingTo:t})&&Xu(e)}function MG(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 NG(e){let t=e.state;if(t.scheduledWork.has("checkFinishedScrollFallback"))return;let n=t.scrollingTo,o=UN(e),r=PG(t,n),a=n!==void 0?zN(t,n):!1,i=n?.isInitialScroll&&!o&&!a||!t.didContainersLayout,s=o||a?0:r?HC: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 g=B_(t)&&!t.hasScrolled,h=r?5:g?IG:5,v=UN(e),y=zN(t,m),x=vb(e,m),C=ti.OS==="android",w=t.hasScrolled&&(!m.isInitialScroll||x.isAtResolvedTarget),T=m.isInitialScroll&&!x.isAtResolvedTarget&&l<=h;if(v||w||y||C||l>h)Xu(e);else if((g||T)&&l<=h){let S=(p=(f=F_(t))!=null?f:m.targetOffset)!=null?p:t.scrollPending;MG(e,S),d(r?HC:100)}else d(r?HC:100)}};d(s)}function z_(e){var t;let n=e.state,o=n.initialScroll;return n.didFinishInitialScroll?N_(e):!o||((t=n.initialScrollSession)==null?void 0:t.kind)==="offset"||o.viewPosition!==1||n.props.data.length===0?!1:Yu(e,{forceScroll:!0})}function _G(e){var t;if(!e.state.initialScroll)return;let n=()=>Yu(e,{forceScroll:!0});n(),((t=e.state.initialScrollSession)==null?void 0:t.kind)!=="offset"&&requestAnimationFrame(n),hb(e,{onlyIfAligned:!0})}function DG(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")&&il(e,{...f,contentOffset:p,preserveForFooterLayout:m}),d&&f&&((o=c.initialScrollSession)==null?void 0:o.kind)!=="offset"){hG(e,{initialScrollAtEnd:l,target:c.initialScroll});return}!r&&!p&&!(f&&a===0&&!(p===0&&!l))&&(f&&!l?Ed(e,{resolvedOffset:p}):ub(e,{didInitialScroll:!0}))}function OG(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,g=(o=(n=m.initialScrollSession)==null?void 0:n.previousDataLength)!=null?o:0,h=a>0&&(!m.hasHadNonEmptyData||s);if(a>0&&(m.hasHadNonEmptyData=!0),h&&(d?(il(e,d),ni(m,{kind:c,previousDataLength:g})):Ad(m)),m.initialScrollSession&&(m.initialScrollSession.previousDataLength=a),ni(m),p){vG(e,{dataLength:a,didDataChange:i,initialScrollAtEnd:l,previousDataLength:g,stylePaddingEnd:f});return}let v=g===0&&a>0&&!!m.initialScroll&&((r=e.state.initialScrollSession)==null?void 0:r.kind)==="offset"&&!!m.didFinishInitialScroll;g!==0||a===0||!m.initialScroll||!m.queuedInitialLayout||m.didFinishInitialScroll&&!v||(v&&cb(e,{resetInitialScroll:!0}),Yu(e))}function U_(e){e.indexByKey.clear(),e.idCache.length=0,e.positions.length=0,e.columns.length=0,e.columnSpans.length=0}function FG(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 Hg(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=be(e,"containerLayoutEpoch"))!=null?n:0)+1;Be(e,"containerLayoutEpoch",a)}}function BG(e,t,n,o){var r,a,i,s,l,d,c,f,p;let m=e.state,{columns:g,columnSpans:h,positions:v,props:{data:y,itemsAreEqual:x,keyExtractor:C}}=m,w=y[n];if(w===void 0)return{didChangePosition:!1,didRefreshData:!1};let T=(r=m.idCache[n])!=null?r:Qt(m,n),S=(a=o?.updateLayout)!=null?a:!0,L=!1,k=!1;if(S){let _=v[n];if(_===void 0)return Be(e,`containerPosition${t}`,Pd),{didChangePosition:!1,didRefreshData:!1};let A=(_||0)-((i=o?.scrollAdjustPending)!=null?i:0),H=(s=m.sizes.get(T))!=null?s:yo(e,T,n,w),V=J4(m,A,H,be(e,"totalSize")),J=g[n]||1,D=h[n]||1,ne=be(e,`containerPosition${t}`),B=be(e,`containerColumn${t}`),U=be(e,`containerSpan${t}`);V>Pd&&V!==ne&&(Be(e,`containerPosition${t}`,V),L=!0),J>=0&&J!==B&&Be(e,`containerColumn${t}`,J),D!==U&&Be(e,`containerSpan${t}`,D)}be(e,`containerItemIndex${t}`)!==n&&Be(e,`containerItemIndex${t}`,n);let P=be(e,`containerItemData${t}`),E=()=>{Be(e,`containerItemData${t}`,w),k=!0};if(P!==w){let _=((l=m.pendingDataComparison)==null?void 0:l.previousData)===m.previousData&&((d=m.pendingDataComparison)==null?void 0:d.nextData)===y?m.pendingDataComparison:void 0,A=(c=_?.byIndex[n])!=null?c:0;if(A===2)E();else if(A!==1){let H=(f=be(e,`containerItemKey${t}`))!=null?f:T,V=C?.(P,n);if(P===void 0||!C||V!==H)E();else if(!x)E();else{let J=x(P,w,n,y);(!m.pendingDataComparison||m.pendingDataComparison.previousData!==m.previousData||m.pendingDataComparison.nextData!==y)&&m.previousData&&(m.pendingDataComparison={byIndex:[],nextData:y,previousData:m.previousData}),(p=m.pendingDataComparison)!=null&&p.byIndex&&(m.pendingDataComparison.byIndex[n]=J?1:2),J||E()}}}return{didChangePosition:L,didRefreshData:k}}function zG(e,t,n){var o;let r=e.state,a=be(e,"numColumns"),i=t;r.columns[t]!==1&&(i=HN(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=HN(r,a,c),m=UG(e,p,c,n);l=f+m}return{column:d,currentRowTop:l,startIndex:i}}function HN(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 UG(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=yo(e,l,s,a[s],o);d>i&&(i=d)}return i}function HG(e){var t,n;let o=e.state,{positions:r,props:{data:a}}=o,i=(t=be(e,"numColumns"))!=null?t:1;if(a.length===0)Vu(e,null,0);else{let s=a.length-1,l=Qt(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:Qt(o,p),g=yo(e,m,p,a[p]);g>f&&(f=g)}Vu(e,null,d+f)}else{let c=yo(e,l,s,a[s]);if(c!==void 0){let f=d+c;Vu(e,null,f)}}}}function H_(e){let t=e.state,{props:{snapToIndices:n}}=t,o=t.props.horizontal?vo(e):void 0,r=Array(n.length);for(let a=0;a<n.length;a++){let i=n[a];Qt(t,i);let s=t.positions[i];r[a]=ib(t,s,o)}Be(e,"snapToOffsets",r)}function $_(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,g=e.positionListeners.size>0,{columns:h,columnSpans:v,indexByKey:y,positions:x,idCache:C,sizesKnown:w,props:{data:T,overrideItemLayout:S,snapToIndices:L},scrollingTo:k}=m,I=T.length,P=(l=be(e,"numColumns"))!=null?l:1,E=P>1,_=Zo?new Map:void 0,A=be(e,"extraData"),H=S?{span:1}:void 0,V=m.lastScrollDelta,J=i??Yg(m),D=!o&&!t&&(r||Math.abs(J)>0||m.scrollLength>0&&V>m.scrollLength),ne=a+1e3,B=!0,U=!n||t||m.scrollAdjustHandler.getAdjust()!==0||((d=be(e,"scrollAdjustPending"))!=null?d:0)!==0,ee=!1,j=0,Z=1,de=0;if(t&&(v.length=0),E||(h.length&&(h.length=0),v.length&&(v.length=0)),s>0){if(E){let{startIndex:re,currentRowTop:we}=zG(e,s,B);s=re,j=we}else if(s<I){let re=s-1,we=Qt(m,re),Xe=(c=x[re])!=null?c:0,ot=(f=w.get(we))!=null?f:yo(e,we,re,T[re],B,U,ee);j=Xe+ot}}let F=t||y.size===0,X=E&&!!S&&!!H,pe=!1,le;for(let re=s;re<I;re++){if(D&&le!==void 0&&re>le){pe=!0;break}D&&le===void 0&&!k&&!t&&j>ne&&(le=re+(E?P:1)+10);let we=(p=C[re])!=null?p:Qt(m,re),Xe=1;if(X){H.span=1,S(H,T[re],re,P,A);let je=H.span;je!==void 0&&Number.isFinite(je)&&(Xe=Math.max(1,Math.min(P,Math.round(je))))}E&&Z+Xe-1>P&&(j+=de,Z=1,de=0);let ot=w.get(we),at=ot!==void 0?ot:yo(e,we,re,T[re],B,U,ee);Zo&&F&&(_.has(we)&&console.error(`[legend-list] Error: Detected overlapping key (${we}) which causes missing items and gaps and other terrrible things. Check that keyExtractor returns unique values.`),_.set(we,re)),j!==x[re]&&(x[re]=j,g&&iW(e,we,j)),F&&y.set(we,re),E?(h[re]=Z,v[re]=Xe,at>de&&(de=at),Z+=Xe,Z>P&&(j+=de,Z=1,de=0)):j+=at}pe||HG(e),L&&H_(e)}function K_(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 $G(e){let{viewabilityConfig:t,viewabilityConfigCallbackPairs:n,onViewableItemsChanged:o}=e;return(t||o)&&(n=[...n||[],{onViewableItemsChanged:o,viewabilityConfig:t||{viewAreaCoveragePercentThreshold:0}}]),n}function q_(e,t,n,o,r,a,i=r,s=a){let{props:{data:l}}=e;for(let d of n){let c=K_(t,d.viewabilityConfig.id);c.start=r,c.end=a,c.startBuffered=i,c.endBuffered=s,d.viewabilityConfig.minimumViewTime?e.scheduledWork.timeout(()=>$N(l,d,e,t,o),d.viewabilityConfig.minimumViewTime):$N(l,d,e,t,o)}}function $N(e,t,n,o,r){let{viewabilityConfig:a,onViewableItemsChanged:i}=t,s=a.id,l=K_(o,s),{viewableItems:d,start:c,end:f,startBuffered:p,endBuffered:m}=l,g;for(let[x,C]of o.mapViewabilityAmountValues)V_(n,o,a,x,C.key,r,C.item,C.index).sizeVisible<0&&(g??(g=[]),g.push(x));let h=[],v=new Set;if(d)for(let x of d){v.add(x.key);let C=n.indexByKey.get(x.key),w=C!==void 0?e[C]:void 0,T=jC(o,x.key),S=!1;C!==void 0&&w!==void 0&&(S=qN(n,o,a,T,x.key,r,w,C)),S||h.push({...x,index:C??x.index,isViewable:!1,item:w??x.item})}let y=[];for(let x=c;x<=f;x++){let C=e[x];if(C){let w=Qt(n,x),T=jC(o,w);if(qN(n,o,a,T,w,r,C,x)){let S={containerId:T,index:x,isViewable:!0,item:C,key:w};y.push(S),v.has(S.key)||h.push(S)}}}if(Object.assign(l,{previousEnd:f,previousStart:c,viewableItems:y}),h.length>0){l.viewableItems=y;for(let x=0;x<h.length;x++){let C=h[x];KG(o,s,C.containerId,C)}i&&i({changed:h,end:f,endBuffered:m,start:c,startBuffered:p,viewableItems:y})}if(g)for(let x of g){let C=o.mapViewabilityAmountValues.get(x);C&&C.sizeVisible<0&&o.mapViewabilityAmountValues.delete(x)}}function KN(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 V_(e,t,n,o,r,a,i,s){let{sizes:l,scroll:d}=e,c=(be(t,"stylePaddingTop")||0)+(be(t,"alignItemsAtEndPadding")||0)+(be(t,"headerSize")||0),{itemVisiblePercentThreshold:f,viewAreaCoveragePercentThreshold:p}=n,m=p!=null,g=m?p:f,h=d-c,v=e.positions[s],y=l.get(r)||0;if(v===void 0){let _={containerId:o,index:s,isViewable:!1,item:i,key:r,percentOfScroller:0,percentVisible:0,scrollSize:a,size:y,sizeVisible:-1},A=t.mapViewabilityAmountValues.get(o);if(!KN(A,_)){t.mapViewabilityAmountValues.set(o,_);let H=t.mapViewabilityAmountCallbacks.get(o);H&&H(_)}return _}let x=v-h,C=x+y,w=x>=0&&C<=a&&C>x,T=w?y:Math.min(C,a)-Math.max(x,0),S=y?w?100:100*(T/y):0,L=y?100*(T/a):0,I=(w?100:m?L:S)>=g,P={containerId:o,index:s,isViewable:I,item:i,key:r,percentOfScroller:L,percentVisible:S,scrollSize:a,size:y,sizeVisible:T},E=t.mapViewabilityAmountValues.get(o);if(!KN(E,P)){t.mapViewabilityAmountValues.set(o,P);let _=t.mapViewabilityAmountCallbacks.get(o);_&&_(P)}return P}function qN(e,t,n,o,r,a,i,s){let l=t.mapViewabilityAmountValues.get(o);return(!l||l.key!==r||l.index!==s)&&(l=V_(e,t,n,o,r,a,i,s)),l.isViewable}function KG(e,t,n,o){let r=n+t;e.mapViewabilityValues.set(r,o);let a=e.mapViewabilityCallbacks.get(r);a?.(o)}var VN=i_.unstable_batchedUpdates,qG=typeof VN=="function"?VN:e=>e(),VG=32,WG=64,GG=3;function jG(e,t){if(e<=0||t<=0)return 0;let n=Math.ceil(t*GG),o=t+WG,r=Math.max(t,Math.min(n,o),Math.min(e,VG)),a=Math.max(e,t);return Math.min(a,r)}function QG(e,t){return e<=0||t<=0?0:Math.min(Math.max(e,t),Math.max(t,Math.ceil(t*1.5)))}function XG(e,t,n,o,r,a,i){var s;let l=t.length;if(l===0)return[];let d=be(e,"numContainers"),c=e.state,{containerItemMetadata:f,stickyContainerPool:p}=c,m=c.props.recycleItems&&!!c.props.positionComponentInternal,g=r.length>0?new Set(r):void 0,h=t.map((P,E)=>({isSticky:c.props.stickyHeaderIndicesSet.has(P),itemIndex:P,itemType:a?.(P),order:E})),v=h.filter(P=>!P.isSticky),y=h.filter(P=>P.isSticky),x=[],C=[];for(let P=0;P<d;P++){let E=be(e,`containerItemKey${P}`),_=!!g?.has(P);if(!(E&&i?.has(E)&&c.indexByKey.has(E))){if(p.has(P))(E===void 0||_)&&C.push({containerIndex:P,distance:Number.POSITIVE_INFINITY});else if(E===void 0||_)x.push({containerIndex:P,distance:Number.POSITIVE_INFINITY});else if(!m){let H=c.indexByKey.get(E);if(H!==void 0&&(H<n||H>o)){let V=H<n?n-H:H-o;x.push({containerIndex:P,distance:V})}}}}x.sort(YG);let w=new Array(l),T=d,S=!1,L=(P,E)=>{w[P.order]={containerIndex:E,itemIndex:P.itemIndex,itemType:P.itemType},g?.delete(E)&&(S=!0)},k=(P,E,_)=>{for(let A of P){if(w[A.order])continue;let H=E.findIndex(V=>{var J;return _((J=f.get(V.containerIndex))==null?void 0:J.itemType,A.itemType)});if(H!==-1){let[V]=E.splice(H,1);L(A,V.containerIndex)}}},I=(P,E,_)=>{a&&k(P,E,(A,H)=>H!==void 0&&A===H),k(P,E,A=>A===void 0),_&&k(P,E,()=>!0)};I(v,x,!0),I(y,C,!1);for(let P of h){if(w[P.order])continue;let E=T++;P.isSticky&&p.add(E),L(P,E)}if(S&&(r.length=0,g))for(let P of g)r.push(P);if(Zo){let P=(s=be(e,"numContainersPooled"))!=null?s:Number.POSITIVE_INFINITY;T>P&&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:P,numNeeded:l,stillNeeded:T-d}})}return w}function YG(e,t){return t.distance-e.distance}function JG(e){let t=e.state;t.queuedInitialLayout=!0,y_(e),ub(e,{didLayout:!0})}var ZG=4,ej=100;function tj(e,t){if(t<=0)return 0;let n=Math.min(1,Math.abs(e)/ZG);return Math.sign(e)*t*n}function nj(e){let t=e.state;t.scheduledWork.timeout(()=>{var n;t.scrollHistory.length=0,(n=t.triggerCalculateItemsInView)==null||n.call(t)},ej,"renderRangeProjection")}function oj(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 rj(e,t){let n=e.state,o=!1;for(let r of n.stickyContainerPool){let a=be(e,`containerItemKey${r}`);if((a?n.indexByKey.get(a):void 0)===t){o=!0;break}}return o}function aj(e,t,n,o,r,a,i){var s;let l=e.state;Be(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(rj(e,f))continue;let p=(s=l.idCache[f])!=null?s:Qt(l,f);p&&!l.containerItemKeys.has(p)&&(f<a||f>i)&&!r.has(f)&&(r.add(f),o.push(f))}}function ij(e,t,n,o,r,a,i){var s,l;let d=e.state;for(let c of d.stickyContainerPool){let f=be(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),Be(e,`containerSticky${c}`,!1);continue}if(m>=r-1&&m<=r+1)continue;let h=t[m+1],v=!1;if(h){let y=d.positions[h];v=y!==void 0&&n>y+o*2}else{let y=(s=d.idCache[p])!=null?s:Qt(d,p);if(y){let x=d.positions[p],C=(l=d.sizes.get(y))!=null?l:yo(e,y,p,d.props.data[p]);v=x!==void 0&&n>x+C+o*3}}v&&a.push(c)}}function W_(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 G_(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:Qt(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:Qt(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 sj(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:Qt(r,f),m=(o=d.get(p))!=null?o:yo(e,p,f,l[f]);if(s[f]+m>t)return f}return null}function lj(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 g={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null};for(let h=m;h<=l&&h<f.length;h++){let v=(a=d[h])!=null?a:Qt(s,h),y=(i=p.get(v))!=null?i:yo(e,v,h,f[h]),x=c[h];if(W_(g,h,x,y,o,r))break}Object.assign(s,{endNoBuffer:g.endNoBuffer,firstFullyOnScreenIndex:g.firstFullyOnScreenIndex,idsInView:G_(s,g),startNoBuffer:g.startNoBuffer}),XC(s,g.startNoBuffer),g.startNoBuffer!==null&&g.endNoBuffer!==null&&q_(s,e,t,n,g.startNoBuffer,g.endNoBuffer,m,l)}function ei(e,t={}){let n=e.state;qG(()=>{var o,r,a,i,s,l,d,c,f,p,m,g,h,v,y,x,C,w,T,S,L;let{columns:k,containerItemKeys:I,enableScrollForNextCalculateItemsInView:P,idCache:E,indexByKey:_,minIndexSizeChanged:A,positions:H,props:{alwaysRenderIndicesArr:V,alwaysRenderIndicesSet:J,getItemType:D,keyExtractor:ne,onStickyHeaderChange:B},scrollForNextCalculateItemsInView:U,scrollLength:ee,sizes:j,startBufferedId:Z,viewabilityConfigCallbackPairs:de}=n,{data:F}=n.props,X=n.props.stickyHeaderIndicesArr||[],pe=n.props.stickyHeaderIndicesSet||new Set,le=b_(e,t.drawDistanceMode),{dataChanged:re,doMVCP:we,forceFullItemPositions:Xe}=t,ot=((o=n.initialScrollSession)==null?void 0:o.kind)==="bootstrap"?n.initialScrollSession.bootstrap:void 0,at=!!ot,je=be(e,"numContainers");if(!F||ee===0||!je)return;let oe=vo(e),Te,Y=be(e,"stylePaddingTop")+be(e,"alignItemsAtEndPadding")+be(e,"headerSize"),me=be(e,"numColumns"),ge=(r=t.scrollVelocity)!=null?r:Yg(n),G=0,{initialScroll:Ye,queuedInitialLayout:vt}=n,Mt=at?(a=ot?.scroll)!=null?a:n.scroll:!vt&&qu(n)&&Ye?Hr(e,Ye):n.scroll,Dt=0,Nt=0,Ot=0,At=0,xt=0,_t=0,Xt=Mt,mn=xe=>{var Ve;Xt=xe,Dt=(Ve=be(e,"scrollAdjustPending"))!=null?Ve:0,Nt=Dt-Y,Ot=Math.round(xe+G+Nt),Ot+ee>oe&&(Ot=Math.max(0,oe-ee))};mn(Mt);let Hn=be(e,"activeStickyIndex"),yt=()=>{let xe=X.length>0?oj(X,Ot,n):-1,Ve=xe>=0?X[xe]:-1,Ct=Hn!==Ve;(xe>=0||Hn>=0)&&Be(e,"activeStickyIndex",Ve);let ct=!!B&&X.length>0&&Ct;return{currentStickyIdx:xe,finishCalculateItemsInView:ct?()=>{let vn=F[Ve];vn!==void 0&&B?.({index:Ve,item:vn})}:void 0}},qt=re?void 0:yt(),an=le,kn=le;ge>0||ge===0&&Ot<Math.max(50,le)?(an=le*.5,kn=le*1.5):(an=le*1.5,kn=le*.5);let Cn=!re&&!Xe&&!at&&!qu(n)&&!n.scrollingTo&&!n.pendingNativeMVCPAdjust&&!!be(e,"readyToRender")?tj(ge,Math.min(an,kn)):0,$n=()=>{let xe=Math.max(0,Ot),Ve=Math.max(0,-Xt);xt=Math.max(xe,Ot+ee+Ve),At=xe-an+Cn,_t=xt+kn+Cn};if($n(),Cn!==0&&nj(e),P&&!at&&!re&&!Xe&&U){let{top:xe,bottom:Ve}=U;if(xe===null&&Ve===null)n.scrollForNextCalculateItemsInView=void 0;else if((xe===null||At>xe)&&(Ve===null||_t<Ve)&&!tf(n)){de?lj(e,de,ee,Ot,xt):n.props.onFirstVisibleItemChanged&&XC(n,sj(e,Ot)),(i=qt?.finishCalculateItemsInView)==null||i.call(qt);return}}let $=we&&!at?jW(e,re):void 0;re&&U_(n);let ae=Xe||re?0:(s=A??n.startBuffered)!=null?s:0,ce=!Xe&&!re&&me>1&&A!==void 0;$_(e,re,{doMVCP:we,forceFullUpdate:!!Xe,optimizeForVisibleWindow:ce,scrollBottomBuffered:_t,scrollVelocity:ge,startIndex:ae}),oe=vo(e),A!==void 0&&(n.minIndexSizeChanged=void 0);let Le;if(re&&we&&n.props.maintainVisibleContentPosition.data&&n.didContainersLayout&&n.idsInView.length>0){let xe=n.props.maintainVisibleContentPosition.shouldRestorePosition;Le=new Set;for(let Ve of n.idsInView){let Ct=_.get(Ve);Ct!==void 0&&(xe&&!xe(F[Ct],Ct,F)||Le.add(Ve))}}let ze=n.scroll,ft=(l=be(e,"scrollAdjustPending"))!=null?l:0;$?.(),$&&(n.scroll!==ze||((d=be(e,"scrollAdjustPending"))!=null?d:0)!==ft)&&(mn(n.scroll),$n()),re&&(qt=yt());let lt=null,hn=null,Ft=null,rt=(c=at?ot?.targetIndexSeed:void 0)!=null?c:!re&&Z&&_.get(Z)||0;for(let xe=rt;xe>=0;xe--){let Ve=(f=E[xe])!=null?f:Qt(n,xe),Ct=H[xe],ct=(p=j.get(Ve))!=null?p:yo(e,Ve,xe,F[xe]);if(Ct+ct>At)rt=xe;else break}if(me>1)for(;rt>0;){let xe=k[rt];if(xe===1||xe===void 0)break;rt-=1}let Zt=!1,ln,Se,Re=0;for(let xe=0;xe<je;xe++){let Ve=be(e,`containerItemKey${xe}`);if(Ve!==void 0){let Ct=_.get(Ve);Re=Math.max(Re,Ct)}}let qe={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null},pt=F.length;for(let xe=Math.max(0,rt);xe<pt&&(!Zt||xe<=Re);xe++){let Ve=(m=E[xe])!=null?m:Qt(n,xe),Ct=(g=j.get(Ve))!=null?g:yo(e,Ve,xe,F[xe]),ct=H[xe];Zt||(W_(qe,xe,ct,Ct,Ot,xt),lt===null&&ct+Ct>At&&(lt=xe,hn=Ve,At<0?ln=null:ln=ct),qe.startNoBuffer!==null&&(ct<=_t?(Ft=xe,_t>oe?Se=null:Se=ct+Ct):Zt=!0))}Object.assign(n,{endBuffered:Ft,endNoBuffer:qe.endNoBuffer,firstFullyOnScreenIndex:qe.firstFullyOnScreenIndex,idsInView:G_(n,qe),startBuffered:lt,startBufferedId:hn,startNoBuffer:qe.startNoBuffer}),P&&ln!==void 0&&Se!==void 0&&(n.scrollForNextCalculateItemsInView=Wu(ln)&&Wu(Se)?void 0:{bottom:Se,top:ln});let st=je,it=[];if(re)for(let xe=0;xe<st;xe++){let Ve=be(e,`containerItemKey${xe}`);(!ne||Ve&&_.get(Ve)===void 0)&&it.push(xe)}let kt=n.scrollTargetPinnedRange,Vt=0,Pe=-1;kt&&(Vt=Math.max(0,Math.min(kt.start,kt.end)),Pe=Math.min(pt-1,Math.max(kt.start,kt.end)));let Et=Vt<=Pe,mt=xe=>J.has(xe)||Et&&xe>=Vt&&xe<=Pe;if(lt!==null&&Ft!==null){let xe=[],Ve=new Set,Ct=ct=>{var vn;if(ct>=0&&ct<pt){let bn=(vn=E[ct])!=null?vn:Qt(n,ct),yn=I.get(bn);yn!==void 0?n.stickyContainerPool.add(yn):!Wu(bn)&&!Ve.has(ct)&&(Ve.add(ct),xe.push(ct))}};for(let ct=lt;ct<=Ft;ct++){let vn=(h=E[ct])!=null?h:Qt(n,ct);I.has(vn)||(Ve.add(ct),xe.push(ct))}for(let ct of V)Ct(ct);if(Et)for(let ct=Vt;ct<=Pe;ct++)Ct(ct);if(X.length>0?aj(e,X,(v=qt?.currentStickyIdx)!=null?v:-1,xe,Ve,lt,Ft):Hn!==-1&&Be(e,"activeStickyIndex",-1),xe.length>0){let vn=XG(e,xe,lt,Ft,it,D?bn=>{let yn=D(F[bn],bn);return yn!==void 0?String(yn):""}:void 0,Le);for(let bn of vn){let yn=bn.itemIndex,Lt=bn.containerIndex,xn=(y=E[yn])!=null?y:Qt(n,yn),Wt=be(e,`containerItemKey${Lt}`);Wt&&Wt!==xn&&I.delete(Wt),Wt!==xn&&(Te??(Te=new Set),Te.add(Lt),n.containerItemGenerations[Lt]=((x=n.containerItemGenerations[Lt])!=null?x:0)+1),Be(e,`containerItemKey${Lt}`,xn),Be(e,`containerItemIndex${Lt}`,yn),Be(e,`containerItemData${Lt}`,F[yn]),n.containerItemMetadata.set(Lt,D_(n,yn,F[yn],bn.itemType)),I.set(xn,Lt),(C=n.userScrollAnchorReset)==null||C.keys.add(xn);let An=`containerSticky${Lt}`,eo=pe.has(yn),va=mt(yn);eo?(Be(e,An,!0),n.stickyContainerPool.add(Lt)):(be(e,An)&&Be(e,An,!1),va?n.stickyContainerPool.add(Lt):n.stickyContainerPool.delete(Lt)),Lt>=st&&(st=Lt+1)}st!==je&&(Be(e,"numContainers",st),st>be(e,"numContainersPooled")&&Be(e,"numContainersPooled",QG(pt,st)))}((w=n.userScrollAnchorReset)==null?void 0:w.keys.size)===0&&(n.userScrollAnchorReset=void 0)}n.stickyContainerPool.size>0&&ij(e,X,Ot,le,(T=qt?.currentStickyIdx)!=null?T:-1,it,mt);let on=it.length>0?new Set(it):void 0,Nn=!1;for(let xe=0;xe<st;xe++){let Ve=be(e,`containerItemKey${xe}`);if(on?.has(xe))Ve!==void 0&&(I.delete(Ve),Te??(Te=new Set),Te.add(xe),n.containerItemGenerations[xe]=((S=n.containerItemGenerations[xe])!=null?S:0)+1),n.containerItemMetadata.delete(xe),n.stickyContainerPool.has(xe)&&(Be(e,`containerSticky${xe}`,!1),n.stickyContainerPool.delete(xe)),Be(e,`containerItemKey${xe}`,void 0),Be(e,`containerItemIndex${xe}`,void 0),Be(e,`containerItemData${xe}`,void 0),Be(e,`containerPosition${xe}`,Pd),Be(e,`containerColumn${xe}`,-1),Be(e,`containerSpan${xe}`,1);else{let Ct=_.get(Ve);Ct!==void 0&&(Nn=BG(e,xe,Ct,{scrollAdjustPending:Dt,updateLayout:!0}).didChangePosition||Nn)}}if(Te&&sb&&Hg(e,Te),Nn&&Be(e,"lastPositionUpdate",Date.now()),at){CG(e);return}XC(n,qe.startNoBuffer),!vt&&!n.didContainersLayout&&(qu(n)?Gu(n,n.startBuffered,n.endBuffered):Gu(n,n.startNoBuffer,n.endNoBuffer)||Gu(n,n.startBuffered,n.endBuffered))&&(JG(e),_G(e)),de&&qe.startNoBuffer!==null&&qe.endNoBuffer!==null&&q_(e.state,e,de,ee,qe.startNoBuffer,qe.endNoBuffer,lt??qe.startNoBuffer,Ft??qe.endNoBuffer),(L=qt?.finishCalculateItemsInView)==null||L.call(qt)})}function $g(e){var t,n;let o=e.state,r=o.props.anchoredEndSpace,a=be(e,"anchoredEndSpaceSize"),i=o.anchoredEndSpaceReadyAnchorIndex,s=o.anchoredEndSpaceReadyAnchorKey,l=r?.anchorIndex,d,c=!0,f=0;if(r){let{anchorIndex:h,anchorMaxSize:v,anchorOffset:y=0}=r,{data:x}=o.props;if(h>=0&&h<x.length&&o.scrollLength>0){d=Qt(o,h);let C=0,w=!1;for(let S=h;S<x.length;S++){let L=k_(e,S),k=S===h&&v!==void 0?Math.min(L||0,Math.max(0,v)):L;L===void 0&&(w=!0),k!=null&&k>0&&(C+=k)}C=Math.max(0,C-e.scrollAxisGap),C+=(e.values.get("footerSize")||0)+ab(o.props),c=!w;let T=Math.max(0,o.scrollLength-C-y);f=w?Math.min(a||0,T):T}else h>=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&&(Be(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f)),m&&(ll(e),al(e,o.scroll,!0,{markHasScrolled:!1})),(n=r?.onReady)==null||n.call(r,{anchorIndex:l,anchorKey:d,size:f})):!c&&p&&f<(a||0)&&(Be(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f),r?.includeInEndInset&&al(e,o.scroll,!0,{markHasScrolled:!1})),f}function dj(e){var t;let n=e.state;n.userScrollAnchorReset!==void 0?(ei(e),((t=n.userScrollAnchorReset)==null?void 0:t.keys.size)===0&&(n.userScrollAnchorReset=void 0)):n.mvcpAnchorLock?n.scheduledWork.has("mvcpRecalculate")||n.scheduledWork.frame(()=>ei(e,{doMVCP:!0}),"mvcpRecalculate"):(n.scheduledWork.cancel("mvcpRecalculate"),ei(e,{doMVCP:!0}))}function WN(e,t,n){if(e.state.needsOtherAxisSize){let r=n?t.height:t.width,a=be(e,"otherAxisSize");(!a||r>a)&&Be(e,"otherAxisSize",r)}}var Ja;function j_(e){let t=Ja===void 0;Ja??(Ja=new Map);try{e()}finally{if(t){let n=Ja;Ja=void 0;for(let[o,r]of n)yb(o,r)}}}function cj(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 uj(e,t){var n;let o=e.state;t.needsRecalculate?(o.scrollForNextCalculateItemsInView=void 0,dj(e)):t.didMeasureUserScrollAnchorResetItem&&((n=o.userScrollAnchorReset)==null?void 0:n.keys.size)===0&&(o.userScrollAnchorReset=void 0),t.didChange&&$g(e),t.didChange&&t.shouldMaintainScrollAtEnd&&Rd(e)}function Q_(e,t){if(Ja){let n=Ja.get(e);n?n.push(t):Ja.set(e,[t])}else yb(e,[t])}function yb(e,t){var n;let o=e.state,r={};for(let a of t)if(a.containerId===void 0||be(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?SG(o,a.containerId,s,l):void 0,c=fj(e,a.itemKey,a.size,d);cj(r,c)}uj(e,r)}function fj(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:g,data:h,maintainScrollAtEnd:v}}=i;if(!h)return{didMeasureUserScrollAnchorResetItem:l};let y=i.indexByKey.get(t);if(f){if(y===void 0)return{didMeasureUserScrollAnchorResetItem:l};let k=i.props.data[y];if(k===void 0)return{didMeasureUserScrollAnchorResetItem:l};if(!o?.didResolveFixedItemSize){let P=(a=o?.itemType)!=null?a:p&&(r=p(k,y))!=null?r:"";o={didResolveFixedItemSize:!0,fixedItemSize:f(k,y,P),itemType:P}}let I=o.fixedItemSize;if(I!==void 0&&I===c.get(t))return WN(e,n,m),{didMeasureUserScrollAnchorResetItem:l}}let x=!d,C=!1,w,T=i.sizesKnown.get(t),S=pj(e,t,n,o),L=Qu(m?n.width:n.height);if(S!==0){w=w!==void 0?Math.min(w,y):y;let{startBuffered:k,endBuffered:I}=i;x||(x=y>=k&&y<=I),!x&&i.containerItemKeys.has(t)&&(x=!0),(T===void 0||Math.abs(T-L)>5)&&(C=!0),g?.({index:y,itemData:i.props.data[y],itemKey:t,previous:L-S,size:L})}if(w!==void 0&&(i.minIndexSizeChanged=i.minIndexSizeChanged!==void 0?Math.min(i.minIndexSizeChanged,w):w),WN(e,n,m),d||Gu(i,i.startBuffered,i.endBuffered)){let k=C&&!!v?.onItemLayout;return{didChange:S!==0,didMeasureUserScrollAnchorResetItem:l,needsRecalculate:x,shouldMaintainScrollAtEnd:k}}return{didChange:S!==0,didMeasureUserScrollAnchorResetItem:l}}function pj(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 g=s.get(t),h=c[g],v=o?.itemType,y=o?.fixedItemSize;m&&!o?.didResolveFixedItemSize&&(v=p&&(r=p(h,g))!=null?r:"",y=m(h,g,v));let x=o?.didResolveFixedItemSize||v!==void 0||y!==void 0?{didResolveFixedItemSize:o?.didResolveFixedItemSize,fixedItemSize:y,itemType:v}:void 0,C=yo(e,t,g,h,void 0,void 0,void 0,x),w=f?n.width:n.height,T=l.get(t),S=Math.round(w);if(l.set(t,S),y===void 0&&S>0){v??(v=p&&(a=p(h,g))!=null?a:"");let L=d[v];L||(L=d[v]={avg:0,num:0}),L.num===0?(L.avg=S,L.num++):T!==void 0&&T>0?L.avg+=(S-T)/L.num:(L.avg=(L.avg*L.num+S)/(L.num+1),L.num++)}return!C||Math.abs(C-S)>.1?(GC(e,t,S),S-C):0}function mj(e,t=null){let n=[],o=t??e.viewRefs.keys();for(let r of o){let a=e.viewRefs.get(r),i=be(e,`containerItemKey${r}`),s=a?.current;if(i!==void 0&&s){let l=s.getBoundingClientRect();uW(s,l),n.push({containerId:r,itemKey:i,size:{height:l.height,width:l.width}})}}n.length>0&&yb(e,n)}var X_=Wn,ha=ve,gj=ha(function({children:t}){let n=$r(),[o]=er(["containerLayoutEpoch"]);return Ce(()=>{{let r=FG(n);r!==void 0&&mj(n,r)}},[n,o]),t}),Og=e=>Rh(e)?e:e?De(e,null):null,hj=typeof document<"u"&&!!document.getElementById("react-native-stylesheet"),YC={contain:"paint layout style",...hj?{display:"flex",flexDirection:"column"}:{}},vj=ha(function({id:t,horizontal:n,style:o,refView:r,...a}){let[i=Pd]=er([`containerPosition${t}`]),s=Qg(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 De("div",{ref:r,...m,style:l})}),yj=ha(function({id:t,horizontal:n,style:o,refView:r,animatedScrollY:a,stickyHeaderConfig:i,onLayout:s,onLayoutChange:l,children:d,...c}){let[f=Pd,p,m]=er([`containerPosition${t}`,"activeStickyIndex",`containerItemIndex${t}`]),g=q(()=>{var y;return(y=Qg(o)?Object.assign({},...o):o)!=null?y:{}},[o]),h=q(()=>{var y;let x={...YC,...g};delete x.transform;let C=(y=i?.offset)!=null?y:0,w=p===m;return x.position=w?"sticky":"absolute",x.zIndex=m+1e3,n?x.left=w?C:f:x.top=w?C:f,x},[g,n,f,m,p,i?.offset]),v=q(()=>i?.backdropComponent?De("div",{style:{inset:0,pointerEvents:"none",position:"absolute"}},Og(i.backdropComponent)):null,[i?.backdropComponent]);return De("div",{ref:r,style:h,...c},v,d)}),xj=vj;function Cj(e){Q(()=>e())}var Y_=bt(null),bj=-1;function wj(){return Ut(Y_)}function Sj(){var e;let t=wj(),n=(e=t?.containerId)!=null?e:bj,[o]=er([`containerItemKey${n}`]);return sW("lastItemKeys",a=>t&&!Wu(o)&&a?.includes(o)||!1)}function Ij({ItemSeparatorComponent:e,leadingItem:t}){return Sj()?null:De(e,{leadingItem:t})}var $C=null;function Tj(){return $C||($C=new ResizeObserver(e=>{j_(()=>{for(let t of e){let n=Fg.get(t.target);if(n)for(let o of n)o(t)}})})),$C}var Fg=new WeakMap;function kj(e,t){var n;if(typeof ResizeObserver>"u"||!e)return()=>{};let o=Tj(),r=(n=Fg.get(e))!=null?n:new Set;return r.size===0&&(Fg.set(e,r),o.observe(e,{box:"border-box"})),r.add(t),()=>{r.delete(t),r.size===0&&(Fg.delete(e),o.unobserve(e))}}function xb({ref:e,measureInLayoutEffect:t=!0,onLayoutProp:n,onLayoutChange:o,webLayoutResync:r},a){return Ce(()=>{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,g)=>{m.height===0&&m.width===0||(o(m,g),n?.({nativeEvent:{layout:m}}))},p;if(t){let m=c.getBoundingClientRect();f(GN(m),!0),p=m}return kj(c,m=>{var g;let h=m.target instanceof HTMLElement?m.target:void 0,v=Array.isArray(m.borderBoxSize)?m.borderBoxSize[0]:m.borderBoxSize,y=v?{height:v.blockSize,left:m.contentRect.left,top:m.contentRect.top,width:v.inlineSize}:(g=h?.getBoundingClientRect())!=null?g:m.contentRect,x=p??cW(c),C=x===void 0||y.width!==x.width||y.height!==x.height;p=y;let w=!!r?.();(C||w)&&f(GN(y),!1)})},[t,...a||[]]),{}}function GN(e){return e?{height:e.height,width:e.width,x:e.left,y:e.top}:{height:0,width:0,x:0,y:0}}var Bg=new Map,KC;function J_(e){Bg.delete(e)}function Lj(e,t){Bg.set(e,t),KC===void 0&&(KC=requestAnimationFrame(()=>{let n=Array.from(Bg.values());Bg.clear(),KC=void 0,j_(()=>{for(let o of n)o()})}))}function Pj({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=Qu(n[l]);r.lastSize&&Qu(r.lastSize[l]);let f=a.sizesKnown.get(i),p=()=>{r.lastSize=s,Q_(t,{containerId:e,itemKey:i,size:s})};!tf(a)&&f!==void 0&&d+1<f?Lj(r,()=>{var g;if(r.itemKey===i){let h=o.current,v=(g=h?.getBoundingClientRect)==null?void 0:g.call(h);v&&(s={height:v.height,width:v.width}),p()}}):(J_(r),p())}function Aj({containerId:e,ctx:t,horizontal:n,itemKey:o,ref:r}){let a=N({didLayout:!1,horizontal:n,itemKey:o});a.current.horizontal=n,a.current.itemKey=o;let[i,s]=Q(0),l=R(f=>{Pj({containerId:e,ctx:t,rectangle:f,ref:r,state:a.current})},[e,t,r]),d=R(()=>{Hg(t,e)},[e,t]);Ce(()=>(t.containerLayoutTriggers.set(e,d),()=>{J_(a.current),t.containerLayoutTriggers.get(e)===d&&t.containerLayoutTriggers.delete(e)}),[e,t,d]),Ce(()=>{Hg(t,e)});let{onLayout:c}=xb({measureInLayoutEffect:!sb,onLayoutChange:l,ref:r,webLayoutResync:()=>tf(t.state)},[o,i]);return W(()=>{},[e,t,o]),{onLayout:c,triggerLayout:d}}function Ej({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&&ti.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 Rj=ha(function({id:t,itemKey:n,recycleItems:o,horizontal:r,getRenderedItem:a,ItemSeparatorComponent:i,stickyHeaderConfig:s}){let l=$r(),{columnWrapperStyle:d,animatedScrollY:c}=l,f=oi(l.state),p=l.state.props.positionComponentInternal,m=l.state.props.stickyPositionComponentInternal,[g=0,h=1,v,y=1,x,C]=er([`containerColumn${t}`,`containerSpan${t}`,`containerItemData${t}`,"numColumns","extraData",`containerSticky${t}`]),w=N(null),{onLayout:T,triggerLayout:S}=Aj({containerId:t,ctx:l,horizontal:r,itemKey:n,ref:w}),L=g>0?g:1,k=Math.min(Math.max(h||1,1),y),I=y>1?`${(L-1)/y*100}%`:0,P=y>1?`${k/y*100}%`:void 0,E=q(()=>Ej({columnWrapperStyle:d,contentContainerAlignItems:l.state.props.contentContainerAlignItems,hasItemSeparator:!!i,horizontal:r,isHorizontalRTLList:f,numColumns:y,otherAxisPos:I,otherAxisSize:P}),[r,f,I,P,d,l.state.props.contentContainerAlignItems,y,i]),_=q(()=>n!==void 0?a(n):null,[n,v,x]),{renderedItem:A}=_||{},H=q(()=>(l.viewRefs.set(t,w),{containerId:t,triggerLayout:S}),[t,S]);return De(C?m||yj:p||xj,{animatedScrollY:C?c:void 0,horizontal:r,id:t,key:o?void 0:n,onLayout:T,refView:w,stickyHeaderConfig:s,style:E},De(Y_.Provider,{value:H},A,_&&i&&De(Ij,{ItemSeparatorComponent:i,leadingItem:_.item})))});function Mj({id:e,horizontal:t,recycleItems:n,ItemSeparatorComponent:o,getRenderedItem:r,stickyHeaderConfig:a,ContainerComponent:i=Rj}){let[s]=er([`containerItemKey${e}`]);return s===void 0?null:De(i,{getRenderedItem:r,horizontal:t,ItemSeparatorComponent:o,id:e,itemKey:s,recycleItems:n,stickyHeaderConfig:a})}var Nj=ha(function(t){return De(Mj,{...t})});function _j(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=Dj(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],g=n.indexOf(m);if(s.has(g)){f=m;break}}f?e.insertBefore(d,f):e.appendChild(d)}}}function Dj(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 Oj(e){let t=$r(),n=N(void 0);W(()=>{let o=Za(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=be(t,`containerItemIndex${i}`);l&&d!==void 0&&a.set(l,d)}_j(r,a)}n.current=void 0},500)});return()=>{o(),n.current!==void 0&&clearTimeout(n.current)}},[t])}function Fj(e,t){let[n,o]=Q(t),r=n!==t;return Ce(()=>{o(t)},[t]),e&&!r}var Bj=ha(function({freshDataTransitionEpoch:t,horizontal:n,numColumns:o,children:r}){let a=N(null),i=$r(),s=i.columnWrapperStyle,l=oi(i.state),[d,c,f]=er(["otherAxisSize","readyToRender","totalSize"]),p=Fj(!!c,t);Oj(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:g,rowGap:h,gap:v}=s,y=g||v||0,x=h||v||0;n?(x&&(m.marginTop=m.marginBottom=-x/2),y&&(m.marginRight=-y)):x&&(m.marginBottom=-x)}return De("div",{ref:a,style:m},De(gj,null,r))}),zj=ha(function({freshDataTransitionEpoch:t,horizontal:n,recycleItems:o,ItemSeparatorComponent:r,getRenderedItem:a,stickyHeaderConfig:i}){let[s,l]=er(["numContainersPooled","numColumns"]),d=[];for(let c=0;c<s;c++)d.push(De(Nj,{getRenderedItem:a,horizontal:n,ItemSeparatorComponent:r,id:c,key:c,recycleItems:o,stickyHeaderConfig:i}));return De(Bj,{freshDataTransitionEpoch:t,horizontal:n,numColumns:l},d)});function Uj(e){return Qg(e)?Object.assign({},...e.filter(Boolean)):e}var ef={create:e=>e,flatten:e=>Uj(e)};function JC(e){let t=N(e);return t.current=e,t}function Hj(e){let t=JC(e),n=N(void 0),o=q(()=>({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 W(()=>()=>{o.cancel()},[o]),o}var ZC="legend-list-content-container",Z_="legend-list-scrollbar-x-hidden",eD="legend-list-scrollbar-y-hidden";function $j(){return typeof document>"u"?null:document.scrollingElement||document.documentElement||document.body}function eb(){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 jN(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 tD(e){var t,n;return{height:(t=e?.scrollHeight)!=null?t:0,width:(n=e?.scrollWidth)!=null?n:0}}function Kj(e,t,n){return tD(n?t:e)}function QN(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 XN(e,t){return Math.max(0,Math.min(e,t))}function YN(e,t){return t?e.width:e.height}function qj(e,t,n){return Math.max(0,YN(e,n)-YN(t,n))}function JN(e,t){return t&&$j()||e}function Vj(e,t){return t&&typeof window<"u"?window:e}function Wj(e,t,n){let o=e.getBoundingClientRect(),r=eb();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 Gj({clampedOffset:e,horizontal:t,listPos:n,scroll:o}){return{left:t?n.left+e:o.x,top:t?o.y:n.top+e}}var ZN="legend-list-scrollbar-axis-hidden-style",jj=200,Qj=`.${eD}::-webkit-scrollbar:vertical{width:0;display:none;}.${Z_}::-webkit-scrollbar:horizontal{height:0;display:none;}`;function Xj(){if(typeof document>"u"||document.getElementById(ZN))return;let e=document.createElement("style");e.id=ZN,e.textContent=Qj,document.head.appendChild(e)}function Yj(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 Jj(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 Zj(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 e_=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:g=!1,onLayout:h,...v},y){var x,C,w;let T=$r(),[S]=er(["anchoredEndSpaceSize"]),L=N(null),k=N(null),I=g,P=R(()=>Vj(L.current,I),[I]),E=R(()=>{let Y=L.current,me=Kj(Y,k.current,I),ge=QN(Y,I,a);return qj(me,ge,a)},[a,I]),_=R(()=>{let Y=L.current;if(I){let me=E(),ge=eb(),G=jN(Y,ge),Ye=a?ge.x-G.left:ge.y-G.top;return XN(Ye,me)}return Y?a?Y.scrollLeft:Y.scrollTop:0},[E,a,I]),A=R((Y,me)=>{let ge=L.current,G=P();if(!G||typeof G.scrollTo!="function")return;let Ye=E(),vt=XN(Y,Ye),Dt={behavior:me?"smooth":"auto"};if(I){let Nt=eb(),Ot=jN(ge,Nt),{left:At,top:xt}=Gj({clampedOffset:vt,horizontal:a,listPos:Ot,scroll:Nt});Dt.left=At,Dt.top=xt}else a?Dt.left=vt:Dt.top=vt;G.scrollTo(Dt)},[E,P,a,I]);rr(y,()=>({getBoundingClientRect:()=>{var me;return(me=L.current)==null?void 0:me.getBoundingClientRect()},getCurrentScrollOffset:_,getScrollableNode:()=>JN(L.current,I),getScrollEventTarget:()=>P(),getScrollResponder:()=>JN(L.current,I),isWindowScroll:()=>I,scrollBy:(me,ge)=>{let G=P();!G||typeof G.scrollBy!="function"||G.scrollBy({behavior:"auto",left:me,top:ge})},scrollTo:me=>{let{x:ge=0,y:G=0,animated:Ye=!0}=me;A(a?ge:G,Ye)},scrollToEnd:(me={})=>{let{animated:ge=!0}=me,G=E();A(G,ge)},scrollToOffset:me=>{let{offset:ge,animated:G=!0}=me;A(ge,G)}}),[_,E,P,a,I,A]);let H=R(()=>{if(!l||!L.current)return;let Y=tD(k.current),me=QN(L.current,I,a),ge=_(),G={nativeEvent:{contentOffset:{x:a?ge:0,y:a?0:ge},contentSize:{height:Y.height,width:Y.width},layoutMeasurement:{height:me.height,width:me.width}}};l(G)},[_,a,I,l]),V=Hj(H),J=N(void 0),D=R(()=>{let Y=J.current;Y!==void 0&&(clearTimeout(Y),J.current=void 0),V.flush(),d?.()},[d,V]),ne=R(Y=>{if(!l)return;let me=T.state;if(!!me?.scrollingTo||!!me?.initialScrollSession&&!me.didFinishInitialScroll||!!me?.initialScroll&&!me.didFinishInitialScroll||!!me&&tf(me)?V.flush():V.schedule(),d){let G=J.current;G!==void 0&&clearTimeout(G),J.current=setTimeout(D,jj)}},[T.state,D,d,l,V]);Ce(()=>{let Y=P();if(Y)return Y.addEventListener("scroll",ne,{passive:!0}),"onscrollend"in Y&&Y.addEventListener("scrollend",D),()=>{Y.removeEventListener("scroll",ne),"onscrollend"in Y&&Y.removeEventListener("scrollend",D);let me=J.current;me!==void 0&&(clearTimeout(me),J.current=void 0),V.cancel()}},[D,P,ne,V]),W(()=>{let Y=()=>{i&&A(a?i.x||0:i.y||0,!1)};Y(),requestAnimationFrame(Y)},[i?.x,i?.y,a,A]),Ce(()=>{if(!h||!L.current)return;let Y=L.current,me=()=>{h({nativeEvent:{layout:Wj(Y,I,a)}})};me();let ge=new ResizeObserver(()=>{me()});ge.observe(Y);let G=()=>{me()};return I&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("resize",G),()=>{ge.disconnect(),I&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",G)}},[I,h]);let B=!I&&(a?!f&&Z_:!p&&eD);Ce(()=>{B&&Xj()},[B]);let U={...I?{}:{overflow:"auto",overflowX:a||f?"auto":"hidden",overflowY:a?p?"auto":"hidden":"auto",WebkitOverflowScrolling:"touch"},...ef.flatten(n),...s?{overflowAnchor:"none"}:{}},ee=Yj(T),j=(C=(x=T.state)==null?void 0:x.props)!=null&&C.anchoredEndSpace&&S?S:0,Z=Math.max(0,ee-j),de=Z?a?{flexShrink:0,width:Z}:{height:Z}:void 0,F={display:a?"flex":"block",flexDirection:a?"row":void 0,minHeight:a?void 0:"100%",minWidth:a?"100%":void 0,...ef.flatten(r),...s?{overflowAnchor:"none"}:{}},X=o?`${ZC} ${o}`:ZC,{contentContainerClassName:pe,contentInset:le,scrollEventThrottle:re,ScrollComponent:we,snapToOffsets:Xe,useWindowScroll:ot,className:at,...je}=v,oe=I?[]:Jj(Xe);oe.length>0&&(U.scrollSnapType=a?"x mandatory":"y mandatory",F.position=(w=F.position)!=null?w:"relative");let Te=B?at?`${at} ${B}`:B:at;return Zo&&/(?:^|\s)(?:[a-z0-9_-]+:)*gap(?:-[xy])?-(?:\[[^\]]+\]|[^\s]+)/.test(`${o??""} ${at??""}`)&&ol("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."),De("div",{className:Te,ref:L,...je,style:U},m,De("div",{className:X,ref:k,style:F},oe.map(Y=>De("div",{"aria-hidden":!0,"data-legend-list-snap-anchor":Y,key:`snap-${Y}`,style:Zj(Y,a)})),t,de?De("div",{"aria-hidden":!0,style:de}):null))});function e6({horizontal:e,needsOtherAxisSize:t,otherAxisSize:n}){if(!(!t||!n||n<=0))return e?{height:n}:{width:n}}function t_(e,t){let n=$r();Ce(()=>Za(n,e,r=>{t(r)}),[t,n,e])}function t6(e){return e?{contentSizeKey:"scrollWidth",paddingEndProp:"paddingRight",viewportSizeKey:"clientWidth",x:1,y:0}:{contentSizeKey:"scrollHeight",paddingEndProp:"paddingBottom",viewportSizeKey:"clientHeight",x:0,y:1}}function n6(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 > .${ZC}`)),i?{contentNode:s,scrollElement:i}:null}function o6(e,t,n){e.scrollBy({behavior:"auto",left:t,top:n})}function r6(){let e=$r(),t=N(0),n=N(0),o=N(void 0),r=N(void 0),a=N(null),i=R(()=>{let s=be(e,"scrollAdjust"),l=be(e,"scrollAdjustUserOffset"),d=(s||0)+(l||0);if(d-t.current!==0){let f=n6(e,a.current);if(f){let p=!!e.state.props.horizontal,m=t6(p),{contentNode:g,scrollElement:h}=f,v=p?h.scrollLeft:h.scrollTop,y=(l||0)-n.current,C=(y!==0?v+y:e.state.scroll)-v,w=Math.abs(C)>.01,T=()=>o6(h,m.x*C,m.y*C);if(a.current=g,w&&g){let S=g[m.contentSizeKey],L=h[m.viewportSizeKey],k=v+C;if(C>0&&!e.state.adjustingFromInitialMount&&S<k+L){let P=g.style[m.paddingEndProp],E=r.current,_=E?.value===P?E.baseline:P,A=(k+L-S)*2,V=`${(Number.parseFloat(window.getComputedStyle(g)[m.paddingEndProp])||0)+A}px`;g.style[m.paddingEndProp]=V,r.current={baseline:_,value:g.style[m.paddingEndProp]},g.offsetHeight,T(),o.current!==void 0&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{let J=r.current;o.current=void 0,r.current=void 0,g.style[m.paddingEndProp]===J?.value&&(g.style[m.paddingEndProp]=J.baseline)})}else T()}else w&&T()}t.current=d,n.current=l||0}},[e]);return t_("scrollAdjust",i),t_("scrollAdjustUserOffset",i),null}var a6=Wn(function({ScrollComponent:t,...n},o){let[r]=er(["snapToOffsets"]);return De(t,{...n,ref:o,snapToOffsets:r})}),tb=.1;function i6(e,t,n){let o=be(e,t)!==n;return o&&(Be(e,t,n),ll(e)),o}function s6(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-tb&&Math.abs(l)>tb}function n_(e,t){let{state:n}=e,o=be(e,"headerSize")||0,r=o!==t,a=n.didMeasureHeader||o>tb;r&&(Be(e,"headerSize",t),ll(e),a&&s6(e,o,t)&&dl(e,t-o)),n.didMeasureHeader=!0}function l6(e,t){let n=i6(e,"footerSize",t);return n&&$g(e),n}function d6(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 c6(e,t){let{state:n}=e,o=n.contentInsetOverride,r=t??void 0,a=!d6(o,r);return n.contentInsetOverride=r,a&&ll(e),a}function u6(e,t){let n=JC(e),o=JC(t);return q(()=>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 o_=({onLayoutChange:e,refView:t,children:n,...o})=>{let r=N(null),a=t??r;return xb({onLayoutChange:e,ref:a}),De("div",{...o,ref:a},n)},f6=ha(function({horizontal:t}){let[n=0]=er(["alignItemsAtEndPadding"]);return n<=0?null:De(Kg,{style:t?{flexShrink:0,width:n}:{flexShrink:0,height:n}},null)}),p6=ha(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:g,ListFooterComponentStyle:h,ListEmptyComponent:v,getRenderedItem:y,refScrollView:x,renderScrollComponent:C,onLayoutFooter:w,onInternalScrollBeginDrag:T,onInternalScrollEnd:S,scrollAdjustHandler:L,snapToIndices:k,stickyHeaderConfig:I,stickyHeaderIndices:P,useWindowScroll:E=!1,..._}){let A=$r(),H=A.state.props.maintainVisibleContentPosition,[V=0,J=0]=er(["anchoredEndSpaceSize","otherAxisSize"]),D=A.state.props.alignItemsAtEndPaddingEnabled,ne=!!A.state.props.anchoredEndSpace&&A.state.props.anchoredEndSpaceOwner==="list"&&V>0,B;if(ne){let pe=a?oi(A.state)?"Left":"Right":"Bottom",le=ef.flatten(r);B={[`padding${pe}`]:Ku({},le||{},pe)+V}}let U=e6({horizontal:a,needsOtherAxisSize:A.state.needsOtherAxisSize,otherAxisSize:J}),ee=u6(C,(pe,le)=>({...pe,ref:le})),j=C?ee:e_,Z=k?a6:j,de=R((pe,le)=>{var re;let we=l6(A,pe);le?.(),we&&((re=A.state.props.maintainScrollAtEnd)!=null&&re.onFooterLayout)&&Rd(A)},[A]);Ce(()=>{p||n_(A,0),g||de(0)},[p,g,A,de]);let F=R(pe=>{let le=pe[a?"width":"height"];n_(A,le)},[A,a]),X=R((pe,le)=>{let re=pe[a?"width":"height"];de(re,()=>{w?.(pe,le)})},[a,w,de]);return De(Z,{..._,...j===e_?{onInternalScrollEnd:S,useWindowScroll:E}:{},contentContainerStyle:[a?{height:"100%"}:{},r,B,{boxSizing:"border-box"}],contentOffset:i!==void 0?a?{x:i,y:0}:{x:0,y:i}:void 0,horizontal:a,maintainVisibleContentPosition:H.size||H.data?{minIndexForVisible:0}:void 0,onLayout:f,onScroll:c,ref:x,ScrollComponent:k?j:void 0,style:U?[U,o]:o},De(r6,null),p&&De(o_,{onLayoutChange:F,style:m},Og(p)),v&&Og(v),D&&De(f6,{horizontal:a}),t&&!v&&De(zj,{freshDataTransitionEpoch:n,getRenderedItem:y,horizontal:a,ItemSeparatorComponent:l,recycleItems:s,stickyHeaderConfig:I}),g&&De(o_,{onLayoutChange:X,style:h},Og(g)),Zo&&pW)}),m6=100,g6=.9,h6=.9;function v6(e){let t=$r(),{anchoredEndSpace:n,childrenMode:o,keyExtractor:r,numColumns:a,renderScrollComponent:i,useWindowScroll:s}=e,l=!!n;W(()=>{l&&(a??1)>1&&ol("anchoredEndSpaceNumColumns","anchoredEndSpace is only supported when numColumns is 1. Using it with multiple columns may produce incorrect anchored spacing.")},[l,a]),W(()=>{s&&i&&ol("useWindowScrollRenderScrollComponent","useWindowScroll is not supported when renderScrollComponent is provided.")},[i,s]),W(()=>{!r&&!t.state.isFirst&&t.state.didDataChange&&!o&&ol("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]),W(()=>{let d=t.state,c=d.props.data.length;if(d.props.useWindowScroll||c<m6)return;let p=()=>{let g=be(t,"readyToRender"),h=be(t,"numContainers")||0,v=be(t,"totalSize")||0,y=t.state.scrollLength||0;if(!g||v<=0||y<=0)return;let x=h>=Math.ceil(c*g6),C=y>=v*h6;x&&C&&ol("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=[Za(t,"numContainers",p),Za(t,"readyToRender",p),Za(t,"totalSize",p)];return()=>{for(let g of m)g()}},[t])}function y6(e){}var x6=Zo?v6:y6;function C6(e,t,{didColumnsChange:n=!1}={}){let o=e.state,{previousData:r}=o,{maintainScrollAtEnd:a}=o.props;if(n){o.sizes.clear(),o.sizesKnown.clear(),O_(o);for(let l in o.averageSizes)delete o.averageSizes[l];o.minIndexSizeChanged=0,o.scrollForNextCalculateItemsInView=void 0}ei(e,{dataChanged:!0,doMVCP:!0});let s=!n&&a?.onDataChange&&Rd(e);!s&&r&&t.length>r.length&&(o.isEndReached=!1),s||Gg(e),delete o.previousData}function b6(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 nD(e){var t,n;let o=e.state,{scrollLength:r,props:{data:a,getFixedItemSize:i,getItemType:s,numColumns:l,estimatedItemSize:d}}=o,c=b_(e),f=be(e,"numContainers");if(r>0&&a.length>0&&!f){let p;if(i){let g=0,h=Math.min(20,a.length);for(let v=0;v<h;v++){let y=a[v];if(y!==void 0){let x=(t=s?.(y,v))!=null?t:"";g+=((n=i(y,v,x))!=null?n:d)+e.scrollAxisGap}}p=g/h}else p=d+e.scrollAxisGap;let m=Math.max(1,Math.ceil((r+c*2)/p*l));for(let g=0;g<m;g++)Be(e,`containerPosition${g}`,Pd),Be(e,`containerColumn${g}`,-1),Be(e,`containerSpan${g}`,1);return Be(e,"numContainers",m),Be(e,"numContainersPooled",jG(a.length,m)),o.lastLayout&&(o.initialScroll?requestAnimationFrame(()=>{ei(e,{dataChanged:!0,doMVCP:!0})}):ei(e,{dataChanged:!0,doMVCP:!0})),!0}}function w6(){return typeof window>"u"?{height:0,width:0}:{height:window.innerHeight,width:window.innerWidth}}function S6(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=w6()[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 g=o.otherAxisSize,h=f!==o.scrollLength||p!==g;if(h){if(o.scrollLength=f,o.otherAxisSize=p,ll(e),o.lastBatchingAction=Date.now(),o.scrollForNextCalculateItemsInView=void 0,f>0&&nD(e),m&&ei(e,{doMVCP:!0}),(h||p!==g)&&Be(e,"scrollSize",{height:l.height,width:l.width}),r?.onLayout&&Rd(e),Gg(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}Zo&&d===0&&ol("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 I6(e,t){let n=lo.get(e);if(!!n&&lo.didReachTarget(t,n)){lo.clear(e);return}n&&(e.hasScrolled=!1,lo.set(e,{startScroll:n.startScroll,targetOffset:n.targetOffset}))}function T6(e){var t;return!!e.initialScroll&&((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"&&!e.didFinishInitialScroll}function k6(e){return{...e,nativeEvent:{...e.nativeEvent}}}function L6(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=Z4(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=Yi(e,f,l.scrollingTo);if(f!==p&&Math.abs(f-p)>1){f=p,Jg(e,{forceScroll:!0,isInitialScroll:!0,noScrollingTo:!0,offset:f});return}}l.scrollPending=f,al(e,f,c,{fromNativeScrollEvent:!0}),I6(l,f),gG(e),l.scrollingTo&&hb(e),l.props.onScroll&&(T6(l)?l.deferredPublicOnScrollEvent=k6(t):l.props.onScroll(t))}var P6=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()}},A6=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,Be(this.ctx,"scrollAdjustPending",this.pendingAdjust)):(this.appliedAdjust+=e,Be(this.ctx,"scrollAdjust",this.appliedAdjust)),this.ctx.state.scrollingTo&&hb(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=jg(this.ctx,e.index);o=Xg(this.ctx,a,e),o=Yi(this.ctx,o,e)}else o=Yi(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,Be(this.ctx,"scrollAdjust",this.appliedAdjust)),Be(this.ctx,"scrollAdjustPending",0),ei(this.ctx)}}}};function E6(e,t){let n=e.state,o=rl(e,t),a=rl(e)-o;if(a!==0){let i=!!be(e,"isWithinMaintainScrollAtEndThreshold");al(e,n.scroll,!0,{markHasScrolled:!1}),!z_(e)&&i&&a>0&&dl(e,a)}}function qC(e){return q(()=>e?(t,n,o)=>t!==void 0&&n!==void 0?e(t,n,o):void 0:void 0,[e])}var R6=(...e)=>R(n=>{for(let o of e)o&&(I_(o)?o(n):o.current=n)},e);function M6(e){return null}function N6(e,t,n,o){return o}function _6(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 D6(e,t){let n=e.state,r=n.props.data.length-1;if(r===-1)return!1;let a=n.props.stylePaddingBottom||0,i=be(e,"footerSize")||0;return Dg(e,{...t,index:r,viewOffset:-a-i+(t?.viewOffset||0),viewPosition:1}),!0}var O6="default";function F6(e){let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];o&&(t[n||O6]={average:o.avg,count:o.num})}return t}function B6(e){Hg(e)}function z6(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=(h,v=!1)=>{var y;let x=n.props,C=x.data.length,w=(y=x.anchoredEndSpace)==null?void 0:y.anchorIndex;return h<0?v:h>=C?!1:w===void 0||w<0||w>=C||h<w?!0:RW(e,w,C-1)},l=(h,v,y)=>{let x=Date.now(),C=0,w=()=>{if(h!==a)return;i()||!y()?C=0:C+=1;let T=Date.now()-x>=o;if(C>=r||T){v();return}n.scheduledWork.frame(w,"imperativeScrollReady")};n.scheduledWork.frame(w,"imperativeScrollReady")},d=(h,v,y,x=()=>!0)=>{let C=()=>{if(h!==a)return;(!y()||!n.scrollingTo)&&(n.pendingScrollResolve===v&&(n.pendingScrollResolve=void 0),v())};i()||!x()?l(h,C,x):C()},c=h=>{n.scheduledWork.cancel("imperativeScrollReady");let v=++a;return p_(n),n.pendingScrollResolve=h,v},f=(h,v=()=>!0)=>new Promise(y=>{let x=c(y);_N(e),d(x,y,h,v)});n.runPendingScrollToEnd=()=>{let h=n.pendingScrollToEnd;h&&(n.pendingScrollToEnd=void 0,h.token===a&&d(h.token,h.resolve,()=>D6(e,h.options),()=>s(n.props.data.length-1,!0)))};let p=h=>{if(n){let{index:v,...y}=h,{startNoBuffer:x,endNoBuffer:C}=n;if(v<x||v>C){let w=v<x?0:1;return Dg(e,{...y,index:v,viewPosition:w}),!0}}return!1},m=n.refScroller;return{clearCaches:h=>{var v,y;let x=(v=h?.mode)!=null?v:"sizes";n.sizes.clear(),n.sizesKnown.clear(),O_(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,Be(e,"totalSize",0),x==="full"&&(n.indexByKey.clear(),n.idCache.length=0,n.positions.length=0,n.columns.length=0,n.columnSpans.length=0),B6(e),(y=n.triggerCalculateItemsInView)==null||y.call(n,{forceFullItemPositions:!0})},flashScrollIndicators:()=>m.current.flashScrollIndicators(),getAnimatableRef:()=>{var h,v,y;return(y=(v=(h=m.current).getNativeScrollRef)==null?void 0:v.call(h))!=null?y:m.current},getNativeScrollRef:()=>m.current,getScrollableNode:()=>m.current.getScrollableNode(),getScrollResponder:()=>m.current.getScrollResponder(),getState:()=>({activeStickyIndex:be(e,"activeStickyIndex"),contentLength:vo(e),data:n.props.data,elementAtIndex:h=>{var v;return(v=e.viewRefs.get(jC(e,Qt(n,h))))==null?void 0:v.current},end:n.endNoBuffer,endBuffered:n.endBuffered,getAverageItemSizes:()=>F6(n),indexByKey:h=>n.indexByKey.get(h),isAtEnd:be(e,"isAtEnd"),isAtStart:be(e,"isAtStart"),isEndReached:n.isEndReached,isNearEnd:be(e,"isNearEnd"),isNearStart:be(e,"isNearStart"),isStartReached:n.isStartReached,isWithinMaintainScrollAtEndThreshold:be(e,"isWithinMaintainScrollAtEndThreshold"),listen:(h,v)=>Za(e,h,v),listenToPosition:(h,v)=>aW(e,h,v),positionAtIndex:h=>n.positions[h],positionByKey:h=>{let v=n.indexByKey.get(h);return v===void 0?void 0:n.positions[v]},scroll:n.scroll,scrollLength:n.scrollLength,scrollVelocity:Yg(n),sizeAtIndex:h=>n.sizesKnown.get(Qt(n,h)),sizes:n.sizesKnown,start:n.startNoBuffer,startBuffered:n.startBuffered}),reportContentInset:h=>{let v=c6(e,h);al(e,n.scroll,!0,{markHasScrolled:!1}),v&&z_(e)},scrollIndexIntoView:h=>f(()=>p(h)),scrollItemIntoView:({item:h,...v})=>f(()=>{let x=n.props.data.indexOf(h);return x!==-1?(p({index:x,...v}),!0):!1}),scrollToEnd:h=>new Promise(v=>{var y;let x=c(v);n.pendingScrollToEnd={options:h,resolve:v,token:x},t?.(),_N(e),t||(y=n.runPendingScrollToEnd)==null||y.call(n)}),scrollToIndex:h=>f(()=>(Dg(e,h),!0),h.index>=0?()=>s(h.index):void 0),scrollToItem:({item:h,...v})=>f(()=>{let x=n.props.data.indexOf(h);return x!==-1?(Dg(e,{index:x,...v}),!0):!1}),scrollToOffset:h=>f(()=>(Jg(e,h),!0)),setItemSize:(h,v)=>{Q_(e,{itemKey:h,size:v})},setScrollProcessingEnabled:h=>{n.scrollProcessingEnabled=h},setVisibleContentAnchorOffset:h=>{let v=I_(h)?h(be(e,"scrollAdjustUserOffset")||0):h;Be(e,"scrollAdjustUserOffset",v)}}}var U6=(e,t)=>e-t,r_=e=>typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):0,$u=(e,t,n)=>{n>=0&&n<t&&e.add(n)};function H6(e,t,n,o){var r,a;if(t.length===0)return[];let i=new Set,s=t.length,l=r_(e?.top);if(l>0)for(let f=0;f<Math.min(l,s);f++)$u(i,s,f);let d=r_(e?.bottom);if(d>0)for(let f=Math.max(0,s-d);f<s;f++)$u(i,s,f);if((r=e?.indices)!=null&&r.length)for(let f of e.indices)Number.isFinite(f)&&$u(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)&&($u(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++)$u(i,s,p)}let c=Array.from(i);return c.sort(U6),c}function $6(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=be(e,"extraData"),f=a[l];if(s&&!Wu(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 a_(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 K6(e){var t;return e?e===!0?{...a_(void 0,!1),animated:!1}:{...a_(e.on,"on"in e),animated:(t=e.animated)!=null?t:!1}:void 0}function q6(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 V6(e,{stylePaddingTop:t}){let n=e.state;if(t!==void 0){let o=be(e,"stylePaddingTop")||0;if(t<o){let r=be(e,"totalSize")||0;Be(e,"totalSize",r+o),n.timeoutSetPaddingTop=setTimeout(()=>{r=be(e,"totalSize")||0,Be(e,"totalSize",r-o)},16)}Be(e,"stylePaddingTop",t)}}function W6(e){let t=N(null),n=N(0),o=N(null),r=()=>{t.current&&(clearTimeout(t.current),t.current=null)};return R((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 G6(e,t){let n=W6("throttle");return o=>n(e,t,{nativeEvent:o.nativeEvent})}var j6=ha(X_(function(t,n){let{children:o,data:r,renderItem:a,...i}=t,l=o!==void 0&&r===void 0?{...i,childrenMode:!0,data:(Qg(o)?o:Ah.toArray(o)).flat(1),renderItem:({item:d})=>d}:{...i,data:r||[],renderItem:a};return De(nW,null,De(Q6,{...l,ref:n}))})),Q6=X_(function(t,n){var o,r,a,i,s,l,d,c,f,p,m,g,h,v,y,x,C,w,T;let S=R(Ke=>{},[]);t.recycleItems===void 0&&ol("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:k,alwaysRender:I,columnWrapperStyle:P,contentContainerStyle:E,contentInset:_,data:A=[],dataKey:H,dataVersion:V,drawDistance:J=250,contentInsetEndAdjustment:D,estimatedItemSize:ne=100,estimatedListSize:B,extraData:U,getFixedItemSize:ee,getItemType:j,horizontal:Z,rtl:de,estimatedHeaderSize:F,initialScrollAtEnd:X=!1,initialScrollIndex:pe,initialScrollOffset:le,experimental_adaptiveRender:re,itemsAreEqual:we,keyExtractor:Xe,ListEmptyComponent:ot,ListFooterComponent:at,ListFooterComponentStyle:je,ListHeaderComponent:oe,maintainScrollAtEnd:Te=!1,maintainScrollAtEndThreshold:Y=.1,maintainVisibleContentPosition:me,numColumns:ge=1,overrideItemLayout:G,onEndReached:Ye,onEndReachedThreshold:vt=.5,onItemSizeChanged:Mt,onMetricsChange:Dt,onLayout:Nt,onLoad:Ot,onMomentumScrollEnd:At,onRefresh:xt,onScroll:_t,onScrollBeginDrag:Xt,onStartReached:mn,onStartReachedThreshold:Hn=.5,onStickyHeaderChange:yt,onFirstVisibleItemChanged:qt,onViewableItemsChanged:an,progressViewOffset:kn,recycleItems:sn=!1,refreshControl:Cn,refreshing:$n,refScrollView:$,renderScrollComponent:ae,renderItem:ce,scrollEventThrottle:Le,snapToIndices:ze,stickyHeaderIndices:ft,style:gn,useWindowScroll:lt=!1,viewabilityConfig:hn,viewabilityConfigCallbackPairs:Ft,...rt}=t,Zt=t.animatedPropsInternal,ln=(o=t.anchoredEndSpaceOwnerInternal)!=null?o:"list",Se=t.positionComponentInternal,Re=t.stickyPositionComponentInternal,{anchoredEndSpaceOwnerInternal:qe,positionComponentInternal:pt,stickyPositionComponentInternal:st,...it}=rt,kt=ef.flatten(E),Vt=L&&!Z&&kt?.minHeight==null&&A.length>0,Pe=L&&!Vt&&(Z?kt?.minWidth==null:kt?.minHeight==null),Et={...kt,...L&&!Vt?{display:"flex",flexDirection:Z?"row":"column",...Pe?{flexGrow:1}:{},justifyContent:"flex-end"}:{}},mt={...ef.flatten(gn)},on=Ku(mt,Et,"Top"),Nn=Ku(mt,Et,"Bottom"),xe=Ku(mt,Et,"Left"),Ve=Ku(mt,Et,"Right"),Ct=ab({horizontal:Z,rtl:de,stylePaddingBottom:Nn,stylePaddingLeft:xe,stylePaddingRight:Ve}),ct=K6(Te),vn=q6(me),bn=pe!=null,yn=le!=null,Lt=!X&&!bn&&!yn&&rb({horizontal:Z,rtl:de}),xn=!X&&!bn&&(yn||Lt),Wt=X||bn,An=X?{index:Math.max(0,A.length-1),preserveForBottomPadding:!0,viewOffset:-Ct,viewPosition:1}:bn?typeof pe=="object"?{index:(r=pe.index)!=null?r:0,preserveForBottomPadding:pe.viewOffset===void 0&&pe.viewPosition===1?!0:void 0,viewOffset:(a=pe.viewOffset)!=null?a:pe.viewPosition===1?-Ct:0,viewPosition:(i=pe.viewPosition)!=null?i:0}:{index:pe??0,viewOffset:le??0}:xn?{contentOffset:le??0,index:0,viewOffset:0}:void 0,[eo,va]=Q(!sb),[,ya]=Ea(Ke=>Ke+1,0),He=$r();He.columnWrapperStyle=P||(Et?_6(Et):void 0);let xa=Z?(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,Cr=typeof xa=="number"&&Number.isFinite(xa)?xa:0,qr=N(null),_n=R6(qr,$),tr=Xe??((Ke,Bt)=>Bt.toString()),Ro=ft,ii=D,ul=N(ii),Zi=q(()=>{let Ke=H6(I,A,tr,k?.anchorIndex);return{arr:Ke,set:new Set(Ke)}},[k?.anchorIndex,I?.top,I?.bottom,(m=I?.indices)==null?void 0:m.join(","),(g=I?.keys)==null?void 0:g.join(","),A,H,V,tr]),to=!!lt&&!ae,gt=N(void 0),xo=!!G,zo=N(xo);if(!gt.current){if(!He.state){let Ke=(B??{height:0,width:0})[Z?"width":"height"];He.values.set("adaptiveRender",(h=re?.initialMode)!=null?h:"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:A.length>0,idCache:[],idsInView:[],indexByKey:new Map,initialScroll:An,initialScrollSession:An?{kind:xn?"offset":"bootstrap",previousDataLength:A.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 P6,scroll:0,scrollAdjustHandler:new A6(He),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 Bt=He.state;Bt.triggerCalculateItemsInView=dn=>ei(He,dn),Bt.reprocessCurrentScroll=()=>al(He,Bt.scroll,!0),Be(He,"maintainVisibleContentPosition",vn),Be(He,"extraData",U),F!==void 0&&Be(He,"headerSize",F)}gt.current=He.state}let Ae=gt.current,Uo=Ae.isFirst,es=Ae.props.adaptiveRender,Dn=Ae.props.numColumns,Vr=!Uo&&He.scrollAxisGap!==Cr;He.scrollAxisGap=Cr,Ae.didColumnsChange=ge!==Dn||Vr;let co=(y=(v=Ae.props.data)==null?void 0:v.length)!=null?y:0,Wr=Ae.props.data!==A,uo=Ae.props.dataKey!==H,Ho=Ae.props.dataVersion!==V,Kn=uo||Ho||Wr&&b6(Ae,A,Ae.props.data),Co=!Uo&&Kn&&Ae.hasHadNonEmptyData&&(uo||co===0)&&A.length>0;Kn&&!X&&Ae.didFinishInitialScroll&&((x=Ae.initialScroll)==null?void 0:x.viewPosition)===1&&Ae.props.data.length>0&&Ad(Ae),Kn&&(Ae.dataChangeEpoch+=1,Ae.dataChangeNeedsScrollUpdate=!0,Ae.didDataChange=!0,Ae.previousData=Ae.props.data),Co&&(Ae.freshDataTransitionEpoch+=1);let si=G6(_t??S,Le??0),li=Le&&_t?si:_t,di=!Uo&&!Kn&&((C=Ae.props.anchoredEndSpace)==null?void 0:C.anchorIndex)!==k?.anchorIndex;Ae.props={adaptiveRender:re,alignItemsAtEnd:L,alignItemsAtEndPaddingEnabled:Vt,alwaysRender:I,alwaysRenderIndicesArr:Zi.arr,alwaysRenderIndicesSet:Zi.set,anchoredEndSpace:k,anchoredEndSpaceOwner:ln,animatedProps:Zt,contentContainerAlignItems:Et.alignItems,contentInset:_,contentInsetEndAdjustment:ii,data:A,dataKey:H,dataVersion:V,drawDistance:J,estimatedItemSize:ne,getFixedItemSize:qC(ee),getItemType:qC(j),horizontal:!!Z,itemsAreEqual:we,keyExtractor:qC(tr),maintainScrollAtEnd:ct,maintainScrollAtEndThreshold:Y,maintainVisibleContentPosition:vn,numColumns:ge,onEndReached:Ye,onEndReachedThreshold:vt,onFirstVisibleItemChanged:qt,onItemSizeChanged:Mt,onLoad:Ot,onMomentumScrollEnd:At,onScroll:li,onScrollBeginDrag:Xt,onStartReached:mn,onStartReachedThreshold:Hn,onStickyHeaderChange:yt,overrideItemLayout:G,positionComponentInternal:Se,recycleItems:!!sn,renderItem:ce,rtl:de,snapToIndices:ze,stickyHeaderIndicesArr:Ro??[],stickyHeaderIndicesSet:q(()=>new Set(Ro??[]),[Ro?.join(",")]),stickyPositionComponentInternal:Re,stylePaddingBottom:Nn,stylePaddingLeft:xe,stylePaddingRight:Ve,stylePaddingTop:on,useWindowScroll:to},Ae.refScroller=qr,!Uo&&es&&!re&&lb(He);let nr=q(()=>A.length?Array.from({length:Math.min(ge,A.length)},(Ke,Bt)=>Qt(Ae,A.length-1-Bt)):[],[A,H,V,ge]),wn=Ke=>{Be(He,"lastItemKeys",nr),Be(He,"numColumns",ge);let Bt=be(He,"stylePaddingTop");V6(He,{stylePaddingTop:on}),gt.current.props.stylePaddingBottom=Nn,ll(He);let dn=on-Bt;Ke&&vn.size&&dn&&Bt!==void 0&&ti.OS};Uo&&(wn(!1),U_(Ae),$_(He,!0));let Gr=q(()=>{var Ke,Bt;let dn=Ae.initialScroll;if(!dn)return;let Ln=(Ke=dn.contentOffset)!=null?Ke:Hr(He,dn);return Wt&&((Bt=Ae.initialScrollSession)==null?void 0:Bt.kind)==="bootstrap"&&ti.OS==="web"?void 0:Ln},[Wt]);Ce(()=>{DG(He,{alwaysDispatchInitialScroll:Lt,dataLength:A.length,hasFooterComponent:!!at,initialContentOffset:Gr,initialScrollAtEnd:X,useBootstrapInitialScroll:Wt})},[]),(Uo||Kn||Ae.didColumnsChange)&&(gt.current.lastBatchingAction=Date.now(),!Xe&&!Uo&&Kn&&(gt.current.sizes.clear(),gt.current.positions.length=0,gt.current.totalSize=0,Be(He,"totalSize",0))),Zo&&x6(t),Ce(()=>{Co&&cb(He,{resetInitialScroll:!!An,resetLayout:!0}),OG(He,{dataLength:A.length,didDataChange:Kn,didStartFreshData:Co,initialScrollAtEnd:X,latestInitialScroll:An,latestInitialScrollSessionKind:xn?"offset":"bootstrap",stylePaddingEnd:Ct,useBootstrapInitialScroll:Wt})},[A.length,H,Kn,Co,X,Ct,Wt]),Ce(()=>{var Ke;di&&(Ae.scrollForNextCalculateItemsInView=void 0,(Ke=Ae.triggerCalculateItemsInView)==null||Ke.call(Ae)),$g(He)},[He,A,V,k?.anchorIndex,k?.anchorMaxSize,k?.anchorOffset,di,Z,ge,de,Nn,xe,Ve]),Ce(()=>{let Ke=ul.current;ul.current=ii,E6(He,Ke)},[He,ii]);let Mo=R(Ke=>{Wt&&yG(He,{dataLength:A.length,footerSize:Ke[Z?"width":"height"],initialScrollAtEnd:X,stylePaddingEnd:Ct})},[A.length,X,Z,Ct,Wt]),Ca=R((Ke,Bt)=>{let dn=Ae.scrollLength,Ln=Ae.otherAxisSize;S6(He,Ke,va),$g(He);let Sa=dn!==Ae.scrollLength||Ln!==Ae.otherAxisSize;Wt&&!Bt&&Sa&&xG(He),!Wt&&Yu(He)},[A.length,X,Ct,Wt]),{onLayout:ba}=xb({onLayoutChange:Ca,onLayoutProp:Nt,ref:qr});Ce(()=>{ze&&H_(He)},[ze]),Ce(()=>wn(!0),[H,V,nr.join(","),ge,Cr,Nn,on,Vt]),Ce(()=>{let{didColumnsChange:Ke,didDataChange:Bt,isFirst:dn,props:{data:Ln}}=Ae;!(Ln.length>0&&nD(He))&&!dn&&(Bt||Ke)&&C6(He,Ln,{didColumnsChange:Ke}),Bt&&(Ae.pendingDataComparison=void 0),Ae.didColumnsChange=!1,Ae.didDataChange=!1,Ae.isFirst=!1},[A,H,V,ge,Cr]),Ce(()=>{var Ke;Be(He,"extraData",U);let Bt=zo.current!==xo;zo.current=xo,(xo||Bt)&&ge>1&&((Ke=Ae.triggerCalculateItemsInView)==null||Ke.call(Ae,{forceFullItemPositions:!0}))},[U,xo,ge]),W(()=>{if(!Dt)return;let Ke,Bt=()=>{let Ln={footerSize:be(He,"footerSize")||0,headerSize:be(He,"headerSize")||0};(!Ke||Ln.headerSize!==Ke.headerSize||Ln.footerSize!==Ke.footerSize)&&(Ke=Ln,Dt(Ln))};Bt();let dn=[Za(He,"headerSize",Bt),Za(He,"footerSize",Bt)];return()=>{for(let Ln of dn)Ln()}},[He,Dt]),W(()=>{let Ke=$G({onViewableItemsChanged:an,viewabilityConfig:hn,viewabilityConfigCallbackPairs:Ft});Ae.viewabilityConfigCallbackPairs=Ke,Ae.enableScrollForNextCalculateItemsInView=!0,Ke&&(Ae.scrollForNextCalculateItemsInView=void 0)},[hn,Ft,an]),Cj(()=>{}),rr(n,()=>z6(He,ya),[]),W(()=>()=>{gW(Ae),Ae.scheduledWork.dispose()},[Ae]),Ce(()=>{var Ke;(Ke=Ae.runPendingScrollToEnd)==null||Ke.call(Ae)}),W(()=>{Wt||Yu(He)},[He,Wt]);let qn=q(()=>({getRenderedItem:Ke=>$6(He,Ke),onMomentumScrollEnd:Ke=>{NG(He),Ae.props.onMomentumScrollEnd&&Ae.props.onMomentumScrollEnd(Ke)},onScroll:Ke=>L6(He,Ke),onScrollBeginDrag:Ke=>{var Bt,dn;RN(He),(dn=(Bt=Ae.props).onScrollBeginDrag)==null||dn.call(Bt,Ke)},onScrollEnd:()=>RN(He)}),[]),wa=N6(Ro,Z,He,qn.onScroll),no=Cn;return De(mi,null,De(p6,{...it,alignItemsAtEnd:L,canRender:eo,contentContainerStyle:Et,contentInset:_,freshDataTransitionEpoch:Ae.freshDataTransitionEpoch,getRenderedItem:qn.getRenderedItem,horizontal:Z,initialContentOffset:Gr,ListEmptyComponent:A.length===0?ot:void 0,ListFooterComponent:at,ListFooterComponentStyle:je,ListHeaderComponent:oe,onInternalScrollBeginDrag:qn.onScrollBeginDrag,onInternalScrollEnd:qn.onScrollEnd,onLayout:ba,onLayoutFooter:Mo,onMomentumScrollEnd:qn.onMomentumScrollEnd,onScroll:wa,recycleItems:sn,refreshControl:no?on>0?Lf(no,{progressViewOffset:((w=no.props.progressViewOffset)!=null?w:0)+on}):no:xt&&De(M6,{onRefresh:xt,progressViewOffset:(kn||0)+on,refreshing:!!$n}),refScrollView:_n,renderScrollComponent:ae,scrollAdjustHandler:(T=gt.current)==null?void 0:T.scrollAdjustHandler,scrollEventThrottle:0,snapToIndices:ze,stickyHeaderIndices:Ro,style:mt,useWindowScroll:to}),Zo&&mW)});var X6=j6;var oD=X6;he();he();function Y6(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function J6(e,t){let n=t?.trim();if(!n)return e;let o=new RegExp(`^${Y6(n)}(?:\\s*[.:/-]\\s*|\\s+)`,"iu");return e.replace(o,"").trim()||e}function Cb(e,t){let n=t?.preferShortName&&e.shortName?e.shortName:e.name;return J6(n,e.subProvider)}function Md(e){return Cb(e,{preferShortName:!0})}var bb="model:",wb="unavailable-models:",Sb="action:",Nd="pluginActions:manage";function nf(e,t){return`${bb}${e.length}:${e}${t}`}function Ib(e){if(!e.startsWith(bb))return null;let t=e.slice(bb.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 rD(e){return`${wb}${e}`}function aD(e){return e.startsWith(wb)?e.slice(wb.length):null}function of(e){return`${Sb}${e}`}function iD(e){if(!e.startsWith(Sb))return null;let t=e.slice(Sb.length);return t.length>0?t:null}var sD=ve(function(t){let{t:n}=ye(),o=t.isFavorite?n("modelPicker.removeFromFavorites"):n("modelPicker.addToFavorites"),r=[t.providerDisplayName,t.model.subProvider,t.providerAccountEmail].filter(s=>typeof s=="string"&&s.length>0).join(" \xB7 "),a=b(Pl,{hideIndicator:!0,index:t.index,value:nf(t.instanceId,t.model.slug),disabled:!!t.disabledReason,contentClassName:"flex w-full items-center gap-3",className:K("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:[b("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?Md(t.model):Cb(t.model,t.preferShortName?{preferShortName:!0}:void 0)}),t.model.isUnavailable?u(ra,{variant:"outline",size:"sm",children:n("modelPicker.unavailableBadge")}):null]}),t.showProvider&&b("div",{className:"mt-1 flex items-center gap-1.5",children:[u(Sr,{driver:t.driver,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(Xf,{className:"h-4 min-w-0 rounded-sm px-1.5 text-[10px]",children:t.jumpLabel}):null,b(Je,{children:[u(et,{render:u(ie,{size:"icon-xs",variant:"ghost",className:K("-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(xs,{className:K("size-icon-1",t.isFavorite&&"fill-current text-yellow-500")})})}),u(Ze,{side:"top",align:"center",children:o})]})]})]}),i=t.disabledReason??t.actionLabel;return i?b(Je,{children:[u(et,{render:a}),u(Ze,{side:"left",align:"center",className:"max-w-64 text-balance leading-snug",children:i})]}):a});he();function Z6(e,t){let n=e.displayName,o=e.enabled?e.readiness:"disabled";if(uN(o))return n;let r=pN(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 e8="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",t8="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 ",n8=`${t8} text-update-foreground`,lD="left",dD=8,cD="max-w-64 text-balance font-normal leading-snug",uD=ve(function(t){let{t:n}=ye(),{t:o}=ye(),r=jt().model.isProviderUpdateInFlight,a=p=>{t.onSelectInstance(p)},i=t.showFavorites??!0,[s,l]=Q(null),d=N(null),[c,f]=Q(null);return Ce(()=>{let p=d.current;if(!p)return;let m=Array.from(p.querySelectorAll("[data-model-picker-provider]")).find(g=>g.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:K(e8,"right-0 translate-y-0 transition-[top] duration-200 ease-out"),style:{top:c}}):null,i?b(ke,{children:[u("div",{className:"relative w-full","data-model-picker-provider":"favorites",children:b(Je,{children:[u(et,{render:u("button",{className:K("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(xs,{className:"size-5 fill-current shrink-0","aria-hidden":!0})})}),u(Ze,{side:lD,sideOffset:dD,align:"center",className:cD,children:n("modelPicker.favorites")})]})}),u("div",{className:"border-b border-border/70","aria-hidden":"true"})]}):null,t.instanceEntries.map(p=>{let m=!Mg(p),g=t.disabledInstanceIds?.has(p.instanceId)??!1,h=m||g,v=t.selectedInstanceId===p.instanceId,y=s===p.instanceId,x=r(p.snapshot),C=p.snapshot.versionAdvisory?.latestVersion!=null?o("updates.rail.updatingToVersion",{version:p.snapshot.versionAdvisory.latestVersion}):o("updates.rail.updating"),w=m?Z6(p,o):g?t.getDisabledInstanceTooltip?.(p)??p.displayName:x?`${p.displayName} \u2014 ${C}`:p.displayName,T=b("button",{className:K("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))]",h&&"opacity-50 cursor-not-allowed hover:bg-transparent"),"data-provider-accent-color":p.accentColor,onClick:()=>!h&&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:h,type:"button","aria-label":h?w:p.displayName,children:[u(Sr,{driver:p.driverKind,displayName:p.displayName,accentColor:p.accentColor,className:"size-6",iconClassName:"size-5",indicatorBackground:y&&!h?"var(--muted)":v?"var(--background)":"color-mix(in oklab, var(--muted) 30%, transparent)"}),x?u("span",{className:n8,"aria-hidden":!0,children:u(Ff,{className:"size-2.5"})}):null]}),S=h?u("span",{className:"relative block w-full",children:T}):T;return u("div",{className:"relative w-full","data-model-picker-provider":p.instanceId,children:b(Je,{children:[u(et,{render:S}),b(Ze,{side:lD,sideOffset:dD,align:"center",className:cD,children:[w,p.accountEmail?u("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:p.accountEmail}):null]})]})},p.instanceId)})]})})})});function fD(e,t){let n=[],o=[];for(let r of e)t(r)?o.push(r):n.push(r);return{current:n,unavailable:o}}function pD(e){return e.instanceReady?!0:e.entry.enabled&&e.entry.driverKind==="opencode"&&e.instanceId===e.activeInstanceId&&e.option.slug===e.activeModel&&e.option.isUnavailable===!0}var o8=24;function r8(e){return[ho(e.name),...e.shortName?[ho(e.shortName)]:[],...e.subProvider?[ho(e.subProvider)]:[],ho(e.driverKind),ho(e.providerDisplayName),...e.providerAccountEmail?[ho(e.providerAccountEmail)]:[],Tb(e),...e.slug?[ho(e.slug)]:[]]}function a8(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 Tb(e){return ho([e.name,e.shortName,e.subProvider,e.driverKind,e.providerDisplayName,e.providerAccountEmail,e.slug].filter(t=>typeof t=="string"&&t.length>0).join(" "))}function mD(e,t){let n=ho(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=a8(e[i],r,i*10);s!==null&&a.push(s)}if(a.length===0)return null;o+=Math.min(...a)}return o}function gD(e,t){let n=mD(r8(e),t);return n===null?null:e.isFavorite?n-o8:n}function hD(e,t){return mD([ho(e.title),ho(e.description??"")],t)}function vD({top:e,bottom:t}){if(!(!e&&!t))return K("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 yD(e,t){return`${e}:${t}`}var xD=new Map,CD=[],i8=[],s8=[];function rf(e){return nf(e.instanceId,e.slug)}function bD(e,t,n){return t.environmentId===n&&t.instanceId===e.instanceId&&t.model===e.slug}function l8(){return u("div",{className:"h-0.5"})}function kb(e){return e?.trim()||null}function wD({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 d8=ve(function({index:t,itemKey:n,action:o,showSectionHeader:r}){let{t:a}=ye(),i=kb(o.description);return b(ke,{children:[r?u(wD,{label:a("modelPicker.plugins")}):null,b(Pl,{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(hs,{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})]})]})]})}),c8=ve(function({index:t,showSectionHeader:n}){let{t:o}=ye();return b(ke,{children:[n?u(wD,{label:o("modelPicker.plugins")}):null,b(Pl,{hideIndicator:!0,index:t,value:Nd,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(jd,{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")})]})]})}),SD=ve(function(t){let{keybindings:n,modelOptionsByInstance:o,instanceEntries:r,hideInstanceRail:a=!1,getModelDisabledReason:i,getModelContinuationLabel:s,onContinueInModel:l,onInstanceModelChange:d,onManagePlugins:c,onSelectPluginAction:f}=t,p=t.pluginActions??CD,m=t.selectedPluginActionKey??null,{t:g}=ye(),{t:h}=ye(),v=jt(),[y,x]=Q(""),[C,w]=Q(!1),[T,S]=Q(!1),L=N(null),k=N(null),I=N(null),P=v.environment.useActiveEnvironmentId(),E=v.settings.useClientSettings($=>$.favorites??[]),_=q(()=>P===null?s8:E.filter($=>$.environmentId===P),[P,E]),A=(o.get(t.activeInstanceId)??[]).some($=>$.slug===t.model&&$.isUnavailable===!0),[H,V]=Q(()=>t.lockedProvider!==null||A?t.activeInstanceId:_.length>0?"favorites":t.activeInstanceId),[J,D]=Q(()=>new Set),ne=q(()=>n??[],[n]),B=v.settings.useUpdateClientSettings(),U=R(()=>{L.current?.focus({preventScroll:!0})},[]),ee=R($=>{V($),window.requestAnimationFrame(()=>{U()})},[U]);Ce(()=>{U();let $=window.requestAnimationFrame(()=>{U()}),ae=window.setTimeout(()=>{U()},0);return()=>{window.cancelAnimationFrame($),window.clearTimeout(ae)}},[U]);let j=q(()=>new Set(_.map($=>yD($.instanceId,$.model))),[_]),Z=R($=>P===null?!1:_.some(ae=>bD($,ae,P)),[P,_]),de=q(()=>new Map(r.map($=>[$.instanceId,$])),[r]),F=R($=>t.lockedProvider===null?!0:$.driverKind!==t.lockedProvider?!1:t.lockedContinuationGroupKey?$.continuationGroupKey===t.lockedContinuationGroupKey:!0,[t.lockedContinuationGroupKey,t.lockedProvider]),X=q(()=>{let $=new Set;for(let ae of r)Mg(ae)&&$.add(ae.instanceId);return $},[r]),pe=q(()=>{let $=[];for(let[ae,ce]of o){let Le=de.get(ae);if(!Le)continue;let ze=X.has(ae);for(let ft of ce)pD({entry:Le,instanceReady:ze,instanceId:ae,option:ft,activeInstanceId:t.activeInstanceId,activeModel:t.model})&&$.push({slug:ft.slug,name:ft.name,...ft.shortName?{shortName:ft.shortName}:{},...ft.subProvider?{subProvider:ft.subProvider}:{},...ft.isUnavailable?{isUnavailable:!0}:{},instanceId:ae,driverKind:Le.driverKind,instanceDisplayName:Le.displayName,...Le.accentColor?{instanceAccentColor:Le.accentColor}:{},...Le.accountEmail?{instanceAccountEmail:Le.accountEmail}:{},...Le.continuationGroupKey?{continuationGroupKey:Le.continuationGroupKey}:{}})}return $},[o,de,X,t.activeInstanceId,t.model]),le=t.lockedProvider!==null,re=y.trim().length>0,we=q(()=>{if(!le)return;let $=new Set;for(let ae of r)F(ae)||$.add(ae.instanceId);return $},[r,le,F]),Xe=q(()=>{let $=r.filter(Hu);if(!le)return $;let ae=[],ce=[];for(let Le of $)F(Le)?ae.push(Le):ce.push(Le);return[...ae,...ce]},[r,le,F]),ot=!a&&!re&&Xe.length>0,at=q(()=>r.map($=>$.instanceId),[r]),je=q(()=>{let $=pe;if(y.trim()){let ae=$.map(ce=>({model:ce,score:gD({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:Z(ce)},y),isFavorite:Z(ce),tieBreaker:Tb({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 Le of ae)F(Le.model)&&ce.push(Le);return ce.toSorted((Le,ze)=>{let ft=Le.score-ze.score;return ft!==0?ft:Le.isFavorite!==ze.isFavorite?Le.isFavorite?-1:1:Le.tieBreaker.localeCompare(ze.tieBreaker)}).map(Le=>Le.model)}return ae.toSorted((ce,Le)=>{let ze=ce.score-Le.score;return ze!==0?ze:ce.isFavorite!==Le.isFavorite?ce.isFavorite?-1:1:ce.tieBreaker.localeCompare(Le.tieBreaker)}).map(ce=>ce.model)}return t.lockedProvider!==null?($=$.filter(ae=>F(ae)),H==="favorites"?$=$.filter(ae=>Z(ae)):$=$.filter(ae=>ae.instanceId===H)):H==="favorites"?$=$.filter(ae=>Z(ae)):$=$.filter(ae=>ae.instanceId===H),v.model.sortProviderModelItems($,{favoriteModelKeys:j,groupFavorites:H!=="favorites",instanceOrder:H==="favorites"?at:[]})},[j,pe,at,F,t.lockedProvider,y,H,Z]),oe=R(($,ae)=>v.model.resolvePickerRowAction({disabledReason:i?.($,ae)??null,continuationLabel:l?s?.($,ae)??null:null}),[s,i,l]),Te=R($=>oe($.instanceId,$.slug),[oe]),Y=q(()=>fD(je,$=>Te($).kind==="blocked"),[je,Te]),me=q(()=>Y.unavailable.length===0?null:{key:rD(H),models:Y.unavailable,isExpanded:J.has(H)},[J,Y,H]),ge=q(()=>[...Y.current,...me?.isExpanded?me.models:[]],[Y,me]),G=f!==void 0,Ye=q(()=>{if(!G)return CD;let $=y.trim();return $.length===0?p:p.map(ae=>({action:ae,score:hD(ae,$)})).filter(ae=>ae.score!==null).toSorted((ae,ce)=>ae.score-ce.score||ae.action.title.localeCompare(ce.action.title)).map(ae=>ae.action)},[y,p,G]),vt=G&&(!re||Ye.length>0),Mt=q(()=>vt?[...Ye.map($=>of($.id)),Nd]:i8,[vt,Ye]),Dt=q(()=>new Map(Ye.map($=>[of($.id),$])),[Ye]),Nt=Mt[0]??null,Ot=R($=>{D(ae=>{let ce=new Set(ae);return ce.has($)?ce.delete($):ce.add($),ce})},[]),At=R(($,ae)=>{let ce=oe(ae,$);if(ce.kind==="blocked")return;if(ce.kind==="continue"){l?.(ae,$);return}let Le=o.get(ae);if(!Le||!de.has(ae))return;let ze=v.model.resolveSelectableModel($,Le);ze&&d(ae,ze)},[de,o,l,d,oe]),xt=R($=>{let ae=aD($);if(ae){Ot(ae);return}if($===Nd){c?.();return}let ce=iD($);if(ce!==null){f?.(ce);return}let Le=ge.find(ft=>rf(ft)===$);if(!Le||Te(Le).kind==="blocked")return;let ze=Ib($);ze&&At(ze.slug,ze.instanceId)},[At,c,f,Ot,ge,Te]),_t=R($=>{if(P===null)return;let ae=E.findIndex(Le=>bD($,Le,P)),ce=[...E];ae>=0?ce.splice(ae,1):ce.push({environmentId:P,instanceId:$.instanceId,model:$.slug}),B({favorites:ce})},[P,E,B]),Xt=q(()=>{let $=new Map,ae=0;for(let ce of ge){if(oe(ce.instanceId,ce.slug).kind==="blocked")continue;let Le=v.keybindings.modelPickerJumpCommandForIndex(ae);if(!Le)return $;$.set(rf(ce),Le),ae+=1}return $},[oe,ge]),mn=q(()=>[...Xt.keys()],[Xt]),Hn=q(()=>[...pe.map($=>rf($)),...me?[me.key]:[],...G?[...p.map($=>of($.id)),Nd]:[]],[pe,p,G,me]),yt=q(()=>{let $=ge.map(ae=>rf(ae));return me&&$.splice(Y.current.length,0,me.key),Mt.length>0?[...$,...Mt]:$},[me,Y,Mt,ge]),qt=q(()=>new Map(ge.map($=>[rf($),$])),[ge]),an=R(()=>{let $=k.current?.getScrollableNode();if(!($ instanceof HTMLElement))return;let ae=Math.max(0,$.scrollHeight-$.clientHeight);w($.scrollTop>1),S(ae-$.scrollTop>1)},[]),kn=q(()=>({terminalFocus:!1,terminalOpen:t.terminalOpen,modelPickerOpen:!0}),[t.terminalOpen]),sn=q(()=>{if(Xt.size===0)return xD;let $={platform:navigator.platform,context:kn},ae=new Map;for(let[ce,Le]of Xt){let ze=v.keybindings.shortcutLabelForCommand(ne,Le,$);ze&&ae.set(ce,ze)}return ae.size>0?ae:xD},[ne,Xt,kn]),Cn=m===null?nf(t.activeInstanceId,t.model):of(m),$n=q(()=>({favoritesSet:j,modelJumpLabelByKey:sn,selectedItemKey:Cn}),[j,sn,Cn]);return v.pane.useKeydown($=>{if($.defaultPrevented||$.repeat)return;let ae=v.keybindings.resolveShortcutCommand($,ne,{platform:navigator.platform,context:kn}),ce=v.keybindings.modelPickerJumpIndexFromCommand(ae??"");if(ce===null)return;let Le=mn[ce];if(!Le)return;let ze=Ib(Le);ze&&($.preventDefault(),$.stopPropagation(),At(ze.slug,ze.instanceId))},{capture:!0}),Ce(()=>{w(!1),S(yt.length>5);let $=0,ae=window.requestAnimationFrame(()=>{an(),$=window.requestAnimationFrame(an)});return()=>{window.cancelAnimationFrame(ae),window.cancelAnimationFrame($)}},[yt,an]),u(MS,{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:[ot&&u(uD,{selectedInstanceId:H,onSelectInstance:ee,instanceEntries:Xe,showFavorites:!0,...we?{disabledInstanceIds:we,getDisabledInstanceTooltip:$=>h("instance.lockedToThread",{name:$.displayName})}:{}}),u(PS,{inline:!0,items:Hn,filteredItems:yt,filter:null,autoHighlight:!0,open:!0,virtualized:!0,value:Cn,onItemHighlighted:($,ae)=>{I.current=typeof $=="string"?$:null,ae.reason==="keyboard"&&ae.index>=0&&k.current?.scrollIndexIntoView?.({index:ae.index,animated:!1})},onValueChange:$=>{typeof $=="string"&&xt($)},children:b("div",{className:K("flex min-h-0 flex-1 flex-col overflow-hidden bg-muted/40",ot&&"border-l border-border/70"),children:[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(ES,{ref:L,className:"[&_input]:h-control-3 [&_input]:font-sans [&_input]:leading-control-3",inputClassName:"rounded-none bg-transparent text-sm",placeholder:g("modelPicker.searchPlaceholder"),showTrigger:!1,startAddon:u(ys,{className:"-translate-x-0.5 size-4 shrink-0 text-muted-foreground opacity-70"}),value:y,onChange:$=>x($.target.value),onKeyDown:$=>{if($.key==="Escape"){$.preventDefault(),$.stopPropagation(),t.onRequestClose?.();return}if($.key==="Enter"&&I.current){$.preventBaseUIHandler?.(),$.preventDefault(),$.stopPropagation(),xt(I.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(RS,{className:"size-full min-w-0 p-0 not-empty:p-0",children:u(oD,{ref:k,data:yt,extraData:$n,keyExtractor:$=>$,renderItem:({item:$,index:ae})=>{let ce=me?.key===$?{label:g("modelPicker.unavailableModels"),count:me.models.length,isExpanded:me.isExpanded}:null;if(ce)return b(Pl,{hideIndicator:!0,index:ae,value:$,"aria-expanded":ce.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:ce.label}),u("div",{className:"mt-1 text-xs font-normal leading-snug text-muted-foreground/70",children:g("modelPicker.modelCount",{count:ce.count})})]}),u(Ko,{className:K("size-4 transition-transform",ce.isExpanded&&"rotate-90")})]});let Le=Dt.get($);if(Le)return u(d8,{index:ae,itemKey:$,action:Le,showSectionHeader:$===Nt});if($===Nd)return u(c8,{index:ae,showSectionHeader:$===Nt});let ze=qt.get($);if(!ze)return null;let ft=Te(ze);return u(sD,{index:ae,model:ze,instanceId:ze.instanceId,driver:ze.driverKind,providerDisplayName:ze.instanceDisplayName,providerAccentColor:ze.instanceAccentColor,providerAccountEmail:ze.instanceAccountEmail,isFavorite:Z(ze),isSelected:$===Cn,showProvider:!0,preferShortName:!le,useTriggerLabel:!1,jumpLabel:sn.get($)??null,disabledReason:ft.kind==="blocked"?ft.reason:null,actionLabel:ft.kind==="continue"?ft.label:null,onToggleFavorite:()=>_t(ze)},$)},estimatedItemSize:52,drawDistance:480,recycleItems:!0,contentContainerClassName:"pl-2 pr-px",ItemSeparatorComponent:l8,onLayout:an,onScroll:an,className:K("scrollbar-gutter-stable h-full overflow-x-hidden overscroll-y-contain py-1.5 [&::-webkit-scrollbar-track]:my-2",vD({top:C,bottom:T}))})})}),u(AS,{className:"not-empty:py-6 empty:h-0 text-xs font-normal leading-snug",children:g("modelPicker.noModelsFound")})]})})]})})});function th(e){switch(e){case"probing":return{seatKey:"modelPicker.fetchingModels",blockKey:"composer.modelFetching",canChooseModel:!1};case"missing":return{seatKey:"modelPicker.chooseModel",blockKey:"composer.modelMissing",canChooseModel:!0};default:return null}}function ID(e){return e.submissionTarget==="provider-turn"&&e.status!=="known"}function u8(e){let t=e.unknownModelLabel?.trim();if(t)return t;let n=e.catalogOptions.find(o=>o.slug===e.model);return n?Md(n):e.model}var Lb=ve(function(t){let{t:n}=ye(),[o,r]=Q(!1),i=ea()&&(t.open??o),s=q(()=>t.instanceEntries.find(w=>w.instanceId===t.activeInstanceId)??null,[t.activeInstanceId,t.instanceEntries]),l=t.activeInstanceId,d=t.modelOptionsByInstance.get(l)??[],c=th(t.modelStatus??"known"),f=u8({model:t.model,catalogOptions:d,unknownModelLabel:c?n(c.seatKey):null}),p=c===null&&d.some(w=>w.slug===t.model&&w.isUnavailable===!0),m=w=>{t.onOpenChange?.(w),t.open===void 0&&r(w)};W(()=>{if(!i)return;let{documentElement:w,body:T}=document,S=w.style.overscrollBehavior,L=T.style.overflow,k=T.style.paddingRight,I=window.innerWidth-w.clientWidth;w.style.overscrollBehavior="contain",T.style.overflow="hidden",I>0&&(T.style.paddingRight=`${I}px`);let P=A=>A instanceof Element&&A.closest("[data-model-picker-content]"),E=A=>{P(A.target)||A.preventDefault()},_=A=>{P(A.target)||A.preventDefault()};return document.addEventListener("wheel",E,{capture:!0,passive:!1}),document.addEventListener("touchmove",_,{capture:!0,passive:!1}),()=>{document.removeEventListener("wheel",E,{capture:!0}),document.removeEventListener("touchmove",_,{capture:!0}),w.style.overscrollBehavior=S,T.style.overflow=L,T.style.paddingRight=k}},[i]);let g=(w,T)=>{t.disabled||(t.onInstanceModelChange(w,T),m(!1))},h=(w,T)=>{t.disabled||(t.onContinueInModel?.(w,T),m(!1))},v=w=>{t.disabled||(t.onSelectPluginAction?.(w),m(!1))},y=()=>{t.onManagePlugins?.(),m(!1)},x=t.selectedPluginActionKey==null?null:t.pluginActions?.find(w=>w.id===t.selectedPluginActionKey)??null,C=x?kb(x.description):null;return b(wi,{open:i,onOpenChange:w=>{if(t.disabled){m(!1);return}m(w)},children:[b(Ii,{render:u(Yo,{"aria-label":t.triggerAriaLabel,variant:t.triggerVariant??"ghost","data-chat-provider-model-picker":"true",className:K("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(ke,{children:[u(hs,{className:"size-4 shrink-0"}),b(Je,{children:[b(et,{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}),C?b("span",{className:"min-w-0 truncate text-muted-foreground/80",children:["\xB7 ",C]}):null]}),u(Ze,{side:"top",children:C?`${x.title} \xB7 ${C}`:x.title})]})]}):b(ke,{children:[t.showInstanceOnTrigger!==!1&&s?u(Sr,{driver:s.driverKind,displayName:s.displayName,accentColor:s.accentColor,className:K("size-4",t.activeProviderIconClassName),iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,b(Je,{children:[u(et,{render:u("span",{className:"min-w-0 flex-1 overflow-hidden truncate"}),children:f}),u(Ze,{side:"top",children:p?n("modelPicker.unavailableLabel",{name:f}):f})]}),p?u(ra,{variant:"outline",size:"sm",children:n("modelPicker.unavailableBadge")}):null]})}),u("span",{"aria-hidden":"true",className:"flex items-center",children:u(ga,{})})]}),u(Si,{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(SD,{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:()=>m(!1),...t.getModelDisabledReason?{getModelDisabledReason:t.getModelDisabledReason}:{},...t.getModelContinuationLabel?{getModelContinuationLabel:t.getModelContinuationLabel}:{},...t.onContinueInModel?{onContinueInModel:h}:{},onInstanceModelChange:g,...t.pluginActions?{pluginActions:t.pluginActions}:{},selectedPluginActionKey:t.selectedPluginActionKey??null,...t.onSelectPluginAction?{onSelectPluginAction:v}:{},...t.onManagePlugins?{onManagePlugins:y}:{}})})]})});function TD(e){let{slots:t,...n}=e,o=u(Lb,{...n,hideInstanceRail:!0,showInstanceOnTrigger:!1}),r=t?.renderSlot("conversation.input.model",n,o);return u("span",{"data-conversation-slot":"conversation.input.model",children:r??o})}function kD(e){return u(Lb,{...e,hideInstanceRail:!0,showInstanceOnTrigger:!1})}function Pb(e){let{t}=ye();if(!e.showInteractionModeToggle)return null;let n=e.interactionMode==="plan",o=t(n?"composer.planModeTooltip":"composer.defaultModeTooltip");return b(Je,{children:[b(et,{render:u(Yo,{"data-composer-plan-toggle":"true",className:K("shrink-0 whitespace-nowrap",n?"bg-accent text-accent-foreground hover:bg-accent/90":"text-secondary-label hover:text-foreground"),type:"button",onClick:e.onToggleInteractionMode,"aria-label":o}),children:[n?u(Jo,{icon:fc,className:"text-current opacity-100"}):u(Jo,{icon:is,opticalSize:"large"}),u("span",{className:"sr-only sm:not-sr-only",children:t(n?"composer.interactionModePlan":"composer.interactionModeBuild")})]}),u(Ze,{side:"top",children:o})]})}function LD(e){return u(Pb,{...e})}he();var Kr=["approval-required","auto-accept-edits","auto","full-access"];var f8={"approval-required":dc,"auto-accept-edits":na,auto:bi,"full-access":xi},p8={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function nh(){let{t:e}=ye();return R(t=>{let n=p8[t];return{mode:t,label:e(`runtimeMode.${n}`),description:e(`runtimeMode.${n}Description`),icon:f8[t]}},[e])}he();function PD(e){return e.description??e.name}var AD=ve(function(t){let{t:n}=ye(),{current:o,modes:r}=t.nativeMode,a=PD(o);return!t.canSwitch||r.length<2?b(Je,{children:[b(et,{render:u(Yo,{className:"shrink-0 cursor-default whitespace-nowrap font-medium",type:"button",disabled:!0,"data-composer-native-mode":o.id,"aria-label":n("composer.agentModeLabel",{name:o.name})}),children:[u(Jo,{icon:Il}),u("span",{children:o.name})]}),b(Ze,{side:"top",children:[u("span",{className:"block font-medium",children:a}),r.length>1?u("span",{className:"mt-1 block text-muted-foreground text-xs",children:n("composer.agentModesList",{modes:r.map(i=>i.name).join(", ")})}):null]})]}):b(ke,{children:[b(Je,{children:[b(Bf,{value:o.id,onValueChange:i=>t.onNativeModeChange(i),children:[b(et,{render:u(Ng,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":o.id,"aria-label":n("composer.agentModeLabel",{name:o.name})}),children:[u(Jo,{icon:Il}),u(Hf,{children:o.name})]}),b(Uf,{alignItemWithTrigger:!1,children:[r.map(i=>u(zf,{value:i.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:i.name}),i.description?u("span",{className:"text-muted-foreground text-xs leading-4",children:i.description}):null]})},i.id)),t.appliesNextTurn?u("div",{className:"border-t px-2 py-1.5 text-muted-foreground text-xs leading-4","data-composer-next-turn-note":"popup",children:n("runtimeMode.appliesNextTurnHint")}):null]})]}),u(Ze,{side:"top",children:t.appliesNextTurn?`${a} ${n("runtimeMode.appliesNextTurnHint")}`:a})]}),t.appliesNextTurn?u("span",{className:"hidden whitespace-nowrap text-muted-foreground text-xs sm:inline","data-composer-next-turn-note":"inline",children:n("runtimeMode.appliesNextTurn")}):null]})});function Ab(e){let{t}=ye(),n=nh();if(e.nativeMode)return u(AD,{nativeMode:e.nativeMode,canSwitch:e.canSwitchNativeMode,appliesNextTurn:e.runtimeModeSwitch==="next-turn",onNativeModeChange:e.onNativeModeChange});let o=n(e.runtimeMode),r=o.icon,a=e.runtimeModeSwitch==="next-turn";return b(ke,{children:[b(Je,{children:[b(Bf,{value:e.runtimeMode,onValueChange:i=>e.onRuntimeModeChange(i),children:[b(et,{render:u(Ng,{"data-composer-permission":"true","data-composer-runtime-mode-switch":e.runtimeModeSwitch,className:"font-medium","aria-label":t("composer.runtimeMode")}),children:[u(Jo,{icon:r}),u(Hf,{children:o.label})]}),b(Uf,{alignItemWithTrigger:!1,children:[Kr.map(i=>{let s=n(i),l=s.icon;return u(zf,{value:i,hideIndicator:!0,className:"min-w-64 py-2",children:b("span",{className:"flex items-center gap-2",children:[u(l,{className:"size-4"}),s.label]})},i)}),a?u("div",{className:"border-t px-2 py-1.5 text-muted-foreground text-xs leading-4","data-composer-next-turn-note":"popup",children:t("runtimeMode.appliesNextTurnHint")}):null]})]}),u(Ze,{side:"top",children:a?t("runtimeMode.appliesNextTurnHint"):o.label})]}),a?u("span",{className:"hidden whitespace-nowrap text-muted-foreground text-xs sm:inline","data-composer-next-turn-note":"inline",children:t("runtimeMode.appliesNextTurn")}):null]})}function ED(e){return u(Ab,{...e})}function af(e){let t=e.slots?.renderSlot(e.name,e.owner??{},e.fallback);return u("span",{"data-conversation-slot":e.name,children:t??e.fallback})}he();var RD=ve(function(t){let{t:n}=ye(),o=nh();return b(_o,{children:[u(Oo,{render:u(ie,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground/70 hover:text-foreground/80","aria-label":n("composer.moreComposerControls")}),children:u(ir,{"aria-hidden":"true",className:"size-4"})}),b(Do,{align:"start",children:[t.traitsMenuContent?b(ke,{children:[t.traitsMenuContent,u(_a,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?b(ke,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.modeMenuTitle")}),b(Ir,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[u(Vo,{value:"default",children:n("composer.interactionModeChat")}),u(Vo,{value:"plan",children:n("composer.interactionModePlan")})]}),u(_a,{})]}):null,t.nativeMode===null?b(ke,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.accessMenuTitle")}),u(Ir,{value:t.runtimeMode,onValueChange:r=>{!r||r===t.runtimeMode||t.onRuntimeModeChange(r)},children:Kr.map(r=>u(Vo,{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(ke,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.accessMenuTitle")}),t.canSwitchNativeMode&&t.nativeMode.modes.length>1?b(ke,{children:[u(Ir,{value:t.nativeMode.current.id,onValueChange:r=>{t.onNativeModeChange(String(r))},children:t.nativeMode.modes.map(r=>u(Vo,{value:r.id,children:r.name},r.id))}),t.runtimeModeSwitch==="next-turn"?u("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]}):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})]})]})]})});he();var MD="application/x-ycodium-composer-mention";function Eb(e){return e.includes(MD)}function ND(e){let t=n=>Eb(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(MD);o.length!==0&&(e.insertMentionAtEnd(`${o} `)||e.onInsertRejected())}}}function _D({documentKey:e,insertMentionAtEnd:t,onInsertRejected:n}){let[o,r]=Q(!1),a=ND({insertMentionAtEnd:t,setDragActive:r,onInsertRejected:n}),i=s=>{if(!Eb(s.dataTransfer.types))return;s.stopPropagation();let l=s.relatedTarget;l instanceof Node&&s.currentTarget.contains(l)||r(!1)};return Ce(()=>{r(!1)},[e]),W(()=>{if(!o)return;let s=()=>{r(!1)};return window.addEventListener("dragend",s),()=>window.removeEventListener("dragend",s)},[o]),{isDragOverComposer:o,composerMentionDragHandlers:a,onComposerMentionDragLeaveCapture:i}}he();function DD({promptRef:e,maxInputChars:t,noProviderAvailable:n,isSendDisabled:o,sendDisabledReason:r,isModelSendBlocked:a,onModelSendBlocked:i,activeThreadId:s,activePendingProgress:l,composerDocumentKey:d,pendingImageCompressionsRef:c,onSend:f,onProviderInputRejectedReset:p,wasProviderInputRejected:m,onStillCompressing:g,shouldBlurMobileComposerOnSubmit:h,blurMobileComposerAfterSend:v}){let{t:y}=ye(),[x,C]=Q(null);W(()=>C(null),[d]);let w=R(S=>{C(L=>L===null?L:Uu(S,t,y))},[t,y]),T=R((S,L="foreground")=>{if(n||o){S?.preventDefault();return}if(a){S?.preventDefault(),i();return}if(s&&(c.current.get(d)??0)>0){S?.preventDefault(),g();return}let k=xM({prompt:e.current,submissionTarget:l?"pending-user-input":"provider-turn",maxInputChars:t,t:y,disabledReason:r,event:S,onSend:I=>(p(),f(I,L),!m())});C(k.validationMessage),k.didDispatch&&h()&&v()},[l,s,v,d,a,o,t,n,i,p,f,g,c,e,r,h,y,m]);return{composerSubmissionError:x,setComposerSubmissionError:C,revalidatePromptLength:w,submitComposer:T}}he();var m8=(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"),g8=e=>{e.preventDefault()},sf=ve(function({compact:t,pendingAction:n,isRunning:o,showPlanFollowUpPrompt:r,promptHasText:a,isSendBusy:i,sendDisabledReason:s,isEnvironmentUnavailable:l,isPreparingWorktree:d,hasSendableContent:c,preserveComposerFocusOnPointerDown:f=!1,showSendWhileRunning:p=!1,onPreviousPendingQuestion:m,onInterrupt:g,interruptArmed:h=!1,onImplementPlanInNewThread:v,shellCommandMode:y=!1,shellCommandUnavailableReason:x=null}){let{t:C}=ye(),w=jt(),T=f?{onPointerDown:g8}:void 0,S=w.settings.useEnvironmentIdentificationMode(),L=s!==null,k=w.devBackdrop.useVisible(S==="artwork"),I=E=>u("button",{type:"button",className:K("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",h?"h-8 px-3 text-xs font-medium whitespace-nowrap ring-2 ring-destructive/60":E?"size-8 sm:size-7":p&&c?"size-9 sm:size-8":"size-8 sm:h-8 sm:w-8"),...T,onClick:g,"data-interrupt-armed":h?"":void 0,"aria-label":C(h?"primaryActions.confirmStopEsc":"primaryActions.stopGeneration"),children:h?C("primaryActions.confirmStopEsc"):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:K("flex items-center justify-end",t?"gap-1.5":"gap-2"),children:[o?I(!0):null,n.questionIndex>0?t?u(ie,{size:"icon-sm",variant:"outline",className:"rounded-full",...T,onClick:m,disabled:n.isResponding,"aria-label":C("primaryActions.previousQuestion"),children:u(ss,{})}):u(ie,{size:"sm",variant:"outline",className:"rounded-full",...T,onClick:m,disabled:n.isResponding,children:C("primaryActions.previous")}):null,u(ie,{type:"submit",size:"sm",className:K("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"px-3":"px-4"),...T,disabled:l||n.isResponding||(n.isLastQuestion?!n.isComplete:!n.canAdvance),children:m8(C,{compact:t,isLastQuestion:n.isLastQuestion,isResponding:n.isResponding,questionIndex:n.questionIndex})})]});if(y){let E=u("button",{type:"submit","data-shell-command-run":"true",className:"flex h-9 w-9 items-center justify-center rounded-full bg-message-action text-message-action-foreground shadow-xs shadow-message-action/24 transition-[background-color,opacity,scale] duration-(--control-duration) enabled:cursor-pointer enabled:inset-shadow-[0_1px_--theme(--color-white/16%)] hover:scale-105 hover:bg-message-action-hover 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",...T,disabled:x!==null||!c,"aria-label":x??C("primaryActions.runInTerminal"),children:u(qo,{"aria-hidden":"true",className:"size-4"})});return o?b(ke,{children:[I(!1),E]}):E}if(r)return a?u(ie,{type:"submit",size:"sm",className:K("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"),...T,disabled:i||L||l,children:C(i?"primaryActions.sendingButtonLabel":"primaryActions.refine")}):b("div",{"data-chat-composer-implement-actions":"true",className:"flex items-center justify-end",children:[u(ie,{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",...T,disabled:i||L||l,children:C(i?"primaryActions.sendingButtonLabel":"primaryActions.implement")}),b(_o,{children:[u(Oo,{render:u(ie,{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":C("primaryActions.implementationActions"),...T,disabled:i||L||l}),children:u(rn,{})}),u(Do,{align:"end",side:"top",children:u(sr,{disabled:i||L||l,onClick:()=>{v()},children:C("primaryActions.implementInNewThread")})})]})]});let P=b("button",{type:"submit",className:K("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",k?"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"),...T,disabled:i||L||l||!c,"aria-label":l?C("primaryActions.environmentDisconnected"):s||C(d?"primaryActions.preparingWorktree":i?"primaryActions.sendingAriaLabel":"primaryActions.sendMessage"),children:[k?u("span",{className:"absolute inset-0 -z-10","aria-hidden":"true",children:u(_S,{compact:!0})}):null,i?u(Ff,{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(ke,{children:[I(!1),p&&c?P:null]}):P});function OD(e){let{t}=ye(),n=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:K("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",!n&&"p-0"),children:[e.isPendingUserInputChoiceOnly?null:u("button",{type:"button",className:K("min-w-0 flex-1 truncate bg-transparent py-1.5 text-left text-sm",e.activePendingProgress?.customAnswer?"text-foreground":"text-placeholder",!n&&"px-3 py-2"),onPointerDown:o=>o.preventDefault(),onClick:e.expandMobileComposer,"aria-label":t("composer.writeCustomAnswer"),children:e.activePendingProgress?.customAnswer||t("composer.writeCustomAnswer")}),e.inlineTasksBadge,e.inlineStashBadge,n?u(sf,{compact:!0,pendingAction:e.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:e.isSendBusy,sendDisabledReason:e.sendDisabledReason,isEnvironmentUnavailable:e.isEnvironmentUnavailable,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:e.onPreviousActivePendingUserInputQuestion,onInterrupt:e.handleInterruptPrimaryAction,onImplementPlanInNewThread:e.handleImplementPlanInNewThreadPrimaryAction}):null]})})}function FD(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}he();var h8=2e3,v8="min-h-8 max-w-full py-1.5 font-normal whitespace-normal text-start",y8=e=>[{decision:"cancel",label:e("composer.cancel")},{decision:"decline",label:e("composer.decline")},{decision:"acceptForSession",label:e("composer.alwaysAllowSession")},{decision:"accept",label:e("composer.approve")}];function x8(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 BD=ve(function({requestId:t,isResponding:n,options:o,keybindings:r,declineReasonRelay:a,onRespondToApproval:i}){let{t:s}=ye(),l=o??y8(s),d=jt(),c=a==="native"||a==="queued",[f,p]=Q(""),m=N([]);W(()=>{p("")},[t]);let g=R(v=>{let y=v==="decline"?f.trim():"";i(t,v,y.length>0?y:void 0)},[f,i,t]),h=R(v=>{let y=m.current.filter(w=>w!==null);if(y.length===0)return;let x=y.findIndex(w=>w===document.activeElement),C=x===-1?v===1?0:y.length-1:(x+v+y.length)%y.length;y[C]?.focus()},[]);return d.pane.useKeydown(v=>{if(n||d.terminalFocus.getOwner()!==null||v.isComposing||v.keyCode===229)return;let y=ki(v.target);if(r&&(!y||v.metaKey||v.ctrlKey||v.altKey)){let w=d.keybindings.approvalDecisionFromCommand(d.keybindings.resolveShortcutCommand(v,r));if(w!==null&&l.some(T=>T.decision===w)){v.preventDefault(),g(w);return}}if(y)return;let x=QS(v,l);if(x===null)return;if(v.preventDefault(),x.type==="move"){h(x.delta);return}let C=l[x.index];C&&g(C.decision)},{target:"document"}),u(ke,{children:l.map((v,y)=>{let x=y<9?y+1:null,C=b(ie,{ref:w=>{m.current[y]=w},size:"xs",variant:v.decision==="accept"?"default":"outline",style:{height:"auto"},"aria-keyshortcuts":x8(v.decision,y),className:`${v8}${v.decision==="decline"?" text-destructive-foreground [:hover,[data-pressed]]:text-destructive-foreground":""}`,disabled:n,onClick:()=>g(v.decision),children:[u("span",{className:"min-w-0 break-words",children:v.label}),x===null?null:u(Xf,{className:"h-3.5 min-w-3.5 rounded-[3px] bg-transparent px-0 text-[10px] tabular-nums opacity-70",children:x})]},v.decision);return v.decision!=="decline"||!c?C:b(mi,{children:[u(kl,{type:"text",value:f,disabled:n,maxLength:h8,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:w=>p(w.target.value),onKeyDown:w=>{if(w.key==="Enter"){w.preventDefault(),g("decline");return}w.key==="Escape"&&(w.preventDefault(),f.length>0?p(""):w.currentTarget.blur())}}),C]},v.decision)})})});he();var C8=["command","cmd"],b8=["file_path","filePath","path","notebook_path","notebookPath"],w8=["url"],S8=["query","q"],I8=["name","skill","skill_name","skillName"],zD=["toolName","tool_name"],UD=["description"],T8=[],k8=[];function ri(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 L8(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t>=0?e.slice(t+1):e;return n.length>0?n:e}function P8(e){let t=e[0];return t===void 0?null:e.every(n=>n.path===t.path)?t.path:null}function $D(e){let t=e.args??T8,n=e.fileChanges??k8,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=ri(t,C8,o);d!==null&&(s={shape:"command",command:d});break}case"file-read":case"file-change":{let d=ri(t,b8,o)??P8(n);d!==null&&(i=L8(d),s=n.some(c=>c.path===d)?{shape:"none"}:{shape:"path",path:d});break}case"web-fetch":{let d=ri(t,w8,o);d!==null&&(s={shape:"url",url:d});break}case"web-search":{let d=ri(t,S8,o);d!==null&&(s={shape:"query",query:d});break}case"skill":{i=ri(t,I8,o)??ri(t,zD,o),l=ri(t,UD,o),t.length>0&&(s={shape:"none"});break}case"mcp-tool":case"tool":{i=ri(t,zD,o),l=ri(t,UD,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 A8={"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"},E8={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"},R8={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"},M8={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function KD(e,t){let n=e.subject!==null?A8[e.kind]:void 0;return n!==void 0?t(n,{name:e.subject}):t(E8[e.kind])}function qD(e,t){return t(R8[e])}function VD(e,t){return t(M8[e])}function WD(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=HD(t.oldText??""),o=HD(t.newText);if(n.length===0&&o.length===0)return null;let r=`--- a/${e.path}
3847
+ `);for(let h=0;h<g.length;h+=1){let v=g[h]??"";v.length>0&&d.push(_r(v)),h<g.length-1&&d.push(Ks())}},f=s[0];if(f?.isMention&&f.start===0){let m=l.isBackward()?l.focus:l.anchor,g=t.getExpandedAbsoluteOffsetForPoint(m.getNode(),m.offset),h=Rt().getTextContent().slice(g-1,g);h.length>0&&!/\s/.test(h)&&d.push(_r(" "))}let p=0;for(let m of s)m.start<p||(m.start>p&&c(o.slice(p,m.start)),d.push(m.create()),p=m.end);return p<o.length?c(o.slice(p)):s.at(-1)?.isMention&&d.push(_r(" ")),l.insertNodes(d),n.preventDefault(),!0},pr)}var wd=new Map,PV=32;function iM(e,t){for(wd.delete(e),wd.set(e,t);wd.size>PV;){let n=wd.keys().next().value;if(n===void 0)break;wd.delete(n)}}function AV(e){return{anchor:e.length,focus:e.length}}function Xa(e,t,n){let o=wd.get(e);if(o)return iM(e,o),o;let r={cursor:n?.cursor??t.length,expandedCursor:n?.expandedCursor??t.length,selection:n?{anchor:n.cursor,focus:n.cursor}:AV(t),history:nR()};return iM(e,r),r}function Sd(e,t,n){let o=Xa(e,t);o.cursor=n.cursor,o.expandedCursor=n.expandedCursor,o.selection=n.selection}function sM(e,t,n,o){let r=Xa(e,t);r.cursor=n,r.expandedCursor=o}function lM(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 EV=`composer-editor-${Math.random().toString(36).slice(2)}`,RV=[["(",")"],["[","]"],["{","}"],["'","'"],['"','"'],["\u201C","\u201D"],["`","`"],["<",">"],["\xAB","\xBB"],["*","*"],["_","_"]],mM=new Map(RV),dM=mM.get("`")??null,gM=bt({onRemoveTerminalContext:()=>{}});function MV(e){let t=OV(),n=u("span",{className:JR,contentEditable:!1,spellCheck:!1,"data-composer-mention-chip":"true",children:u(ZR,{path:e.path,label:gC(e.path),theme:t})});return b(Je,{children:[u(et,{render:n}),u(Ze,{side:"top",className:"max-w-120 whitespace-normal leading-tight wrap-anywhere",children:e.path})]})}var Du=class e extends Or{__path;__source;static getType(){return"composer-mention"}static clone(t){return new e(t.__path,t.__source,t.__key)}static importJSON(t){return xC(t.path,t.source).updateFromJSON(t)}constructor(t,n=Eu(t),o){super(o),this.__path=t,this.__source=n}exportJSON(){return{...super.exportJSON(),path:this.__path,source:this.__source,type:"composer-mention",version:1}}createDOM(){let t=document.createElement("span");return t.className=bd,t}updateDOM(){return!1}getTextContent(){return this.__source}isInline(){return!0}decorate(){return u(MV,{path:this.__path})}};function xC(e,t){return cd(new Du(e,t))}function NV(e){let t=e.shortDescription?.trim();return t||e.description?.trim()||null}function Ou(e){return new Map(e.map(t=>[t.name,{label:ma(t),description:NV(t)}]))}function _V(e){let t=b("span",{className:jR,contentEditable:!1,spellCheck:!1,"data-composer-skill-chip":"true",children:[u("span",{"aria-hidden":"true",className:gr,dangerouslySetInnerHTML:{__html:QR}}),u("span",{className:hr,children:e.skillLabel})]});return e.skillDescription?b(Je,{children:[u(et,{render:t}),u(Ze,{side:"top",className:"max-w-120 whitespace-normal leading-tight",children:e.skillDescription})]}):t}var Fu=class e extends Or{__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 hM(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=bd,t}updateDOM(){return!1}getTextContent(){return`$${this.__skillName}`}isInline(){return!0}decorate(){return u(_V,{skillLabel:this.__skillLabel,skillDescription:this.__skillDescription})}};function hM(e,t,n){return cd(new Fu(e,t,n))}function DV(e){return u(tM,{context:e.context})}var Js=class e extends Or{__context;static getType(){return"composer-terminal-context"}static clone(t){return new e(t.__context,t.__key)}static importJSON(t){return vM(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=bd,t}updateDOM(){return!1}getTextContent(){return"\uFFFC"}isInline(){return!0}decorate(){return u(DV,{context:this.__context})}};function vM(e){return cd(new Js(e))}function Ya(e){return e instanceof Du||e instanceof Fu||e instanceof Js||e instanceof Xi}function OV(){return document.documentElement.classList.contains("dark")?"dark":"light"}function FV(e){return e.map(t=>[t.id,t.threadId,t.terminalId,t.terminalLabel,t.lineStart,t.lineEnd,t.createdAt,t.text].join("")).join("")}function BV(e){return e.map(t=>[t.name,t.displayName??"",t.shortDescription??"",t.description??"",t.path,t.scope??"",t.enabled?"1":"0"].join("")).join("")}function hg(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.floor(t))):e.length}function yg(e){return e instanceof Xi?e.getTextContentSize():1}function yM(e){return e.getTextContentSize()}function zV(e,t,n){return t+(n>0?yg(e):0)}function UV(e,t,n){return t+(n>0?yM(e):0)}function HV(e,t){let n=e.getParent();if(!n||!We(n))return null;let o=e.getIndexWithinParent();return t.value===0?{key:n.getKey(),offset:o,type:"element"}:t.value===yg(e)?{key:n.getKey(),offset:o+1,type:"element"}:(t.value-=yg(e),null)}function xg(e){return Ya(e)?yg(e):dt(e)?e.getTextContentSize():md(e)?1:We(e)?e.getChildren().reduce((t,n)=>t+xg(n),0):0}function vC(e){return Ya(e)?yM(e):dt(e)?e.getTextContentSize():md(e)?1:We(e)?e.getChildren().reduce((t,n)=>t+vC(n),0):0}function Bu(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!We(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=xg(l))}o=r}if(dt(e))return n+Math.min(t,e.getTextContentSize());if(Ya(e))return zV(e,n,t);if(md(e))return n+Math.min(t,1);if(We(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+=xg(s))}return n}return n}function Cg(e,t){let n=0,o=e;for(;o;){let r=o.getParent();if(!r||!We(r))break;let a=r.getChildren(),i=o.getIndexWithinParent();for(let s=0;s<i;s+=1){let l=a[s];l&&(n+=vC(l))}o=r}if(dt(e))return n+Math.min(t,e.getTextContentSize());if(Ya(e))return UV(e,n,t);if(md(e))return n+Math.min(t,1);if(We(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+=vC(s))}return n}return n}function bg(e,t){if(Ya(e))return HV(e,t);if(dt(e)){let n=e.getTextContentSize();return t.value<=n?{key:e.getKey(),offset:t.value,type:"text"}:(t.value-=n,null)}if(md(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(We(e)){let n=e.getChildren();for(let o of n){let r=bg(o,t);if(r)return r}if(t.value===0)return{key:e.getKey(),offset:n.length,type:"element"}}return null}function wg(){return Rt().getChildren().reduce((n,o)=>n+xg(o),0)}function Zs(e){let t=Rt(),n=wg(),r={value:Math.max(0,Math.min(e,n))},a=bg(t,r)??{key:t.getKey(),offset:t.getChildren().length,type:"element"},i=qs();i.anchor.set(a.key,a.offset,a.type),i.focus.set(a.key,a.offset,a.type),Dr(i)}function vg(e,t){let n=Rt(),o=wg(),r=Math.max(0,Math.min(e,o)),a=Math.max(0,Math.min(t,o)),i={value:r},s={value:a},l=bg(n,i)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},d=bg(n,s)??{key:n.getKey(),offset:n.getChildren().length,type:"element"},c=qs();c.anchor.set(l.key,l.offset,l.type),c.focus.set(d.key,d.offset,d.type),Dr(c)}function cM(e){if(!Ne(e))return null;let t=e.anchor.getNode(),n=e.focus.getNode(),o=Cg(t,e.anchor.offset),r=Cg(n,e.focus.offset);return{start:Math.min(o,r),end:Math.max(o,r)}}function uM(e){return Ne(e)?e.getNodes().some(t=>Ya(t)):!1}function zu(e){let t=$e();if(!Ne(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=Bu(n,t.anchor.offset),r=wg();return Math.max(0,Math.min(o,r))}function fM(e){let t=$e();if(!Ne(t)||!t.isCollapsed())return e;let n=t.anchor.getNode(),o=Cg(n,t.anchor.offset),r=Rt().getTextContent().length;return Math.max(0,Math.min(o,r))}function hC(e){let t=$e();return Ne(t)?{anchor:Bu(t.anchor.getNode(),t.anchor.offset),focus:Bu(t.focus.getNode(),t.focus.offset)}:e}function pM(e,t){let n=t.split(`
3848
+ `);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(Ks())}}function $V(e,t,n){let o=0;for(let r of n?.collect(t)??[])pM(e,t.slice(o,r.start)),e.append(_u(r.quote,r.source)),o=r.end;pM(e,t.slice(o))}function CC(e,t,n,o){let r=Rt();r.clear();let a=fr();r.append(a);let i=Ys(e,t);for(let s of i){if(s.type==="mention"){a.append(xC(s.path,s.source));continue}if(s.type==="skill"){let l=n.get(s.name);a.append(hM(s.name,l?.label??ma({name:s.name}),l?.description??null));continue}if(s.type==="terminal-context"){s.context&&a.append(vM(s.context));continue}$V(a,s.text,o)}}function yC(e){return e instanceof Js?[e.__context.id]:We(e)?e.getChildren().flatMap(t=>yC(t)):[]}function KV(){let[e]=fn();return W(()=>{let t=r=>{if(r.inputType!=="insertText"||!r.data||r.isComposing)return;let a=r.data;e.getEditorState().read(()=>{let s=$e();if(!Ne(s)||!s.isCollapsed()||s.anchor.type!=="element")return!1;let l=s.anchor.getNode();return We(l)&&Ya(l.getChildAtIndex(s.anchor.offset))})&&(r.preventDefault(),r.stopImmediatePropagation(),e.update(()=>{let s=$e();Ne(s)&&s.insertText(a)},{discrete:!0}))},n=null,o=e.registerRootListener((r,a)=>{a?.removeEventListener("beforeinput",t,!0),r?.addEventListener("beforeinput",t,!0),n=r});return()=>{n?.removeEventListener("beforeinput",t,!0),o()}},[e]),null}function qV(e){let[t]=fn();return W(()=>{let n=(l,d)=>{if(!e.onCommandKeyDown||!d)return!1;if(l==="Enter"&&(d.isComposing||d.keyCode===229))return d.stopPropagation(),!0;let c=e.onCommandKeyDown(l,d);return c&&(d.preventDefault(),d.stopPropagation()),c},o=t.registerCommand(lA,l=>n("ArrowDown",l),pr),r=t.registerCommand(dA,l=>n("ArrowUp",l),pr),a=t.registerCommand(zm,l=>n("Enter",l),pr),i=t.registerCommand(Um,l=>n("Tab",l),pr),s=t.registerCommand(fA,l=>n("Escape",l),pr);return()=>{o(),r(),a(),i(),s()}},[t,e]),null}function VV(){let[e]=fn();return W(()=>{let t=e.registerCommand(Om,o=>{let r=null;if(e.getEditorState().read(()=>{let i=$e();if(!Ne(i)||!i.isCollapsed())return;let s=zu(0);if(s<=0)return;let l=Rt().getTextContent();Mu(l,s,"left")&&(r=s-1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{Zs(a)}),!0},pr),n=e.registerCommand(Fm,o=>{let r=null;if(e.getEditorState().read(()=>{let i=$e();if(!Ne(i)||!i.isCollapsed())return;let s=zu(0),l=wg();if(s>=l)return;let d=Rt().getTextContent();Mu(d,s,"right")&&(r=s+1)}),r===null)return!1;let a=r;return o?.preventDefault(),o?.stopPropagation(),e.update(()=>{Zs(a)}),!0},pr);return()=>{t(),n()}},[e]),null}function WV(){let[e]=fn();return W(()=>e.registerCommand(uA,t=>{if(!KR(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(kP(o,e))}),!0)},pr),[e]),null}function GV(){let[e]=fn();return W(()=>e.registerUpdateListener(({editorState:t})=>{let n=null;t.read(()=>{let o=$e();if(!Ne(o)||!o.isCollapsed())return;let r=o.anchor.getNode();if(!Ya(r)||o.anchor.offset===0)return;n=Bu(r,0)+1}),n!==null&&queueMicrotask(()=>{e.update(()=>{Zs(n)})})}),[e]),null}function jV(){let[e]=fn(),{onRemoveTerminalContext:t}=wt(gM);return W(()=>e.registerCommand(Bm,n=>{let o=$e();if(!Ne(o)||!o.isCollapsed())return!1;let r=o.anchor.getNode(),a=zu(0),i=s=>{if(!Ya(s))return!1;let l=Bu(s,0);return s.remove(),s instanceof Js?(t(s.__context.id),Zs(a)):Zs(l),n?.preventDefault(),!0};if(i(r))return!0;if(dt(r)){if(o.anchor.offset>0)return!1;if(i(r.getPreviousSibling()))return!0;let s=r.getParent();if(We(s)){let l=r.getIndexWithinParent();if(l>0&&i(s.getChildAtIndex(l-1)))return!0}return!1}if(We(r)){let s=o.anchor.offset-1;if(s>=0&&i(r.getChildAtIndex(s)))return!0}return!1},pr),[e,t]),null}function QV(){let[e]=fn();return W(()=>{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(Ne(d)&&!d.isCollapsed())for(let c of d.getNodes())c instanceof Or&&l.add(c.getKey())}),l},a=e.registerUpdateListener(()=>{o(n?r():new Set)}),i=e.registerCommand(oA,()=>(n=!0,o(r()),!1),gd),s=e.registerCommand(WP,()=>(n=!1,o(new Set),!1),gd);return()=>{a(),i(),s()}},[e]),null}function XV(){let[e]=fn(),t=N(null);return t.current=Oa()?.data.assistantQuotes??null,W(()=>aM(e,{createMentionNode:xC,getExpandedAbsoluteOffsetForPoint:Cg,readQuotes:()=>{let n=t.current;return n===null?null:{collect:o=>n.collect(o),createNode:o=>_u(o.quote,o.source)}}}),[e]),null}function YV(e){let[t]=fn(),n=N(e.terminalContexts),o=N(Ou(e.skills)),r=N(null);r.current=Oa()?.data.assistantQuotes??null;let a=N(null),i=N(null);W(()=>{n.current=e.terminalContexts},[e.terminalContexts]),W(()=>{o.current=Ou(e.skills)},[e.skills]);let s=Mh(l=>{let d=mM.get(l),c=a.current;if(!d)return a.current=null,!1;let f=!1;return t.update(()=>{let p=c??(()=>{let v=$e();if(!Ne(v)||v.isCollapsed()||uM(v))return null;let y=cM(v);if(!y||y.start===y.end)return null;let x=Rt().getTextContent();return pC(x,y.start,y.end)?null:{value:x,expandedStart:y.start,expandedEnd:y.end}})();if(!p||!d)return;let m=p.value.slice(p.expandedStart,p.expandedEnd),g=`${p.value.slice(0,p.expandedStart)}${l}${m}${d}${p.value.slice(p.expandedEnd)}`;CC(g,n.current,o.current,r.current);let h=Po(g,p.expandedStart);vg(h+l.length,h+l.length+m.length),f=!0,a.current=null}),f});return W(()=>{let l=h=>{if(i.current){if(h.key==="Dead"||h.key===" "||h.code==="Space")return;i.current=null}if(h.defaultPrevented||h.isComposing||h.metaKey||h.ctrlKey){a.current=null,i.current=null;return}t.getEditorState().read(()=>{let v=$e();if(!Ne(v)||v.isCollapsed()){a.current=null,i.current=null;return}if(uM(v)){a.current=null,i.current=null;return}let y=cM(v);if(!y||y.start===y.end){a.current=null,i.current=null;return}let x=Rt().getTextContent();if(pC(x,y.start,y.end)){a.current=null,i.current=null;return}let C={value:x,expandedStart:y.start,expandedEnd:y.end};a.current=C,i.current=null})},d=h=>{if(h.inputType==="insertCompositionText"&&h.data==="`"&&dM!==null&&a.current){i.current=a.current;return}if(i.current||h.inputType==="insertCompositionText")return;if(typeof h.data!="string"){a.current=null;return}let v=h.inputType==="insertText"?h.data:null;if(!v||v.length!==1){a.current=null;return}s(v)&&(h.preventDefault(),h.stopPropagation(),h.stopImmediatePropagation())},c=h=>{queueMicrotask(()=>{t.update(()=>{let v=i.current;if(!v)return;let y=Rt().getTextContent(),x=dM;if(x===null){i.current=null;return}let C=`${v.value.slice(0,v.expandedStart)}\`${v.value.slice(v.expandedEnd)}`;if(y!==C){h?.finalAttempt&&(a.current=null,i.current=null);return}let w=v.value.slice(v.expandedStart,v.expandedEnd),T=Po(y,v.expandedStart);vg(T,T+1);let S=$e();if(!Ne(S)){a.current=null,i.current=null;return}S.insertText(`\`${w}${x}`),vg(T+1,T+1+w.length),a.current=null,i.current=null},{tag:Qo})})},f=h=>{let v=h;(v.inputType==="insertText"||v.inputType==="insertCompositionText")&&c()},p=()=>{c({finalAttempt:!0})},m=null,g=t.registerRootListener((h,v)=>{v?.removeEventListener("keydown",l),v?.removeEventListener("beforeinput",d,!0),v?.removeEventListener("input",f),v?.removeEventListener("compositionend",p),h?.addEventListener("keydown",l),h?.addEventListener("beforeinput",d,!0),h?.addEventListener("input",f),h?.addEventListener("compositionend",p),m=h});return()=>{m&&(m.removeEventListener("keydown",l),m.removeEventListener("beforeinput",d,!0),m.removeEventListener("input",f),m.removeEventListener("compositionend",p)),g()}},[t]),null}function JV({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,ariaLabel:l,onRemoveTerminalContext:d,onChange:c,onCommandKeyDown:f,onPaste:p,editorRef:m}){let[g]=fn(),h=N(c);h.current=c;let v=mr(t,n),y=Xa(e,t,{cursor:v,expandedCursor:Xo(t,v)}),x=mr(t,y.cursor),C=FV(o),w=N(C),T=BV(r),S=N(T),L=N(Ou(r)),k=N(null);k.current=Oa()?.data.assistantQuotes??null;let I=N({value:t,cursor:x,expandedCursor:y.expandedCursor,selection:y.selection,terminalContextIds:o.map(D=>D.id)}),P=N(e),E=y.history,_=N(!1),A=q(()=>({onRemoveTerminalContext:d}),[d]);Ce(()=>{L.current=Ou(r)},[r]),W(()=>{g.setEditable(!a)},[a,g]),Ce(()=>{let D=mr(t,n),ne=I.current,F=P.current,U=F!==e,ee=w.current!==C,j=S.current!==T;if(!U&&ne.value===t&&ne.cursor===D&&!ee&&!j)return;if(U){let we=ne.selection;g.getEditorState().read(()=>{we=hC(we)}),Sd(F,ne.value,{cursor:ne.cursor,expandedCursor:ne.expandedCursor,selection:we})}let Z=Xa(e,t),de=U?Z.selection:{anchor:D,focus:D};I.current={value:t,cursor:U?Z.cursor:D,expandedCursor:U?Z.expandedCursor:Xo(t,D),selection:de,terminalContextIds:o.map(we=>we.id)},P.current=e,w.current=C,S.current=T;let B=g.getRootElement(),X=!!(B&&document.activeElement===B);if(!U&&ne.value===t&&!ee&&!j&&!X)return;let pe=U?Xa(F,ne.value).history:null;_.current=!0;let le=t==="",re=()=>g.update(()=>{let we=U||ne.value!==t||ee||j;we&&CC(t,o,L.current,k.current),U?vg(de.anchor,de.focus):(we||X)&&Zs(D)},{discrete:!0,tag:le?[Qo,gx,wA]:Qo});pe?lM(pe,re):re(),le&&X&&requestAnimationFrame(()=>setTimeout(()=>{document.activeElement===g.getRootElement()&&g.update(()=>{let we=$e();Ne(we)&&(we.dirty=!0)},{tag:[Qo,gx]})},0)),Sd(e,t,I.current),queueMicrotask(()=>{_.current=!1})},[n,e,g,T,o,C,t]);let H=R(D=>{let ne=g.getRootElement();if(!ne)return;let F=mr(I.current.value,D);ne.focus({preventScroll:!0}),g.update(()=>{Zs(F)}),I.current={value:I.current.value,cursor:F,expandedCursor:Xo(I.current.value,F),selection:{anchor:F,focus:F},terminalContextIds:I.current.terminalContextIds},Sd(P.current,I.current.value,{cursor:I.current.cursor,expandedCursor:I.current.expandedCursor,selection:I.current.selection}),h.current(I.current.value,F,I.current.expandedCursor,!1,I.current.terminalContextIds)},[g]),V=R(()=>{let D=I.current;return g.getEditorState().read(()=>{let ne=Rt().getTextContent(),F=mr(ne,I.current.cursor),U=mr(ne,zu(F)),ee=hg(ne,I.current.expandedCursor),j=hg(ne,fM(ee)),Z=yC(Rt()),de=hC(I.current.selection);D={value:ne,cursor:U,expandedCursor:j,selection:de,terminalContextIds:Z}}),I.current=D,Sd(P.current,D.value,D),D},[g]);or(m,()=>({focus:()=>{H(I.current.cursor)},focusAt:H,focusAtEnd:()=>{H(Po(I.current.value,I.current.value.length))},readSnapshot:V}),[H,V]);let J=R(D=>{D.read(()=>{let ne=Rt().getTextContent(),F=mr(ne,I.current.cursor),U=mr(ne,zu(F)),ee=hg(ne,I.current.expandedCursor),j=hg(ne,fM(ee)),Z=yC(Rt()),de=hC(I.current.selection),B=I.current;if(B.value===ne&&B.cursor===U&&B.expandedCursor===j&&B.selection.anchor===de.anchor&&B.selection.focus===de.focus&&B.terminalContextIds.length===Z.length&&B.terminalContextIds.every((pe,le)=>pe===Z[le])||_.current)return;I.current={value:ne,cursor:U,expandedCursor:j,selection:de,terminalContextIds:Z},Sd(P.current,ne,{cursor:U,expandedCursor:j,selection:de});let X=Mu(ne,U,"left")||Mu(ne,U,"right");h.current(ne,U,j,X,Z)})},[]);return u(gM,{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(MR,{contentEditable:u(SE,{className:K("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,...l?{"aria-label":l}:{},placeholder:u("span",{}),onPaste:p}),placeholder:o.length>0?null:u("div",{className:"pointer-events-none absolute inset-0 leading-relaxed text-placeholder",children:i}),ErrorBoundary:IE}),u(oR,{onChange:J}),u(qV,{...f?{onCommandKeyDown:f}:{}}),u(KV,{}),u(YV,{terminalContexts:o,skills:r}),u(WV,{}),u(VV,{}),u(GV,{}),u(jV,{}),u(XV,{}),u(QV,{}),u(tR,{externalHistoryState:E},e)]})})}function ZV(e){let[t]=fn(),n=N(e),o=N(e),[r,a]=Q(e.documentKey);r===e.documentKey&&(n.current=e),o.current=e,Ce(()=>{r===e.documentKey||t.isComposing()||a(e.documentKey)},[r,t,e.documentKey]),W(()=>{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(JV,{...i})}function Sg({documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,className:s,ariaLabel:l,onRemoveTerminalContext:d,onChange:c,onCommandKeyDown:f,onPaste:p,editorRef:m}){let g=N(t),h=N(o),v=N(Ou(r)),y=N(Oa()?.data.assistantQuotes??null),x=q(()=>({namespace:"ycodium-composer-editor",editable:!0,nodes:[Du,Fu,Js,Xi],editorState:()=>{CC(g.current,h.current,v.current,y.current)},onError:C=>{throw C}}),[]);return u(FA,{initialConfig:x,children:u(ZV,{documentKey:e,value:t,cursor:n,terminalContexts:o,skills:r,disabled:a,placeholder:i,onRemoveTerminalContext:d,onChange:c,onPaste:p,editorRef:m,...f?{onCommandKeyDown:f}:{},...s?{className:s}:{},...l?{ariaLabel:l}:{}})},EV)}function Uu(e,t,n){let o=e.trim().length-t;return o<=0?null:n("composer.promptTooLong",{count:o,excess:o.toLocaleString("en-US"),max:t.toLocaleString("en-US")})}function bC(e){return e.submissionTarget==="provider-turn"?Uu(e.providerInput??e.prompt,e.maxInputChars,e.t):null}function xM(e){let t=e.disabledReason??bC(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}}var go=new Map;function e4(e,t,n){return`${e}\0${t}\0${n??"none"}`}function wC(e,t){go.delete(e),go.set(e,t)}function Id(e,t){if(go.get(e)===t){if(t.operationLeases>0){t.disposeRequested=!0;return}t.releaseAuthorityWatch?.(),t.releaseAuthorityWatch=void 0,go.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 t4(e){if(go.size<=100)return;let t=Array.from(go);for(let[n,o]of t){if(go.size<=100)return;n===e||o.committed||o.listeners.size>0||o.operationLeases>0||Id(n,o)}for(let[n,o]of t){if(go.size<=100)return;n===e||o.listeners.size>0||o.operationLeases>0||Id(n,o)}}function Ig(){queueMicrotask(()=>t4())}function CM(e,t,n,o,r=void 0){let a=n.management?.revision??null,i=e4(e,n.intentId,a),s=go.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.management?.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 go.set(i,d),l}function bM(e,t){let n=go.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:()=>Id(e,n)})),n.committed=!0,wC(e,n),n.listeners.add(t),Ig(),()=>{n.listeners.delete(t),Ig()}):()=>{}}function el(e,t){let n=go.get(e);if(!n)return;n.committed=!0;let o=t(n.state);if(o!==n.state){n.state=o,wC(e,n);for(let r of n.listeners)r()}}function Tg(e){return go.get(e)?.state}function wM(e){let t=go.get(e);if(!t)return null;t.committed=!0,t.operationLeases+=1,wC(e,t);let n=!1;return()=>{if(!n){if(n=!0,t.operationLeases=Math.max(0,t.operationLeases-1),t.operationLeases===0&&t.disposeRequested){Id(e,t);return}Ig()}}}function kg(e){let t=go.get(e);t&&Id(e,t)}function SM(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 go)r.state.inputKey===e&&n.get(r.state.intentId)!==r.state.revision&&Id(o,r);Ig()}var n4=[],o4=[],r4=()=>{};function IM({entry:e,current:t,inputKey:n,environmentId:o,unavailable:r,attachments:a,watchEditorAuthority:i,onEdit:s,onClose:l}){let{t:d}=ao(),c=CM(n,o,e,a,i),f=$o(D=>bM(c.key,D),()=>Tg(c.key)??c,()=>Tg(c.key)??c),{key:p,text:m,retained:g,added:h,saving:v,error:y}=f,x=N(null),[C,w]=Q(()=>m.length),T=Oa()?.data.assistantQuotes??null,S=D=>Uu(T?T.expandForProvider(D):D,a.limits.maxInputChars,d),L=S(m),k=N(null),I=a.useUploadStatuses(),P=q(()=>g.map(D=>D.id),[g]),E=a.useAssetUrls(o,P),_=!t?.management||t.management.revision!==e.management?.revision;W(()=>{t===void 0&&(kg(p),l())},[t,p,l]);let A=()=>{v||(kg(p),l())},H=D=>{if(v||r||_)return;let ne=null,F=[...h];for(let U of D){let ee=U.type||"application/octet-stream";if(g.length+F.length>=a.limits.maxAttachments||U.size===0||U.size>a.maxAttachmentBytes(ee)){ne=d("turnQueue.attachmentLimit",{name:U.name,count:a.limits.maxAttachments,size:a.formatAttachmentSize(a.maxAttachmentBytes(ee))});continue}let j=a.makeImageAttachment({id:a.randomUUID(),name:U.name,mimeType:ee,sizeBytes:U.size,file:U});F.push(j),a.startUpload({environmentId:o,image:j})}el(p,U=>({...U,added:F,error:ne}))},V=async()=>{let D=Tg(p);if(!D||D.saving||r||_||!D.text.trim()&&D.retained.length+D.added.length===0||S(D.text)!==null)return;let ne=wM(p);if(ne!==null){el(p,F=>({...F,saving:!0,error:null}));try{await a.awaitUploads(D.added.map(U=>U.id));let F=a.getUploadedAttachments({environmentId:o,images:D.added});if(!F)throw new Error(d("turnQueue.uploadFailed"));await s(e,{text:D.text,attachments:[...D.retained,...F]}),kg(p),l()}catch(F){el(p,U=>({...U,saving:!1,error:F instanceof Error?F.message:d("turnQueue.actionFailed")}))}finally{ne()}}},J=[...g.map((D,ne)=>({...D,previewUrl:E[ne],added:!1})),...h.map(D=>({...D,added:!0}))];return u($f,{open:!0,onOpenChange:D=>{D||A()},children:b(Wf,{className:"max-w-2xl","data-queued-message-editor":!0,initialFocus:()=>(x.current?.focusAtEnd(),!1),children:[b(Vf,{children:[u(Gf,{children:d("turnQueue.editTitle")}),u(Kf,{children:d("turnQueue.editDescription")})]}),b("div",{className:"max-h-[60dvh] space-y-3 overflow-y-auto px-6 pb-4",onDragOver:D=>{D.dataTransfer.types.includes("Files")&&D.preventDefault()},onDrop:D=>{D.dataTransfer.files.length&&(D.preventDefault(),D.stopPropagation(),H(Array.from(D.dataTransfer.files)))},children:[u("div",{className:"rounded-lg border border-input bg-background px-3 py-2 focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/24",children:u(Sg,{editorRef:x,documentKey:`queue-editor\0${p}`,value:m,cursor:C,terminalContexts:n4,skills:o4,disabled:v,placeholder:d("turnQueue.editText"),ariaLabel:d("turnQueue.editText"),className:"max-h-[40dvh]",onRemoveTerminalContext:r4,onChange:(D,ne)=>{w(ne),el(p,F=>({...F,text:D}))},onCommandKeyDown:(D,ne)=>D!=="Enter"||!(ne.metaKey||ne.ctrlKey)?!1:(V(),!0),onPaste:D=>{D.clipboardData.files.length&&(D.preventDefault(),H(Array.from(D.clipboardData.files)))}})}),L?u("p",{role:"alert",className:"text-sm text-destructive-foreground",children:L}):null,u("ul",{className:"flex flex-wrap gap-2",children:J.map(D=>b("li",{className:"flex max-w-full items-center gap-2 rounded-md border border-border px-2 py-1.5",children:[D.type==="image"&&D.previewUrl?u("img",{src:D.previewUrl,alt:D.name,className:"size-12 rounded object-cover"}):u(wo,{className:"size-4 shrink-0"}),b("div",{className:"min-w-0 text-xs",children:[u("p",{className:"max-w-48 break-words",children:D.name}),u("p",{className:"text-muted-foreground",children:a.formatAttachmentSize(D.sizeBytes)}),D.added&&I.get(D.id)!=="ready"?u("p",{children:d(I.get(D.id)==="failed"?"turnQueue.uploadFailed":"turnQueue.uploading")}):null,D.added&&I.get(D.id)==="failed"?u(ie,{size:"xs",variant:"ghost",disabled:v||r||_,onClick:()=>{let ne=h.find(F=>F.id===D.id);ne&&a.retryUpload({environmentId:o,image:ne})},children:d("turnQueue.retryUpload")}):null]}),u(ie,{size:"icon-xs",variant:"ghost","aria-label":d("turnQueue.removeAttachment",{name:D.name}),disabled:v||_,onClick:()=>{D.added?(a.releaseUpload(D.id),D.previewUrl&&URL.revokeObjectURL(D.previewUrl),el(p,ne=>({...ne,added:ne.added.filter(F=>F.id!==D.id)}))):el(p,ne=>({...ne,retained:ne.retained.filter(F=>F.id!==D.id)}))},children:u(en,{className:"size-3.5"})})]},D.id))}),u("input",{ref:k,type:"file",multiple:!0,className:"hidden","aria-label":d("turnQueue.addAttachments"),onChange:D=>{H(Array.from(D.target.files??[])),D.target.value=""}}),b(ie,{size:"sm",variant:"outline",disabled:v||r||_,onClick:()=>k.current?.click(),children:[u(wo,{className:"size-4"}),d("turnQueue.addAttachments")]}),_?u("p",{role:"alert",className:"text-sm text-muted-foreground",children:d("turnQueue.editStale")}):null,y?u("p",{role:"alert",className:"text-sm text-destructive-foreground",children:y}):null]}),b(qf,{children:[u(ie,{variant:"ghost",disabled:v,onClick:A,children:d("turnQueue.discardEdit")}),u(ie,{disabled:v||r||_||L!==null||!m.trim()&&J.length===0,onClick:()=>{V()},children:d(v?"turnQueue.saving":"turnQueue.saveEdit")})]})]})})}function TM(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 kM(e,t,n){if(t===n)return null;let o={intentId:t,beforeIntentId:n,previousOrder:e.map(a=>a.intentId)};return TM(e,o).every((a,i)=>a.intentId===e[i]?.intentId)?null:o}function LM(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:TM(e,t),settled:!1}}he();he();function a4({entry:e,unavailable:t,onCancel:n}){let{t:o}=ao(),r=N(!1),[a,i]=Q(!1),[s,l]=Q(!1),[d,c]=Q(!1);W(()=>{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(ie,{size:"xs",variant:"outline",disabled:a||t,onClick:()=>{f()},children:o("turnQueue.confirmAbandon")}),u(ie,{size:"xs",variant:"ghost",disabled:a,onClick:()=>c(!1),children:o("turnQueue.keepWaiting")})]})]}):u(ie,{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 PM({entries:e,unavailable:t,onCancel:n}){let{t:o}=ao(),[r,a]=Q(!1),i=Jr();return e.length===0?null:b("div",{className:"min-w-0 basis-full space-y-2",children:[u(ie,{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(a4,{entry:s,unavailable:t,onCancel:n},s.intentId))}):null]})}function SC({queue:e,unavailable:t=!1,onResume:n,entries:o,onCancel:r}){let{t:a}=ao(),i=N(!1),[s,l]=Q(!1),[d,c]=Q(!1),f=N(!1),[p,m]=Q(!1),[g,h]=Q(!1),[v,y]=Q(null);W(()=>{e.paused||c(!1)},[e.paused]);let x=o?.[0];W(()=>{m(!1),y(null)},[x?.intentId,x?.status,x?.deliveryCertainty]);let C=e.deliveryUncertain||e.blocked||e.reconciling;if(!e.paused&&!C)return null;let w=r!==void 0&&x?.action==="abandon"&&(e.reconciling||e.deliveryUncertain),T=async()=>{if(f.current||t||r===void 0||x===void 0)return;let I=x;f.current=!0,h(!0),y(null);try{await r(I),m(!1)}catch{y(I.intentId)}finally{f.current=!1,h(!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"),k=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===x?.intentId?u("p",{className:"text-destructive-foreground",role:"alert",children:a("turnQueue.actionFailed")}):null]}),e.paused?u(ie,{size:"xs",variant:"outline",disabled:s,softDisabled:t,onClick:()=>{k()},children:a(s?"turnQueue.resuming":"turnQueue.resume")}):null,w?b(ke,{children:[u(ie,{size:"xs",variant:"outline",disabled:g,softDisabled:t,onClick:()=>m(!0),children:a("turnQueue.stopWaiting")}),u(pS,{open:p,onOpenChange:I=>{I||m(!1)},children:b(yS,{className:"max-w-lg",children:[b(vS,{children:[u(xS,{children:a("turnQueue.stopWaiting")}),u(gS,{children:a("turnQueue.abandonDescription")})]}),b(hS,{children:[u(mS,{render:u(ie,{variant:"ghost"}),children:a("turnQueue.keepWaiting")}),u(ie,{variant:"outline",disabled:g||t,onClick:()=>{T()},children:a(g?"turnQueue.cancelling":"turnQueue.confirmAbandon")})]})]})})]}):null,r&&o?u(PM,{entries:o.filter(I=>I.status!=="queued"),unavailable:t,onCancel:r}):null]})}var i4=[VT,qT],s4=[];function l4({submission:e}){let{t}=ao();return b("li",{"data-queue-pending-message":e.messageId,className:"flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",children:[u("span",{"aria-hidden":"true",className:"grid size-6 shrink-0 place-items-center",children:u("span",{className:"size-1.5 rounded-full bg-muted-foreground/60"})}),b("div",{className:"min-w-0 flex-1",children:[u("p",{className:"line-clamp-2 whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:ov(e.text)||t("turnQueue.attachmentsOnly")}),e.attachmentNames.length?b("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(wo,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:e.attachmentNames.join(", ")})]}):null]}),u("span",{role:"status",className:"w-[5.25rem] shrink-0 text-end text-muted-foreground",children:t("primaryActions.sendingButtonLabel")})]})}function d4({entry:e,disabled:t,dropPosition:n,dragPosition:o,feedback:r,reducedMotion:a,children:i}){let{t:s}=ao(),{attributes:l,listeners:d,setNodeRef:c,setActivatorNodeRef:f,transform:p,transition:m,isDragging:g}=HT({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":g||void 0,"data-queue-feedback":r,style:{transform:Mi.Transform.toString(p),transition:m},className:K("relative flex items-center gap-1.5 border-t border-border/50 px-2 py-1.5",g&&"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:K("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(ie,{ref:f,size:"icon-xs",variant:"ghost",className:K("shrink-0 touch-none cursor-grab text-muted-foreground active:cursor-grabbing",(g||r==="saved")&&"bg-primary/10 text-primary"),...l,...d,"aria-label":s("turnQueue.reorderMessage"),title:s("turnQueue.reorderMessage"),softDisabled:t,children:r==="saved"?u(ro,{className:"size-3.5"}):u(ac,{className:"size-3.5"})}),i,g&&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 AM({inputKey:e,entries:t,pendingSubmissions:n=s4,environmentId:o,unavailable:r,attachments:a,actions:i,onCancel:s}){let{t:l}=ao(),d=Bp("(prefers-reduced-motion: reduce)"),[c,f]=Ht("turn-queue:editing",e,null),[p,m]=Ht("turn-queue:pending",e,!1),g=St("turn-queue:pending-ref",e,!1),[h,v]=Ht("turn-queue:error",e,null),[y,x]=Ht("turn-queue:drag",e,null),[C,w]=Ht("turn-queue:move",e,null),T=St("turn-queue:reorder-ref",e,!1),[S,L]=Ht("turn-queue:feedback",e,null),k=pT(Pv($l,{activationConstraint:{distance:5}}),Pv(Hl,{coordinateGetter:$T,scrollBehavior:d?"auto":"smooth"})),I=q(()=>t.filter(F=>F.waiting),[t]),P=C?LM(I,C.preview):null,E=P?.entries??I,_=E.length+n.length,A=r||p||C!==null,H=E.findIndex(F=>F.intentId===y?.activeId),V=E.findIndex(F=>F.intentId===y?.overId);W(()=>{SM(e,t)},[t,e]),W(()=>{C!==null&&(r||C.acknowledged&&P?.settled)&&(T.current=!1,w(null),!r&&I.some(F=>F.intentId===C.preview.intentId)&&L({intentId:C.preview.intentId,kind:"saved"}))},[I,C,P?.settled,r]),W(()=>{if(S===null||S.kind==="failed")return;let F=window.setTimeout(()=>L(U=>U===S?null:U),1600);return()=>window.clearTimeout(F)},[S]);let J=async F=>{if(!(g.current||T.current||r)){g.current=!0,m(!0),v(null),L(null);try{await F()}catch(U){v(U instanceof Error?U.message:l("turnQueue.actionFailed"))}finally{g.current=!1,m(!1)}}},D=(F,U)=>J(async()=>{let ee=kM(I,F.intentId,U);if(!(ee===null||!F.management?.canReorder)){T.current=!0,w({preview:ee,acknowledged:!1});try{await i.onReorder(F,U),w(j=>j?.preview===ee?{...j,acknowledged:!0}:j)}catch(j){throw T.current=!1,w(null),L({intentId:F.intentId,kind:"failed"}),j}}}),ne=r?l("turnQueue.disconnected"):C!==null?l("turnQueue.saving"):y!==null?`${l("turnQueue.dragStarted")} ${V+1}/${E.length}`:S?.kind==="saved"?l("common.action.done"):S?.kind==="cancelled"?l("turnQueue.dragCancelled"):"";return b(ke,{children:[_>0?b("section",{"aria-label":l("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:l("turnQueue.queued",{count:_})}),u("span",{role:"status","aria-live":y===null?"polite":"off","data-queue-reorder-status":C?"saving":S?.kind,className:K("min-w-0 truncate",S?.kind==="saved"&&"text-primary"),children:ne})]}),u(ET,{sensors:k,collisionDetection:hT,modifiers:i4,accessibility:{screenReaderInstructions:{draggable:l("turnQueue.dragInstructions")},announcements:{onDragStart:()=>l("turnQueue.dragStarted"),onDragOver:({over:F})=>{let U=E.findIndex(ee=>ee.intentId===F?.id);return U<0?void 0:`${l("turnQueue.dragStarted")} ${U+1}/${E.length}`},onDragEnd:()=>l("turnQueue.dragFinished"),onDragCancel:()=>l("turnQueue.dragCancelled")}},onDragStart:({active:F})=>{let U=E.find(ee=>ee.intentId===F.id);!U?.management?.canReorder||A||(v(null),L(null),x({activeId:U.intentId,overId:U.intentId}))},onDragOver:({over:F})=>{let U=E.find(ee=>ee.intentId===F?.id);U&&x(ee=>ee&&{...ee,overId:U.intentId})},onDragCancel:()=>{y&&L({intentId:y.activeId,kind:"cancelled"}),x(null)},onDragEnd:({active:F,over:U})=>{if(x(null),!U||F.id===U.id)return;let ee=E.findIndex(B=>B.intentId===F.id),j=E.findIndex(B=>B.intentId===U.id),Z=E[ee];if(!Z?.management?.canReorder||j<0)return;let de=E[j+(ee<j?1:0)]?.intentId??null;D(Z,de)},children:u(zT,{items:E.map(F=>F.intentId),strategy:OT,children:b("ol",{className:"max-h-52 overflow-x-hidden overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",children:[E.map((F,U)=>b(d4,{entry:F,disabled:!F.management?.canReorder||A,reducedMotion:d,feedback:S?.intentId===F.intentId?S.kind:void 0,dropPosition:F.intentId===y?.overId&&H!==V?H<V?"after":"before":void 0,dragPosition:F.intentId===y?.activeId?`${V+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:ov(F.text??"")||l("turnQueue.attachmentsOnly")}),F.attachmentNames.length?b("p",{className:"flex items-center gap-1 text-muted-foreground",children:[u(wo,{className:"size-3 shrink-0"}),u("span",{className:"truncate",children:F.attachmentNames.join(", ")})]}):null,F.pendingAction?u("p",{className:"text-muted-foreground",children:l(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:K("flex shrink-0 items-center gap-0.5",F.intentId===y?.activeId&&"invisible"),children:[u(ie,{size:"icon-xs",variant:"ghost",disabled:!F.management||A||y!==null,"aria-label":l("turnQueue.editMessage"),title:l("turnQueue.editMessage"),onClick:()=>f(F),children:u(pc,{className:"size-3.5"})}),F.management?.canSteer?u(ie,{size:"icon-xs",variant:"ghost",disabled:A||y!==null,"aria-label":l("turnQueue.steer"),title:l("turnQueue.steerDescription"),onClick:()=>{J(()=>i.onRun(F,"steer"))},children:u(mc,{className:"size-3.5"})}):null,b(_o,{children:[u(Oo,{render:u(ie,{size:"icon-xs",variant:"ghost",disabled:A||!F.management||y!==null,"aria-label":l("turnQueue.messageActions")}),children:u(ar,{className:"size-4"})}),b(Do,{align:"end",children:[b(ir,{disabled:!F.management?.canReorder||U===0,onClick:()=>{D(F,E[U-1].intentId)},children:[u(Qd,{className:"size-4"}),l("turnQueue.moveUp")]}),b(ir,{disabled:!F.management?.canReorder||U===E.length-1,onClick:()=>{D(F,E[U+2]?.intentId??null)},children:[u(Gd,{className:"size-4"}),l("turnQueue.moveDown")]}),F.management?.canSteer?u(ir,{onClick:()=>{J(()=>i.onRun(F,"steer"))},children:l("turnQueue.steer")}):null,u(ir,{disabled:!F.management?.canRun,onClick:()=>{J(()=>i.onRun(F,"interrupt"))},children:l(F.management?.expectedTurnId?"turnQueue.interruptAndRun":"turnQueue.sendNext")}),u(_a,{}),u(ir,{disabled:F.action!=="cancel",onClick:()=>{J(()=>s(F))},children:l("turnQueue.cancelMessage")})]})]})]})]},F.intentId)),n.map(F=>u(l4,{submission:F},F.messageId))]})})},e),h?u("p",{role:"alert",className:"px-3 py-2 text-destructive-foreground",children:h}):null]}):null,c?u(IM,{entry:c,current:t.find(F=>F.intentId===c.intentId),inputKey:e,environmentId:o,unavailable:A,attachments:a,watchEditorAuthority:i.watchEditorAuthority,onEdit:i.onEdit,onClose:()=>f(null)},`${e}\0${c.intentId}\0${c.management?.revision??"none"}`):null]})}function EM({data:e,target:t,inputKey:n,attachments:o}){let r=e.useQueue({target:t,threadKey:n}),{environmentId:a,threadId:i}=t,s=e.queue,l=q(()=>{let c={environmentId:a,threadId:i};return{actions:{onEdit:(p,m)=>s.edit(c,p,m),onReorder:(p,m)=>s.reorder(c,p,m),onRun:(p,m)=>s.run(c,p,m),watchEditorAuthority:s.watchEditorAuthority},onCancel:p=>s.cancel(c,p),onResume:()=>s.resume(c)}},[s,a,i]),d=q(()=>({data:e,target:t,threadKey:`${n}\0queue-editor`}),[e,t,n]);return b(ke,{children:[u(Sp,{value:d,children:u(AM,{inputKey:n,actions:l.actions,attachments:o,entries:r.entries,pendingSubmissions:r.pendingSubmissions,environmentId:a,onCancel:l.onCancel,unavailable:r.unavailable})}),u(SC,{entries:r.entries,onCancel:l.onCancel,onResume:l.onResume,queue:r.state,unavailable:r.unavailable})]})}he();function Td(e){return e.id??e.label}function IC(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?[Td(o)]:[]})))}var RM=ve(function(t){let n=t.data.useQuestions(t.target);return n.pending.length===0?null:u("div",{"data-async-question-stack":!0,className:"mx-auto mb-2 flex max-h-[45vh] w-full max-w-3xl flex-col gap-2 overflow-y-auto overscroll-contain",children:n.pending.toReversed().map(o=>u(u4,{pending:o,actions:n},o.requestId))})});function c4(e,t,n){let o={};for(let r of e.questions){let a=n[r.id]?.trim()??"",i=t[r.id]??[];if(a.length>0)o[r.id]=a;else if(i.length>0)o[r.id]=r.multiSelect?i:i[0];else return null}return o}var u4=ve(function(t){let{pending:n,actions:o}=t,{t:r}=ye(),[a,i]=Q({}),[s,l]=Q({}),[d,c]=Q(!1),[f,p]=Q(null),m=c4(n,a,s),g=y=>{c(!0),p(null),y().then(x=>{c(!1),p(x)})},h=()=>{m===null||d||g(()=>o.answer(n.requestId,m))},v=(y,x,C)=>i(w=>{let T=w[y]??[],S=T.includes(x)?T.filter(L=>L!==x):C?[...T,x]:[x];return{...w,[y]:S}});return b("section",{"data-async-question":n.requestId,"aria-label":r("asyncQuestion.title"),className:"overflow-hidden rounded-xl border border-border/60 bg-background/95 px-3 py-2 text-sm shadow-xs",children:[b("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[u(Ci,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"font-medium",children:r("asyncQuestion.title")})]}),n.questions.map(y=>{let x=a[y.id]??[],C=s[y.id]??"";return b("div",{className:"mt-2","data-async-question-item":y.id,children:[u("p",{className:"whitespace-pre-wrap break-words text-foreground/85",children:y.question}),y.multiSelect?u("p",{className:"mt-0.5 text-xs text-secondary-label",children:r("pendingUserInput.selectOneOrMore")}):null,y.options.length>0?u("div",{className:"mt-1.5 flex flex-wrap gap-1",children:y.options.map(w=>{let T=Td(w),S=C.trim().length===0&&x.includes(T);return b(ie,{size:"xs",variant:S?"secondary":"outline","aria-pressed":S,disabled:d,onClick:()=>v(y.id,T,y.multiSelect===!0),children:[S?u(ro,{"aria-hidden":!0,className:"size-icon-1"}):null,w.label]},T)})}):null,u(kl,{type:"text",value:C,disabled:d,placeholder:r("asyncQuestion.answerPlaceholder"),"aria-label":r("asyncQuestion.answerLabel",{question:y.question}),className:"mt-1.5 h-8",onChange:w=>l(T=>({...T,[y.id]:w.target.value})),onKeyDown:w=>{w.key!=="Enter"||w.nativeEvent.isComposing||(w.preventDefault(),h())}})]},y.id)}),f?u("p",{role:"alert",className:"mt-1.5 text-xs text-destructive-foreground",children:f}):null,b("div",{className:K("mt-2 flex items-center justify-end gap-1"),children:[u(ie,{size:"xs",variant:"ghost",disabled:d,onClick:()=>g(()=>o.dismiss(n.requestId)),children:r("asyncQuestion.dismiss")}),u(ie,{size:"xs",disabled:d||m===null,onClick:h,children:r("asyncQuestion.answer")})]})]})});he();var TC=220,f4={opacity:0,transform:"translate3d(0, 4rem, 0)"},p4={opacity:0,transform:"translate3d(0, 7rem, 0)"},MM={opacity:1,transform:"none"},NM={transition:`transform ${TC}ms ease-in, opacity ${TC}ms ease-in`},m4={default:"border-[var(--chat-composer-attached-outline)]",error:"border-destructive/24",info:"border-info/24",success:"border-success/24",warning:"border-warning/24"};function DM({className:e,items:t}){let{t:n}=ye(),[o,r]=Q(null),a=N(null),i=o!==null&&t.some(m=>m.id===o)?o:null;if(W(()=>()=>{a.current&&clearTimeout(a.current)},[]),t.length===0)return null;let s=t[0];if(!s)return null;let l=t.slice(1),d=l.length>0,c=d&&i!==s.id,f=l[0],p=m=>{!m.onDismiss||i||(r(m.id),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,m.onDismiss?.()},TC))};return u("div",{className:K("group/banner-stack chat-composer-drawer-slot",e),"data-composer-banner-drawer":"true",children:b("div",{className:K("relative flex flex-col-reverse",d?"group-hover/banner-stack:z-50 group-focus-within/banner-stack:z-50":null),children:[c&&f?u("div",{className:K("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)]",m4[f.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:K("relative z-10",i===s.id?"pointer-events-none":null),style:{...NM,...i===s.id?f4:MM},children:u(_M,{item:s,attached:!0,exiting:i===s.id,onDismissRequest:()=>p(s)})}),d?u("div",{"data-composer-banner-stack-expanded-items":"true",className:K("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:K("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:l.map(m=>u("div",{className:K(i===m.id?"pointer-events-none":null),style:{...NM,...i===m.id?p4:MM},children:u(_M,{item:m,attached:!1,exiting:i===m.id,onDismissRequest:()=>p(m)})},m.id))})})}):null]})})}function _M({item:e,attached:t,exiting:n,onDismissRequest:o}){let{t:r}=ye(),a=e.onDismiss&&!e.actions;return e.presentation==="compact"?b(bc,{variant:e.variant,role:"status",className:K("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($h,{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(wc,{className:K("shrink-0",e.actionClassName),children:[e.actions,e.onDismiss?u(ie,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissNotice"),disabled:n,onClick:o,children:u(en,{})}):null]}):null]}):b(bc,{variant:e.variant,className:K(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($h,{children:e.title}),e.description?u(Qf,{children:e.description}):null,e.actions||e.onDismiss?b(wc,{className:K(e.actionClassName,a?"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(ie,{size:"icon-xs",variant:"ghost","aria-label":e.dismissLabel??r("composer.dismissWarning"),disabled:n,onClick:o,children:u(en,{})}):null]}):null]})}he();var OM=bt(!1),FM=OM.Provider;function BM(){return Ut(OM)}function zM({belowSlot:e,composer:t,data:n,draftHero:o,onOverlayElementChange:r,queue:a,questions:i,target:s,threadKey:l}){let d=n.useComposerBanners({target:s,threadKey:l}),c=u(DM,{className:"relative z-0",items:d.items});return b("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,i,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}),c]}):c,b("div",{"data-chat-composer-stack":"true",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:u(FM,{value:d.items.length>0,children:t})})}),u("div",{className:"min-h-0",children:e})]})]}),u("div",{"aria-hidden":!0,className:"h-[calc(env(safe-area-inset-bottom)+1rem)] sm:h-[calc(env(safe-area-inset-bottom)+1.25rem)]"})]}),d.overlay]})}function UM(e,t){let n=e!==null&&e!=="plan-follow-up";return{showTopDrawer:e!==null&&(n||!t),showCollapsedPromptRow:t&&!n,hasBlocking:n}}var g4=["image/gif","image/jpeg","image/png","image/webp"],h4=new Set(g4);function kC(e){return h4.has(e.toLowerCase())}function v4(e){return kC(e)?"image":"file"}var y4=new Set(["application/json","application/xml","application/x-yaml","application/yaml"]);function LC(e){if(e.type==="image")return"image";let t=e.mimeType.toLowerCase();return t==="application/pdf"?"pdf":t.startsWith("text/")||y4.has(t)?"text":"file"}function PC(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 AC(e){let t={id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes};return v4(e.mimeType)==="image"?{type:"image",...t}:{type:"file",...t}}he();he();var EC=ve(function(t){let{t:n}=ye();if(t.count===0)return null;let o=t.placement==="inline",r=u("span",{className:K("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(ie,{size:"micro",variant:"ghost-muted","data-prompt-stash-badge":"true","aria-label":n("stash.ariaLabel",{count:t.count}),"aria-expanded":t.menuOpen,className:K("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(Sl,{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:K("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(Sl,{className:"size-3 shrink-0","aria-hidden":"true"}),n("stash.label"),r]})});he();function $M(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 HM({className:e,steps:t}){return t.length<=1?null:u("span",{"aria-hidden":!0,className:K("flex w-10 shrink-0 items-center gap-0.5",e),children:$M(t).map(({key:n,step:o})=>u("span",{className:K("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 RC=ve(function({expanded:t,hasTrailingShoulder:n=!1,onDismiss:o,onToggle:r,placement:a="tab",progress:i,steps:s}){let{t:l}=ye();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(ie,{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(us,{"aria-hidden":!0,className:"size-3 shrink-0"}),u("span",{children:l("tasksBadge.label")}),u(HM,{steps:s}),b("span",{className:K("font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]})]}),u(ie,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(en,{"aria-hidden":!0,className:"size-2.5"})})]}):b("div",{className:K("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(us,{"aria-hidden":!0,className:"size-icon-1 shrink-0"}),u("span",{className:"shrink-0",children:l("tasksBadge.label")}),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:K("shrink-0 font-medium tabular-nums",d?"text-success":"text-muted-foreground"),children:[i.completedSteps,"/",i.totalSteps]}),u(HM,{className:"w-20",steps:s})]}),u(ie,{size:"icon-micro",variant:"ghost-muted","aria-label":l("tasksBadge.dismissLabel"),className:"shrink-0",onClick:o,onPointerDown:f=>f.preventDefault(),children:u(en,{"aria-hidden":!0,className:"size-3"})})]})}),KM=ve(function({onDismiss:t,onCollapse:n,progress:o,steps:r}){let{t:a}=ye();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(us,{"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(ie,{size:"icon-micro",variant:"ghost-muted","aria-label":a("tasksBadge.dismissLabel"),className:"shrink-0",onClick:t,onPointerDown:i=>i.preventDefault(),children:u(en,{"aria-hidden":!0,className:"size-3"})})]}),u("div",{className:"space-y-px px-3 pb-4 sm:px-4",role:"list",children:$M(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:K("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:K("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?Da(s.durationMs):s.status==="inProgress"?a("tasksBadge.now"):null})]},i))})]})});var x4={"start-failed":"attachments.uploadFailure.startFailed","not-connected":"attachments.uploadFailure.notConnected",rejected:"attachments.uploadFailure.rejected","timed-out":"attachments.uploadFailure.timedOut",cancelled:"attachments.uploadFailure.cancelled",failed:"attachments.uploadFailure.failed"};function Lg(e,t){let n=e.code===void 0?void 0:x4[e.code];return n===void 0?e.reason:t(n,{status:e.httpStatus??""})}function qM(e,t){let n=0,o=0;for(let r of e.imageIds){let a=e.uploadsByImageId[r];a?.status==="failed"&&a.environmentId===e.environmentId?o+=1:(a?.status!=="ready"||a.environmentId!==e.environmentId)&&(n+=1)}return o>0?t("attachments.retryOrRemoveFailed",{count:o}):n>0?t("attachments.stillUploading",{count:n}):null}function Pg(e){let t=Math.max(0,Math.min(1,Number.isFinite(e)?e:0));return`${Math.floor(t*100)}%`}function VM(e){switch(e){case"image":return cs;case"pdf":return ds;case"text":return ls;case"file":return wo}}function C4(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(`
3849
+ `)}function b4({context:e,onRemove:t}){let{t:n}=ye(),o=jt().elementContext,r=o.formatLabel(e),a=o.formatSourceLabel(e);return b(Je,{children:[u(et,{render:b("span",{className:K(pa,"pr-1"),children:[u(ta,{className:K(gr,"size-icon-1")}),u("span",{className:hr,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:mg,onClick:i=>{i.preventDefault(),i.stopPropagation(),t(e.id)},children:u(en,{className:"size-3","aria-hidden":!0})})]})}),u(Ze,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:C4(e,o.formatLabel,o.formatSourceLabel)})]})}function WM({contexts:e,onRemove:t,className:n}){return e.length===0?null:u("div",{className:K("flex flex-wrap gap-1.5",n),children:e.map(o=>u(b4,{context:o,onRemove:t},o.id))})}function GM({comments:e,onRemove:t,className:n}){let{t:o}=ye();return e.length===0?null:u("div",{className:K("flex flex-wrap gap-1.5",n),children:e.map(r=>{let a=`${r.filePath} ${r.rangeLabel}`,i=b("span",{className:K(pa,"pr-1"),children:[u(fs,{className:K(gr,"size-icon-1")}),u("span",{className:hr,children:a}),u("button",{type:"button","aria-label":o("pendingContext.removeReviewComment",{label:a}),className:mg,onClick:s=>{s.preventDefault(),s.stopPropagation(),t(r.id)},children:u(en,{className:"size-3","aria-hidden":!0})})]},r.id);return r.text.length===0?i:b(Je,{children:[u(et,{render:i}),u(Ze,{side:"top",className:"max-w-96 whitespace-pre-wrap leading-tight",children:r.text})]},r.id)})})}function Ag(e){let{t}=ye(),n=t(e.tooltipKey,{count:e.count});return b(Je,{children:[u(et,{render:b("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground",children:[e.icon,e.count]})}),u(Ze,{side:"top",children:n})]})}function jM({annotations:e,images:t,onRemove:n,onExpandImage:o,uploadsByImageId:r,onRetryUpload:a,className:i}){let{t:s}=ye(),l=jt().elementContext;if(e.length===0)return null;let d=new Map(t.map(c=>[c.id,c]));return u("div",{className:K("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(g=>{let h=l.normalizeSelection(g.element);return h?[{id:g.id,label:l.formatLabel(h)}]:[]});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(ta,{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:K("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:g,label:h})=>u("span",{className:"max-w-40 truncate font-mono text-secondary-label text-[10px]",children:h},g)),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(Ag,{icon:u(ta,{className:"size-3"}),count:c.elements.length,tooltipKey:"previewAnnotation.elementCount"}):null,c.regions.length>0?u(Ag,{icon:u(nc,{className:"size-3"}),count:c.regions.length,tooltipKey:"previewAnnotation.regionCount"}):null,c.strokes.length>0?u(Ag,{icon:u(na,{className:"size-3"}),count:c.strokes.length,tooltipKey:"previewAnnotation.drawingCount"}):null,c.styleChanges.length>0?u(Ag,{icon:u(ms,{className:"size-3"}),count:c.styleChanges.length,tooltipKey:"previewAnnotation.styleChangeCount"}):null,p?.status==="uploading"?u("span",{className:"text-[10px] text-secondary-label",children:Pg(p.progress)}):null,p?.status==="failed"&&f&&a?b(Je,{children:[u(et,{render:u(ie,{size:"icon-micro",variant:"ghost-muted","aria-label":s("attachments.retryUpload",{name:f.name}),onClick:()=>a(f)}),children:u(hs,{className:"size-3"})}),u(Ze,{side:"top",children:Lg(p,s)})]}):null]})]})]}),u(ie,{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(en,{className:"size-3"})})]},c.id)})})}he();function QM(e,t){let n=t?.hasWideActions?780:620;return e!==null&&e<n}function XM(e,t){return t?.hasWideActions?e!==null&&e<780:!1}function YM(e,t){let n=jt().pane.useVisible(),[o,r]=Q(null);Ce(()=>{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),g=Number.parseFloat(m.paddingLeft)||0,h=Number.parseFloat(m.paddingRight)||0;r(Math.round(p.contentRect.width+g+h))});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=QM(o,{hasWideActions:t});return{isComposerFooterCompact:a,isComposerPrimaryActionsCompact:a&&XM(o,{hasWideActions:t})}}he();he();var JM={recent:"slashMenu.sections.recent",builtIn:"slashMenu.sections.builtIn",provider:"slashMenu.sections.provider",skills:"slashMenu.sections.skills"},ZM=ve(function(t){let{t:n}=ye(),o=N(null);return Ce(()=>{if(!t.activeItemId||!o.current)return;o.current.querySelector(`[data-composer-item-id="${CSS.escape(t.activeItemId)}"]`)?.scrollIntoView({block:"nearest"})},[t.activeItemId]),u(Yf,{autoHighlight:!1,mode:"none",onItemHighlighted:r=>{t.onHighlightedItemChange(typeof r=="string"?r:null)},children:u("div",{ref:o,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(ep,{className:"max-h-72 scroll-pb-6",children:u(Jf,{children:t.items.map((r,a)=>u(w4,{sectionTitle:r.section!==void 0&&t.items[a-1]?.section!==r.section?r.section:null,item:r,triggerKind:t.triggerKind,resolvedTheme:t.resolvedTheme,isActive:t.activeItemId===r.id,onHighlight:t.onHighlightedItemChange,onSelect:t.onSelect},r.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"?n("composer.searchingSkills"):n("composer.searchingFiles"):t.emptyStateText??(t.triggerKind==="skill"?n("composer.noSkillsFound"):t.triggerKind==="path"?n("composer.noMatchingFiles"):n("composer.noMatchingCommand"))})})})})}),w4=ve(function(t){let{t:n}=ye(),o=t.item.type==="skill"?rM(t.item.skill):null,r=t.triggerKind==="slash-command"&&t.item.type==="skill"?t.item.skill:null;return b(ke,{children:[t.sectionTitle!==null?u("div",{role:"presentation","data-composer-menu-section":t.sectionTitle,className:"px-3 pt-2 pb-1 text-xs text-secondary-label",children:n(JM[t.sectionTitle]??JM.recent)}):null,b(Zf,{value:t.item.id,"data-composer-item-id":t.item.id,className:K("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:a=>{a.preventDefault()},onClick:()=>{t.onSelect(t.item)},children:[t.item.type==="path"?u(gg,{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:r?b(ke,{children:[u("span",{className:"text-secondary-label",children:"/skill:"}),ma(r)]}):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}),o?u(T4,{kind:o,showSkillSuffix:t.triggerKind==="skill"}):null]})]})]})}),S4={app:Xd,repo:vi,project:vi,personal:oa,system:gc,other:uc},I4={app:"slashMenu.skillSource.app",repo:"slashMenu.skillSource.repo",project:"slashMenu.skillSource.project",personal:"slashMenu.skillSource.personal",system:"slashMenu.skillSource.system",other:"slashMenu.skillSource.other"};function T4(e){let{t}=ye(),n=S4[e.kind],o=t(I4[e.kind]);return b(ra,{className:"ms-auto",variant:"secondary",children:[u(n,{"aria-hidden":"true",className:"text-current"}),e.showSkillSuffix?t("slashMenu.skillSourceWithSuffix",{source:o}):o]})}he();function k4(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function eN(e,t){let n=k4(e);if(!n)return"";let o=Date.now()-n.getTime();if(o<0)return t("relativeTime.justNow");let r=Math.floor(o/1e3);if(r<60)return t("relativeTime.justNow");let a=Math.floor(r/60);if(a<60)return t("relativeTime.minutesAgo",{count:a});let i=Math.floor(a/60);return i<24?t("relativeTime.hoursAgo",{count:i}):t("relativeTime.daysAgo",{count:Math.floor(i/24)})}var tN=90;function nN(e){return e.droppedImageNames.length+(e.unreadableImageNames?.length??0)}function L4(e,t){let n=e.prompt.trim().replace(/\s+/g," ");if(n.length>0)return n.length>tN?`${n.slice(0,tN)}\u2026`:n;let o=e.attachments.length+e.droppedImageNames.length;return o>0?t("stash.imageCountLabel",{count:o}):t("stash.emptyEntry")}var oN=ve(function(t){let{entries:n,onRestore:o,onDelete:r,onClose:a}=t,{t:i}=ye(),s=jt(),l=N(null),[d,c]=Q(n[0]?.id??null),f=n.find(p=>p.id===d)??n[0];return W(()=>{let p=m=>{let g=l.current;g&&m.composedPath().includes(g)||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]),W(()=>{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(y=>y.id===d),g=p.key==="ArrowDown"?1:-1,v=((m>=0?m:g===1?-1:0)+g+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(Yf,{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(ie,{variant:"ghost-muted",size:"icon-micro","aria-label":i("stash.closeLabel"),onPointerDown:p=>p.preventDefault(),onClick:a,children:u(en,{className:"size-3"})})}),u(ep,{className:"max-h-64 scroll-pb-6",children:u(Jf,{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(Zf,{value:p.id,className:K("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:L4(p,i)}),p.pendingImageCount?u("span",{className:"shrink-0 text-[10px] text-secondary-label",children:i("stash.savingImage",{count:p.pendingImageCount})}):nN(p)>0?u("span",{className:"shrink-0 text-[10px] text-warning-foreground",children:i("stash.imagesDropped",{count:nN(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:eN(p.createdAt,i)}),u(ie,{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(en,{className:"stroke-2"})})]},p.id))})})]})})});he();function ho(e,t){let n=e.trim();return n?t?.trimLeadingPattern?n.replace(t.trimLeadingPattern,"").toLowerCase():n.toLowerCase():""}function P4(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 MC(e,t){return Math.min(64,Math.max(0,e.length-t.length))}function A4(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+MC(t,n);if(e.boundaryBase!==void 0){let o=A4(t,n,e.boundaryMarkers??[" ","-","_","/"]);if(o!==null)return e.boundaryBase+o*2+MC(t,n)}if(e.includesBase!==void 0){let o=t.indexOf(n);if(o!==-1)return e.includesBase+o*2+MC(t,n)}if(e.fuzzyBase!==void 0){let o=P4(t,n);if(o!==null)return e.fuzzyBase+o}return null}function E4(e,t){let n=e.score-t.score;return n!==0?n:e.tieBreaker.localeCompare(t.tieBreaker)}function R4(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;E4(t,a)<0?o=r:n=r+1}return n}function Eg(e,t,n){if(n<=0)return;let o=R4(e,t);if(e.length<n){e.splice(o,0,t);return}o>=n||(e.splice(o,0,t),e.pop())}function NC(e,t){let n=e.name.toLowerCase(),o=ma(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 rN(e,t,n=Number.POSITIVE_INFINITY){let o=e.filter(i=>i.enabled),r=ho(t,{trimLeadingPattern:/^\$+/});if(!r)return o;let a=[];for(let i of o){let s=NC(i,r);s!==null&&Eg(a,{item:i,score:s,tieBreaker:`${ma(i).toLowerCase()}\0${i.name}`},n)}return a.map(i=>i.item)}function M4(e,t){if(e.type==="skill"){if(t==="skill")return 0;let a=t.startsWith("skill:")?t.slice(6):t,i=a?NC(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 aN(e,t,n=[]){let o=ho(t,{trimLeadingPattern:/^\/+/});if(!o)return[...e];let r=[];for(let a of e){let i=M4(a,o);if(i===null)continue;let s=n.includes(a.id)?i-1:i;Eg(r,{item:a,score:s,tieBreaker:a.type==="slash-command"?`0\0${a.command}`:a.type==="provider-slash-command"?`1\0${a.command.name}\0${a.provider}`:`2\0${a.skill.name}\0${a.provider}`},Number.POSITIVE_INFINITY)}return r.map(a=>a.item)}function iN(e,t){let n=new Map(e.map(s=>[s.id,s])),o=t.map(s=>n.get(s)).filter(s=>s!==void 0).slice(0,3).map(s=>({...s,section:"recent"})),r=new Set(o.map(s=>s.id)),a=e.filter(s=>!r.has(s.id)),i=s=>s.type==="slash-command"?"builtIn":s.type==="provider-slash-command"?"provider":"skills";return[...o,...a.map(s=>({...s,section:i(s)}))]}function _C(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}var sN=(e,t,n)=>n.endsWith(" ")&&e[t]===" "?t+1:t;function Rg(e){return e===null?null:`${e.kind}:${e.rangeStart}:${e.rangeEnd}:${e.query}`}function lN({prompt:e,selectedProvider:t,selectedProviderStatus:n,planModeUiEnabled:o,showSkillsInSlashMenu:r,recentSlashCommandIds:a,environmentId:i,gitCwd:s,useComposerPathSearch:l,readComposerSnapshot:d,applyPromptReplacement:c,onInteractionModeChange:f,onOpenModelPicker:p,onSlashCommandUsed:m}){let{t:g}=ye(),[h,v]=Q(()=>Ao(e,e.length)),[y,x]=Q(null),[C,w]=Q(null),[T,S]=Q(null),L=y!==null&&Rg(h)===y?null:h,k=L?.kind==="path"?L.query:"",I=L?.kind==="path",P=l({environmentId:i,cwd:I?s:null,query:I?k:null}),E=q(()=>{if(!L)return[];if(L.kind==="path")return P.entries.map(ee=>({id:`path:${ee.kind}:${ee.path}`,type:"path",path:ee.path,pathKind:ee.kind,label:N4(ee.path),description:ee.path.slice(0,Math.max(0,ee.path.lastIndexOf("/")))}));if(L.kind==="slash-command"){let ee=[{id:"slash:model",type:"slash-command",command:"model",label:"/model",description:g("composer.switchModelDesc")},...o?[{id:"slash:plan",type:"slash-command",command:"plan",label:"/plan",description:g("composer.planDesc")},{id:"slash:default",type:"slash-command",command:"default",label:"/default",description:g("composer.defaultDesc")}]:[]],j=nM(n?.skills??[],r),Z=oM(n?.slashCommands??[],j).map(pe=>({id:`provider-slash-command:${t}:${pe.name}`,type:"provider-slash-command",provider:t,command:pe,label:`/${pe.name}`,description:pe.description??pe.input?.hint??g("composer.runProviderCommand")})),de=L.query.trim().toLowerCase(),B=j.map(pe=>({id:`skill:${t}:${pe.name}`,type:"skill",provider:t,skill:pe,label:`/skill:${pe.name}`,description:pe.shortDescription??pe.description??(pe.scope?g("composer.skillScopeDescription",{scope:pe.scope}):"")})),X=[...ee,...Z,...B];return de===""?iN(X,a):aN(X,de,a)}return L.kind==="skill"?rN(n?.skills??[],L.query).map(ee=>({id:`skill:${t}:${ee.name}`,type:"skill",provider:t,skill:ee,label:ma(ee),description:ee.shortDescription??ee.description??(ee.scope?g("composer.skillScopeDescription",{scope:ee.scope}):g("composer.runProviderSkill"))})):[]},[L,o,a,t,n,r,g,P.entries]),_=!!L,A=L?`${L.kind}:${L.query.trim().toLowerCase()}`:null,H=q(()=>{let ee=_C({items:E,highlightedItemId:C,currentSearchKey:A,highlightedSearchKey:T});return E.find(j=>j.id===ee)??null},[E,C,A,T]),V=R(()=>{let ee=d(),j=Ao(ee.value,ee.expandedCursor),Z=y!==null&&Rg(j)===y?null:j;return{snapshot:ee,trigger:Z}},[d,y]),J=R(ee=>{let{snapshot:j,trigger:Z}=V();if(!Z)return;if((ee.type==="slash-command"||ee.type==="provider-slash-command"||ee.type==="skill")&&m?.(ee.id),ee.type==="path"){let pe=`${Eu(ee.path)} `,le=sN(j.value,Z.rangeEnd,pe);c(Z.rangeStart,le,pe,{expectedText:j.value.slice(Z.rangeStart,le)})&&w(null);return}if(ee.type==="slash-command"){if(ee.command==="model"){c(Z.rangeStart,Z.rangeEnd,"",{expectedText:j.value.slice(Z.rangeStart,Z.rangeEnd),focusEditorAfterReplace:!1})&&(w(null),p());return}f(ee.command==="plan"?"plan":"default"),c(Z.rangeStart,Z.rangeEnd,"",{expectedText:j.value.slice(Z.rangeStart,Z.rangeEnd)})&&w(null);return}let de=ee.type==="provider-slash-command"?`/${ee.command.name} `:`$${ee.skill.name} `,B=sN(j.value,Z.rangeEnd,de);c(Z.rangeStart,B,de,{expectedText:j.value.slice(Z.rangeStart,B)})&&w(null)},[c,f,p,m,V]);W(()=>{if(!_){w(null),S(null);return}let ee=_C({items:E,highlightedItemId:C,currentSearchKey:A,highlightedSearchKey:T});w(j=>j===ee?j:ee),S(j=>j===A?j:A)},[C,T,E,_,A]);let D=R(ee=>{w(ee),S(A)},[A]),ne=R(()=>{let{trigger:ee}=V();return ee===null?!1:(x(Rg(ee)),w(null),!0)},[V]),F=R((ee,j)=>{let Z=Xo(ee,j),de=Ao(ee,Z);v(de);let B=Rg(de);x(X=>X!==null&&X!==B?null:X),w(null),S(null)},[]),U=R(()=>{w(null)},[]);return{composerTrigger:h,menuTrigger:L,composerMenuItems:E,composerMenuOpen:_,composerMenuSearchKey:A,activeComposerMenuItem:H,resolveActiveComposerTrigger:V,onSelectComposerItem:J,onComposerMenuItemHighlighted:D,onMenuEscape:ne,resetForDocumentChange:F,dismissTrigger:U,workspaceEntries:P,highlightedItemId:C,setTrigger:v,setHighlightedItemId:w,setHighlightedSearchKey:S}}function N4(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function _4(e,t){return e.bottom===t.bottom&&e.left===t.left&&e.maxHeight===t.maxHeight&&e.width===t.width&&e.overlap===t.overlap}function dN(e){let t=jt(),n=Af(),o=t.pane.useActive(),[r,a]=Q(null);return Ce(()=>{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,h=(Number.parseFloat(window.getComputedStyle(c??i).getPropertyValue("--chat-composer-drawer-inset"))||1.375)*m,v=m+1,y={bottom:window.innerHeight-p.top-v,left:p.left+h,maxHeight:Math.max(96,p.top-24+v),width:Math.max(0,p.width-h*2),overlap:v};a(x=>x&&_4(x,y)?x:y)};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:n,"data-composer-drawer-layer":"true",style:{position:"fixed",zIndex:45,pointerEvents:"auto",clipPath:`inset(0 0 ${r.overlap}px 0)`,bottom:r.bottom,left:r.left,maxHeight:r.maxHeight,width:r.width},children:e.children}),document.body)}var D4=[],O4=[],F4=e=>e.prompt,B4=(e,t)=>{let n=new Map(e.map(o=>[o.id,o]));return t.flatMap(o=>{let r=n.get(o);return r?[r]:[]})},z4=(e,t)=>e.length===t.length&&e.every((n,o)=>n.id===t[o]),cN=ve(function(t){let{handleRef:n,api:o,composerDraftTarget:r,composerDocumentKey:a,promptRef:i,editorRef:s,menuAnchor:l,resolvedTheme:d,selectedProvider:c,selectedProviderStatus:f,planModeUiEnabled:p,showSkillsInSlashMenu:m,recentSlashCommandIds:g,environmentId:h,gitCwd:v,onSlashCommandUsed:y,onOpenModelPicker:x,onInteractionModeChange:C,onToggleInteractionMode:w,activePendingProgress:T,activePendingRequestId:S,hasPendingUserInputs:L,changeUserInputCustomAnswer:k,terminalContexts:I,showTerminalContexts:P,showEditor:E,isApprovalState:_,editorClassName:A,placeholder:H,disabled:V,onPaste:J,onSubmit:D,isMobileViewport:ne,isDraftRoute:F,stashMenuOpen:U,stashEntries:ee,onRestoreStashEntry:j,onDeleteStashEntry:Z,onCloseStashMenu:de,onPromptEdited:B,onUnclaimedEscape:X}=t,{t:pe}=ye(),le=o.draft.useThreadDraftSelector(r,F4),re=o.draft.useStore,we=re(Se=>Se.setPrompt),Xe=re(Se=>Se.setTerminalContexts),ot=re(Se=>Se.removeTerminalContext),at=Po(le,le.length),je=Xa(a,le,{cursor:at,expandedCursor:le.length}),[oe,Te]=Q(()=>({documentKey:a,cursor:je.cursor})),Y=oe.documentKey===a?oe.cursor:je.cursor,me=R(Se=>{Te(Re=>{let qe=Re.documentKey===a?Re.cursor:Xa(a,i.current).cursor,pt=typeof Se=="function"?Se(qe):Se,st=i.current,it=Xo(st,pt);return sM(a,st,pt,it),Re.documentKey===a&&Re.cursor===pt?Re:{documentKey:a,cursor:pt}})},[a,i]),ge=N(!1),G=N(!1),Ye=N([]),ht=N(null),Mt=R(Se=>{we(r,Se)},[r,we]),Dt=R((Se,Re,qe,pt,st)=>{k(Se,Re,qe,pt,st),i.current=Re},[k,i]),Nt=R((Se,Re,qe,pt)=>{let st=i.current,it=Math.max(0,Math.min(st.length,Se)),kt=Math.max(it,Math.min(st.length,Re));if(pt?.expectedText!==void 0&&st.slice(it,kt)!==pt.expectedText)return!1;let Vt=$R(i.current,Se,Re,qe),Pe=Po(Vt.text,Vt.cursor),Et=Xo(Vt.text,Pe);i.current=Vt.text;let yt=T?.activeQuestion;return yt&&L?Dt(yt.id,Vt.text,Pe,Et,!1):Mt(Vt.text),me(Pe),sn(Ao(Vt.text,Et)),pt?.focusEditorAfterReplace!==!1&&window.requestAnimationFrame(()=>{s.current?.focusAt(Pe)}),!0},[T?.activeQuestion,s,L,Dt,i,me,Mt]),Ot=R(()=>{let Se=s.current?.readSnapshot();return Se||{value:i.current,cursor:Y,expandedCursor:Xo(i.current,Y),terminalContextIds:I.map(Re=>Re.id)}},[Y,s,i,I]),At=lN({prompt:le,selectedProvider:c,selectedProviderStatus:f,planModeUiEnabled:p,showSkillsInSlashMenu:m,recentSlashCommandIds:g,environmentId:h,gitCwd:v,useComposerPathSearch:o.pathSearch.useComposerPathSearch,readComposerSnapshot:Ot,applyPromptReplacement:Nt,onInteractionModeChange:C,onOpenModelPicker:x,onSlashCommandUsed:y}),{composerTrigger:xt,composerMenuItems:_t,composerMenuOpen:Xt,activeComposerMenuItem:mn,resolveActiveComposerTrigger:Hn,onComposerMenuItemHighlighted:vt,onMenuEscape:qt,workspaceEntries:an,highlightedItemId:kn,setTrigger:sn,setHighlightedItemId:Cn}=At,$n=xt?.kind??null,$=xt?.kind==="path"?xt.query:"",ae=T?T.customAnswer:le,ce=_?"":ae,Le=At.resetForDocumentChange;W(()=>{Le(ae,Y)},[a,Le,ae,Y]),G.current=Xt,Ye.current=_t,ht.current=mn;let ze=$n==="path"&&$.length>0&&an.isPending===!0,ft=q(()=>pe($n==="skill"?"composer.noSkillsFound":$n==="path"?"composer.noMatchingFiles":"composer.noMatchingCommand"),[$n]),gn=R(Se=>{let Re=I.findIndex(st=>st.id===Se);if(Re<0)return;let qe=o.terminalContext.removeInlinePlaceholder(i.current,Re);i.current=qe.prompt,Mt(qe.prompt),ot(r,Se);let pt=Po(qe.prompt,qe.cursor);me(pt),sn(Ao(qe.prompt,qe.cursor))},[o.terminalContext,r,i,ot,me,Mt,I,sn]);Ce(()=>{i.current=le,me(Se=>mr(le,Se))},[a,le,i,me]),W(()=>{B(le)},[B,le]),W(()=>{Xt&&de()},[Xt,de]);let lt=N(null);W(()=>{let Se=T?.customAnswer;if(typeof Se!="string"){if(lt.current!==null){i.current=le;let kt=Po(le,le.length);me(kt),sn(Ao(le,Xo(le,kt)))}lt.current=null;return}let Re=S,qe=T?.activeQuestion?.id??null,pt=lt.current?.requestId!==Re||lt.current?.questionId!==qe,st=i.current!==Se;if(lt.current={requestId:Re,questionId:qe},!pt&&!st)return;i.current=Se;let it=Po(Se,Se.length);me(it),sn(Ao(Se,Xo(Se,it))),Cn(null)},[T?.customAnswer,T?.activeQuestion?.id,S,le,i]);let hn=R((Se,Re,qe,pt,st)=>{if(T?.activeQuestion&&L){if(T.activeQuestion.allowFreeform===!1)return;me(Re),sn(pt?null:Ao(Se,qe)),Dt(T.activeQuestion.id,Se,Re,qe,pt);return}i.current=Se,Mt(Se),z4(I,st)||Xe(r,B4(I,st)),me(Re),sn(pt?null:Ao(Se,qe))},[T?.activeQuestion,L,Dt,i,me,Mt,r,I,Xe,sn]),Ft=At.onSelectComposerItem,rt=R(Se=>{ge.current||(ge.current=!0,window.requestAnimationFrame(()=>{ge.current=!1}),Ft(Se))},[Ft]),Zt=R(Se=>{if(_t.length===0)return;let Re=_t.findIndex(kt=>kt.id===kn),st=((Re>=0?Re:Se==="ArrowDown"?-1:0)+(Se==="ArrowDown"?1:-1)+_t.length)%_t.length,it=_t[st];Cn(it?.id??null)},[kn,_t,Cn]),ln=(Se,Re)=>{if(Se==="Escape")return Re.isComposing||Re.keyCode===229?!1:qt()||(X?.()??!1);if(Se==="Tab"&&Re.shiftKey)return p?(w(),!0):!1;let{trigger:qe}=Hn();if(G.current||qe!==null){let it=Ye.current,kt=ht.current??it[0];if(Se==="ArrowDown"&&it.length>0)return Zt("ArrowDown"),!0;if(Se==="ArrowUp"&&it.length>0)return Zt("ArrowUp"),!0;if((Se==="Enter"||Se==="Tab")&&kt)return rt(kt),!0}let st=Se==="Enter"?zR({isMobileViewport:ne,shiftKey:Re.shiftKey,modifierKey:Re.metaKey||Re.ctrlKey,isDraftThread:F}):null;return st?(D(void 0,st),!0):!1};return or(n,()=>({readSnapshot:Ot,readDraftPrompt:()=>le,applyPromptReplacement:Nt,syncCursor:(Se,Re)=>{me(Se),sn(Re)},resetCursorState:Se=>{let Re=Se?.prompt??i.current,qe=mr(Re,Se?.cursor??0);Cn(null),me(qe),sn(Se?.detectTrigger?Ao(Re,Xo(Re,qe)):null)}}),[Nt,le,i,Ot,me,Cn,sn]),b(ke,{children:[U&&!Xt&&!_&&u(dN,{anchor:l,children:u(oN,{entries:ee,onRestore:j,onDelete:Z,onClose:de})}),Xt&&!_&&u(dN,{anchor:l,children:u(ZM,{items:_t,resolvedTheme:d,isLoading:ze,triggerKind:$n,emptyStateText:ft,activeItemId:mn?.id??null,onHighlightedItemChange:vt,onSelect:rt})}),E?u(Sg,{editorRef:s,documentKey:a,value:ce,cursor:Y,terminalContexts:P?I:D4,skills:f?.skills??O4,...A?{className:A}:{},onRemoveTerminalContext:gn,onChange:hn,onCommandKeyDown:ln,onPaste:J,placeholder:H,disabled:V}):null]})});he();function uN(e){return e==="ready"}function fN(e){return e==="ready"||e==="unchecked"||e==="checking"}function pN(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 Mg(e){return e.enabled&&fN(e.readiness)}function Hu(e){return e.enabled}function mN(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 gN=e=>e.enabled;function hN(e,t){let n=e.find(o=>o.instanceId===t);if(n)return n.driverKind}var vN="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 Yo({className:e,size:t="sm",variant:n="ghost",...o}){return u(ie,{className:K(vN,e),size:t,variant:n,...o})}function Jo({icon:e,className:t,opticalSize:n="default"}){return u(e,{"aria-hidden":"true",className:K("shrink-0",n==="large"?"size-4.5":"size-4",t),"data-composer-control-icon":!0})}function ga(){return u(rn,{"aria-hidden":"true",className:"-mx-0.5 size-icon-2 shrink-0 text-icon-muted","data-composer-control-chevron":!0,strokeWidth:2.25})}function Ng({className:e,size:t="sm",variant:n="ghost",...o}){return u(uS,{className:K(vN,e),icon:u(ga,{}),size:t,variant:n,...o})}function DC(e,t){if(!e)return t("composer.agentPickerLabel");let n=e.agentName?.trim(),o=e.displayName.trim();return n?!o||o===n?n:`${n} \xB7 ${o}`:o}function OC(e,t){let n=e.filter(Hu),o=t.lockedProvider;if(o==null||o.length===0)return n;let r=t.lockedContinuationGroupKey;return n.filter(a=>a.driverKind===o&&(!r||a.continuationGroupKey===r))}var FC=ve(function(t){let{t:n}=ye(),o=t.instanceEntries.filter(Hu),r=t.unavailableInstanceId??null,a=r===null?null:t.instanceEntries.find(c=>c.instanceId===r)??null,i=t.notChosen===!0&&r===null,s=r!==null||i?null:o.find(c=>c.instanceId===t.activeInstanceId)??null,l=t.lockedProvider!=null&&t.lockedProvider.length>0,d=r!==null||i?OC(t.instanceEntries,t):o;return b(_o,{children:[b(Oo,{render:u(Yo,{"aria-label":n("composer.agentPickerLabel"),"data-composer-agent-picker":"true",disabled:t.disabled||l&&r===null||d.length===0,className:K("min-w-0 justify-between whitespace-nowrap",t.compact?"max-w-36 shrink-0":"max-w-44 shrink")}),children:[r!==null?u(Pn,{"aria-hidden":"true",className:"size-4 shrink-0 text-warning"}):i?null:s?u(wr,{driver:s.driverKind,displayName:s.displayName,accentColor:s.accentColor,className:"size-4",iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,r!==null?b("span",{className:"min-w-0 truncate text-warning","data-composer-agent-unavailable":"true",children:[a===null?r:DC(a,n)," \xB7 ",n("composer.agentUnavailableBadge")]}):i?u("span",{className:"min-w-0 truncate","data-composer-agent-not-chosen":"true",children:n("composer.agentChoosePlaceholder")}):u("span",{className:"min-w-0 truncate",children:DC(s,n)}),u(ga,{})]}),u(Do,{align:"start",children:u(Sr,{value:r!==null||i?"":t.activeInstanceId,onValueChange:c=>{!c||r===null&&!i&&c===t.activeInstanceId||t.onInstanceChange(c)},children:d.map(c=>u(Vo,{value:c.instanceId,children:DC(c,n)},c.instanceId))})})]})});function yN(e){return u(FC,{...e})}function xN(e){return e.machineUnavailable?"machineDisconnected":e.sessionStarted&&e.sessionDisconnected?"settled":"default"}function CN(e){switch(e){case"machineDisconnected":return"composer.disconnectedPlaceholder";case"settled":return"composer.idlePlaceholder";case"default":return null}}he();he();he();var nb=qd(IN(),1),i_=qd(_c(),1),s_=qd(_c(),1);Wn(function(t,n){return De("div",{ref:n,...t})});var Kg=Wn(function(t,n){return De("div",{ref:n,...t})}),vr=Kg,ti={OS:"web"};function tl(e,t){return t===void 0?e:Math.max(0,Math.min(t,e))}function ob(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 l_(){return"normal"}function Q4(e){var t;return(t=e?.horizontalRTLScrollType)!=null?t:l_()}function X4(e){var t;return(t=e?.rtl)!=null?t:!1}function oi(e){return rb(e?.props)}function rb(e){return!!e?.horizontal&&X4(e)}function ab(e){return e?.horizontal?(rb(e)?e.stylePaddingLeft:e.stylePaddingRight)||0:e?.stylePaddingBottom||0}function Y4(e,t){var n;return(n=ob(e,t))!=null?n:0}function TN(e,t){return t&&(oi(e)?t.left:t.right)||0}function J4(e,t,n,o){return!oi(e)||o===void 0||!Number.isFinite(o)?t:Math.max(0,o-t-n)}function ib(e,t,n){if(!e||!oi(e))return t;let o=ob(e,n),r=tl(t,o),a=Q4(e);return a==="negative"?r===0?0:-r:a==="inverted"?o===void 0?r:tl(o-r,o):r}function Z4(e,t,n){if(!oi(e))return e.horizontalRTLScrollType=void 0,t;let o=ob(e,n);if(t<0)return e.horizontalRTLScrollType="negative",tl(-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 tl(a,o);if(i==="normal")return tl(r,o);if(!e.hasScrolled){let f=l_();return e.horizontalRTLScrollType=f,tl(r,o)}let s=e.scroll,l=Math.abs(r-s),c=Math.abs(a-s)+.5<l;return e.horizontalRTLScrollType=c?"inverted":"normal",tl(c?a:r,o)}var eW=e=>e,qg=bt(null),d_="\0",tW=0;function nW({children:e}){let[t]=Q(()=>({animatedScrollY:eW(0),columnWrapperStyle:void 0,containerLayoutTriggers:new Map,contextNum:tW++,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 De(qg.Provider,{value:t},e)}function Hr(){return Ut(qg)}function c_(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=be(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(Za(e,i,r));return()=>{for(let i of a)i()}}}}function oW(e){return e.length===1?e[0]:e.join(d_)}function rW(e){return e.split(d_)}function Za(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 be(e,t){let{values:n}=e;return n.get(t)}function Be(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 aW(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 iW(e,t,n){let{positionListeners:o}=e,r=o.get(t);if(r)for(let a of r)a(n)}function er(e){let t=Ut(qg),n=oW(e),{subscribe:o,get:r}=q(()=>c_(t,rW(n)),[t,n]);return(0,nb.useSyncExternalStore)(o,r,r)}function sW(e,t){let n=Ut(qg),{subscribe:o,get:r}=q(()=>c_(n,[e]),[n,e]),a=R(()=>t(r()[0]),[r,t]);return(0,nb.useSyncExternalStore)(o,a,a)}function lW(e){return Math.max(0,e??0)}function ol(e,t){var n;let o=e.state,{props:r}=o,a=r.horizontal,i=r.contentInset,s=i??o.nativeContentInset,l=(a?TN(o,s):s?.bottom)||0,d=lW(t??r.contentInsetEndAdjustment),c=be(e,"anchoredEndSpaceSize"),f=r.anchoredEndSpace&&c?c:0,p=(n=o.contentInsetOverride)!=null?n:void 0,m=l+d;if(p){let g={bottom:0,left:0,right:0,...s,...p};return Math.max(((a?TN(o,g):g.bottom)||0)+d,f)}return Math.max(m,f)}function vo(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=ol(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 Ld=({children:e})=>De(Kg,{style:{alignItems:"center",flexDirection:"row",justifyContent:"space-between"}},e);ve(function(){let t=Hr(),[n=0,o=0,r=0,a=0,i=0,s=0,l=!1]=er(["totalSize","scrollAdjust","debugRawScroll","debugComputedScroll","numContainers","numContainersPooled","isAtEnd"]),d=vo(t),[,c]=Ea(f=>f+1,0);return dW(()=>{c()},100),De(Kg,{pointerEvents:"none",style:{backgroundColor:"#FFFFFFCC",borderRadius:4,padding:4,paddingBottom:4,paddingLeft:4,position:"absolute",right:0,top:0}},De(Ld,null,De(vr,null,"TotalSize:"),De(vr,null,n.toFixed(2))),De(Ld,null,De(vr,null,"ContentSize:"),De(vr,null,d.toFixed(2))),De(Ld,null,De(vr,null,"At end:"),De(vr,null,String(l))),De(Ld,null,De(vr,null,"ScrollAdjust:"),De(vr,null,o.toFixed(2))),De(Ld,null,De(vr,null,"RawScroll: "),De(vr,null,r.toFixed(2))),De(Ld,null,De(vr,null,"ComputedScroll: "),De(vr,null,a.toFixed(2))))});function dW(e,t){W(()=>{let n=setInterval(e,t);return()=>clearInterval(n)},[t])}var sb=!0,u_=new WeakMap;function cW(e){return u_.get(e)}function uW(e,t){u_.set(e,t)}var fW=typeof __DEV__<"u"?__DEV__:void 0,kN,LN=typeof process<"u"&&typeof process.env=="object"&&process.env?(kN="production")!=null?kN:process.env.MODE:void 0,PN=typeof LN=="string"?LN.toLowerCase()!=="production":void 0,AN,Zo=(AN=PN??fW)!=null?AN:!1,Pd=-1e7,f_=1,pW=Zo&&!1,mW=Zo&&!1;function Vg({scheduledWork:e}){e.cancel("checkFinishedScrollFrame"),e.cancel("checkFinishedScrollRetryFrame"),e.cancel("checkFinishedScrollFallback"),e.cancel("platformScrollCompletion")}function p_(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 gW(e){Vg(e),e.scheduledWork.cancel("imperativeScrollReady"),e.scrollingTo=void 0,e.scrollTargetPinnedRange=void 0,p_(e)}function hW(e,t,n){return{...t,nativeEvent:{...t.nativeEvent,contentOffset:e.props.horizontal?{x:n,y:0}:{x:0,y:n}}}}function vW(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,hW(i,s,(o=(n=t??i.scrollPending)!=null?n:i.scroll)!=null?o:0)))}var zC=1;function yW(e){return!!(e?.didDispatchNativeScroll||e?.didRetrySilentInitialScroll||e?.watchdog)}function EN(e){e.initialScrollSession=void 0}function VC(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 _g(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=VC({bootstrap:e.initialScrollSession.kind==="bootstrap"?e.initialScrollSession.bootstrap:void 0,completion:e.initialScrollSession.completion,kind:t,previousDataLength:e.initialScrollSession.previousDataLength})):e.initialScrollSession=VC({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){_g(e).didDispatchNativeScroll=!0},markSilentInitialScrollRetry(e){_g(e).didRetrySilentInitialScroll=!0},resetFlags(e){if(!e.initialScrollSession)return;let t=_g(e,e.initialScrollSession.kind);t.didDispatchNativeScroll=void 0,t.didRetrySilentInitialScroll=void 0}},lo={clear(e){lo.set(e,void 0)},didReachTarget(e,t){return Math.abs(e-t.targetOffset)<=zC},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>zC},isAtZeroTargetOffset(e){return e<=zC},set(e,t){var n,o;if(!t&&!((o=(n=e.initialScrollSession)==null?void 0:n.completion)!=null&&o.watchdog))return;let r=_g(e);r.watchdog=t?{startScroll:t.startScroll,targetOffset:t.targetOffset}:void 0}};function ni(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&&!yW(l))return EN(e);let f=(a=(r=t.previousDataLength)!=null?r:i?.previousDataLength)!=null?a:0;return e.initialScrollSession=VC({bootstrap:c,completion:l,kind:s,previousDataLength:f}),e.initialScrollSession}var xW=1.3;function WC(e,t,n){let o=Math.abs(e);return!t&&n>0&&o>=n*xW||!t&&n<=0&&o>0}var m_=(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?WC(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 CW(e,t){let n=e.state;t==="start"?(n.isStartReached=!1,n.startReachedSnapshot=void 0):(n.isEndReached=!1,n.endReachedSnapshot=void 0)}function g_(e){let t=e.state;if(!t.edgeReachedGate)return;let n=vo(e),o=n-t.scroll-t.scrollLength-ol(e),r=n<t.scrollLength,a=t.props.onStartReachedThreshold*t.scrollLength,i=t.props.onEndReachedThreshold*t.scrollLength,s=WC(t.scroll,!1,a),l=WC(o,r,i);s&&l&&(t.edgeReachedGate=void 0)}function h_(e,t,n,o){return!e.state.edgeReachedGate||n===t||!!o}function v_(e){e.state.edgeReachedGate="closed"}function RN(e){e.state.edgeReachedGate&&(e.state.edgeReachedGate="prepared")}function bW(e,t){let n=e.state;if(n.edgeReachedGate!=="prepared")return;let o=t<0?"start":"end";return n.edgeReachedGate="closed",CW(e,o),o}function qu(e){return!!e?.initialScroll&&!e.didFinishInitialScroll}function y_(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=vo(e);if(g_(e),f>0&&a){let p=ol(e),m=f-s-i-p,g=f<i;Be(e,"isAtEnd",g||m<=f_),Be(e,"isNearEnd",g||m<=c*i),Be(e,"isWithinMaintainScrollAtEndThreshold",g||m<=d*i),qu(r)||l||(r.isEndReached=m_(m,g,c*i,r.isEndReached,r.endReachedSnapshot,{contentSize:f,dataLength:(o=r.props.data)==null?void 0:o.length,scrollPosition:s},v=>{var y,x;h_(e,"end",t,n)&&(v_(e),(x=(y=r.props).onEndReached)==null||x.call(y,{distanceFromEnd:v}))},v=>{r.endReachedSnapshot=v}))}}function wW(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;g_(e),r&&p>0&&s>p&&d&&(d.contentSize!==c||d.dataLength!==f)&&(o.isStartReached=!1,o.startReachedSnapshot=void 0),Be(e,"isAtStart",s<=f_),Be(e,"isNearStart",s<=p),qu(o)||o.scrollingTo||(o.isStartReached=m_(s,!1,p,o.isStartReached,d,{contentSize:c,dataLength:f,scrollPosition:s},g=>{var h,v;h_(e,"start",t,n)&&(v_(e),(v=(h=o.props).onStartReached)==null||v.call(h,{distanceFromStart:g}))},g=>{o.startReachedSnapshot=g}))}function Gg(e,t){let n=!e.state.edgeReachedGate;y_(e,t,n),wW(e,t,n)}function x_(e){var t,n;let o=e.state;(t=o.props)!=null&&t.data&&((n=o.triggerCalculateItemsInView)==null||n.call(o,{forceFullItemPositions:!0})),Gg(e)}var SW=6,IW=3,TW=250;function C_(e){e.state.scheduledWork.cancel("adaptiveRender")}function MN(e,t){let n=e.state;C_(e),t<=0?ju(e,"normal","scroll"):n.scheduledWork.timeout(()=>ju(e,"normal","scroll"),t,"adaptiveRender")}function ju(e,t,n){var o,r;be(e,"adaptiveRender")!==t&&(Be(e,"adaptiveRender",t),(r=(o=e.state.props.adaptiveRender)==null?void 0:o.onChange)==null||r.call(o,t,n))}function lb(e){var t,n;C_(e);let o=(n=(t=e.state.props.adaptiveRender)==null?void 0:t.initialMode)!=null?n:"normal";be(e,"adaptiveRender")!==o&&ju(e,o,"initial")}function kW(e,t,n){var o,r,a;let i=e.state,s=i.props.adaptiveRender,l=be(e,"adaptiveRender");if(be(e,"readyToRender"))if(s){let d=(o=s.enterVelocity)!=null?o:SW,c=(r=s.exitVelocity)!=null?r:IW,f=(a=s.exitDelay)!=null?a:TW,p=l==="light"?c:d,m=n?.forceLight||Math.abs(t)>p?"light":"normal",g=i.scheduledWork.has("adaptiveRender")?"normal":l;m!==g&&(m==="light"?(ju(e,"light","scroll"),MN(e,f)):l==="light"&&MN(e,f))}else lb(e)}var db=50;function b_(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"&&!be(e,"readyToRender")&&!a?Math.min(o,db):o}function w_(e){let{state:t}=e;t.props.drawDistance<=db||t.scheduledWork.has("fullDrawDistancePrewarm")||t.scheduledWork.frame(()=>{var n;return(n=t.triggerCalculateItemsInView)==null?void 0:n.call(t)},"fullDrawDistancePrewarm")}function cb(e,{resetLayout:t,resetInitialScroll:n}){let{state:o}=e;t&&(o.didContainersLayout=!1,o.queuedInitialLayout=!1),n&&(o.didFinishInitialScroll=!1),Be(e,"readyToRender",!1),lb(e)}function ub(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&&!be(e,"readyToRender")&&(Be(e,"readyToRender",!0),ju(e,"normal","ready"),o.props.drawDistance>db&&w_(e),o.didLoad||(o.didLoad=!0,a&&a({elapsedTimeInMs:Date.now()-r})))}var LW=2e3;function NN(e,t){e.scroll=t,e.scrollPending=t,e.scrollPrev=t}function S_(e){e.scheduledWork.cancel("preservedInitialScroll")}function Ad(e){S_(e),e.clearPreservedInitialScrollOnNextFinish=void 0,e.initialScroll=void 0,ni(e)}function _N(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&&(Vg(r),r.scrollingTo=void 0,r.scrollTargetPinnedRange=void 0),Wg.resetFlags(r),ni(r,{bootstrap:null}),Ed(e))}function Ed(e,t){var n,o,r;let a=e.state;if(t?.resolvedOffset!==void 0)NN(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)&&NN(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;lo.clear(a),t?.preserveTarget&&a.initialScroll?(a.clearPreservedInitialScrollOnNextFinish=void 0,ni(a),S_(a),t?.schedulePreservedTargetClear&&a.scheduledWork.timeout(()=>{var g;!a.didFinishInitialScroll||(g=a.scrollingTo)!=null&&g.isInitialScroll||!a.initialScroll||Ad(a)},LW,"preservedInitialScroll")):Ad(a),t?.recalculateItems&&x_(e),ub(e,{didInitialScroll:!0}),p&&vW(e,m),(f=t?.onFinished)==null||f.call(t)};if(t?.waitForCompletionFrame){requestAnimationFrame(i);return}i()}function jg(e,t){let n=e.state;return t!==void 0&&n.positions[t]||0}function PW(e){let{state:t}=e;return(t.props.horizontal?(oi(t)?t.props.stylePaddingRight:t.props.stylePaddingLeft)||0:be(e,"stylePaddingTop")||0)+(be(e,"alignItemsAtEndPadding")||0)+(be(e,"headerSize")||0)}function Qt(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 AW(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 EW(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-AW(e)-ol(e)):0}function sl(e){let t=be(e,"alignItemsAtEndPadding")||0,n=EW(e);t!==n&&Be(e,"alignItemsAtEndPadding",n)}function Vu(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&&Be(e,"totalSize",i),sl(e)):o&&e.values.get("totalSize")!==i&&Be(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&&Vu(e,t,s,o),a.set(t,n)}function I_(e){return typeof e=="function"}function Qg(e){return Array.isArray(e)}var DN=new Set;function nl(e,t){Zo&&!DN.has(e)&&(DN.add(e),console.warn(`[legend-list] ${t}`))}function Qu(e){return Math.floor(e*8)/8}function Wu(e){return e==null}function ON(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 Ku(e,t,n){return ON(e,n)+ON(t,n)}function jC(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=be(e,"numContainers");for(let i=0;i<a;i++)if(be(e,`containerItemKey${i}`)===t)return i;return-1}function T_(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 k_(e,t){let n=Qt(e.state,t);return T_(e,n,t,e.state.props.data[t])}function RW(e,t,n){for(let o=t;o<=n;o++)if(k_(e,o)===void 0)return!1;return!0}function yo(e,t,n,o,r,a,i,s){var l,d,c,f;let p=e.state,{sizes:m,averageSizes:g,props:{estimatedItemSize:h,getItemType:v},scrollingTo:y}=p,x=p.sizesKnown.get(t);if(x!==void 0)return x;let C,w=m.get(t);if(a&&w!==void 0)return w;if(C=T_(e,t,n,o,s),C!==void 0)return GC(e,t,C,i),C;let T=(d=s?.itemType)!=null?d:v&&(l=v(o,n))!=null?l:"";if(r&&!y){let S=(c=g[T])==null?void 0:c.avg;S!==void 0&&(C=Qu(S))}if(C===void 0&&w!==void 0)return w;if(C===void 0&&r&&y){let S=(f=y.averageSizeSnapshot)==null?void 0:f[T];S!==void 0&&(C=Qu(S))}return C===void 0&&(C=h+e.scrollAxisGap),GC(e,t,C,i),C}function fb(e,t){if(t===void 0||t<0)return;let n=Qt(e.state,t);return yo(e,n,t,e.state.props.data[t])}function Xg(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=PW(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:yo(e,Qt(r,a),a,r.props.data[a]),m=Math.max(0,p-(c?0:e.scrollAxisGap)),g=ol(e);if(l-=s*(r.scrollLength-g-m),!c&&a===r.props.data.length-1){let h=be(e,"footerSize")||0;l+=h}}return l}function Yi(e,t,n){let o=e.state,r=vo(e),a=t;if(Number.isFinite(r)&&Number.isFinite(o.scrollLength)&&ti.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 Xu(e){var t,n;let o=e.state;if(o?.scrollingTo){Vg(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&&Vu(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;Ed(e,{onFinished:()=>{r?.()},preserveTarget:i&&o.props.data.length===0||s,recalculateItems:!0,schedulePreservedTargetClear:s,syncObservedOffset:i,waitForCompletionFrame:!!a.waitForInitialScrollCompletionFrame});return}x_(e),r?.()}}var MW=80,NW=1500,_W=320,DW=1;function OW(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?vo(e):void 0,m=f?ib(r,s,p):0,g=f?0:s;if(l.scrollTo({animated:c,x:m,y:g}),c){let h=(o=(n=l.getScrollEventTarget)==null?void 0:n.call(l))!=null?o:null;FW(e,{readOffset:()=>l.getCurrentScrollOffset(),target:h,targetOffset:s})}else{r.scroll=s;let h=r.scrollingTo;r.scheduledWork.timeout(()=>{h===r.scrollingTo&&Xu(e)},100,"platformScrollCompletion")}}function FW(e,t){let{readOffset:n,target:o,targetOffset:r}=t;if(!o){Xu(e);return}let a="onscrollend"in o,i,s=!1,{scheduledWork:l,scrollingTo:d}=e.state,c=setTimeout(()=>m("max"),NW),f=()=>{o.removeEventListener("scroll",g),a&&o.removeEventListener("scrollend",h),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 y=n(),x=Math.abs(y-r)<=DW;v==="scrollend"&&!x||(l.cancel("platformScrollCompletion"),Xu(e))},g=()=>{i!==void 0&&clearTimeout(i),i=setTimeout(()=>m("idle"),MW)},h=()=>m("scrollend");o.addEventListener("scroll",g),a?o.addEventListener("scrollend",h):i=setTimeout(()=>m("idle"),_W),l.register("platformScrollCompletion",p)}function Rd(e){let t=e.state,{didContainersLayout:n,pendingNativeMVCPAdjust:o,refScroller:r,props:{maintainScrollAtEnd:a}}=t,s=!!(be(e,"isWithinMaintainScrollAtEndThreshold")&&a&&n);if(o)return t.pendingMaintainScrollAtEnd=s,!1;if(s){if(t.pendingMaintainScrollAtEnd=!1,vo(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=be(e,"isWithinMaintainScrollAtEndThreshold"),m=t.scroll!==f;if(p||!m){t.maintainingScrollAtEnd=c;let g=r.current;if(t.props.horizontal&&oi(t)){let h=vo(e),v=Y4(t,h),y=ib(t,v,h);g?.scrollTo({animated:a.animated,x:y,y:0})}else g?.scrollToEnd({animated:a.animated});setTimeout(()=>{t.maintainingScrollAtEnd===c&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd&&Rd(e))},a.animated?500:0)}else t.maintainingScrollAtEnd===d&&(t.maintainingScrollAtEnd=void 0,t.pendingMaintainScrollAtEnd=!1)})}return!0}return t.pendingMaintainScrollAtEnd=!1,!1}function ll(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,be(e,"readyToRender")?r():(o.adjustingFromInitialMount=(o.adjustingFromInitialMount||0)+1,requestAnimationFrame(r))}}var Eo=.1,BW=300,zW=2,UW=1;function HW(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 $W(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)<=Eo&&d?.id===n?d.quietPasses+1:0;if(!r&&c>=zW){e.mvcpAnchorLock=void 0;return}e.mvcpAnchorLock={expiresAt:a+BW,id:n,position:o,quietPasses:c}}}function KW(e,t,n,o,r,a){return!1}function qW(e,t,n){if(Math.abs(t)<=Eo)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 VW(e,t){return e<0?-t:t}function UC(e,t,n){let o=e.state;o.pendingNativeMVCPAdjust=void 0;let r=t-n;Math.abs(r)>Eo&&ll(e,r)}function WW(e){let t=e.state,n=t.pendingNativeMVCPAdjust;if(!n||Math.abs(n.manualApplied)>Eo)return;let o=vo(e),r=qW(t,n.amount,o);if(Math.abs(r)<=Eo)return;let a=n.amount-r;Math.abs(a)<=Eo||(n.manualApplied=a,ll(e,a),n.furthestProgressTowardAmount=0)}function GW(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>Eo||r>0&&a<-Eo,s=VW(r,a);if(Math.abs(r)<=Eo)return n.pendingNativeMVCPAdjust=void 0,!0;if(i)return n.pendingNativeMVCPAdjust=void 0,!1;if(s+Eo>=Math.abs(r))return UC(e,r,a),!0;let l=Math.max(0,vo(e)-n.scrollLength);return Math.abs(t-l)<=UW||n.pendingMaintainScrollAtEnd&&be(e,"isWithinMaintainScrollAtEndThreshold")&&s>Eo?(UC(e,r,a),!0):s>o.furthestProgressTowardAmount+Eo?(o.furthestProgressTowardAmount=s,!1):(o.furthestProgressTowardAmount>Eo&&s<o.furthestProgressTowardAmount-Eo&&(n.pendingNativeMVCPAdjust=void 0),!1)}function jW(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=HW(n,c,i,d),m,g,h=[],v=f?.index,y=f?.viewPosition,x=v!==void 0&&n.props.data.length>0&&v>=n.props.data.length-1&&(y??0)>0,C=t?i:s,w=n.indexByKey,T=n.scroll;if(vo(e),C){if(p&&v===void 0?(g=p.id,m=p.position):v!==void 0?g=Qt(n,v):o.length>0&&n.didContainersLayout&&!t&&(g=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],k=w.get(L);if(k!==void 0){let I=r[k];I!==void 0&&h.push({id:L,position:I})}}if(g!==void 0&&m===void 0){let S=w.get(g);S!==void 0&&(m=r[S])}return()=>{let S=0,L=p?.id,k,I=!1,P=n.props.data;if(t&&i&&v===void 0&&g!==void 0&&p?.id===g&&l!==void 0&&g!==void 0){let A=w.get(g);if(A!==void 0){let H=P[A];I=H===void 0||!l(H,A,P),I&&p?.id===g&&(n.mvcpAnchorLock=void 0)}}if(t&&i&&v===void 0&&(()=>{if(g===void 0||I)return!0;let A=w.get(g);return A===void 0||r[A]===void 0})())for(let A=0;A<h.length;A++){let{id:H,position:V}=h[A],J=w.get(H);if(J!==void 0&&l){let ne=P[J];if(ne===void 0||!l(ne,J,P))continue}let D=J!==void 0?r[J]:void 0;if(D!==void 0){S=D-V,L=H,k=D;break}}if(!I&&g!==void 0&&m!==void 0){let A=w.get(g),H=A!==void 0?r[A]:void 0;if(H!==void 0){let V=vo(e),J=H-m;if(J!==0&&x&&n.scroll+n.scrollLength>V)if(J>0)J=Math.max(0,V-n.scroll-n.scrollLength);else{let D=Math.max(0,V-n.scrollLength);n.scroll=D,n.scrollPending=D,J=0}S=J,L=g,k=H}}if(y&&y>0){let A=yo(e,g,v,n.props.data[v]),H=f?.itemSize;if(A!==void 0&&H!==void 0&&A!==H){let V=A-H;V!==0&&(S+=V*y,f.itemSize=A)}}if($W(n,{anchorId:L,anchorPosition:k,dataChanged:t,now:d,positionDiff:S}),KW()){n.pendingNativeMVCPAdjust={amount:S,furthestProgressTowardAmount:0,manualApplied:0,startScroll:T},WW(e);return}Math.abs(S)>Eo&&((n.maintainingScrollAtEnd==="pending-animated"||n.maintainingScrollAtEnd==="animated")&&be(e,"isWithinMaintainScrollAtEndThreshold")||ll(e,S))}}}var FN=1e3,QW=200,Yg=e=>{let{scrollHistory:t}=e,n=t.length-1;if(n<1)return 0;let o=t[n];if(Date.now()-o.time>FN)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>FN)break;if(c===0||f<=0)continue;let m=o.time-l.time,g=Math.exp(-m/QW);a+=c/f*g,i+=g}return i>0?a/i:0};function XW(e){let t=e.mvcpAnchorLock;return t?Date.now()>t.expiresAt?(e.mvcpAnchorLock=void 0,!1):!0:!1}function tf(e){return e.dataChangeNeedsScrollUpdate||XW(e)}function rl(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(),g=s!==void 0&&Math.abs(m-s)>.1;if(g&&(d.length=0),a.lastScrollAdjustForHistory=m,c===void 0&&!(d.length===0&&t===a.scroll)&&(g||d.push({scroll:t,time:p})),d.length>5&&d.shift(),i&&!c){let{lt:I,gt:P}=i;if(I&&t<I||P&&t>P){a.ignoreScrollFromMVCPIgnored=!0;return}}a.scrollPrev=f,a.scrollPrevTime=a.scrollTime,a.scroll=t,a.scrollTime=p;let h=Math.abs(t-f),y=!!o?.fromNativeScrollEvent&&h>.1&&!g&&c===void 0&&!a.pendingNativeMVCPAdjust?bW(e,t-f):void 0,x=GW(e,t),C=a.scrollLength,w=C>0&&c===void 0&&h>C&&!a.pendingNativeMVCPAdjust,T=Yg(a);kW(e,T,{forceLight:w});let S=a.scrollLastCalculate;if(tf(a)||x||y!==void 0||n||S===void 0||Math.abs(a.scroll-S)>2){a.scrollLastCalculate=a.scroll,a.ignoreScrollFromMVCPIgnored=!1,a.lastScrollDelta=h;let I=()=>{var E;let _={doMVCP:c!==void 0,scrollVelocity:T};w&&(_.drawDistanceMode="visible-first"),(E=a.triggerCalculateItemsInView)==null||E.call(a,_),Gg(e,y)};w?(a.mvcpAnchorLock=void 0,a.pendingNativeMVCPAdjust=void 0,a.userScrollAnchorReset={keys:new Set},a.scheduledWork.cancel("mvcpRecalculate"),(0,s_.flushSync)(I),w_(e)):I();let P=!!a.pendingMaintainScrollAtEnd||!!((r=a.props.maintainScrollAtEnd)!=null&&r.onDataChange);x&&P&&(a.pendingMaintainScrollAtEnd=!1,Rd(e)),a.dataChangeNeedsScrollUpdate=!1,a.lastScrollDelta=0}}function YW(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 JW(e,t){var n;let{isInitialScroll:o,requestedOffset:r,targetOffset:a}=t,i=lo.get(e),s=!e.didFinishInitialScroll&&(o||!!i)&&lo.hasNonZeroTargetOffset(a),l=!e.didFinishInitialScroll&&!!i&&lo.isAtZeroTargetOffset(r);if(s){e.hasScrolled=!1,lo.set(e,{startScroll:(n=i?.startScroll)!=null?n:e.scroll,targetOffset:a});return}l&&lo.clear(e)}function ZW(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 BN(e,t){var n;let o=e.state.positions[t];if(o===void 0)return;let r=(n=fb(e,t))!=null?n:0;return o+(Number.isFinite(r)?r:0)}function eG(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)):ZW(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=BN(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=BN(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 tG(e,t,n){let o=eG(e,t,n);o?(e.state.scrollTargetPinnedRange=o,e.state.scrollForNextCalculateItemsInView=void 0):e.state.scrollTargetPinnedRange=void 0}function Jg(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;Vg(r);let g=f?c:Xg(e,c,s),h=!!d&&((n=r.initialScrollSession)==null?void 0:n.kind)==="offset",v=Yi(e,g,s),y=h?g:v;if(r.scrollHistory.length=0,!a){d&&Wg.resetFlags(r);let x=YW(r);r.scrollingTo={...s,...x?{averageSizeSnapshot:x}:{},targetOffset:v,waitForInitialScrollCompletionFrame:p},d||tG(e,v,s.index)}r.scrollPending=v,JW(r,{isInitialScroll:d,requestedOffset:y,targetOffset:v}),!d&&!a&&Math.abs(r.scroll-v)>1&&(l?r.scrollTargetPinnedRange&&((o=r.triggerCalculateItemsInView)==null||o.call(r)):rl(e,v,!0,{markHasScrolled:!1})),i||!d||ti.OS==="android"?OW(e,{animated:l,horizontal:m,offset:y}):r.scroll=y}function L_(e,t){return t<=0?-1:e>=t?t-1:e<0?0:e}function Dg(e,{index:t,viewOffset:n=0,animated:o=!0,forceScroll:r,isInitialScroll:a,viewPosition:i}){let s=e.state,{data:l}=s.props;t=L_(t,l.length);let d=fb(e,t),c=jg(e,t);t===l.length-1&&i===void 0&&(i=1),s.scrollForNextCalculateItemsInView=void 0,Jg(e,{animated:o,forceScroll:r,index:t,isInitialScroll:a,itemSize:d,offset:c,viewOffset:n,viewPosition:i??0})}function Zg(e,t){let{forceScroll:n,resolvedOffset:o,target:r,waitForCompletionFrame:a}=t,i=r.index,s=i!==void 0?L_(i,e.state.props.data.length):void 0,l=fb(e,s);Jg(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 al(e,t,n){var o;let{state:r}=e;r.clearPreservedInitialScrollOnNextFinish=void 0,r.scheduledWork.cancel("preservedInitialScroll"),r.initialScroll=t,n?.resetDidFinish&&cb(e,{resetInitialScroll:!0}),ni(r,{kind:((o=r.initialScrollSession)==null?void 0:o.kind)==="offset"?"offset":"bootstrap"})}function Ur(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?jg(e,t.index):0,i=Xg(e,a,t);return Yi(e,i,t)}function P_(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 nG(e,t){var n,o,r;let a=e.state,i=P_(a,{requiresMeasuredLayout:!0});if(!i)return!1;let{initialScroll:s,isInitialScrollInProgress:l,queuedInitialLayout:d}=i,c=l?i.scrollingTo:void 0,f=Ur(e,s),p=c?(n=c.targetOffset)!=null?n:c.offset:void 0,m=s.contentOffset===void 0||Math.abs(s.contentOffset-f)>1,g=p!==void 0&&Math.abs(p-f)>1,h=p!==void 0&&Math.abs(a.scroll-f)<=1&&Math.abs(a.scrollPending-f)<=1;if(!t?.forceScroll&&!m&&l&&!g||t?.forceScroll&&h)return!1;m&&((o=a.initialScrollSession)==null?void 0:o.kind)!=="offset"&&al(e,{...s,contentOffset:f});let v=(r=t?.forceScroll)!=null?r:!!d||l&&m;return Zg(e,{forceScroll:v,resolvedOffset:f,target:s}),!0}function oG(e,t){var n,o;let r=e.state,a=P_(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 Zg(e,{forceScroll:f,resolvedOffset:l,target:i}),!0}function Yu(e,t){var n;return((n=e.state.initialScrollSession)==null?void 0:n.kind)==="offset"?oG(e,{forceScroll:t?.forceScroll}):nG(e,{forceScroll:t?.forceScroll})}function Gu(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=Qt(e,a);if(i===void 0||!e.sizesKnown.has(i))return!1}}return o}var eh=1,rG=8,aG=24,iG="LegendList bootstrap initial scroll aborted after exceeding convergence bounds.";function yr(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"?e.initialScrollSession.bootstrap:void 0}function dl(e){var t;return((t=e.initialScrollSession)==null?void 0:t.kind)==="offset"}function sG(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 lG(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 dG(e){let{mountFrameCount:t,maxFrames:n=rG,maxPasses:o=aG,passCount:r}=e;return t>=n||r>=o}function A_(e,t){return dG(t)?(Zo&&console.warn(iG),wG(e),!0):!1}function Ju(e){var t;let n=yr(e),o=n?.frameHandle;o!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(o),n&&(n.frameHandle=void 0),ni(e,{bootstrap:null,kind:(t=e.initialScrollSession)==null?void 0:t.kind})}function E_(e,t){var n,o,r;let a=yr(e);ni(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 cG(e,t){var n,o,r;let a=yr(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,ni(e,{bootstrap:a,kind:"bootstrap"})):t?.scroll!==void 0&&E_(e,{scroll:t.scroll,seedContentOffset:t.seedContentOffset,targetIndexSeed:t.targetIndexSeed})}function QC(e){requestAnimationFrame(()=>{var t;yr(e)&&((t=e.triggerCalculateItemsInView)==null||t.call(e,{forceFullItemPositions:!0}))})}function pb(e){let t=e.state,n=yr(t);if(!n||n.frameHandle!==void 0)return;let o=()=>{let r=yr(t);r&&(r.frameHandle=void 0,r.mountFrameCount+=1,!A_(e,{mountFrameCount:r.mountFrameCount,passCount:r.passCount})&&pb(e))};n.frameHandle=requestAnimationFrame(o)}function zg(e,t){cG(e.state,t),pb(e),QC(e.state)}function mb(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 uG(e){return!!e?.preserveForBottomPadding}function il(e){return!!e?.preserveForFooterLayout}function R_(e){return!!(e&&e.viewPosition===1&&(uG(e)||il(e)))}function fG(e){let{dataLength:t,footerSize:n,initialScrollAtEnd:o,stylePaddingEnd:r,target:a}=e,i=il(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 pG(e,t){return e.index===t.index&&e.preserveForBottomPadding===t.preserveForBottomPadding&&e.preserveForFooterLayout===t.preserveForFooterLayout&&e.viewOffset===t.viewOffset&&e.viewPosition===t.viewPosition}function Ug(e,t){let{dataLength:n,stylePaddingEnd:o,target:r}=t;if(!il(r))return;let a=mb({dataLength:n,footerSize:0,preserveForFooterLayout:void 0,stylePaddingEnd:o});al(e,a)}function mG(e){Ad(e)}function gb(e,t,n=eh){let o=e.state;if(!o.didFinishInitialScroll)return!1;let r=Zu(o);return Math.abs(r-Ur(e,t))>n}function Zu(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 M_(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||dl(n))return;let r=typeof n.lastNativeScroll=="number"&&Number.isFinite(n.lastNativeScroll)?n.lastNativeScroll:Zu(n);return Ur(e,o)-r}function N_(e){return M_(e)===void 0?!1:(__(e,{}),!0)}function __(e,t){let n=e.state;n.preservedEndAnchorCorrection=t,requestAnimationFrame(()=>{var o;let r=n.preservedEndAnchorCorrection;if(r!==t)return;let a=M_(e);if(a===void 0||Math.abs(a)<=eh){n.preservedEndAnchorCorrection=void 0;return}(!r.lastRequestTime||((o=n.lastNativeScrollTime)!=null?o:0)>r.lastRequestTime)&&(r.lastRequestTime=Date.now(),ll(e,a)),__(e,t)})}function gG(e){var t;let n=e.state,o=n.initialScroll;!n.didFinishInitialScroll||(t=n.scrollingTo)!=null&&t.isInitialScroll||o?.viewPosition!==1||n.preservedEndAnchorCorrection||gb(e,o)&&(R_(o)&&be(e,"isAtEnd")||(il(o)?Ug(e,{dataLength:n.props.data.length,stylePaddingEnd:ab(n.props),target:o}):mG(n)))}function hG(e,t){var n,o,r;let{initialScrollAtEnd:a,target:i}=t,s=e.state,l=Ur(e,i),d=l===0&&!a&&(dl(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?(Ju(s),Ed(e,{resolvedOffset:l})):c?(Ju(s),Ed(e,{preserveTarget:!0,resolvedOffset:l})):(E_(s,{scroll:l,seedContentOffset:0,targetIndexSeed:i.index}),pb(e))}function vG(e,t){let{dataLength:n,didDataChange:o,initialScrollAtEnd:r,previousDataLength:a,stylePaddingEnd:i}=t,s=e.state,l=s.initialScroll;if(dl(s)||!l)return;let d=!!(s.didFinishInitialScroll&&a===0&&n>0&&l.index!==void 0),c=yr(s);if(!r&&o&&n>0&&s.didFinishInitialScroll&&!c&&!d){Ad(s);return}let p=n>0&&(r||R_(l));if(!(!o&&!d&&!p)){if(p){let m=r?mb({dataLength:n,footerSize:be(e,"footerSize")||0,preserveForFooterLayout:il(l),stylePaddingEnd:i}):fG({dataLength:n,footerSize:be(e,"footerSize")||0,initialScrollAtEnd:r,stylePaddingEnd:i,target:l});if(!d&&gb(e,l)){Ug(e,{dataLength:n,stylePaddingEnd:i,target:l});return}if(!pG(l,m)||c||d||o){al(e,m,{resetDidFinish:d}),zg(e,{scroll:Ur(e,m),seedContentOffset:d&&!c?Zu(s):void 0,targetIndexSeed:m.index});return}}o&&(c||d)&&(al(e,l,{resetDidFinish:d}),zg(e,{scroll:Ur(e,l),seedContentOffset:d&&!c?Zu(s):void 0,targetIndexSeed:l.index}))}}function yG(e,t){let{dataLength:n,footerSize:o,initialScrollAtEnd:r,stylePaddingEnd:a}=t,i=e.state;if(!r)return;let s=i.initialScroll;if(!(dl(i)||n===0||!s||!(yr(i)||il(s))))if(gb(e,s))Ug(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let d=mb({dataLength:n,footerSize:o,preserveForFooterLayout:il(s),stylePaddingEnd:a});if(!(s.index!==d.index||s.viewPosition!==d.viewPosition||s.viewOffset!==d.viewOffset))Ug(e,{dataLength:n,stylePaddingEnd:a,target:s});else{let f=!!i.didFinishInitialScroll;al(e,d,{resetDidFinish:f}),zg(e,{scroll:Ur(e,d),targetIndexSeed:d.index})}}}function xG(e){var t,n,o;let r=e.state,a=r.initialScroll,i=yr(r);if(a&&r.props.data.length>0&&!dl(r)&&(i||a.viewPosition===1)){let s=Ur(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:Zu(r),c=s-d;if(Math.abs(c)>eh){if(r.didFinishInitialScroll)N_(e);else if(l){let f=lo.get(r);l.offset=s,l.targetOffset=s,r.initialScroll={...a,contentOffset:s},r.hasScrolled=!1,lo.set(r,{startScroll:(o=f?.startScroll)!=null?o:r.scroll,targetOffset:s}),ll(e,c)}}}else zg(e,{scroll:s,targetIndexSeed:a.index})}}function CG(e){var t,n;let o=e.state,r=yr(o),a=o.initialScroll;if(!r||!a||dl(o)||(t=o.scrollingTo)!=null&&t.isInitialScroll||(r.passCount+=1,A_(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=Ur(e,a),s=Gu(o,o.startBuffered,o.endBuffered),l=Math.abs(r.scroll-i)>1,{data:d}=o.props,c=lG({dataLength:d.length,getSize:h=>{var v,y;let x=(v=o.idCache[h])!=null?v:Qt(o,h);return(y=o.sizes.get(x))!=null?y:yo(e,x,h,d[h])},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(h=>{var v;let y=(v=o.idCache[h])!=null?v:Qt(o,h);return o.sizesKnown.has(y)}),p=r.previousResolvedOffset,m=r.visibleIndices;if(r.previousResolvedOffset=i,r.visibleIndices=c,l){r.scroll=i,QC(o);return}if(!s||!f)return;if(!(p!==void 0&&Math.abs(p-i)<=eh&&sG(m,c))){QC(o);return}Ju(o),Zg(e,{forceScroll:!0,resolvedOffset:i,target:a,waitForCompletionFrame:ti.OS==="web"})}function bG(e,t){var n;let o=e.state;Ju(o);let r=!o.clearPreservedInitialScrollOnNextFinish&&o.props.data.length>0&&((n=o.initialScroll)==null?void 0:n.viewPosition)===1;Ed(e,{preserveTarget:r,recalculateItems:!0,resolvedOffset:t,schedulePreservedTargetClear:r})}function wG(e){var t,n,o,r;let a=e.state,i=yr(a),s=a.initialScroll;i&&s&&!dl(a)&&a.refScroller.current?(Ju(a),Zg(e,{forceScroll:!0,resolvedOffset:i.scroll,target:s,waitForCompletionFrame:ti.OS==="web"})):bG(e,(r=(o=(n=(t=yr(a))==null?void 0:t.scroll)!=null?n:a.scrollPending)!=null?o:a.scroll)!=null?r:0)}function D_(e,t,n,o){return{dataChangeEpoch:e.dataChangeEpoch,getFixedItemSize:e.props.getFixedItemSize,getItemType:e.props.getItemType,itemData:n,itemIndex:t,itemType:o}}function SG(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=D_(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 O_(e){for(let t of e.containerItemMetadata.values())t.didResolveFixedItemSize=!1,t.fixedItemSize=void 0}var IG=20,TG=1,kG=1,HC=16;function hb(e,t){let n=e.state.scrollingTo;t?.onlyIfAligned&&(!n?.isInitialScroll||n.animated||!vb(e,n).isAtResolvedTarget)||e.state.scheduledWork.frame(()=>RG(e),"checkFinishedScrollFrame")}function LG(e,t){let{clampedTargetOffset:n,scrollingTo:o}=t;return!o.isInitialScroll||e.hasScrolled||n<=TG}function PG(e,t){return!!t?.isInitialScroll&&Wg.didDispatchNativeScroll(e)&&!e.hasScrolled}function F_(e){var t;return(t=lo.get(e))==null?void 0:t.targetOffset}function B_(e){let t=F_(e);return!e.didFinishInitialScroll&&lo.hasNonZeroTargetOffset(t)}function zN(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 lo.hasNonZeroTargetOffset(r)&&Wg.didDispatchNativeScroll(e)&&!e.hasScrolled||lo.isAtZeroTargetOffset(r)||Math.abs(e.scroll-r)>1||Math.abs(e.scrollPending-r)>1?!1:!!t.waitForInitialScrollCompletionFrame||B_(e)}function UN(e){var t;let{state:n}=e;return!!((t=n.scrollingTo)!=null&&t.isInitialScroll)&&n.props.data.length>0&&vo(e)<=n.scrollLength&&n.scrollPending<=kG}function AG(e,t){return t.index===e.state.props.data.length-1&&t.viewPosition===1}function EG(e,t){var n;let o=t.index,a=AG(e,t)&&o!==void 0?Xg(e,jg(e,o),t):(n=t.targetOffset)!=null?n:Yi(e,t.offset-(t.viewOffset||0),t);return Yi(e,a,t)}function vb(e,t){let{state:n}=e,o=n.scrollPending,r=n.scrollAdjustHandler.getAdjust(),a=EG(e,t),i=Yi(e,o,t),s=Math.abs(o-a),l=a+r,d=Math.abs(o-l),c=!t.animated||ti.OS==="ios";return{clampedTargetOffset:a,isAtResolvedTarget:Math.abs(o-i)<1&&(s<1||c&&d<1)}}function RG(e){let t=e.state.scrollingTo;if(!t)return;let{state:n}=e,o=vb(e,t);o.isAtResolvedTarget&&LG(n,{clampedTargetOffset:o.clampedTargetOffset,scrollingTo:t})&&Xu(e)}function MG(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 NG(e){let t=e.state;if(t.scheduledWork.has("checkFinishedScrollFallback"))return;let n=t.scrollingTo,o=UN(e),r=PG(t,n),a=n!==void 0?zN(t,n):!1,i=n?.isInitialScroll&&!o&&!a||!t.didContainersLayout,s=o||a?0:r?HC: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 g=B_(t)&&!t.hasScrolled,h=r?5:g?IG:5,v=UN(e),y=zN(t,m),x=vb(e,m),C=ti.OS==="android",w=t.hasScrolled&&(!m.isInitialScroll||x.isAtResolvedTarget),T=m.isInitialScroll&&!x.isAtResolvedTarget&&l<=h;if(v||w||y||C||l>h)Xu(e);else if((g||T)&&l<=h){let S=(p=(f=F_(t))!=null?f:m.targetOffset)!=null?p:t.scrollPending;MG(e,S),d(r?HC:100)}else d(r?HC:100)}};d(s)}function z_(e){var t;let n=e.state,o=n.initialScroll;return n.didFinishInitialScroll?N_(e):!o||((t=n.initialScrollSession)==null?void 0:t.kind)==="offset"||o.viewPosition!==1||n.props.data.length===0?!1:Yu(e,{forceScroll:!0})}function _G(e){var t;if(!e.state.initialScroll)return;let n=()=>Yu(e,{forceScroll:!0});n(),((t=e.state.initialScrollSession)==null?void 0:t.kind)!=="offset"&&requestAnimationFrame(n),hb(e,{onlyIfAligned:!0})}function DG(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")&&al(e,{...f,contentOffset:p,preserveForFooterLayout:m}),d&&f&&((o=c.initialScrollSession)==null?void 0:o.kind)!=="offset"){hG(e,{initialScrollAtEnd:l,target:c.initialScroll});return}!r&&!p&&!(f&&a===0&&!(p===0&&!l))&&(f&&!l?Ed(e,{resolvedOffset:p}):ub(e,{didInitialScroll:!0}))}function OG(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,g=(o=(n=m.initialScrollSession)==null?void 0:n.previousDataLength)!=null?o:0,h=a>0&&(!m.hasHadNonEmptyData||s);if(a>0&&(m.hasHadNonEmptyData=!0),h&&(d?(al(e,d),ni(m,{kind:c,previousDataLength:g})):Ad(m)),m.initialScrollSession&&(m.initialScrollSession.previousDataLength=a),ni(m),p){vG(e,{dataLength:a,didDataChange:i,initialScrollAtEnd:l,previousDataLength:g,stylePaddingEnd:f});return}let v=g===0&&a>0&&!!m.initialScroll&&((r=e.state.initialScrollSession)==null?void 0:r.kind)==="offset"&&!!m.didFinishInitialScroll;g!==0||a===0||!m.initialScroll||!m.queuedInitialLayout||m.didFinishInitialScroll&&!v||(v&&cb(e,{resetInitialScroll:!0}),Yu(e))}function U_(e){e.indexByKey.clear(),e.idCache.length=0,e.positions.length=0,e.columns.length=0,e.columnSpans.length=0}function FG(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 Hg(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=be(e,"containerLayoutEpoch"))!=null?n:0)+1;Be(e,"containerLayoutEpoch",a)}}function BG(e,t,n,o){var r,a,i,s,l,d,c,f,p;let m=e.state,{columns:g,columnSpans:h,positions:v,props:{data:y,itemsAreEqual:x,keyExtractor:C}}=m,w=y[n];if(w===void 0)return{didChangePosition:!1,didRefreshData:!1};let T=(r=m.idCache[n])!=null?r:Qt(m,n),S=(a=o?.updateLayout)!=null?a:!0,L=!1,k=!1;if(S){let _=v[n];if(_===void 0)return Be(e,`containerPosition${t}`,Pd),{didChangePosition:!1,didRefreshData:!1};let A=(_||0)-((i=o?.scrollAdjustPending)!=null?i:0),H=(s=m.sizes.get(T))!=null?s:yo(e,T,n,w),V=J4(m,A,H,be(e,"totalSize")),J=g[n]||1,D=h[n]||1,ne=be(e,`containerPosition${t}`),F=be(e,`containerColumn${t}`),U=be(e,`containerSpan${t}`);V>Pd&&V!==ne&&(Be(e,`containerPosition${t}`,V),L=!0),J>=0&&J!==F&&Be(e,`containerColumn${t}`,J),D!==U&&Be(e,`containerSpan${t}`,D)}be(e,`containerItemIndex${t}`)!==n&&Be(e,`containerItemIndex${t}`,n);let P=be(e,`containerItemData${t}`),E=()=>{Be(e,`containerItemData${t}`,w),k=!0};if(P!==w){let _=((l=m.pendingDataComparison)==null?void 0:l.previousData)===m.previousData&&((d=m.pendingDataComparison)==null?void 0:d.nextData)===y?m.pendingDataComparison:void 0,A=(c=_?.byIndex[n])!=null?c:0;if(A===2)E();else if(A!==1){let H=(f=be(e,`containerItemKey${t}`))!=null?f:T,V=C?.(P,n);if(P===void 0||!C||V!==H)E();else if(!x)E();else{let J=x(P,w,n,y);(!m.pendingDataComparison||m.pendingDataComparison.previousData!==m.previousData||m.pendingDataComparison.nextData!==y)&&m.previousData&&(m.pendingDataComparison={byIndex:[],nextData:y,previousData:m.previousData}),(p=m.pendingDataComparison)!=null&&p.byIndex&&(m.pendingDataComparison.byIndex[n]=J?1:2),J||E()}}}return{didChangePosition:L,didRefreshData:k}}function zG(e,t,n){var o;let r=e.state,a=be(e,"numColumns"),i=t;r.columns[t]!==1&&(i=HN(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=HN(r,a,c),m=UG(e,p,c,n);l=f+m}return{column:d,currentRowTop:l,startIndex:i}}function HN(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 UG(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=yo(e,l,s,a[s],o);d>i&&(i=d)}return i}function HG(e){var t,n;let o=e.state,{positions:r,props:{data:a}}=o,i=(t=be(e,"numColumns"))!=null?t:1;if(a.length===0)Vu(e,null,0);else{let s=a.length-1,l=Qt(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:Qt(o,p),g=yo(e,m,p,a[p]);g>f&&(f=g)}Vu(e,null,d+f)}else{let c=yo(e,l,s,a[s]);if(c!==void 0){let f=d+c;Vu(e,null,f)}}}}function H_(e){let t=e.state,{props:{snapToIndices:n}}=t,o=t.props.horizontal?vo(e):void 0,r=Array(n.length);for(let a=0;a<n.length;a++){let i=n[a];Qt(t,i);let s=t.positions[i];r[a]=ib(t,s,o)}Be(e,"snapToOffsets",r)}function $_(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,g=e.positionListeners.size>0,{columns:h,columnSpans:v,indexByKey:y,positions:x,idCache:C,sizesKnown:w,props:{data:T,overrideItemLayout:S,snapToIndices:L},scrollingTo:k}=m,I=T.length,P=(l=be(e,"numColumns"))!=null?l:1,E=P>1,_=Zo?new Map:void 0,A=be(e,"extraData"),H=S?{span:1}:void 0,V=m.lastScrollDelta,J=i??Yg(m),D=!o&&!t&&(r||Math.abs(J)>0||m.scrollLength>0&&V>m.scrollLength),ne=a+1e3,F=!0,U=!n||t||m.scrollAdjustHandler.getAdjust()!==0||((d=be(e,"scrollAdjustPending"))!=null?d:0)!==0,ee=!1,j=0,Z=1,de=0;if(t&&(v.length=0),E||(h.length&&(h.length=0),v.length&&(v.length=0)),s>0){if(E){let{startIndex:re,currentRowTop:we}=zG(e,s,F);s=re,j=we}else if(s<I){let re=s-1,we=Qt(m,re),Xe=(c=x[re])!=null?c:0,ot=(f=w.get(we))!=null?f:yo(e,we,re,T[re],F,U,ee);j=Xe+ot}}let B=t||y.size===0,X=E&&!!S&&!!H,pe=!1,le;for(let re=s;re<I;re++){if(D&&le!==void 0&&re>le){pe=!0;break}D&&le===void 0&&!k&&!t&&j>ne&&(le=re+(E?P:1)+10);let we=(p=C[re])!=null?p:Qt(m,re),Xe=1;if(X){H.span=1,S(H,T[re],re,P,A);let je=H.span;je!==void 0&&Number.isFinite(je)&&(Xe=Math.max(1,Math.min(P,Math.round(je))))}E&&Z+Xe-1>P&&(j+=de,Z=1,de=0);let ot=w.get(we),at=ot!==void 0?ot:yo(e,we,re,T[re],F,U,ee);Zo&&B&&(_.has(we)&&console.error(`[legend-list] Error: Detected overlapping key (${we}) which causes missing items and gaps and other terrrible things. Check that keyExtractor returns unique values.`),_.set(we,re)),j!==x[re]&&(x[re]=j,g&&iW(e,we,j)),B&&y.set(we,re),E?(h[re]=Z,v[re]=Xe,at>de&&(de=at),Z+=Xe,Z>P&&(j+=de,Z=1,de=0)):j+=at}pe||HG(e),L&&H_(e)}function K_(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 $G(e){let{viewabilityConfig:t,viewabilityConfigCallbackPairs:n,onViewableItemsChanged:o}=e;return(t||o)&&(n=[...n||[],{onViewableItemsChanged:o,viewabilityConfig:t||{viewAreaCoveragePercentThreshold:0}}]),n}function q_(e,t,n,o,r,a,i=r,s=a){let{props:{data:l}}=e;for(let d of n){let c=K_(t,d.viewabilityConfig.id);c.start=r,c.end=a,c.startBuffered=i,c.endBuffered=s,d.viewabilityConfig.minimumViewTime?e.scheduledWork.timeout(()=>$N(l,d,e,t,o),d.viewabilityConfig.minimumViewTime):$N(l,d,e,t,o)}}function $N(e,t,n,o,r){let{viewabilityConfig:a,onViewableItemsChanged:i}=t,s=a.id,l=K_(o,s),{viewableItems:d,start:c,end:f,startBuffered:p,endBuffered:m}=l,g;for(let[x,C]of o.mapViewabilityAmountValues)V_(n,o,a,x,C.key,r,C.item,C.index).sizeVisible<0&&(g??(g=[]),g.push(x));let h=[],v=new Set;if(d)for(let x of d){v.add(x.key);let C=n.indexByKey.get(x.key),w=C!==void 0?e[C]:void 0,T=jC(o,x.key),S=!1;C!==void 0&&w!==void 0&&(S=qN(n,o,a,T,x.key,r,w,C)),S||h.push({...x,index:C??x.index,isViewable:!1,item:w??x.item})}let y=[];for(let x=c;x<=f;x++){let C=e[x];if(C){let w=Qt(n,x),T=jC(o,w);if(qN(n,o,a,T,w,r,C,x)){let S={containerId:T,index:x,isViewable:!0,item:C,key:w};y.push(S),v.has(S.key)||h.push(S)}}}if(Object.assign(l,{previousEnd:f,previousStart:c,viewableItems:y}),h.length>0){l.viewableItems=y;for(let x=0;x<h.length;x++){let C=h[x];KG(o,s,C.containerId,C)}i&&i({changed:h,end:f,endBuffered:m,start:c,startBuffered:p,viewableItems:y})}if(g)for(let x of g){let C=o.mapViewabilityAmountValues.get(x);C&&C.sizeVisible<0&&o.mapViewabilityAmountValues.delete(x)}}function KN(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 V_(e,t,n,o,r,a,i,s){let{sizes:l,scroll:d}=e,c=(be(t,"stylePaddingTop")||0)+(be(t,"alignItemsAtEndPadding")||0)+(be(t,"headerSize")||0),{itemVisiblePercentThreshold:f,viewAreaCoveragePercentThreshold:p}=n,m=p!=null,g=m?p:f,h=d-c,v=e.positions[s],y=l.get(r)||0;if(v===void 0){let _={containerId:o,index:s,isViewable:!1,item:i,key:r,percentOfScroller:0,percentVisible:0,scrollSize:a,size:y,sizeVisible:-1},A=t.mapViewabilityAmountValues.get(o);if(!KN(A,_)){t.mapViewabilityAmountValues.set(o,_);let H=t.mapViewabilityAmountCallbacks.get(o);H&&H(_)}return _}let x=v-h,C=x+y,w=x>=0&&C<=a&&C>x,T=w?y:Math.min(C,a)-Math.max(x,0),S=y?w?100:100*(T/y):0,L=y?100*(T/a):0,I=(w?100:m?L:S)>=g,P={containerId:o,index:s,isViewable:I,item:i,key:r,percentOfScroller:L,percentVisible:S,scrollSize:a,size:y,sizeVisible:T},E=t.mapViewabilityAmountValues.get(o);if(!KN(E,P)){t.mapViewabilityAmountValues.set(o,P);let _=t.mapViewabilityAmountCallbacks.get(o);_&&_(P)}return P}function qN(e,t,n,o,r,a,i,s){let l=t.mapViewabilityAmountValues.get(o);return(!l||l.key!==r||l.index!==s)&&(l=V_(e,t,n,o,r,a,i,s)),l.isViewable}function KG(e,t,n,o){let r=n+t;e.mapViewabilityValues.set(r,o);let a=e.mapViewabilityCallbacks.get(r);a?.(o)}var VN=i_.unstable_batchedUpdates,qG=typeof VN=="function"?VN:e=>e(),VG=32,WG=64,GG=3;function jG(e,t){if(e<=0||t<=0)return 0;let n=Math.ceil(t*GG),o=t+WG,r=Math.max(t,Math.min(n,o),Math.min(e,VG)),a=Math.max(e,t);return Math.min(a,r)}function QG(e,t){return e<=0||t<=0?0:Math.min(Math.max(e,t),Math.max(t,Math.ceil(t*1.5)))}function XG(e,t,n,o,r,a,i){var s;let l=t.length;if(l===0)return[];let d=be(e,"numContainers"),c=e.state,{containerItemMetadata:f,stickyContainerPool:p}=c,m=c.props.recycleItems&&!!c.props.positionComponentInternal,g=r.length>0?new Set(r):void 0,h=t.map((P,E)=>({isSticky:c.props.stickyHeaderIndicesSet.has(P),itemIndex:P,itemType:a?.(P),order:E})),v=h.filter(P=>!P.isSticky),y=h.filter(P=>P.isSticky),x=[],C=[];for(let P=0;P<d;P++){let E=be(e,`containerItemKey${P}`),_=!!g?.has(P);if(!(E&&i?.has(E)&&c.indexByKey.has(E))){if(p.has(P))(E===void 0||_)&&C.push({containerIndex:P,distance:Number.POSITIVE_INFINITY});else if(E===void 0||_)x.push({containerIndex:P,distance:Number.POSITIVE_INFINITY});else if(!m){let H=c.indexByKey.get(E);if(H!==void 0&&(H<n||H>o)){let V=H<n?n-H:H-o;x.push({containerIndex:P,distance:V})}}}}x.sort(YG);let w=new Array(l),T=d,S=!1,L=(P,E)=>{w[P.order]={containerIndex:E,itemIndex:P.itemIndex,itemType:P.itemType},g?.delete(E)&&(S=!0)},k=(P,E,_)=>{for(let A of P){if(w[A.order])continue;let H=E.findIndex(V=>{var J;return _((J=f.get(V.containerIndex))==null?void 0:J.itemType,A.itemType)});if(H!==-1){let[V]=E.splice(H,1);L(A,V.containerIndex)}}},I=(P,E,_)=>{a&&k(P,E,(A,H)=>H!==void 0&&A===H),k(P,E,A=>A===void 0),_&&k(P,E,()=>!0)};I(v,x,!0),I(y,C,!1);for(let P of h){if(w[P.order])continue;let E=T++;P.isSticky&&p.add(E),L(P,E)}if(S&&(r.length=0,g))for(let P of g)r.push(P);if(Zo){let P=(s=be(e,"numContainersPooled"))!=null?s:Number.POSITIVE_INFINITY;T>P&&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:P,numNeeded:l,stillNeeded:T-d}})}return w}function YG(e,t){return t.distance-e.distance}function JG(e){let t=e.state;t.queuedInitialLayout=!0,y_(e),ub(e,{didLayout:!0})}var ZG=4,ej=100;function tj(e,t){if(t<=0)return 0;let n=Math.min(1,Math.abs(e)/ZG);return Math.sign(e)*t*n}function nj(e){let t=e.state;t.scheduledWork.timeout(()=>{var n;t.scrollHistory.length=0,(n=t.triggerCalculateItemsInView)==null||n.call(t)},ej,"renderRangeProjection")}function oj(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 rj(e,t){let n=e.state,o=!1;for(let r of n.stickyContainerPool){let a=be(e,`containerItemKey${r}`);if((a?n.indexByKey.get(a):void 0)===t){o=!0;break}}return o}function aj(e,t,n,o,r,a,i){var s;let l=e.state;Be(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(rj(e,f))continue;let p=(s=l.idCache[f])!=null?s:Qt(l,f);p&&!l.containerItemKeys.has(p)&&(f<a||f>i)&&!r.has(f)&&(r.add(f),o.push(f))}}function ij(e,t,n,o,r,a,i){var s,l;let d=e.state;for(let c of d.stickyContainerPool){let f=be(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),Be(e,`containerSticky${c}`,!1);continue}if(m>=r-1&&m<=r+1)continue;let h=t[m+1],v=!1;if(h){let y=d.positions[h];v=y!==void 0&&n>y+o*2}else{let y=(s=d.idCache[p])!=null?s:Qt(d,p);if(y){let x=d.positions[p],C=(l=d.sizes.get(y))!=null?l:yo(e,y,p,d.props.data[p]);v=x!==void 0&&n>x+C+o*3}}v&&a.push(c)}}function W_(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 G_(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:Qt(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:Qt(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 sj(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:Qt(r,f),m=(o=d.get(p))!=null?o:yo(e,p,f,l[f]);if(s[f]+m>t)return f}return null}function lj(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 g={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null};for(let h=m;h<=l&&h<f.length;h++){let v=(a=d[h])!=null?a:Qt(s,h),y=(i=p.get(v))!=null?i:yo(e,v,h,f[h]),x=c[h];if(W_(g,h,x,y,o,r))break}Object.assign(s,{endNoBuffer:g.endNoBuffer,firstFullyOnScreenIndex:g.firstFullyOnScreenIndex,idsInView:G_(s,g),startNoBuffer:g.startNoBuffer}),XC(s,g.startNoBuffer),g.startNoBuffer!==null&&g.endNoBuffer!==null&&q_(s,e,t,n,g.startNoBuffer,g.endNoBuffer,m,l)}function ei(e,t={}){let n=e.state;qG(()=>{var o,r,a,i,s,l,d,c,f,p,m,g,h,v,y,x,C,w,T,S,L;let{columns:k,containerItemKeys:I,enableScrollForNextCalculateItemsInView:P,idCache:E,indexByKey:_,minIndexSizeChanged:A,positions:H,props:{alwaysRenderIndicesArr:V,alwaysRenderIndicesSet:J,getItemType:D,keyExtractor:ne,onStickyHeaderChange:F},scrollForNextCalculateItemsInView:U,scrollLength:ee,sizes:j,startBufferedId:Z,viewabilityConfigCallbackPairs:de}=n,{data:B}=n.props,X=n.props.stickyHeaderIndicesArr||[],pe=n.props.stickyHeaderIndicesSet||new Set,le=b_(e,t.drawDistanceMode),{dataChanged:re,doMVCP:we,forceFullItemPositions:Xe}=t,ot=((o=n.initialScrollSession)==null?void 0:o.kind)==="bootstrap"?n.initialScrollSession.bootstrap:void 0,at=!!ot,je=be(e,"numContainers");if(!B||ee===0||!je)return;let oe=vo(e),Te,Y=be(e,"stylePaddingTop")+be(e,"alignItemsAtEndPadding")+be(e,"headerSize"),me=be(e,"numColumns"),ge=(r=t.scrollVelocity)!=null?r:Yg(n),G=0,{initialScroll:Ye,queuedInitialLayout:ht}=n,Mt=at?(a=ot?.scroll)!=null?a:n.scroll:!ht&&qu(n)&&Ye?Ur(e,Ye):n.scroll,Dt=0,Nt=0,Ot=0,At=0,xt=0,_t=0,Xt=Mt,mn=xe=>{var Ve;Xt=xe,Dt=(Ve=be(e,"scrollAdjustPending"))!=null?Ve:0,Nt=Dt-Y,Ot=Math.round(xe+G+Nt),Ot+ee>oe&&(Ot=Math.max(0,oe-ee))};mn(Mt);let Hn=be(e,"activeStickyIndex"),vt=()=>{let xe=X.length>0?oj(X,Ot,n):-1,Ve=xe>=0?X[xe]:-1,Ct=Hn!==Ve;(xe>=0||Hn>=0)&&Be(e,"activeStickyIndex",Ve);let ct=!!F&&X.length>0&&Ct;return{currentStickyIdx:xe,finishCalculateItemsInView:ct?()=>{let vn=B[Ve];vn!==void 0&&F?.({index:Ve,item:vn})}:void 0}},qt=re?void 0:vt(),an=le,kn=le;ge>0||ge===0&&Ot<Math.max(50,le)?(an=le*.5,kn=le*1.5):(an=le*1.5,kn=le*.5);let Cn=!re&&!Xe&&!at&&!qu(n)&&!n.scrollingTo&&!n.pendingNativeMVCPAdjust&&!!be(e,"readyToRender")?tj(ge,Math.min(an,kn)):0,$n=()=>{let xe=Math.max(0,Ot),Ve=Math.max(0,-Xt);xt=Math.max(xe,Ot+ee+Ve),At=xe-an+Cn,_t=xt+kn+Cn};if($n(),Cn!==0&&nj(e),P&&!at&&!re&&!Xe&&U){let{top:xe,bottom:Ve}=U;if(xe===null&&Ve===null)n.scrollForNextCalculateItemsInView=void 0;else if((xe===null||At>xe)&&(Ve===null||_t<Ve)&&!tf(n)){de?lj(e,de,ee,Ot,xt):n.props.onFirstVisibleItemChanged&&XC(n,sj(e,Ot)),(i=qt?.finishCalculateItemsInView)==null||i.call(qt);return}}let $=we&&!at?jW(e,re):void 0;re&&U_(n);let ae=Xe||re?0:(s=A??n.startBuffered)!=null?s:0,ce=!Xe&&!re&&me>1&&A!==void 0;$_(e,re,{doMVCP:we,forceFullUpdate:!!Xe,optimizeForVisibleWindow:ce,scrollBottomBuffered:_t,scrollVelocity:ge,startIndex:ae}),oe=vo(e),A!==void 0&&(n.minIndexSizeChanged=void 0);let Le;if(re&&we&&n.props.maintainVisibleContentPosition.data&&n.didContainersLayout&&n.idsInView.length>0){let xe=n.props.maintainVisibleContentPosition.shouldRestorePosition;Le=new Set;for(let Ve of n.idsInView){let Ct=_.get(Ve);Ct!==void 0&&(xe&&!xe(B[Ct],Ct,B)||Le.add(Ve))}}let ze=n.scroll,ft=(l=be(e,"scrollAdjustPending"))!=null?l:0;$?.(),$&&(n.scroll!==ze||((d=be(e,"scrollAdjustPending"))!=null?d:0)!==ft)&&(mn(n.scroll),$n()),re&&(qt=vt());let lt=null,hn=null,Ft=null,rt=(c=at?ot?.targetIndexSeed:void 0)!=null?c:!re&&Z&&_.get(Z)||0;for(let xe=rt;xe>=0;xe--){let Ve=(f=E[xe])!=null?f:Qt(n,xe),Ct=H[xe],ct=(p=j.get(Ve))!=null?p:yo(e,Ve,xe,B[xe]);if(Ct+ct>At)rt=xe;else break}if(me>1)for(;rt>0;){let xe=k[rt];if(xe===1||xe===void 0)break;rt-=1}let Zt=!1,ln,Se,Re=0;for(let xe=0;xe<je;xe++){let Ve=be(e,`containerItemKey${xe}`);if(Ve!==void 0){let Ct=_.get(Ve);Re=Math.max(Re,Ct)}}let qe={endNoBuffer:null,firstFullyOnScreenIndex:void 0,startNoBuffer:null},pt=B.length;for(let xe=Math.max(0,rt);xe<pt&&(!Zt||xe<=Re);xe++){let Ve=(m=E[xe])!=null?m:Qt(n,xe),Ct=(g=j.get(Ve))!=null?g:yo(e,Ve,xe,B[xe]),ct=H[xe];Zt||(W_(qe,xe,ct,Ct,Ot,xt),lt===null&&ct+Ct>At&&(lt=xe,hn=Ve,At<0?ln=null:ln=ct),qe.startNoBuffer!==null&&(ct<=_t?(Ft=xe,_t>oe?Se=null:Se=ct+Ct):Zt=!0))}Object.assign(n,{endBuffered:Ft,endNoBuffer:qe.endNoBuffer,firstFullyOnScreenIndex:qe.firstFullyOnScreenIndex,idsInView:G_(n,qe),startBuffered:lt,startBufferedId:hn,startNoBuffer:qe.startNoBuffer}),P&&ln!==void 0&&Se!==void 0&&(n.scrollForNextCalculateItemsInView=Wu(ln)&&Wu(Se)?void 0:{bottom:Se,top:ln});let st=je,it=[];if(re)for(let xe=0;xe<st;xe++){let Ve=be(e,`containerItemKey${xe}`);(!ne||Ve&&_.get(Ve)===void 0)&&it.push(xe)}let kt=n.scrollTargetPinnedRange,Vt=0,Pe=-1;kt&&(Vt=Math.max(0,Math.min(kt.start,kt.end)),Pe=Math.min(pt-1,Math.max(kt.start,kt.end)));let Et=Vt<=Pe,yt=xe=>J.has(xe)||Et&&xe>=Vt&&xe<=Pe;if(lt!==null&&Ft!==null){let xe=[],Ve=new Set,Ct=ct=>{var vn;if(ct>=0&&ct<pt){let bn=(vn=E[ct])!=null?vn:Qt(n,ct),yn=I.get(bn);yn!==void 0?n.stickyContainerPool.add(yn):!Wu(bn)&&!Ve.has(ct)&&(Ve.add(ct),xe.push(ct))}};for(let ct=lt;ct<=Ft;ct++){let vn=(h=E[ct])!=null?h:Qt(n,ct);I.has(vn)||(Ve.add(ct),xe.push(ct))}for(let ct of V)Ct(ct);if(Et)for(let ct=Vt;ct<=Pe;ct++)Ct(ct);if(X.length>0?aj(e,X,(v=qt?.currentStickyIdx)!=null?v:-1,xe,Ve,lt,Ft):Hn!==-1&&Be(e,"activeStickyIndex",-1),xe.length>0){let vn=XG(e,xe,lt,Ft,it,D?bn=>{let yn=D(B[bn],bn);return yn!==void 0?String(yn):""}:void 0,Le);for(let bn of vn){let yn=bn.itemIndex,Lt=bn.containerIndex,xn=(y=E[yn])!=null?y:Qt(n,yn),Wt=be(e,`containerItemKey${Lt}`);Wt&&Wt!==xn&&I.delete(Wt),Wt!==xn&&(Te??(Te=new Set),Te.add(Lt),n.containerItemGenerations[Lt]=((x=n.containerItemGenerations[Lt])!=null?x:0)+1),Be(e,`containerItemKey${Lt}`,xn),Be(e,`containerItemIndex${Lt}`,yn),Be(e,`containerItemData${Lt}`,B[yn]),n.containerItemMetadata.set(Lt,D_(n,yn,B[yn],bn.itemType)),I.set(xn,Lt),(C=n.userScrollAnchorReset)==null||C.keys.add(xn);let An=`containerSticky${Lt}`,eo=pe.has(yn),va=yt(yn);eo?(Be(e,An,!0),n.stickyContainerPool.add(Lt)):(be(e,An)&&Be(e,An,!1),va?n.stickyContainerPool.add(Lt):n.stickyContainerPool.delete(Lt)),Lt>=st&&(st=Lt+1)}st!==je&&(Be(e,"numContainers",st),st>be(e,"numContainersPooled")&&Be(e,"numContainersPooled",QG(pt,st)))}((w=n.userScrollAnchorReset)==null?void 0:w.keys.size)===0&&(n.userScrollAnchorReset=void 0)}n.stickyContainerPool.size>0&&ij(e,X,Ot,le,(T=qt?.currentStickyIdx)!=null?T:-1,it,yt);let on=it.length>0?new Set(it):void 0,Nn=!1;for(let xe=0;xe<st;xe++){let Ve=be(e,`containerItemKey${xe}`);if(on?.has(xe))Ve!==void 0&&(I.delete(Ve),Te??(Te=new Set),Te.add(xe),n.containerItemGenerations[xe]=((S=n.containerItemGenerations[xe])!=null?S:0)+1),n.containerItemMetadata.delete(xe),n.stickyContainerPool.has(xe)&&(Be(e,`containerSticky${xe}`,!1),n.stickyContainerPool.delete(xe)),Be(e,`containerItemKey${xe}`,void 0),Be(e,`containerItemIndex${xe}`,void 0),Be(e,`containerItemData${xe}`,void 0),Be(e,`containerPosition${xe}`,Pd),Be(e,`containerColumn${xe}`,-1),Be(e,`containerSpan${xe}`,1);else{let Ct=_.get(Ve);Ct!==void 0&&(Nn=BG(e,xe,Ct,{scrollAdjustPending:Dt,updateLayout:!0}).didChangePosition||Nn)}}if(Te&&sb&&Hg(e,Te),Nn&&Be(e,"lastPositionUpdate",Date.now()),at){CG(e);return}XC(n,qe.startNoBuffer),!ht&&!n.didContainersLayout&&(qu(n)?Gu(n,n.startBuffered,n.endBuffered):Gu(n,n.startNoBuffer,n.endNoBuffer)||Gu(n,n.startBuffered,n.endBuffered))&&(JG(e),_G(e)),de&&qe.startNoBuffer!==null&&qe.endNoBuffer!==null&&q_(e.state,e,de,ee,qe.startNoBuffer,qe.endNoBuffer,lt??qe.startNoBuffer,Ft??qe.endNoBuffer),(L=qt?.finishCalculateItemsInView)==null||L.call(qt)})}function $g(e){var t,n;let o=e.state,r=o.props.anchoredEndSpace,a=be(e,"anchoredEndSpaceSize"),i=o.anchoredEndSpaceReadyAnchorIndex,s=o.anchoredEndSpaceReadyAnchorKey,l=r?.anchorIndex,d,c=!0,f=0;if(r){let{anchorIndex:h,anchorMaxSize:v,anchorOffset:y=0}=r,{data:x}=o.props;if(h>=0&&h<x.length&&o.scrollLength>0){d=Qt(o,h);let C=0,w=!1;for(let S=h;S<x.length;S++){let L=k_(e,S),k=S===h&&v!==void 0?Math.min(L||0,Math.max(0,v)):L;L===void 0&&(w=!0),k!=null&&k>0&&(C+=k)}C=Math.max(0,C-e.scrollAxisGap),C+=(e.values.get("footerSize")||0)+ab(o.props),c=!w;let T=Math.max(0,o.scrollLength-C-y);f=w?Math.min(a||0,T):T}else h>=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&&(Be(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f)),m&&(sl(e),rl(e,o.scroll,!0,{markHasScrolled:!1})),(n=r?.onReady)==null||n.call(r,{anchorIndex:l,anchorKey:d,size:f})):!c&&p&&f<(a||0)&&(Be(e,"anchoredEndSpaceSize",f),(t=r?.onSizeChanged)==null||t.call(r,f),r?.includeInEndInset&&rl(e,o.scroll,!0,{markHasScrolled:!1})),f}function dj(e){var t;let n=e.state;n.userScrollAnchorReset!==void 0?(ei(e),((t=n.userScrollAnchorReset)==null?void 0:t.keys.size)===0&&(n.userScrollAnchorReset=void 0)):n.mvcpAnchorLock?n.scheduledWork.has("mvcpRecalculate")||n.scheduledWork.frame(()=>ei(e,{doMVCP:!0}),"mvcpRecalculate"):(n.scheduledWork.cancel("mvcpRecalculate"),ei(e,{doMVCP:!0}))}function WN(e,t,n){if(e.state.needsOtherAxisSize){let r=n?t.height:t.width,a=be(e,"otherAxisSize");(!a||r>a)&&Be(e,"otherAxisSize",r)}}var Ja;function j_(e){let t=Ja===void 0;Ja??(Ja=new Map);try{e()}finally{if(t){let n=Ja;Ja=void 0;for(let[o,r]of n)yb(o,r)}}}function cj(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 uj(e,t){var n;let o=e.state;t.needsRecalculate?(o.scrollForNextCalculateItemsInView=void 0,dj(e)):t.didMeasureUserScrollAnchorResetItem&&((n=o.userScrollAnchorReset)==null?void 0:n.keys.size)===0&&(o.userScrollAnchorReset=void 0),t.didChange&&$g(e),t.didChange&&t.shouldMaintainScrollAtEnd&&Rd(e)}function Q_(e,t){if(Ja){let n=Ja.get(e);n?n.push(t):Ja.set(e,[t])}else yb(e,[t])}function yb(e,t){var n;let o=e.state,r={};for(let a of t)if(a.containerId===void 0||be(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?SG(o,a.containerId,s,l):void 0,c=fj(e,a.itemKey,a.size,d);cj(r,c)}uj(e,r)}function fj(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:g,data:h,maintainScrollAtEnd:v}}=i;if(!h)return{didMeasureUserScrollAnchorResetItem:l};let y=i.indexByKey.get(t);if(f){if(y===void 0)return{didMeasureUserScrollAnchorResetItem:l};let k=i.props.data[y];if(k===void 0)return{didMeasureUserScrollAnchorResetItem:l};if(!o?.didResolveFixedItemSize){let P=(a=o?.itemType)!=null?a:p&&(r=p(k,y))!=null?r:"";o={didResolveFixedItemSize:!0,fixedItemSize:f(k,y,P),itemType:P}}let I=o.fixedItemSize;if(I!==void 0&&I===c.get(t))return WN(e,n,m),{didMeasureUserScrollAnchorResetItem:l}}let x=!d,C=!1,w,T=i.sizesKnown.get(t),S=pj(e,t,n,o),L=Qu(m?n.width:n.height);if(S!==0){w=w!==void 0?Math.min(w,y):y;let{startBuffered:k,endBuffered:I}=i;x||(x=y>=k&&y<=I),!x&&i.containerItemKeys.has(t)&&(x=!0),(T===void 0||Math.abs(T-L)>5)&&(C=!0),g?.({index:y,itemData:i.props.data[y],itemKey:t,previous:L-S,size:L})}if(w!==void 0&&(i.minIndexSizeChanged=i.minIndexSizeChanged!==void 0?Math.min(i.minIndexSizeChanged,w):w),WN(e,n,m),d||Gu(i,i.startBuffered,i.endBuffered)){let k=C&&!!v?.onItemLayout;return{didChange:S!==0,didMeasureUserScrollAnchorResetItem:l,needsRecalculate:x,shouldMaintainScrollAtEnd:k}}return{didChange:S!==0,didMeasureUserScrollAnchorResetItem:l}}function pj(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 g=s.get(t),h=c[g],v=o?.itemType,y=o?.fixedItemSize;m&&!o?.didResolveFixedItemSize&&(v=p&&(r=p(h,g))!=null?r:"",y=m(h,g,v));let x=o?.didResolveFixedItemSize||v!==void 0||y!==void 0?{didResolveFixedItemSize:o?.didResolveFixedItemSize,fixedItemSize:y,itemType:v}:void 0,C=yo(e,t,g,h,void 0,void 0,void 0,x),w=f?n.width:n.height,T=l.get(t),S=Math.round(w);if(l.set(t,S),y===void 0&&S>0){v??(v=p&&(a=p(h,g))!=null?a:"");let L=d[v];L||(L=d[v]={avg:0,num:0}),L.num===0?(L.avg=S,L.num++):T!==void 0&&T>0?L.avg+=(S-T)/L.num:(L.avg=(L.avg*L.num+S)/(L.num+1),L.num++)}return!C||Math.abs(C-S)>.1?(GC(e,t,S),S-C):0}function mj(e,t=null){let n=[],o=t??e.viewRefs.keys();for(let r of o){let a=e.viewRefs.get(r),i=be(e,`containerItemKey${r}`),s=a?.current;if(i!==void 0&&s){let l=s.getBoundingClientRect();uW(s,l),n.push({containerId:r,itemKey:i,size:{height:l.height,width:l.width}})}}n.length>0&&yb(e,n)}var X_=Wn,ha=ve,gj=ha(function({children:t}){let n=Hr(),[o]=er(["containerLayoutEpoch"]);return Ce(()=>{{let r=FG(n);r!==void 0&&mj(n,r)}},[n,o]),t}),Og=e=>Rh(e)?e:e?De(e,null):null,hj=typeof document<"u"&&!!document.getElementById("react-native-stylesheet"),YC={contain:"paint layout style",...hj?{display:"flex",flexDirection:"column"}:{}},vj=ha(function({id:t,horizontal:n,style:o,refView:r,...a}){let[i=Pd]=er([`containerPosition${t}`]),s=Qg(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 De("div",{ref:r,...m,style:l})}),yj=ha(function({id:t,horizontal:n,style:o,refView:r,animatedScrollY:a,stickyHeaderConfig:i,onLayout:s,onLayoutChange:l,children:d,...c}){let[f=Pd,p,m]=er([`containerPosition${t}`,"activeStickyIndex",`containerItemIndex${t}`]),g=q(()=>{var y;return(y=Qg(o)?Object.assign({},...o):o)!=null?y:{}},[o]),h=q(()=>{var y;let x={...YC,...g};delete x.transform;let C=(y=i?.offset)!=null?y:0,w=p===m;return x.position=w?"sticky":"absolute",x.zIndex=m+1e3,n?x.left=w?C:f:x.top=w?C:f,x},[g,n,f,m,p,i?.offset]),v=q(()=>i?.backdropComponent?De("div",{style:{inset:0,pointerEvents:"none",position:"absolute"}},Og(i.backdropComponent)):null,[i?.backdropComponent]);return De("div",{ref:r,style:h,...c},v,d)}),xj=vj;function Cj(e){Q(()=>e())}var Y_=bt(null),bj=-1;function wj(){return Ut(Y_)}function Sj(){var e;let t=wj(),n=(e=t?.containerId)!=null?e:bj,[o]=er([`containerItemKey${n}`]);return sW("lastItemKeys",a=>t&&!Wu(o)&&a?.includes(o)||!1)}function Ij({ItemSeparatorComponent:e,leadingItem:t}){return Sj()?null:De(e,{leadingItem:t})}var $C=null;function Tj(){return $C||($C=new ResizeObserver(e=>{j_(()=>{for(let t of e){let n=Fg.get(t.target);if(n)for(let o of n)o(t)}})})),$C}var Fg=new WeakMap;function kj(e,t){var n;if(typeof ResizeObserver>"u"||!e)return()=>{};let o=Tj(),r=(n=Fg.get(e))!=null?n:new Set;return r.size===0&&(Fg.set(e,r),o.observe(e,{box:"border-box"})),r.add(t),()=>{r.delete(t),r.size===0&&(Fg.delete(e),o.unobserve(e))}}function xb({ref:e,measureInLayoutEffect:t=!0,onLayoutProp:n,onLayoutChange:o,webLayoutResync:r},a){return Ce(()=>{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,g)=>{m.height===0&&m.width===0||(o(m,g),n?.({nativeEvent:{layout:m}}))},p;if(t){let m=c.getBoundingClientRect();f(GN(m),!0),p=m}return kj(c,m=>{var g;let h=m.target instanceof HTMLElement?m.target:void 0,v=Array.isArray(m.borderBoxSize)?m.borderBoxSize[0]:m.borderBoxSize,y=v?{height:v.blockSize,left:m.contentRect.left,top:m.contentRect.top,width:v.inlineSize}:(g=h?.getBoundingClientRect())!=null?g:m.contentRect,x=p??cW(c),C=x===void 0||y.width!==x.width||y.height!==x.height;p=y;let w=!!r?.();(C||w)&&f(GN(y),!1)})},[t,...a||[]]),{}}function GN(e){return e?{height:e.height,width:e.width,x:e.left,y:e.top}:{height:0,width:0,x:0,y:0}}var Bg=new Map,KC;function J_(e){Bg.delete(e)}function Lj(e,t){Bg.set(e,t),KC===void 0&&(KC=requestAnimationFrame(()=>{let n=Array.from(Bg.values());Bg.clear(),KC=void 0,j_(()=>{for(let o of n)o()})}))}function Pj({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=Qu(n[l]);r.lastSize&&Qu(r.lastSize[l]);let f=a.sizesKnown.get(i),p=()=>{r.lastSize=s,Q_(t,{containerId:e,itemKey:i,size:s})};!tf(a)&&f!==void 0&&d+1<f?Lj(r,()=>{var g;if(r.itemKey===i){let h=o.current,v=(g=h?.getBoundingClientRect)==null?void 0:g.call(h);v&&(s={height:v.height,width:v.width}),p()}}):(J_(r),p())}function Aj({containerId:e,ctx:t,horizontal:n,itemKey:o,ref:r}){let a=N({didLayout:!1,horizontal:n,itemKey:o});a.current.horizontal=n,a.current.itemKey=o;let[i,s]=Q(0),l=R(f=>{Pj({containerId:e,ctx:t,rectangle:f,ref:r,state:a.current})},[e,t,r]),d=R(()=>{Hg(t,e)},[e,t]);Ce(()=>(t.containerLayoutTriggers.set(e,d),()=>{J_(a.current),t.containerLayoutTriggers.get(e)===d&&t.containerLayoutTriggers.delete(e)}),[e,t,d]),Ce(()=>{Hg(t,e)});let{onLayout:c}=xb({measureInLayoutEffect:!sb,onLayoutChange:l,ref:r,webLayoutResync:()=>tf(t.state)},[o,i]);return W(()=>{},[e,t,o]),{onLayout:c,triggerLayout:d}}function Ej({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&&ti.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 Rj=ha(function({id:t,itemKey:n,recycleItems:o,horizontal:r,getRenderedItem:a,ItemSeparatorComponent:i,stickyHeaderConfig:s}){let l=Hr(),{columnWrapperStyle:d,animatedScrollY:c}=l,f=oi(l.state),p=l.state.props.positionComponentInternal,m=l.state.props.stickyPositionComponentInternal,[g=0,h=1,v,y=1,x,C]=er([`containerColumn${t}`,`containerSpan${t}`,`containerItemData${t}`,"numColumns","extraData",`containerSticky${t}`]),w=N(null),{onLayout:T,triggerLayout:S}=Aj({containerId:t,ctx:l,horizontal:r,itemKey:n,ref:w}),L=g>0?g:1,k=Math.min(Math.max(h||1,1),y),I=y>1?`${(L-1)/y*100}%`:0,P=y>1?`${k/y*100}%`:void 0,E=q(()=>Ej({columnWrapperStyle:d,contentContainerAlignItems:l.state.props.contentContainerAlignItems,hasItemSeparator:!!i,horizontal:r,isHorizontalRTLList:f,numColumns:y,otherAxisPos:I,otherAxisSize:P}),[r,f,I,P,d,l.state.props.contentContainerAlignItems,y,i]),_=q(()=>n!==void 0?a(n):null,[n,v,x]),{renderedItem:A}=_||{},H=q(()=>(l.viewRefs.set(t,w),{containerId:t,triggerLayout:S}),[t,S]);return De(C?m||yj:p||xj,{animatedScrollY:C?c:void 0,horizontal:r,id:t,key:o?void 0:n,onLayout:T,refView:w,stickyHeaderConfig:s,style:E},De(Y_.Provider,{value:H},A,_&&i&&De(Ij,{ItemSeparatorComponent:i,leadingItem:_.item})))});function Mj({id:e,horizontal:t,recycleItems:n,ItemSeparatorComponent:o,getRenderedItem:r,stickyHeaderConfig:a,ContainerComponent:i=Rj}){let[s]=er([`containerItemKey${e}`]);return s===void 0?null:De(i,{getRenderedItem:r,horizontal:t,ItemSeparatorComponent:o,id:e,itemKey:s,recycleItems:n,stickyHeaderConfig:a})}var Nj=ha(function(t){return De(Mj,{...t})});function _j(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=Dj(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],g=n.indexOf(m);if(s.has(g)){f=m;break}}f?e.insertBefore(d,f):e.appendChild(d)}}}function Dj(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 Oj(e){let t=Hr(),n=N(void 0);W(()=>{let o=Za(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=be(t,`containerItemIndex${i}`);l&&d!==void 0&&a.set(l,d)}_j(r,a)}n.current=void 0},500)});return()=>{o(),n.current!==void 0&&clearTimeout(n.current)}},[t])}function Fj(e,t){let[n,o]=Q(t),r=n!==t;return Ce(()=>{o(t)},[t]),e&&!r}var Bj=ha(function({freshDataTransitionEpoch:t,horizontal:n,numColumns:o,children:r}){let a=N(null),i=Hr(),s=i.columnWrapperStyle,l=oi(i.state),[d,c,f]=er(["otherAxisSize","readyToRender","totalSize"]),p=Fj(!!c,t);Oj(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:g,rowGap:h,gap:v}=s,y=g||v||0,x=h||v||0;n?(x&&(m.marginTop=m.marginBottom=-x/2),y&&(m.marginRight=-y)):x&&(m.marginBottom=-x)}return De("div",{ref:a,style:m},De(gj,null,r))}),zj=ha(function({freshDataTransitionEpoch:t,horizontal:n,recycleItems:o,ItemSeparatorComponent:r,getRenderedItem:a,stickyHeaderConfig:i}){let[s,l]=er(["numContainersPooled","numColumns"]),d=[];for(let c=0;c<s;c++)d.push(De(Nj,{getRenderedItem:a,horizontal:n,ItemSeparatorComponent:r,id:c,key:c,recycleItems:o,stickyHeaderConfig:i}));return De(Bj,{freshDataTransitionEpoch:t,horizontal:n,numColumns:l},d)});function Uj(e){return Qg(e)?Object.assign({},...e.filter(Boolean)):e}var ef={create:e=>e,flatten:e=>Uj(e)};function JC(e){let t=N(e);return t.current=e,t}function Hj(e){let t=JC(e),n=N(void 0),o=q(()=>({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 W(()=>()=>{o.cancel()},[o]),o}var ZC="legend-list-content-container",Z_="legend-list-scrollbar-x-hidden",eD="legend-list-scrollbar-y-hidden";function $j(){return typeof document>"u"?null:document.scrollingElement||document.documentElement||document.body}function eb(){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 jN(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 tD(e){var t,n;return{height:(t=e?.scrollHeight)!=null?t:0,width:(n=e?.scrollWidth)!=null?n:0}}function Kj(e,t,n){return tD(n?t:e)}function QN(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 XN(e,t){return Math.max(0,Math.min(e,t))}function YN(e,t){return t?e.width:e.height}function qj(e,t,n){return Math.max(0,YN(e,n)-YN(t,n))}function JN(e,t){return t&&$j()||e}function Vj(e,t){return t&&typeof window<"u"?window:e}function Wj(e,t,n){let o=e.getBoundingClientRect(),r=eb();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 Gj({clampedOffset:e,horizontal:t,listPos:n,scroll:o}){return{left:t?n.left+e:o.x,top:t?o.y:n.top+e}}var ZN="legend-list-scrollbar-axis-hidden-style",jj=200,Qj=`.${eD}::-webkit-scrollbar:vertical{width:0;display:none;}.${Z_}::-webkit-scrollbar:horizontal{height:0;display:none;}`;function Xj(){if(typeof document>"u"||document.getElementById(ZN))return;let e=document.createElement("style");e.id=ZN,e.textContent=Qj,document.head.appendChild(e)}function Yj(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 Jj(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 Zj(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 e_=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:g=!1,onLayout:h,...v},y){var x,C,w;let T=Hr(),[S]=er(["anchoredEndSpaceSize"]),L=N(null),k=N(null),I=g,P=R(()=>Vj(L.current,I),[I]),E=R(()=>{let Y=L.current,me=Kj(Y,k.current,I),ge=QN(Y,I,a);return qj(me,ge,a)},[a,I]),_=R(()=>{let Y=L.current;if(I){let me=E(),ge=eb(),G=jN(Y,ge),Ye=a?ge.x-G.left:ge.y-G.top;return XN(Ye,me)}return Y?a?Y.scrollLeft:Y.scrollTop:0},[E,a,I]),A=R((Y,me)=>{let ge=L.current,G=P();if(!G||typeof G.scrollTo!="function")return;let Ye=E(),ht=XN(Y,Ye),Dt={behavior:me?"smooth":"auto"};if(I){let Nt=eb(),Ot=jN(ge,Nt),{left:At,top:xt}=Gj({clampedOffset:ht,horizontal:a,listPos:Ot,scroll:Nt});Dt.left=At,Dt.top=xt}else a?Dt.left=ht:Dt.top=ht;G.scrollTo(Dt)},[E,P,a,I]);or(y,()=>({getBoundingClientRect:()=>{var me;return(me=L.current)==null?void 0:me.getBoundingClientRect()},getCurrentScrollOffset:_,getScrollableNode:()=>JN(L.current,I),getScrollEventTarget:()=>P(),getScrollResponder:()=>JN(L.current,I),isWindowScroll:()=>I,scrollBy:(me,ge)=>{let G=P();!G||typeof G.scrollBy!="function"||G.scrollBy({behavior:"auto",left:me,top:ge})},scrollTo:me=>{let{x:ge=0,y:G=0,animated:Ye=!0}=me;A(a?ge:G,Ye)},scrollToEnd:(me={})=>{let{animated:ge=!0}=me,G=E();A(G,ge)},scrollToOffset:me=>{let{offset:ge,animated:G=!0}=me;A(ge,G)}}),[_,E,P,a,I,A]);let H=R(()=>{if(!l||!L.current)return;let Y=tD(k.current),me=QN(L.current,I,a),ge=_(),G={nativeEvent:{contentOffset:{x:a?ge:0,y:a?0:ge},contentSize:{height:Y.height,width:Y.width},layoutMeasurement:{height:me.height,width:me.width}}};l(G)},[_,a,I,l]),V=Hj(H),J=N(void 0),D=R(()=>{let Y=J.current;Y!==void 0&&(clearTimeout(Y),J.current=void 0),V.flush(),d?.()},[d,V]),ne=R(Y=>{if(!l)return;let me=T.state;if(!!me?.scrollingTo||!!me?.initialScrollSession&&!me.didFinishInitialScroll||!!me?.initialScroll&&!me.didFinishInitialScroll||!!me&&tf(me)?V.flush():V.schedule(),d){let G=J.current;G!==void 0&&clearTimeout(G),J.current=setTimeout(D,jj)}},[T.state,D,d,l,V]);Ce(()=>{let Y=P();if(Y)return Y.addEventListener("scroll",ne,{passive:!0}),"onscrollend"in Y&&Y.addEventListener("scrollend",D),()=>{Y.removeEventListener("scroll",ne),"onscrollend"in Y&&Y.removeEventListener("scrollend",D);let me=J.current;me!==void 0&&(clearTimeout(me),J.current=void 0),V.cancel()}},[D,P,ne,V]),W(()=>{let Y=()=>{i&&A(a?i.x||0:i.y||0,!1)};Y(),requestAnimationFrame(Y)},[i?.x,i?.y,a,A]),Ce(()=>{if(!h||!L.current)return;let Y=L.current,me=()=>{h({nativeEvent:{layout:Wj(Y,I,a)}})};me();let ge=new ResizeObserver(()=>{me()});ge.observe(Y);let G=()=>{me()};return I&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("resize",G),()=>{ge.disconnect(),I&&typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("resize",G)}},[I,h]);let F=!I&&(a?!f&&Z_:!p&&eD);Ce(()=>{F&&Xj()},[F]);let U={...I?{}:{overflow:"auto",overflowX:a||f?"auto":"hidden",overflowY:a?p?"auto":"hidden":"auto",WebkitOverflowScrolling:"touch"},...ef.flatten(n),...s?{overflowAnchor:"none"}:{}},ee=Yj(T),j=(C=(x=T.state)==null?void 0:x.props)!=null&&C.anchoredEndSpace&&S?S:0,Z=Math.max(0,ee-j),de=Z?a?{flexShrink:0,width:Z}:{height:Z}:void 0,B={display:a?"flex":"block",flexDirection:a?"row":void 0,minHeight:a?void 0:"100%",minWidth:a?"100%":void 0,...ef.flatten(r),...s?{overflowAnchor:"none"}:{}},X=o?`${ZC} ${o}`:ZC,{contentContainerClassName:pe,contentInset:le,scrollEventThrottle:re,ScrollComponent:we,snapToOffsets:Xe,useWindowScroll:ot,className:at,...je}=v,oe=I?[]:Jj(Xe);oe.length>0&&(U.scrollSnapType=a?"x mandatory":"y mandatory",B.position=(w=B.position)!=null?w:"relative");let Te=F?at?`${at} ${F}`:F:at;return Zo&&/(?:^|\s)(?:[a-z0-9_-]+:)*gap(?:-[xy])?-(?:\[[^\]]+\]|[^\s]+)/.test(`${o??""} ${at??""}`)&&nl("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."),De("div",{className:Te,ref:L,...je,style:U},m,De("div",{className:X,ref:k,style:B},oe.map(Y=>De("div",{"aria-hidden":!0,"data-legend-list-snap-anchor":Y,key:`snap-${Y}`,style:Zj(Y,a)})),t,de?De("div",{"aria-hidden":!0,style:de}):null))});function e6({horizontal:e,needsOtherAxisSize:t,otherAxisSize:n}){if(!(!t||!n||n<=0))return e?{height:n}:{width:n}}function t_(e,t){let n=Hr();Ce(()=>Za(n,e,r=>{t(r)}),[t,n,e])}function t6(e){return e?{contentSizeKey:"scrollWidth",paddingEndProp:"paddingRight",viewportSizeKey:"clientWidth",x:1,y:0}:{contentSizeKey:"scrollHeight",paddingEndProp:"paddingBottom",viewportSizeKey:"clientHeight",x:0,y:1}}function n6(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 > .${ZC}`)),i?{contentNode:s,scrollElement:i}:null}function o6(e,t,n){e.scrollBy({behavior:"auto",left:t,top:n})}function r6(){let e=Hr(),t=N(0),n=N(0),o=N(void 0),r=N(void 0),a=N(null),i=R(()=>{let s=be(e,"scrollAdjust"),l=be(e,"scrollAdjustUserOffset"),d=(s||0)+(l||0);if(d-t.current!==0){let f=n6(e,a.current);if(f){let p=!!e.state.props.horizontal,m=t6(p),{contentNode:g,scrollElement:h}=f,v=p?h.scrollLeft:h.scrollTop,y=(l||0)-n.current,C=(y!==0?v+y:e.state.scroll)-v,w=Math.abs(C)>.01,T=()=>o6(h,m.x*C,m.y*C);if(a.current=g,w&&g){let S=g[m.contentSizeKey],L=h[m.viewportSizeKey],k=v+C;if(C>0&&!e.state.adjustingFromInitialMount&&S<k+L){let P=g.style[m.paddingEndProp],E=r.current,_=E?.value===P?E.baseline:P,A=(k+L-S)*2,V=`${(Number.parseFloat(window.getComputedStyle(g)[m.paddingEndProp])||0)+A}px`;g.style[m.paddingEndProp]=V,r.current={baseline:_,value:g.style[m.paddingEndProp]},g.offsetHeight,T(),o.current!==void 0&&cancelAnimationFrame(o.current),o.current=requestAnimationFrame(()=>{let J=r.current;o.current=void 0,r.current=void 0,g.style[m.paddingEndProp]===J?.value&&(g.style[m.paddingEndProp]=J.baseline)})}else T()}else w&&T()}t.current=d,n.current=l||0}},[e]);return t_("scrollAdjust",i),t_("scrollAdjustUserOffset",i),null}var a6=Wn(function({ScrollComponent:t,...n},o){let[r]=er(["snapToOffsets"]);return De(t,{...n,ref:o,snapToOffsets:r})}),tb=.1;function i6(e,t,n){let o=be(e,t)!==n;return o&&(Be(e,t,n),sl(e)),o}function s6(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-tb&&Math.abs(l)>tb}function n_(e,t){let{state:n}=e,o=be(e,"headerSize")||0,r=o!==t,a=n.didMeasureHeader||o>tb;r&&(Be(e,"headerSize",t),sl(e),a&&s6(e,o,t)&&ll(e,t-o)),n.didMeasureHeader=!0}function l6(e,t){let n=i6(e,"footerSize",t);return n&&$g(e),n}function d6(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 c6(e,t){let{state:n}=e,o=n.contentInsetOverride,r=t??void 0,a=!d6(o,r);return n.contentInsetOverride=r,a&&sl(e),a}function u6(e,t){let n=JC(e),o=JC(t);return q(()=>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 o_=({onLayoutChange:e,refView:t,children:n,...o})=>{let r=N(null),a=t??r;return xb({onLayoutChange:e,ref:a}),De("div",{...o,ref:a},n)},f6=ha(function({horizontal:t}){let[n=0]=er(["alignItemsAtEndPadding"]);return n<=0?null:De(Kg,{style:t?{flexShrink:0,width:n}:{flexShrink:0,height:n}},null)}),p6=ha(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:g,ListFooterComponentStyle:h,ListEmptyComponent:v,getRenderedItem:y,refScrollView:x,renderScrollComponent:C,onLayoutFooter:w,onInternalScrollBeginDrag:T,onInternalScrollEnd:S,scrollAdjustHandler:L,snapToIndices:k,stickyHeaderConfig:I,stickyHeaderIndices:P,useWindowScroll:E=!1,..._}){let A=Hr(),H=A.state.props.maintainVisibleContentPosition,[V=0,J=0]=er(["anchoredEndSpaceSize","otherAxisSize"]),D=A.state.props.alignItemsAtEndPaddingEnabled,ne=!!A.state.props.anchoredEndSpace&&A.state.props.anchoredEndSpaceOwner==="list"&&V>0,F;if(ne){let pe=a?oi(A.state)?"Left":"Right":"Bottom",le=ef.flatten(r);F={[`padding${pe}`]:Ku({},le||{},pe)+V}}let U=e6({horizontal:a,needsOtherAxisSize:A.state.needsOtherAxisSize,otherAxisSize:J}),ee=u6(C,(pe,le)=>({...pe,ref:le})),j=C?ee:e_,Z=k?a6:j,de=R((pe,le)=>{var re;let we=l6(A,pe);le?.(),we&&((re=A.state.props.maintainScrollAtEnd)!=null&&re.onFooterLayout)&&Rd(A)},[A]);Ce(()=>{p||n_(A,0),g||de(0)},[p,g,A,de]);let B=R(pe=>{let le=pe[a?"width":"height"];n_(A,le)},[A,a]),X=R((pe,le)=>{let re=pe[a?"width":"height"];de(re,()=>{w?.(pe,le)})},[a,w,de]);return De(Z,{..._,...j===e_?{onInternalScrollEnd:S,useWindowScroll:E}:{},contentContainerStyle:[a?{height:"100%"}:{},r,F,{boxSizing:"border-box"}],contentOffset:i!==void 0?a?{x:i,y:0}:{x:0,y:i}:void 0,horizontal:a,maintainVisibleContentPosition:H.size||H.data?{minIndexForVisible:0}:void 0,onLayout:f,onScroll:c,ref:x,ScrollComponent:k?j:void 0,style:U?[U,o]:o},De(r6,null),p&&De(o_,{onLayoutChange:B,style:m},Og(p)),v&&Og(v),D&&De(f6,{horizontal:a}),t&&!v&&De(zj,{freshDataTransitionEpoch:n,getRenderedItem:y,horizontal:a,ItemSeparatorComponent:l,recycleItems:s,stickyHeaderConfig:I}),g&&De(o_,{onLayoutChange:X,style:h},Og(g)),Zo&&pW)}),m6=100,g6=.9,h6=.9;function v6(e){let t=Hr(),{anchoredEndSpace:n,childrenMode:o,keyExtractor:r,numColumns:a,renderScrollComponent:i,useWindowScroll:s}=e,l=!!n;W(()=>{l&&(a??1)>1&&nl("anchoredEndSpaceNumColumns","anchoredEndSpace is only supported when numColumns is 1. Using it with multiple columns may produce incorrect anchored spacing.")},[l,a]),W(()=>{s&&i&&nl("useWindowScrollRenderScrollComponent","useWindowScroll is not supported when renderScrollComponent is provided.")},[i,s]),W(()=>{!r&&!t.state.isFirst&&t.state.didDataChange&&!o&&nl("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]),W(()=>{let d=t.state,c=d.props.data.length;if(d.props.useWindowScroll||c<m6)return;let p=()=>{let g=be(t,"readyToRender"),h=be(t,"numContainers")||0,v=be(t,"totalSize")||0,y=t.state.scrollLength||0;if(!g||v<=0||y<=0)return;let x=h>=Math.ceil(c*g6),C=y>=v*h6;x&&C&&nl("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=[Za(t,"numContainers",p),Za(t,"readyToRender",p),Za(t,"totalSize",p)];return()=>{for(let g of m)g()}},[t])}function y6(e){}var x6=Zo?v6:y6;function C6(e,t,{didColumnsChange:n=!1}={}){let o=e.state,{previousData:r}=o,{maintainScrollAtEnd:a}=o.props;if(n){o.sizes.clear(),o.sizesKnown.clear(),O_(o);for(let l in o.averageSizes)delete o.averageSizes[l];o.minIndexSizeChanged=0,o.scrollForNextCalculateItemsInView=void 0}ei(e,{dataChanged:!0,doMVCP:!0});let s=!n&&a?.onDataChange&&Rd(e);!s&&r&&t.length>r.length&&(o.isEndReached=!1),s||Gg(e),delete o.previousData}function b6(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 nD(e){var t,n;let o=e.state,{scrollLength:r,props:{data:a,getFixedItemSize:i,getItemType:s,numColumns:l,estimatedItemSize:d}}=o,c=b_(e),f=be(e,"numContainers");if(r>0&&a.length>0&&!f){let p;if(i){let g=0,h=Math.min(20,a.length);for(let v=0;v<h;v++){let y=a[v];if(y!==void 0){let x=(t=s?.(y,v))!=null?t:"";g+=((n=i(y,v,x))!=null?n:d)+e.scrollAxisGap}}p=g/h}else p=d+e.scrollAxisGap;let m=Math.max(1,Math.ceil((r+c*2)/p*l));for(let g=0;g<m;g++)Be(e,`containerPosition${g}`,Pd),Be(e,`containerColumn${g}`,-1),Be(e,`containerSpan${g}`,1);return Be(e,"numContainers",m),Be(e,"numContainersPooled",jG(a.length,m)),o.lastLayout&&(o.initialScroll?requestAnimationFrame(()=>{ei(e,{dataChanged:!0,doMVCP:!0})}):ei(e,{dataChanged:!0,doMVCP:!0})),!0}}function w6(){return typeof window>"u"?{height:0,width:0}:{height:window.innerHeight,width:window.innerWidth}}function S6(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=w6()[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 g=o.otherAxisSize,h=f!==o.scrollLength||p!==g;if(h){if(o.scrollLength=f,o.otherAxisSize=p,sl(e),o.lastBatchingAction=Date.now(),o.scrollForNextCalculateItemsInView=void 0,f>0&&nD(e),m&&ei(e,{doMVCP:!0}),(h||p!==g)&&Be(e,"scrollSize",{height:l.height,width:l.width}),r?.onLayout&&Rd(e),Gg(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}Zo&&d===0&&nl("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 I6(e,t){let n=lo.get(e);if(!!n&&lo.didReachTarget(t,n)){lo.clear(e);return}n&&(e.hasScrolled=!1,lo.set(e,{startScroll:n.startScroll,targetOffset:n.targetOffset}))}function T6(e){var t;return!!e.initialScroll&&((t=e.initialScrollSession)==null?void 0:t.kind)==="bootstrap"&&!e.didFinishInitialScroll}function k6(e){return{...e,nativeEvent:{...e.nativeEvent}}}function L6(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=Z4(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=Yi(e,f,l.scrollingTo);if(f!==p&&Math.abs(f-p)>1){f=p,Jg(e,{forceScroll:!0,isInitialScroll:!0,noScrollingTo:!0,offset:f});return}}l.scrollPending=f,rl(e,f,c,{fromNativeScrollEvent:!0}),I6(l,f),gG(e),l.scrollingTo&&hb(e),l.props.onScroll&&(T6(l)?l.deferredPublicOnScrollEvent=k6(t):l.props.onScroll(t))}var P6=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()}},A6=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,Be(this.ctx,"scrollAdjustPending",this.pendingAdjust)):(this.appliedAdjust+=e,Be(this.ctx,"scrollAdjust",this.appliedAdjust)),this.ctx.state.scrollingTo&&hb(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=jg(this.ctx,e.index);o=Xg(this.ctx,a,e),o=Yi(this.ctx,o,e)}else o=Yi(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,Be(this.ctx,"scrollAdjust",this.appliedAdjust)),Be(this.ctx,"scrollAdjustPending",0),ei(this.ctx)}}}};function E6(e,t){let n=e.state,o=ol(e,t),a=ol(e)-o;if(a!==0){let i=!!be(e,"isWithinMaintainScrollAtEndThreshold");rl(e,n.scroll,!0,{markHasScrolled:!1}),!z_(e)&&i&&a>0&&ll(e,a)}}function qC(e){return q(()=>e?(t,n,o)=>t!==void 0&&n!==void 0?e(t,n,o):void 0:void 0,[e])}var R6=(...e)=>R(n=>{for(let o of e)o&&(I_(o)?o(n):o.current=n)},e);function M6(e){return null}function N6(e,t,n,o){return o}function _6(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 D6(e,t){let n=e.state,r=n.props.data.length-1;if(r===-1)return!1;let a=n.props.stylePaddingBottom||0,i=be(e,"footerSize")||0;return Dg(e,{...t,index:r,viewOffset:-a-i+(t?.viewOffset||0),viewPosition:1}),!0}var O6="default";function F6(e){let t={};for(let n in e.averageSizes){let o=e.averageSizes[n];o&&(t[n||O6]={average:o.avg,count:o.num})}return t}function B6(e){Hg(e)}function z6(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=(h,v=!1)=>{var y;let x=n.props,C=x.data.length,w=(y=x.anchoredEndSpace)==null?void 0:y.anchorIndex;return h<0?v:h>=C?!1:w===void 0||w<0||w>=C||h<w?!0:RW(e,w,C-1)},l=(h,v,y)=>{let x=Date.now(),C=0,w=()=>{if(h!==a)return;i()||!y()?C=0:C+=1;let T=Date.now()-x>=o;if(C>=r||T){v();return}n.scheduledWork.frame(w,"imperativeScrollReady")};n.scheduledWork.frame(w,"imperativeScrollReady")},d=(h,v,y,x=()=>!0)=>{let C=()=>{if(h!==a)return;(!y()||!n.scrollingTo)&&(n.pendingScrollResolve===v&&(n.pendingScrollResolve=void 0),v())};i()||!x()?l(h,C,x):C()},c=h=>{n.scheduledWork.cancel("imperativeScrollReady");let v=++a;return p_(n),n.pendingScrollResolve=h,v},f=(h,v=()=>!0)=>new Promise(y=>{let x=c(y);_N(e),d(x,y,h,v)});n.runPendingScrollToEnd=()=>{let h=n.pendingScrollToEnd;h&&(n.pendingScrollToEnd=void 0,h.token===a&&d(h.token,h.resolve,()=>D6(e,h.options),()=>s(n.props.data.length-1,!0)))};let p=h=>{if(n){let{index:v,...y}=h,{startNoBuffer:x,endNoBuffer:C}=n;if(v<x||v>C){let w=v<x?0:1;return Dg(e,{...y,index:v,viewPosition:w}),!0}}return!1},m=n.refScroller;return{clearCaches:h=>{var v,y;let x=(v=h?.mode)!=null?v:"sizes";n.sizes.clear(),n.sizesKnown.clear(),O_(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,Be(e,"totalSize",0),x==="full"&&(n.indexByKey.clear(),n.idCache.length=0,n.positions.length=0,n.columns.length=0,n.columnSpans.length=0),B6(e),(y=n.triggerCalculateItemsInView)==null||y.call(n,{forceFullItemPositions:!0})},flashScrollIndicators:()=>m.current.flashScrollIndicators(),getAnimatableRef:()=>{var h,v,y;return(y=(v=(h=m.current).getNativeScrollRef)==null?void 0:v.call(h))!=null?y:m.current},getNativeScrollRef:()=>m.current,getScrollableNode:()=>m.current.getScrollableNode(),getScrollResponder:()=>m.current.getScrollResponder(),getState:()=>({activeStickyIndex:be(e,"activeStickyIndex"),contentLength:vo(e),data:n.props.data,elementAtIndex:h=>{var v;return(v=e.viewRefs.get(jC(e,Qt(n,h))))==null?void 0:v.current},end:n.endNoBuffer,endBuffered:n.endBuffered,getAverageItemSizes:()=>F6(n),indexByKey:h=>n.indexByKey.get(h),isAtEnd:be(e,"isAtEnd"),isAtStart:be(e,"isAtStart"),isEndReached:n.isEndReached,isNearEnd:be(e,"isNearEnd"),isNearStart:be(e,"isNearStart"),isStartReached:n.isStartReached,isWithinMaintainScrollAtEndThreshold:be(e,"isWithinMaintainScrollAtEndThreshold"),listen:(h,v)=>Za(e,h,v),listenToPosition:(h,v)=>aW(e,h,v),positionAtIndex:h=>n.positions[h],positionByKey:h=>{let v=n.indexByKey.get(h);return v===void 0?void 0:n.positions[v]},scroll:n.scroll,scrollLength:n.scrollLength,scrollVelocity:Yg(n),sizeAtIndex:h=>n.sizesKnown.get(Qt(n,h)),sizes:n.sizesKnown,start:n.startNoBuffer,startBuffered:n.startBuffered}),reportContentInset:h=>{let v=c6(e,h);rl(e,n.scroll,!0,{markHasScrolled:!1}),v&&z_(e)},scrollIndexIntoView:h=>f(()=>p(h)),scrollItemIntoView:({item:h,...v})=>f(()=>{let x=n.props.data.indexOf(h);return x!==-1?(p({index:x,...v}),!0):!1}),scrollToEnd:h=>new Promise(v=>{var y;let x=c(v);n.pendingScrollToEnd={options:h,resolve:v,token:x},t?.(),_N(e),t||(y=n.runPendingScrollToEnd)==null||y.call(n)}),scrollToIndex:h=>f(()=>(Dg(e,h),!0),h.index>=0?()=>s(h.index):void 0),scrollToItem:({item:h,...v})=>f(()=>{let x=n.props.data.indexOf(h);return x!==-1?(Dg(e,{index:x,...v}),!0):!1}),scrollToOffset:h=>f(()=>(Jg(e,h),!0)),setItemSize:(h,v)=>{Q_(e,{itemKey:h,size:v})},setScrollProcessingEnabled:h=>{n.scrollProcessingEnabled=h},setVisibleContentAnchorOffset:h=>{let v=I_(h)?h(be(e,"scrollAdjustUserOffset")||0):h;Be(e,"scrollAdjustUserOffset",v)}}}var U6=(e,t)=>e-t,r_=e=>typeof e=="number"&&Number.isFinite(e)?Math.max(0,Math.floor(e)):0,$u=(e,t,n)=>{n>=0&&n<t&&e.add(n)};function H6(e,t,n,o){var r,a;if(t.length===0)return[];let i=new Set,s=t.length,l=r_(e?.top);if(l>0)for(let f=0;f<Math.min(l,s);f++)$u(i,s,f);let d=r_(e?.bottom);if(d>0)for(let f=Math.max(0,s-d);f<s;f++)$u(i,s,f);if((r=e?.indices)!=null&&r.length)for(let f of e.indices)Number.isFinite(f)&&$u(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)&&($u(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++)$u(i,s,p)}let c=Array.from(i);return c.sort(U6),c}function $6(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=be(e,"extraData"),f=a[l];if(s&&!Wu(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 a_(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 K6(e){var t;return e?e===!0?{...a_(void 0,!1),animated:!1}:{...a_(e.on,"on"in e),animated:(t=e.animated)!=null?t:!1}:void 0}function q6(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 V6(e,{stylePaddingTop:t}){let n=e.state;if(t!==void 0){let o=be(e,"stylePaddingTop")||0;if(t<o){let r=be(e,"totalSize")||0;Be(e,"totalSize",r+o),n.timeoutSetPaddingTop=setTimeout(()=>{r=be(e,"totalSize")||0,Be(e,"totalSize",r-o)},16)}Be(e,"stylePaddingTop",t)}}function W6(e){let t=N(null),n=N(0),o=N(null),r=()=>{t.current&&(clearTimeout(t.current),t.current=null)};return R((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 G6(e,t){let n=W6("throttle");return o=>n(e,t,{nativeEvent:o.nativeEvent})}var j6=ha(X_(function(t,n){let{children:o,data:r,renderItem:a,...i}=t,l=o!==void 0&&r===void 0?{...i,childrenMode:!0,data:(Qg(o)?o:Ah.toArray(o)).flat(1),renderItem:({item:d})=>d}:{...i,data:r||[],renderItem:a};return De(nW,null,De(Q6,{...l,ref:n}))})),Q6=X_(function(t,n){var o,r,a,i,s,l,d,c,f,p,m,g,h,v,y,x,C,w,T;let S=R(Ke=>{},[]);t.recycleItems===void 0&&nl("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:k,alwaysRender:I,columnWrapperStyle:P,contentContainerStyle:E,contentInset:_,data:A=[],dataKey:H,dataVersion:V,drawDistance:J=250,contentInsetEndAdjustment:D,estimatedItemSize:ne=100,estimatedListSize:F,extraData:U,getFixedItemSize:ee,getItemType:j,horizontal:Z,rtl:de,estimatedHeaderSize:B,initialScrollAtEnd:X=!1,initialScrollIndex:pe,initialScrollOffset:le,experimental_adaptiveRender:re,itemsAreEqual:we,keyExtractor:Xe,ListEmptyComponent:ot,ListFooterComponent:at,ListFooterComponentStyle:je,ListHeaderComponent:oe,maintainScrollAtEnd:Te=!1,maintainScrollAtEndThreshold:Y=.1,maintainVisibleContentPosition:me,numColumns:ge=1,overrideItemLayout:G,onEndReached:Ye,onEndReachedThreshold:ht=.5,onItemSizeChanged:Mt,onMetricsChange:Dt,onLayout:Nt,onLoad:Ot,onMomentumScrollEnd:At,onRefresh:xt,onScroll:_t,onScrollBeginDrag:Xt,onStartReached:mn,onStartReachedThreshold:Hn=.5,onStickyHeaderChange:vt,onFirstVisibleItemChanged:qt,onViewableItemsChanged:an,progressViewOffset:kn,recycleItems:sn=!1,refreshControl:Cn,refreshing:$n,refScrollView:$,renderScrollComponent:ae,renderItem:ce,scrollEventThrottle:Le,snapToIndices:ze,stickyHeaderIndices:ft,style:gn,useWindowScroll:lt=!1,viewabilityConfig:hn,viewabilityConfigCallbackPairs:Ft,...rt}=t,Zt=t.animatedPropsInternal,ln=(o=t.anchoredEndSpaceOwnerInternal)!=null?o:"list",Se=t.positionComponentInternal,Re=t.stickyPositionComponentInternal,{anchoredEndSpaceOwnerInternal:qe,positionComponentInternal:pt,stickyPositionComponentInternal:st,...it}=rt,kt=ef.flatten(E),Vt=L&&!Z&&kt?.minHeight==null&&A.length>0,Pe=L&&!Vt&&(Z?kt?.minWidth==null:kt?.minHeight==null),Et={...kt,...L&&!Vt?{display:"flex",flexDirection:Z?"row":"column",...Pe?{flexGrow:1}:{},justifyContent:"flex-end"}:{}},yt={...ef.flatten(gn)},on=Ku(yt,Et,"Top"),Nn=Ku(yt,Et,"Bottom"),xe=Ku(yt,Et,"Left"),Ve=Ku(yt,Et,"Right"),Ct=ab({horizontal:Z,rtl:de,stylePaddingBottom:Nn,stylePaddingLeft:xe,stylePaddingRight:Ve}),ct=K6(Te),vn=q6(me),bn=pe!=null,yn=le!=null,Lt=!X&&!bn&&!yn&&rb({horizontal:Z,rtl:de}),xn=!X&&!bn&&(yn||Lt),Wt=X||bn,An=X?{index:Math.max(0,A.length-1),preserveForBottomPadding:!0,viewOffset:-Ct,viewPosition:1}:bn?typeof pe=="object"?{index:(r=pe.index)!=null?r:0,preserveForBottomPadding:pe.viewOffset===void 0&&pe.viewPosition===1?!0:void 0,viewOffset:(a=pe.viewOffset)!=null?a:pe.viewPosition===1?-Ct:0,viewPosition:(i=pe.viewPosition)!=null?i:0}:{index:pe??0,viewOffset:le??0}:xn?{contentOffset:le??0,index:0,viewOffset:0}:void 0,[eo,va]=Q(!sb),[,ya]=Ea(Ke=>Ke+1,0),He=Hr();He.columnWrapperStyle=P||(Et?_6(Et):void 0);let xa=Z?(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,xr=typeof xa=="number"&&Number.isFinite(xa)?xa:0,Kr=N(null),_n=R6(Kr,$),tr=Xe??((Ke,Bt)=>Bt.toString()),Ro=ft,ii=D,cl=N(ii),Zi=q(()=>{let Ke=H6(I,A,tr,k?.anchorIndex);return{arr:Ke,set:new Set(Ke)}},[k?.anchorIndex,I?.top,I?.bottom,(m=I?.indices)==null?void 0:m.join(","),(g=I?.keys)==null?void 0:g.join(","),A,H,V,tr]),to=!!lt&&!ae,mt=N(void 0),xo=!!G,zo=N(xo);if(!mt.current){if(!He.state){let Ke=(F??{height:0,width:0})[Z?"width":"height"];He.values.set("adaptiveRender",(h=re?.initialMode)!=null?h:"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:A.length>0,idCache:[],idsInView:[],indexByKey:new Map,initialScroll:An,initialScrollSession:An?{kind:xn?"offset":"bootstrap",previousDataLength:A.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 P6,scroll:0,scrollAdjustHandler:new A6(He),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 Bt=He.state;Bt.triggerCalculateItemsInView=dn=>ei(He,dn),Bt.reprocessCurrentScroll=()=>rl(He,Bt.scroll,!0),Be(He,"maintainVisibleContentPosition",vn),Be(He,"extraData",U),B!==void 0&&Be(He,"headerSize",B)}mt.current=He.state}let Ae=mt.current,Uo=Ae.isFirst,es=Ae.props.adaptiveRender,Dn=Ae.props.numColumns,qr=!Uo&&He.scrollAxisGap!==xr;He.scrollAxisGap=xr,Ae.didColumnsChange=ge!==Dn||qr;let co=(y=(v=Ae.props.data)==null?void 0:v.length)!=null?y:0,Vr=Ae.props.data!==A,uo=Ae.props.dataKey!==H,Ho=Ae.props.dataVersion!==V,Kn=uo||Ho||Vr&&b6(Ae,A,Ae.props.data),Co=!Uo&&Kn&&Ae.hasHadNonEmptyData&&(uo||co===0)&&A.length>0;Kn&&!X&&Ae.didFinishInitialScroll&&((x=Ae.initialScroll)==null?void 0:x.viewPosition)===1&&Ae.props.data.length>0&&Ad(Ae),Kn&&(Ae.dataChangeEpoch+=1,Ae.dataChangeNeedsScrollUpdate=!0,Ae.didDataChange=!0,Ae.previousData=Ae.props.data),Co&&(Ae.freshDataTransitionEpoch+=1);let si=G6(_t??S,Le??0),li=Le&&_t?si:_t,di=!Uo&&!Kn&&((C=Ae.props.anchoredEndSpace)==null?void 0:C.anchorIndex)!==k?.anchorIndex;Ae.props={adaptiveRender:re,alignItemsAtEnd:L,alignItemsAtEndPaddingEnabled:Vt,alwaysRender:I,alwaysRenderIndicesArr:Zi.arr,alwaysRenderIndicesSet:Zi.set,anchoredEndSpace:k,anchoredEndSpaceOwner:ln,animatedProps:Zt,contentContainerAlignItems:Et.alignItems,contentInset:_,contentInsetEndAdjustment:ii,data:A,dataKey:H,dataVersion:V,drawDistance:J,estimatedItemSize:ne,getFixedItemSize:qC(ee),getItemType:qC(j),horizontal:!!Z,itemsAreEqual:we,keyExtractor:qC(tr),maintainScrollAtEnd:ct,maintainScrollAtEndThreshold:Y,maintainVisibleContentPosition:vn,numColumns:ge,onEndReached:Ye,onEndReachedThreshold:ht,onFirstVisibleItemChanged:qt,onItemSizeChanged:Mt,onLoad:Ot,onMomentumScrollEnd:At,onScroll:li,onScrollBeginDrag:Xt,onStartReached:mn,onStartReachedThreshold:Hn,onStickyHeaderChange:vt,overrideItemLayout:G,positionComponentInternal:Se,recycleItems:!!sn,renderItem:ce,rtl:de,snapToIndices:ze,stickyHeaderIndicesArr:Ro??[],stickyHeaderIndicesSet:q(()=>new Set(Ro??[]),[Ro?.join(",")]),stickyPositionComponentInternal:Re,stylePaddingBottom:Nn,stylePaddingLeft:xe,stylePaddingRight:Ve,stylePaddingTop:on,useWindowScroll:to},Ae.refScroller=Kr,!Uo&&es&&!re&&lb(He);let nr=q(()=>A.length?Array.from({length:Math.min(ge,A.length)},(Ke,Bt)=>Qt(Ae,A.length-1-Bt)):[],[A,H,V,ge]),wn=Ke=>{Be(He,"lastItemKeys",nr),Be(He,"numColumns",ge);let Bt=be(He,"stylePaddingTop");V6(He,{stylePaddingTop:on}),mt.current.props.stylePaddingBottom=Nn,sl(He);let dn=on-Bt;Ke&&vn.size&&dn&&Bt!==void 0&&ti.OS};Uo&&(wn(!1),U_(Ae),$_(He,!0));let Wr=q(()=>{var Ke,Bt;let dn=Ae.initialScroll;if(!dn)return;let Ln=(Ke=dn.contentOffset)!=null?Ke:Ur(He,dn);return Wt&&((Bt=Ae.initialScrollSession)==null?void 0:Bt.kind)==="bootstrap"&&ti.OS==="web"?void 0:Ln},[Wt]);Ce(()=>{DG(He,{alwaysDispatchInitialScroll:Lt,dataLength:A.length,hasFooterComponent:!!at,initialContentOffset:Wr,initialScrollAtEnd:X,useBootstrapInitialScroll:Wt})},[]),(Uo||Kn||Ae.didColumnsChange)&&(mt.current.lastBatchingAction=Date.now(),!Xe&&!Uo&&Kn&&(mt.current.sizes.clear(),mt.current.positions.length=0,mt.current.totalSize=0,Be(He,"totalSize",0))),Zo&&x6(t),Ce(()=>{Co&&cb(He,{resetInitialScroll:!!An,resetLayout:!0}),OG(He,{dataLength:A.length,didDataChange:Kn,didStartFreshData:Co,initialScrollAtEnd:X,latestInitialScroll:An,latestInitialScrollSessionKind:xn?"offset":"bootstrap",stylePaddingEnd:Ct,useBootstrapInitialScroll:Wt})},[A.length,H,Kn,Co,X,Ct,Wt]),Ce(()=>{var Ke;di&&(Ae.scrollForNextCalculateItemsInView=void 0,(Ke=Ae.triggerCalculateItemsInView)==null||Ke.call(Ae)),$g(He)},[He,A,V,k?.anchorIndex,k?.anchorMaxSize,k?.anchorOffset,di,Z,ge,de,Nn,xe,Ve]),Ce(()=>{let Ke=cl.current;cl.current=ii,E6(He,Ke)},[He,ii]);let Mo=R(Ke=>{Wt&&yG(He,{dataLength:A.length,footerSize:Ke[Z?"width":"height"],initialScrollAtEnd:X,stylePaddingEnd:Ct})},[A.length,X,Z,Ct,Wt]),Ca=R((Ke,Bt)=>{let dn=Ae.scrollLength,Ln=Ae.otherAxisSize;S6(He,Ke,va),$g(He);let Sa=dn!==Ae.scrollLength||Ln!==Ae.otherAxisSize;Wt&&!Bt&&Sa&&xG(He),!Wt&&Yu(He)},[A.length,X,Ct,Wt]),{onLayout:ba}=xb({onLayoutChange:Ca,onLayoutProp:Nt,ref:Kr});Ce(()=>{ze&&H_(He)},[ze]),Ce(()=>wn(!0),[H,V,nr.join(","),ge,xr,Nn,on,Vt]),Ce(()=>{let{didColumnsChange:Ke,didDataChange:Bt,isFirst:dn,props:{data:Ln}}=Ae;!(Ln.length>0&&nD(He))&&!dn&&(Bt||Ke)&&C6(He,Ln,{didColumnsChange:Ke}),Bt&&(Ae.pendingDataComparison=void 0),Ae.didColumnsChange=!1,Ae.didDataChange=!1,Ae.isFirst=!1},[A,H,V,ge,xr]),Ce(()=>{var Ke;Be(He,"extraData",U);let Bt=zo.current!==xo;zo.current=xo,(xo||Bt)&&ge>1&&((Ke=Ae.triggerCalculateItemsInView)==null||Ke.call(Ae,{forceFullItemPositions:!0}))},[U,xo,ge]),W(()=>{if(!Dt)return;let Ke,Bt=()=>{let Ln={footerSize:be(He,"footerSize")||0,headerSize:be(He,"headerSize")||0};(!Ke||Ln.headerSize!==Ke.headerSize||Ln.footerSize!==Ke.footerSize)&&(Ke=Ln,Dt(Ln))};Bt();let dn=[Za(He,"headerSize",Bt),Za(He,"footerSize",Bt)];return()=>{for(let Ln of dn)Ln()}},[He,Dt]),W(()=>{let Ke=$G({onViewableItemsChanged:an,viewabilityConfig:hn,viewabilityConfigCallbackPairs:Ft});Ae.viewabilityConfigCallbackPairs=Ke,Ae.enableScrollForNextCalculateItemsInView=!0,Ke&&(Ae.scrollForNextCalculateItemsInView=void 0)},[hn,Ft,an]),Cj(()=>{}),or(n,()=>z6(He,ya),[]),W(()=>()=>{gW(Ae),Ae.scheduledWork.dispose()},[Ae]),Ce(()=>{var Ke;(Ke=Ae.runPendingScrollToEnd)==null||Ke.call(Ae)}),W(()=>{Wt||Yu(He)},[He,Wt]);let qn=q(()=>({getRenderedItem:Ke=>$6(He,Ke),onMomentumScrollEnd:Ke=>{NG(He),Ae.props.onMomentumScrollEnd&&Ae.props.onMomentumScrollEnd(Ke)},onScroll:Ke=>L6(He,Ke),onScrollBeginDrag:Ke=>{var Bt,dn;RN(He),(dn=(Bt=Ae.props).onScrollBeginDrag)==null||dn.call(Bt,Ke)},onScrollEnd:()=>RN(He)}),[]),wa=N6(Ro,Z,He,qn.onScroll),no=Cn;return De(mi,null,De(p6,{...it,alignItemsAtEnd:L,canRender:eo,contentContainerStyle:Et,contentInset:_,freshDataTransitionEpoch:Ae.freshDataTransitionEpoch,getRenderedItem:qn.getRenderedItem,horizontal:Z,initialContentOffset:Wr,ListEmptyComponent:A.length===0?ot:void 0,ListFooterComponent:at,ListFooterComponentStyle:je,ListHeaderComponent:oe,onInternalScrollBeginDrag:qn.onScrollBeginDrag,onInternalScrollEnd:qn.onScrollEnd,onLayout:ba,onLayoutFooter:Mo,onMomentumScrollEnd:qn.onMomentumScrollEnd,onScroll:wa,recycleItems:sn,refreshControl:no?on>0?Lf(no,{progressViewOffset:((w=no.props.progressViewOffset)!=null?w:0)+on}):no:xt&&De(M6,{onRefresh:xt,progressViewOffset:(kn||0)+on,refreshing:!!$n}),refScrollView:_n,renderScrollComponent:ae,scrollAdjustHandler:(T=mt.current)==null?void 0:T.scrollAdjustHandler,scrollEventThrottle:0,snapToIndices:ze,stickyHeaderIndices:Ro,style:yt,useWindowScroll:to}),Zo&&mW)});var X6=j6;var oD=X6;he();he();function Y6(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function J6(e,t){let n=t?.trim();if(!n)return e;let o=new RegExp(`^${Y6(n)}(?:\\s*[.:/-]\\s*|\\s+)`,"iu");return e.replace(o,"").trim()||e}function Cb(e,t){let n=t?.preferShortName&&e.shortName?e.shortName:e.name;return J6(n,e.subProvider)}function Md(e){return Cb(e,{preferShortName:!0})}var bb="model:",wb="unavailable-models:",Sb="action:",Nd="pluginActions:manage";function nf(e,t){return`${bb}${e.length}:${e}${t}`}function Ib(e){if(!e.startsWith(bb))return null;let t=e.slice(bb.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 rD(e){return`${wb}${e}`}function aD(e){return e.startsWith(wb)?e.slice(wb.length):null}function of(e){return`${Sb}${e}`}function iD(e){if(!e.startsWith(Sb))return null;let t=e.slice(Sb.length);return t.length>0?t:null}var sD=ve(function(t){let{t:n}=ye(),o=t.isFavorite?n("modelPicker.removeFromFavorites"):n("modelPicker.addToFavorites"),r=[t.providerDisplayName,t.model.subProvider,t.providerAccountEmail].filter(s=>typeof s=="string"&&s.length>0).join(" \xB7 "),a=b(Pl,{hideIndicator:!0,index:t.index,value:nf(t.instanceId,t.model.slug),disabled:!!t.disabledReason,contentClassName:"flex w-full items-center gap-3",className:K("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:[b("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?Md(t.model):Cb(t.model,t.preferShortName?{preferShortName:!0}:void 0)}),t.model.isUnavailable?u(ra,{variant:"outline",size:"sm",children:n("modelPicker.unavailableBadge")}):null]}),t.showProvider&&b("div",{className:"mt-1 flex items-center gap-1.5",children:[u(wr,{driver:t.driver,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(Xf,{className:"h-4 min-w-0 rounded-sm px-1.5 text-[10px]",children:t.jumpLabel}):null,b(Je,{children:[u(et,{render:u(ie,{size:"icon-xs",variant:"ghost",className:K("-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(ys,{className:K("size-icon-1",t.isFavorite&&"fill-current text-yellow-500")})})}),u(Ze,{side:"top",align:"center",children:o})]})]})]}),i=t.disabledReason??t.actionLabel;return i?b(Je,{children:[u(et,{render:a}),u(Ze,{side:"left",align:"center",className:"max-w-64 text-balance leading-snug",children:i})]}):a});he();function Z6(e,t){let n=e.displayName,o=e.enabled?e.readiness:"disabled";if(uN(o))return n;let r=pN(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 e8="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",t8="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 ",n8=`${t8} text-update-foreground`,lD="left",dD=8,cD="max-w-64 text-balance font-normal leading-snug",uD=ve(function(t){let{t:n}=ye(),{t:o}=ye(),r=jt().model.isProviderUpdateInFlight,a=p=>{t.onSelectInstance(p)},i=t.showFavorites??!0,[s,l]=Q(null),d=N(null),[c,f]=Q(null);return Ce(()=>{let p=d.current;if(!p)return;let m=Array.from(p.querySelectorAll("[data-model-picker-provider]")).find(g=>g.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:K(e8,"right-0 translate-y-0 transition-[top] duration-200 ease-out"),style:{top:c}}):null,i?b(ke,{children:[u("div",{className:"relative w-full","data-model-picker-provider":"favorites",children:b(Je,{children:[u(et,{render:u("button",{className:K("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(ys,{className:"size-5 fill-current shrink-0","aria-hidden":!0})})}),u(Ze,{side:lD,sideOffset:dD,align:"center",className:cD,children:n("modelPicker.favorites")})]})}),u("div",{className:"border-b border-border/70","aria-hidden":"true"})]}):null,t.instanceEntries.map(p=>{let m=!Mg(p),g=t.disabledInstanceIds?.has(p.instanceId)??!1,h=m||g,v=t.selectedInstanceId===p.instanceId,y=s===p.instanceId,x=r(p.snapshot),C=p.snapshot.versionAdvisory?.latestVersion!=null?o("updates.rail.updatingToVersion",{version:p.snapshot.versionAdvisory.latestVersion}):o("updates.rail.updating"),w=m?Z6(p,o):g?t.getDisabledInstanceTooltip?.(p)??p.displayName:x?`${p.displayName} \u2014 ${C}`:p.displayName,T=b("button",{className:K("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))]",h&&"opacity-50 cursor-not-allowed hover:bg-transparent"),"data-provider-accent-color":p.accentColor,onClick:()=>!h&&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:h,type:"button","aria-label":h?w:p.displayName,children:[u(wr,{driver:p.driverKind,displayName:p.displayName,accentColor:p.accentColor,className:"size-6",iconClassName:"size-5",indicatorBackground:y&&!h?"var(--muted)":v?"var(--background)":"color-mix(in oklab, var(--muted) 30%, transparent)"}),x?u("span",{className:n8,"aria-hidden":!0,children:u(Ff,{className:"size-2.5"})}):null]}),S=h?u("span",{className:"relative block w-full",children:T}):T;return u("div",{className:"relative w-full","data-model-picker-provider":p.instanceId,children:b(Je,{children:[u(et,{render:S}),b(Ze,{side:lD,sideOffset:dD,align:"center",className:cD,children:[w,p.accountEmail?u("span",{className:"mt-0.5 block text-[10px] text-muted-foreground",children:p.accountEmail}):null]})]})},p.instanceId)})]})})})});function fD(e,t){let n=[],o=[];for(let r of e)t(r)?o.push(r):n.push(r);return{current:n,unavailable:o}}function pD(e){return e.instanceReady?!0:e.entry.enabled&&e.entry.driverKind==="opencode"&&e.instanceId===e.activeInstanceId&&e.option.slug===e.activeModel&&e.option.isUnavailable===!0}var o8=24;function r8(e){return[ho(e.name),...e.shortName?[ho(e.shortName)]:[],...e.subProvider?[ho(e.subProvider)]:[],ho(e.driverKind),ho(e.providerDisplayName),...e.providerAccountEmail?[ho(e.providerAccountEmail)]:[],Tb(e),...e.slug?[ho(e.slug)]:[]]}function a8(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 Tb(e){return ho([e.name,e.shortName,e.subProvider,e.driverKind,e.providerDisplayName,e.providerAccountEmail,e.slug].filter(t=>typeof t=="string"&&t.length>0).join(" "))}function mD(e,t){let n=ho(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=a8(e[i],r,i*10);s!==null&&a.push(s)}if(a.length===0)return null;o+=Math.min(...a)}return o}function gD(e,t){let n=mD(r8(e),t);return n===null?null:e.isFavorite?n-o8:n}function hD(e,t){return mD([ho(e.title),ho(e.description??"")],t)}function vD({top:e,bottom:t}){if(!(!e&&!t))return K("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 yD(e,t){return`${e}:${t}`}var xD=new Map,CD=[],i8=[],s8=[];function rf(e){return nf(e.instanceId,e.slug)}function bD(e,t,n){return t.environmentId===n&&t.instanceId===e.instanceId&&t.model===e.slug}function l8(){return u("div",{className:"h-0.5"})}function kb(e){return e?.trim()||null}function wD({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 d8=ve(function({index:t,itemKey:n,action:o,showSectionHeader:r}){let{t:a}=ye(),i=kb(o.description);return b(ke,{children:[r?u(wD,{label:a("modelPicker.plugins")}):null,b(Pl,{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(gs,{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})]})]})]})}),c8=ve(function({index:t,showSectionHeader:n}){let{t:o}=ye();return b(ke,{children:[n?u(wD,{label:o("modelPicker.plugins")}):null,b(Pl,{hideIndicator:!0,index:t,value:Nd,className:"group w-full cursor-pointer rounded-md px-2 py-2",contentClassName:"flex w-full items-center gap-2",children:[u(jd,{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")})]})]})}),SD=ve(function(t){let{keybindings:n,modelOptionsByInstance:o,instanceEntries:r,hideInstanceRail:a=!1,getModelDisabledReason:i,getModelContinuationLabel:s,onContinueInModel:l,onInstanceModelChange:d,onManagePlugins:c,onSelectPluginAction:f}=t,p=t.pluginActions??CD,m=t.selectedPluginActionKey??null,{t:g}=ye(),{t:h}=ye(),v=jt(),[y,x]=Q(""),[C,w]=Q(!1),[T,S]=Q(!1),L=N(null),k=N(null),I=N(null),P=v.environment.useActiveEnvironmentId(),E=v.settings.useClientSettings($=>$.favorites??[]),_=q(()=>P===null?s8:E.filter($=>$.environmentId===P),[P,E]),A=(o.get(t.activeInstanceId)??[]).some($=>$.slug===t.model&&$.isUnavailable===!0),[H,V]=Q(()=>t.lockedProvider!==null||A?t.activeInstanceId:_.length>0?"favorites":t.activeInstanceId),[J,D]=Q(()=>new Set),ne=q(()=>n??[],[n]),F=v.settings.useUpdateClientSettings(),U=R(()=>{L.current?.focus({preventScroll:!0})},[]),ee=R($=>{V($),window.requestAnimationFrame(()=>{U()})},[U]);Ce(()=>{U();let $=window.requestAnimationFrame(()=>{U()}),ae=window.setTimeout(()=>{U()},0);return()=>{window.cancelAnimationFrame($),window.clearTimeout(ae)}},[U]);let j=q(()=>new Set(_.map($=>yD($.instanceId,$.model))),[_]),Z=R($=>P===null?!1:_.some(ae=>bD($,ae,P)),[P,_]),de=q(()=>new Map(r.map($=>[$.instanceId,$])),[r]),B=R($=>t.lockedProvider===null?!0:$.driverKind!==t.lockedProvider?!1:t.lockedContinuationGroupKey?$.continuationGroupKey===t.lockedContinuationGroupKey:!0,[t.lockedContinuationGroupKey,t.lockedProvider]),X=q(()=>{let $=new Set;for(let ae of r)Mg(ae)&&$.add(ae.instanceId);return $},[r]),pe=q(()=>{let $=[];for(let[ae,ce]of o){let Le=de.get(ae);if(!Le)continue;let ze=X.has(ae);for(let ft of ce)pD({entry:Le,instanceReady:ze,instanceId:ae,option:ft,activeInstanceId:t.activeInstanceId,activeModel:t.model})&&$.push({slug:ft.slug,name:ft.name,...ft.shortName?{shortName:ft.shortName}:{},...ft.subProvider?{subProvider:ft.subProvider}:{},...ft.isUnavailable?{isUnavailable:!0}:{},instanceId:ae,driverKind:Le.driverKind,instanceDisplayName:Le.displayName,...Le.accentColor?{instanceAccentColor:Le.accentColor}:{},...Le.accountEmail?{instanceAccountEmail:Le.accountEmail}:{},...Le.continuationGroupKey?{continuationGroupKey:Le.continuationGroupKey}:{}})}return $},[o,de,X,t.activeInstanceId,t.model]),le=t.lockedProvider!==null,re=y.trim().length>0,we=q(()=>{if(!le)return;let $=new Set;for(let ae of r)B(ae)||$.add(ae.instanceId);return $},[r,le,B]),Xe=q(()=>{let $=r.filter(Hu);if(!le)return $;let ae=[],ce=[];for(let Le of $)B(Le)?ae.push(Le):ce.push(Le);return[...ae,...ce]},[r,le,B]),ot=!a&&!re&&Xe.length>0,at=q(()=>r.map($=>$.instanceId),[r]),je=q(()=>{let $=pe;if(y.trim()){let ae=$.map(ce=>({model:ce,score:gD({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:Z(ce)},y),isFavorite:Z(ce),tieBreaker:Tb({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 Le of ae)B(Le.model)&&ce.push(Le);return ce.toSorted((Le,ze)=>{let ft=Le.score-ze.score;return ft!==0?ft:Le.isFavorite!==ze.isFavorite?Le.isFavorite?-1:1:Le.tieBreaker.localeCompare(ze.tieBreaker)}).map(Le=>Le.model)}return ae.toSorted((ce,Le)=>{let ze=ce.score-Le.score;return ze!==0?ze:ce.isFavorite!==Le.isFavorite?ce.isFavorite?-1:1:ce.tieBreaker.localeCompare(Le.tieBreaker)}).map(ce=>ce.model)}return t.lockedProvider!==null?($=$.filter(ae=>B(ae)),H==="favorites"?$=$.filter(ae=>Z(ae)):$=$.filter(ae=>ae.instanceId===H)):H==="favorites"?$=$.filter(ae=>Z(ae)):$=$.filter(ae=>ae.instanceId===H),v.model.sortProviderModelItems($,{favoriteModelKeys:j,groupFavorites:H!=="favorites",instanceOrder:H==="favorites"?at:[]})},[j,pe,at,B,t.lockedProvider,y,H,Z]),oe=R(($,ae)=>v.model.resolvePickerRowAction({disabledReason:i?.($,ae)??null,continuationLabel:l?s?.($,ae)??null:null}),[s,i,l]),Te=R($=>oe($.instanceId,$.slug),[oe]),Y=q(()=>fD(je,$=>Te($).kind==="blocked"),[je,Te]),me=q(()=>Y.unavailable.length===0?null:{key:rD(H),models:Y.unavailable,isExpanded:J.has(H)},[J,Y,H]),ge=q(()=>[...Y.current,...me?.isExpanded?me.models:[]],[Y,me]),G=f!==void 0,Ye=q(()=>{if(!G)return CD;let $=y.trim();return $.length===0?p:p.map(ae=>({action:ae,score:hD(ae,$)})).filter(ae=>ae.score!==null).toSorted((ae,ce)=>ae.score-ce.score||ae.action.title.localeCompare(ce.action.title)).map(ae=>ae.action)},[y,p,G]),ht=G&&(!re||Ye.length>0),Mt=q(()=>ht?[...Ye.map($=>of($.id)),Nd]:i8,[ht,Ye]),Dt=q(()=>new Map(Ye.map($=>[of($.id),$])),[Ye]),Nt=Mt[0]??null,Ot=R($=>{D(ae=>{let ce=new Set(ae);return ce.has($)?ce.delete($):ce.add($),ce})},[]),At=R(($,ae)=>{let ce=oe(ae,$);if(ce.kind==="blocked")return;if(ce.kind==="continue"){l?.(ae,$);return}let Le=o.get(ae);if(!Le||!de.has(ae))return;let ze=v.model.resolveSelectableModel($,Le);ze&&d(ae,ze)},[de,o,l,d,oe]),xt=R($=>{let ae=aD($);if(ae){Ot(ae);return}if($===Nd){c?.();return}let ce=iD($);if(ce!==null){f?.(ce);return}let Le=ge.find(ft=>rf(ft)===$);if(!Le||Te(Le).kind==="blocked")return;let ze=Ib($);ze&&At(ze.slug,ze.instanceId)},[At,c,f,Ot,ge,Te]),_t=R($=>{if(P===null)return;let ae=E.findIndex(Le=>bD($,Le,P)),ce=[...E];ae>=0?ce.splice(ae,1):ce.push({environmentId:P,instanceId:$.instanceId,model:$.slug}),F({favorites:ce})},[P,E,F]),Xt=q(()=>{let $=new Map,ae=0;for(let ce of ge){if(oe(ce.instanceId,ce.slug).kind==="blocked")continue;let Le=v.keybindings.modelPickerJumpCommandForIndex(ae);if(!Le)return $;$.set(rf(ce),Le),ae+=1}return $},[oe,ge]),mn=q(()=>[...Xt.keys()],[Xt]),Hn=q(()=>[...pe.map($=>rf($)),...me?[me.key]:[],...G?[...p.map($=>of($.id)),Nd]:[]],[pe,p,G,me]),vt=q(()=>{let $=ge.map(ae=>rf(ae));return me&&$.splice(Y.current.length,0,me.key),Mt.length>0?[...$,...Mt]:$},[me,Y,Mt,ge]),qt=q(()=>new Map(ge.map($=>[rf($),$])),[ge]),an=R(()=>{let $=k.current?.getScrollableNode();if(!($ instanceof HTMLElement))return;let ae=Math.max(0,$.scrollHeight-$.clientHeight);w($.scrollTop>1),S(ae-$.scrollTop>1)},[]),kn=q(()=>({terminalFocus:!1,terminalOpen:t.terminalOpen,modelPickerOpen:!0}),[t.terminalOpen]),sn=q(()=>{if(Xt.size===0)return xD;let $={platform:navigator.platform,context:kn},ae=new Map;for(let[ce,Le]of Xt){let ze=v.keybindings.shortcutLabelForCommand(ne,Le,$);ze&&ae.set(ce,ze)}return ae.size>0?ae:xD},[ne,Xt,kn]),Cn=m===null?nf(t.activeInstanceId,t.model):of(m),$n=q(()=>({favoritesSet:j,modelJumpLabelByKey:sn,selectedItemKey:Cn}),[j,sn,Cn]);return v.pane.useKeydown($=>{if($.defaultPrevented||$.repeat)return;let ae=v.keybindings.resolveShortcutCommand($,ne,{platform:navigator.platform,context:kn}),ce=v.keybindings.modelPickerJumpIndexFromCommand(ae??"");if(ce===null)return;let Le=mn[ce];if(!Le)return;let ze=Ib(Le);ze&&($.preventDefault(),$.stopPropagation(),At(ze.slug,ze.instanceId))},{capture:!0}),Ce(()=>{w(!1),S(vt.length>5);let $=0,ae=window.requestAnimationFrame(()=>{an(),$=window.requestAnimationFrame(an)});return()=>{window.cancelAnimationFrame(ae),window.cancelAnimationFrame($)}},[vt,an]),u(MS,{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:[ot&&u(uD,{selectedInstanceId:H,onSelectInstance:ee,instanceEntries:Xe,showFavorites:!0,...we?{disabledInstanceIds:we,getDisabledInstanceTooltip:$=>h("instance.lockedToThread",{name:$.displayName})}:{}}),u(PS,{inline:!0,items:Hn,filteredItems:vt,filter:null,autoHighlight:!0,open:!0,virtualized:!0,value:Cn,onItemHighlighted:($,ae)=>{I.current=typeof $=="string"?$:null,ae.reason==="keyboard"&&ae.index>=0&&k.current?.scrollIndexIntoView?.({index:ae.index,animated:!1})},onValueChange:$=>{typeof $=="string"&&xt($)},children:b("div",{className:K("flex min-h-0 flex-1 flex-col overflow-hidden bg-muted/40",ot&&"border-l border-border/70"),children:[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(ES,{ref:L,className:"[&_input]:h-control-3 [&_input]:font-sans [&_input]:leading-control-3",inputClassName:"rounded-none bg-transparent text-sm",placeholder:g("modelPicker.searchPlaceholder"),showTrigger:!1,startAddon:u(vs,{className:"-translate-x-0.5 size-4 shrink-0 text-muted-foreground opacity-70"}),value:y,onChange:$=>x($.target.value),onKeyDown:$=>{if($.key==="Escape"){$.preventDefault(),$.stopPropagation(),t.onRequestClose?.();return}if($.key==="Enter"&&I.current){$.preventBaseUIHandler?.(),$.preventDefault(),$.stopPropagation(),xt(I.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(RS,{className:"size-full min-w-0 p-0 not-empty:p-0",children:u(oD,{ref:k,data:vt,extraData:$n,keyExtractor:$=>$,renderItem:({item:$,index:ae})=>{let ce=me?.key===$?{label:g("modelPicker.unavailableModels"),count:me.models.length,isExpanded:me.isExpanded}:null;if(ce)return b(Pl,{hideIndicator:!0,index:ae,value:$,"aria-expanded":ce.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:ce.label}),u("div",{className:"mt-1 text-xs font-normal leading-snug text-muted-foreground/70",children:g("modelPicker.modelCount",{count:ce.count})})]}),u(Ko,{className:K("size-4 transition-transform",ce.isExpanded&&"rotate-90")})]});let Le=Dt.get($);if(Le)return u(d8,{index:ae,itemKey:$,action:Le,showSectionHeader:$===Nt});if($===Nd)return u(c8,{index:ae,showSectionHeader:$===Nt});let ze=qt.get($);if(!ze)return null;let ft=Te(ze);return u(sD,{index:ae,model:ze,instanceId:ze.instanceId,driver:ze.driverKind,providerDisplayName:ze.instanceDisplayName,providerAccentColor:ze.instanceAccentColor,providerAccountEmail:ze.instanceAccountEmail,isFavorite:Z(ze),isSelected:$===Cn,showProvider:!0,preferShortName:!le,useTriggerLabel:!1,jumpLabel:sn.get($)??null,disabledReason:ft.kind==="blocked"?ft.reason:null,actionLabel:ft.kind==="continue"?ft.label:null,onToggleFavorite:()=>_t(ze)},$)},estimatedItemSize:52,drawDistance:480,recycleItems:!0,contentContainerClassName:"pl-2 pr-px",ItemSeparatorComponent:l8,onLayout:an,onScroll:an,className:K("scrollbar-gutter-stable h-full overflow-x-hidden overscroll-y-contain py-1.5 [&::-webkit-scrollbar-track]:my-2",vD({top:C,bottom:T}))})})}),u(AS,{className:"not-empty:py-6 empty:h-0 text-xs font-normal leading-snug",children:g("modelPicker.noModelsFound")})]})})]})})});function th(e){switch(e){case"probing":return{seatKey:"modelPicker.fetchingModels",blockKey:"composer.modelFetching",canChooseModel:!1};case"missing":return{seatKey:"modelPicker.chooseModel",blockKey:"composer.modelMissing",canChooseModel:!0};default:return null}}function ID(e){return e.submissionTarget==="provider-turn"&&e.status!=="known"}function u8(e){let t=e.unknownModelLabel?.trim();if(t)return t;let n=e.catalogOptions.find(o=>o.slug===e.model);return n?Md(n):e.model}var Lb=ve(function(t){let{t:n}=ye(),[o,r]=Q(!1),i=ea()&&(t.open??o),s=q(()=>t.instanceEntries.find(w=>w.instanceId===t.activeInstanceId)??null,[t.activeInstanceId,t.instanceEntries]),l=t.activeInstanceId,d=t.modelOptionsByInstance.get(l)??[],c=th(t.modelStatus??"known"),f=u8({model:t.model,catalogOptions:d,unknownModelLabel:c?n(c.seatKey):null}),p=c===null&&d.some(w=>w.slug===t.model&&w.isUnavailable===!0),m=w=>{t.onOpenChange?.(w),t.open===void 0&&r(w)};W(()=>{if(!i)return;let{documentElement:w,body:T}=document,S=w.style.overscrollBehavior,L=T.style.overflow,k=T.style.paddingRight,I=window.innerWidth-w.clientWidth;w.style.overscrollBehavior="contain",T.style.overflow="hidden",I>0&&(T.style.paddingRight=`${I}px`);let P=A=>A instanceof Element&&A.closest("[data-model-picker-content]"),E=A=>{P(A.target)||A.preventDefault()},_=A=>{P(A.target)||A.preventDefault()};return document.addEventListener("wheel",E,{capture:!0,passive:!1}),document.addEventListener("touchmove",_,{capture:!0,passive:!1}),()=>{document.removeEventListener("wheel",E,{capture:!0}),document.removeEventListener("touchmove",_,{capture:!0}),w.style.overscrollBehavior=S,T.style.overflow=L,T.style.paddingRight=k}},[i]);let g=(w,T)=>{t.disabled||(t.onInstanceModelChange(w,T),m(!1))},h=(w,T)=>{t.disabled||(t.onContinueInModel?.(w,T),m(!1))},v=w=>{t.disabled||(t.onSelectPluginAction?.(w),m(!1))},y=()=>{t.onManagePlugins?.(),m(!1)},x=t.selectedPluginActionKey==null?null:t.pluginActions?.find(w=>w.id===t.selectedPluginActionKey)??null,C=x?kb(x.description):null;return b(wi,{open:i,onOpenChange:w=>{if(t.disabled){m(!1);return}m(w)},children:[b(Ii,{render:u(Yo,{"aria-label":t.triggerAriaLabel,variant:t.triggerVariant??"ghost","data-chat-provider-model-picker":"true",className:K("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(ke,{children:[u(gs,{className:"size-4 shrink-0"}),b(Je,{children:[b(et,{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}),C?b("span",{className:"min-w-0 truncate text-muted-foreground/80",children:["\xB7 ",C]}):null]}),u(Ze,{side:"top",children:C?`${x.title} \xB7 ${C}`:x.title})]})]}):b(ke,{children:[t.showInstanceOnTrigger!==!1&&s?u(wr,{driver:s.driverKind,displayName:s.displayName,accentColor:s.accentColor,className:K("size-4",t.activeProviderIconClassName),iconClassName:"size-4",indicatorBackground:"var(--contrast-input)"}):null,b(Je,{children:[u(et,{render:u("span",{className:"min-w-0 flex-1 overflow-hidden truncate"}),children:f}),u(Ze,{side:"top",children:p?n("modelPicker.unavailableLabel",{name:f}):f})]}),p?u(ra,{variant:"outline",size:"sm",children:n("modelPicker.unavailableBadge")}):null]})}),u("span",{"aria-hidden":"true",className:"flex items-center",children:u(ga,{})})]}),u(Si,{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(SD,{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:()=>m(!1),...t.getModelDisabledReason?{getModelDisabledReason:t.getModelDisabledReason}:{},...t.getModelContinuationLabel?{getModelContinuationLabel:t.getModelContinuationLabel}:{},...t.onContinueInModel?{onContinueInModel:h}:{},onInstanceModelChange:g,...t.pluginActions?{pluginActions:t.pluginActions}:{},selectedPluginActionKey:t.selectedPluginActionKey??null,...t.onSelectPluginAction?{onSelectPluginAction:v}:{},...t.onManagePlugins?{onManagePlugins:y}:{}})})]})});function TD(e){let{slots:t,...n}=e,o=u(Lb,{...n,hideInstanceRail:!0,showInstanceOnTrigger:!1}),r=t?.renderSlot("conversation.input.model",n,o);return u("span",{"data-conversation-slot":"conversation.input.model",children:r??o})}function kD(e){return u(Lb,{...e,hideInstanceRail:!0,showInstanceOnTrigger:!1})}function Pb(e){let{t}=ye();if(!e.showInteractionModeToggle)return null;let n=e.interactionMode==="plan",o=t(n?"composer.planModeTooltip":"composer.defaultModeTooltip");return b(Je,{children:[b(et,{render:u(Yo,{"data-composer-plan-toggle":"true",className:K("shrink-0 whitespace-nowrap",n?"bg-accent text-accent-foreground hover:bg-accent/90":"text-secondary-label hover:text-foreground"),type:"button",onClick:e.onToggleInteractionMode,"aria-label":o}),children:[n?u(Jo,{icon:fc,className:"text-current opacity-100"}):u(Jo,{icon:as,opticalSize:"large"}),u("span",{className:"sr-only sm:not-sr-only",children:t(n?"composer.interactionModePlan":"composer.interactionModeBuild")})]}),u(Ze,{side:"top",children:o})]})}function LD(e){return u(Pb,{...e})}he();var $r=["approval-required","auto-accept-edits","auto","full-access"];var f8={"approval-required":dc,"auto-accept-edits":na,auto:bi,"full-access":xi},p8={"approval-required":"approvalRequired","auto-accept-edits":"autoAcceptEdits",auto:"auto","full-access":"fullAccess"};function nh(){let{t:e}=ye();return R(t=>{let n=p8[t];return{mode:t,label:e(`runtimeMode.${n}`),description:e(`runtimeMode.${n}Description`),icon:f8[t]}},[e])}he();function PD(e){return e.description??e.name}var AD=ve(function(t){let{t:n}=ye(),{current:o,modes:r}=t.nativeMode,a=PD(o);return!t.canSwitch||r.length<2?b(Je,{children:[b(et,{render:u(Yo,{className:"shrink-0 cursor-default whitespace-nowrap font-medium",type:"button",disabled:!0,"data-composer-native-mode":o.id,"aria-label":n("composer.agentModeLabel",{name:o.name})}),children:[u(Jo,{icon:Il}),u("span",{children:o.name})]}),b(Ze,{side:"top",children:[u("span",{className:"block font-medium",children:a}),r.length>1?u("span",{className:"mt-1 block text-muted-foreground text-xs",children:n("composer.agentModesList",{modes:r.map(i=>i.name).join(", ")})}):null]})]}):b(ke,{children:[b(Je,{children:[b(Bf,{value:o.id,onValueChange:i=>t.onNativeModeChange(i),children:[b(et,{render:u(Ng,{className:"shrink-0 whitespace-nowrap font-medium","data-composer-native-mode":o.id,"aria-label":n("composer.agentModeLabel",{name:o.name})}),children:[u(Jo,{icon:Il}),u(Hf,{children:o.name})]}),b(Uf,{alignItemWithTrigger:!1,children:[r.map(i=>u(zf,{value:i.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:i.name}),i.description?u("span",{className:"text-muted-foreground text-xs leading-4",children:i.description}):null]})},i.id)),t.appliesNextTurn?u("div",{className:"border-t px-2 py-1.5 text-muted-foreground text-xs leading-4","data-composer-next-turn-note":"popup",children:n("runtimeMode.appliesNextTurnHint")}):null]})]}),u(Ze,{side:"top",children:t.appliesNextTurn?`${a} ${n("runtimeMode.appliesNextTurnHint")}`:a})]}),t.appliesNextTurn?u("span",{className:"hidden whitespace-nowrap text-muted-foreground text-xs sm:inline","data-composer-next-turn-note":"inline",children:n("runtimeMode.appliesNextTurn")}):null]})});function Ab(e){let{t}=ye(),n=nh();if(e.nativeMode)return u(AD,{nativeMode:e.nativeMode,canSwitch:e.canSwitchNativeMode,appliesNextTurn:e.runtimeModeSwitch==="next-turn",onNativeModeChange:e.onNativeModeChange});let o=n(e.runtimeMode),r=o.icon,a=e.runtimeModeSwitch==="next-turn";return b(ke,{children:[b(Je,{children:[b(Bf,{value:e.runtimeMode,onValueChange:i=>e.onRuntimeModeChange(i),children:[b(et,{render:u(Ng,{"data-composer-permission":"true","data-composer-runtime-mode-switch":e.runtimeModeSwitch,className:"font-medium","aria-label":t("composer.runtimeMode")}),children:[u(Jo,{icon:r}),u(Hf,{children:o.label})]}),b(Uf,{alignItemWithTrigger:!1,children:[$r.map(i=>{let s=n(i),l=s.icon;return u(zf,{value:i,hideIndicator:!0,className:"min-w-64 py-2",children:b("span",{className:"flex items-center gap-2",children:[u(l,{className:"size-4"}),s.label]})},i)}),a?u("div",{className:"border-t px-2 py-1.5 text-muted-foreground text-xs leading-4","data-composer-next-turn-note":"popup",children:t("runtimeMode.appliesNextTurnHint")}):null]})]}),u(Ze,{side:"top",children:a?t("runtimeMode.appliesNextTurnHint"):o.label})]}),a?u("span",{className:"hidden whitespace-nowrap text-muted-foreground text-xs sm:inline","data-composer-next-turn-note":"inline",children:t("runtimeMode.appliesNextTurn")}):null]})}function ED(e){return u(Ab,{...e})}function af(e){let t=e.slots?.renderSlot(e.name,e.owner??{},e.fallback);return u("span",{"data-conversation-slot":e.name,children:t??e.fallback})}he();var RD=ve(function(t){let{t:n}=ye(),o=nh();return b(_o,{children:[u(Oo,{render:u(ie,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground/70 hover:text-foreground/80","aria-label":n("composer.moreComposerControls")}),children:u(ar,{"aria-hidden":"true",className:"size-4"})}),b(Do,{align:"start",children:[t.traitsMenuContent?b(ke,{children:[t.traitsMenuContent,u(_a,{})]}):null,t.showInteractionModeToggle&&t.nativeMode===null?b(ke,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.modeMenuTitle")}),b(Sr,{value:t.interactionMode,onValueChange:r=>{!r||r===t.interactionMode||t.onToggleInteractionMode()},children:[u(Vo,{value:"default",children:n("composer.interactionModeChat")}),u(Vo,{value:"plan",children:n("composer.interactionModePlan")})]}),u(_a,{})]}):null,t.nativeMode===null?b(ke,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.accessMenuTitle")}),u(Sr,{value:t.runtimeMode,onValueChange:r=>{!r||r===t.runtimeMode||t.onRuntimeModeChange(r)},children:$r.map(r=>u(Vo,{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(ke,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:n("composer.accessMenuTitle")}),t.canSwitchNativeMode&&t.nativeMode.modes.length>1?b(ke,{children:[u(Sr,{value:t.nativeMode.current.id,onValueChange:r=>{t.onNativeModeChange(String(r))},children:t.nativeMode.modes.map(r=>u(Vo,{value:r.id,children:r.name},r.id))}),t.runtimeModeSwitch==="next-turn"?u("div",{className:"px-2 pb-1.5 text-muted-foreground text-xs leading-4",children:n("runtimeMode.appliesNextTurnHint")}):null]}):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})]})]})]})});he();var MD="application/x-ycodium-composer-mention";function Eb(e){return e.includes(MD)}function ND(e){let t=n=>Eb(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(MD);o.length!==0&&(e.insertMentionAtEnd(`${o} `)||e.onInsertRejected())}}}function _D({documentKey:e,insertMentionAtEnd:t,onInsertRejected:n}){let[o,r]=Q(!1),a=ND({insertMentionAtEnd:t,setDragActive:r,onInsertRejected:n}),i=s=>{if(!Eb(s.dataTransfer.types))return;s.stopPropagation();let l=s.relatedTarget;l instanceof Node&&s.currentTarget.contains(l)||r(!1)};return Ce(()=>{r(!1)},[e]),W(()=>{if(!o)return;let s=()=>{r(!1)};return window.addEventListener("dragend",s),()=>window.removeEventListener("dragend",s)},[o]),{isDragOverComposer:o,composerMentionDragHandlers:a,onComposerMentionDragLeaveCapture:i}}he();function DD({promptRef:e,maxInputChars:t,noProviderAvailable:n,isSendDisabled:o,sendDisabledReason:r,isModelSendBlocked:a,onModelSendBlocked:i,activeThreadId:s,activePendingProgress:l,composerDocumentKey:d,pendingImageCompressionsRef:c,onSend:f,onProviderInputRejectedReset:p,wasProviderInputRejected:m,onStillCompressing:g,shouldBlurMobileComposerOnSubmit:h,blurMobileComposerAfterSend:v}){let{t:y}=ye(),[x,C]=Q(null);W(()=>C(null),[d]);let w=R(S=>{C(L=>L===null?L:Uu(S,t,y))},[t,y]),T=R((S,L="foreground")=>{if(n||o){S?.preventDefault();return}if(a){S?.preventDefault(),i();return}if(s&&(c.current.get(d)??0)>0){S?.preventDefault(),g();return}let k=xM({prompt:e.current,submissionTarget:l?"pending-user-input":"provider-turn",maxInputChars:t,t:y,disabledReason:r,event:S,onSend:I=>(p(),f(I,L),!m())});C(k.validationMessage),k.didDispatch&&h()&&v()},[l,s,v,d,a,o,t,n,i,p,f,g,c,e,r,h,y,m]);return{composerSubmissionError:x,setComposerSubmissionError:C,revalidatePromptLength:w,submitComposer:T}}he();var m8=(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"),g8=e=>{e.preventDefault()},sf=ve(function({compact:t,pendingAction:n,isRunning:o,showPlanFollowUpPrompt:r,promptHasText:a,isSendBusy:i,sendDisabledReason:s,isEnvironmentUnavailable:l,isPreparingWorktree:d,hasSendableContent:c,preserveComposerFocusOnPointerDown:f=!1,showSendWhileRunning:p=!1,onPreviousPendingQuestion:m,onInterrupt:g,interruptArmed:h=!1,onImplementPlanInNewThread:v,shellCommandMode:y=!1,shellCommandUnavailableReason:x=null}){let{t:C}=ye(),w=jt(),T=f?{onPointerDown:g8}:void 0,S=w.settings.useEnvironmentIdentificationMode(),L=s!==null,k=w.devBackdrop.useVisible(S==="artwork"),I=E=>u("button",{type:"button",className:K("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",h?"h-8 px-3 text-xs font-medium whitespace-nowrap ring-2 ring-destructive/60":E?"size-8 sm:size-7":p&&c?"size-9 sm:size-8":"size-8 sm:h-8 sm:w-8"),...T,onClick:g,"data-interrupt-armed":h?"":void 0,"aria-label":C(h?"primaryActions.confirmStopEsc":"primaryActions.stopGeneration"),children:h?C("primaryActions.confirmStopEsc"):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:K("flex items-center justify-end",t?"gap-1.5":"gap-2"),children:[o?I(!0):null,n.questionIndex>0?t?u(ie,{size:"icon-sm",variant:"outline",className:"rounded-full",...T,onClick:m,disabled:n.isResponding,"aria-label":C("primaryActions.previousQuestion"),children:u(is,{})}):u(ie,{size:"sm",variant:"outline",className:"rounded-full",...T,onClick:m,disabled:n.isResponding,children:C("primaryActions.previous")}):null,u(ie,{type:"submit",size:"sm",className:K("rounded-full bg-message-action text-message-action-foreground hover:bg-message-action-hover",t?"px-3":"px-4"),...T,disabled:l||n.isResponding||(n.isLastQuestion?!n.isComplete:!n.canAdvance),children:m8(C,{compact:t,isLastQuestion:n.isLastQuestion,isResponding:n.isResponding,questionIndex:n.questionIndex})})]});if(y){let E=u("button",{type:"submit","data-shell-command-run":"true",className:"flex h-9 w-9 items-center justify-center rounded-full bg-message-action text-message-action-foreground shadow-xs shadow-message-action/24 transition-[background-color,opacity,scale] duration-(--control-duration) enabled:cursor-pointer enabled:inset-shadow-[0_1px_--theme(--color-white/16%)] hover:scale-105 hover:bg-message-action-hover 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",...T,disabled:x!==null||!c,"aria-label":x??C("primaryActions.runInTerminal"),children:u(qo,{"aria-hidden":"true",className:"size-4"})});return o?b(ke,{children:[I(!1),E]}):E}if(r)return a?u(ie,{type:"submit",size:"sm",className:K("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"),...T,disabled:i||L||l,children:C(i?"primaryActions.sendingButtonLabel":"primaryActions.refine")}):b("div",{"data-chat-composer-implement-actions":"true",className:"flex items-center justify-end",children:[u(ie,{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",...T,disabled:i||L||l,children:C(i?"primaryActions.sendingButtonLabel":"primaryActions.implement")}),b(_o,{children:[u(Oo,{render:u(ie,{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":C("primaryActions.implementationActions"),...T,disabled:i||L||l}),children:u(rn,{})}),u(Do,{align:"end",side:"top",children:u(ir,{disabled:i||L||l,onClick:()=>{v()},children:C("primaryActions.implementInNewThread")})})]})]});let P=b("button",{type:"submit",className:K("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",k?"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"),...T,disabled:i||L||l||!c,"aria-label":l?C("primaryActions.environmentDisconnected"):s||C(d?"primaryActions.preparingWorktree":i?"primaryActions.sendingAriaLabel":"primaryActions.sendMessage"),children:[k?u("span",{className:"absolute inset-0 -z-10","aria-hidden":"true",children:u(_S,{compact:!0})}):null,i?u(Ff,{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(ke,{children:[I(!1),p&&c?P:null]}):P});function OD(e){let{t}=ye(),n=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:K("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",!n&&"p-0"),children:[e.isPendingUserInputChoiceOnly?null:u("button",{type:"button",className:K("min-w-0 flex-1 truncate bg-transparent py-1.5 text-left text-sm",e.activePendingProgress?.customAnswer?"text-foreground":"text-placeholder",!n&&"px-3 py-2"),onPointerDown:o=>o.preventDefault(),onClick:e.expandMobileComposer,"aria-label":t("composer.writeCustomAnswer"),children:e.activePendingProgress?.customAnswer||t("composer.writeCustomAnswer")}),e.inlineTasksBadge,e.inlineStashBadge,n?u(sf,{compact:!0,pendingAction:e.pendingPrimaryAction,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:e.isSendBusy,sendDisabledReason:e.sendDisabledReason,isEnvironmentUnavailable:e.isEnvironmentUnavailable,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:e.onPreviousActivePendingUserInputQuestion,onInterrupt:e.handleInterruptPrimaryAction,onImplementPlanInNewThread:e.handleImplementPlanInNewThreadPrimaryAction}):null]})})}function FD(e){let t=e.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim();return t&&t.length>0?t:null}he();var h8=2e3,v8="min-h-8 max-w-full py-1.5 font-normal whitespace-normal text-start",y8=e=>[{decision:"cancel",label:e("composer.cancel")},{decision:"decline",label:e("composer.decline")},{decision:"acceptForSession",label:e("composer.alwaysAllowSession")},{decision:"accept",label:e("composer.approve")}];function x8(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 BD=ve(function({requestId:t,isResponding:n,options:o,keybindings:r,declineReasonRelay:a,onRespondToApproval:i}){let{t:s}=ye(),l=o??y8(s),d=jt(),c=a==="native"||a==="queued",[f,p]=Q(""),m=N([]);W(()=>{p("")},[t]);let g=R(v=>{let y=v==="decline"?f.trim():"";i(t,v,y.length>0?y:void 0)},[f,i,t]),h=R(v=>{let y=m.current.filter(w=>w!==null);if(y.length===0)return;let x=y.findIndex(w=>w===document.activeElement),C=x===-1?v===1?0:y.length-1:(x+v+y.length)%y.length;y[C]?.focus()},[]);return d.pane.useKeydown(v=>{if(n||d.terminalFocus.getOwner()!==null||v.isComposing||v.keyCode===229)return;let y=ki(v.target);if(r&&(!y||v.metaKey||v.ctrlKey||v.altKey)){let w=d.keybindings.approvalDecisionFromCommand(d.keybindings.resolveShortcutCommand(v,r));if(w!==null&&l.some(T=>T.decision===w)){v.preventDefault(),g(w);return}}if(y)return;let x=QS(v,l);if(x===null)return;if(v.preventDefault(),x.type==="move"){h(x.delta);return}let C=l[x.index];C&&g(C.decision)},{target:"document"}),u(ke,{children:l.map((v,y)=>{let x=y<9?y+1:null,C=b(ie,{ref:w=>{m.current[y]=w},size:"xs",variant:v.decision==="accept"?"default":"outline",style:{height:"auto"},"aria-keyshortcuts":x8(v.decision,y),className:`${v8}${v.decision==="decline"?" text-destructive-foreground [:hover,[data-pressed]]:text-destructive-foreground":""}`,disabled:n,onClick:()=>g(v.decision),children:[u("span",{className:"min-w-0 break-words",children:v.label}),x===null?null:u(Xf,{className:"h-3.5 min-w-3.5 rounded-[3px] bg-transparent px-0 text-[10px] tabular-nums opacity-70",children:x})]},v.decision);return v.decision!=="decline"||!c?C:b(mi,{children:[u(kl,{type:"text",value:f,disabled:n,maxLength:h8,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:w=>p(w.target.value),onKeyDown:w=>{if(w.key==="Enter"){w.preventDefault(),g("decline");return}w.key==="Escape"&&(w.preventDefault(),f.length>0?p(""):w.currentTarget.blur())}}),C]},v.decision)})})});he();var C8=["command","cmd"],b8=["file_path","filePath","path","notebook_path","notebookPath"],w8=["url"],S8=["query","q"],I8=["name","skill","skill_name","skillName"],zD=["toolName","tool_name"],UD=["description"],T8=[],k8=[];function ri(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 L8(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),n=t>=0?e.slice(t+1):e;return n.length>0?n:e}function P8(e){let t=e[0];return t===void 0?null:e.every(n=>n.path===t.path)?t.path:null}function $D(e){let t=e.args??T8,n=e.fileChanges??k8,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=ri(t,C8,o);d!==null&&(s={shape:"command",command:d});break}case"file-read":case"file-change":{let d=ri(t,b8,o)??P8(n);d!==null&&(i=L8(d),s=n.some(c=>c.path===d)?{shape:"none"}:{shape:"path",path:d});break}case"web-fetch":{let d=ri(t,w8,o);d!==null&&(s={shape:"url",url:d});break}case"web-search":{let d=ri(t,S8,o);d!==null&&(s={shape:"query",query:d});break}case"skill":{i=ri(t,I8,o)??ri(t,zD,o),l=ri(t,UD,o),t.length>0&&(s={shape:"none"});break}case"mcp-tool":case"tool":{i=ri(t,zD,o),l=ri(t,UD,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 A8={"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"},E8={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"},R8={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"},M8={command:"approval.commandDetailLabel",path:"approval.body.pathLabel",url:"approval.body.urlLabel",query:"approval.body.queryLabel",text:"approval.body.detailLabel"};function KD(e,t){let n=e.subject!==null?A8[e.kind]:void 0;return n!==void 0?t(n,{name:e.subject}):t(E8[e.kind])}function qD(e,t){return t(R8[e])}function VD(e,t){return t(M8[e])}function WD(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=HD(t.oldText??""),o=HD(t.newText);if(n.length===0&&o.length===0)return null;let r=`--- a/${e.path}
3850
3850
  +++ b/${e.path}
3851
3851
  `,a=`@@ -${n.length===0?"0,0":`1,${n.length}`} +${o.length===0?"0,0":`1,${o.length}`} @@
3852
3852
  `,i=[...n.map(s=>`-${s}`),...o.map(s=>`+${s}`)];return`${r}${a}${i.join(`
@@ -3865,8 +3865,8 @@ From `)}function o1(e){let t=l1(e);for(let n=0;n<t.length;n++)t[n]=Mn(t[n]);retu
3865
3865
  diff --git`)}function u1(e,t){if(e.length===0)return[""];let n=`
3866
3866
  ${t}`,o=e.startsWith(t)?0:a1(e,n,0);if(o===-1)return[e];let r=[];o>0&&r.push(e.slice(0,o));let a=o;for(;;){let i=a1(e,n,a+1);if(i===-1)break;r.push(e.slice(a,i)),a=i}return r.push(e.slice(a)),r}function a1(e,t,n){let o=e.indexOf(t,n);return o===-1?-1:o+1}function i1(e){return e==null?e:Mn(e)}function J8(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function _b(e){let t=e.slice(1);return Mn(t===""?`
3867
3867
  `:t)}function Db(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 f1={light:"vscode-light-modern",dark:"vscode-dark-modern"};function m1(e){return e==="dark"?f1.dark:f1.light}var g1=2166136261,h1=16777619,Z8=2654435769,eQ=2246822507;function p1(e,t=g1,n=h1){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 tQ(e,t="diff-panel"){let n=e.trim(),o=p1(n,g1,h1).toString(36),r=p1(n,Z8,eQ).toString(36);return`${t}:${n.length}:${o}:${r}`}function Fb(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 v1(e,t="diff-panel",n={}){if(!e)return null;let o=e.trim();if(o.length===0)return null;try{let a=s1(o,tQ(o,t)).flatMap(i=>n.compactPartialHunkOffsets?i.files.map(Fb):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 y1(e){let t=e.cacheKey;return t?t.endsWith(":hydrated")?t.slice(0,-9):t:`${e.prevName??"none"}:${e.name}`}function x1({fileChange:e,onOpenDiff:t}){let{t:n}=ye(),[o,r]=Q(!1),a=q(()=>WD(e),[e]),i=jD(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(ie,{size:"micro",variant:"ghost-muted",className:"font-normal","aria-expanded":o,onClick:()=>r(s=>!s),children:[o?u(rn,{className:"size-3 shrink-0"}):u(Ko,{className:"size-3 shrink-0"}),u("span",{children:n(o?"approval.diff.hide":"approval.diff.show")})]}),t?u(ie,{size:"micro",variant:"ghost-muted",className:"font-normal",onClick:()=>t(e.path),children:n("approval.diff.open")}):null]}),o&&a!==null?u(nQ,{path:e.path,unifiedDiff:a}):null]})}function nQ({path:e,unifiedDiff:t}){let n=jt().theme.useResolvedTheme(),o=q(()=>{let r=v1(t,`approval:${n}`,{compactPartialHunkOffsets:!0});return r?.kind==="files"?r.files.map(a=>({id:y1(Fb(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(NS,{className:"max-h-56 overflow-auto [scrollbar-gutter:stable]",items:o,options:{diffStyle:"unified",lineDiffType:"none",overflow:"wrap",theme:m1(n),themeType:n,stickyHeaders:!1}})})}var oQ="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",C1=ve(function({approval:t,pendingCount:n,onOpenDiff:o,className:r}){let{t:a}=ye(),i=$D(t),{body:s}=i,l=GD(i.fileChanges);return b("div",{"aria-label":qD(i.kind,a),className:K("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:KD(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":VD(s.shape,a),className:K(oQ,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(x1,{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 Bb=ve(function(t){return u(C1,{...t})});he();var zb=ve(function(t){let{t:n}=ye(),[o,r]=Q(!1),[a,i]=Q(!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:K("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(`
3868
- `)[0]}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-1 pt-0.5",children:s.options.map(f=>u(ie,{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 rQ(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Ub(e,t){let n=rQ(t?.customAnswer);if(e.allowFreeform!==!1&&n)return n;let o=IC(e,t?.selectedOptionLabels);return e.multiSelect?o.length>0?o:null:o[0]??null}function aQ(e,t){let n={};for(let o of e){let r=Ub(o,t[o.id]);if(!r)return null;n[o.id]=r}return n}function iQ(e,t){return e.reduce((n,o)=>Ub(o,t[o.id])?n+1:n,0)}function b1(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?Ub(r,a):null,s=r?.allowFreeform===!1?"":a?.customAnswer??"",l=iQ(e,t),d=e.length===0?!0:o>=e.length-1;return{questionIndex:o,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?IC(r,a?.selectedOptionLabels):[],customAnswer:s,resolvedAnswer:i,usingCustomAnswer:s.trim().length>0,answeredQuestionCount:l,isLastQuestion:d,isComplete:aQ(e,t)!==null,canAdvance:!!i}}var sQ={approve:{label:"pendingUserInput.planApprove",description:"pendingUserInput.planApproveHint"},revise:{label:"pendingUserInput.planRevise",description:"pendingUserInput.planReviseHint"},stop:{label:"pendingUserInput.planStop",description:"pendingUserInput.planStopHint"}};function w1(e,t,n){let o=t.kind==="plan"&&n.planAction!==void 0?sQ[n.planAction]:void 0;return o===void 0?{label:n.label,description:n.description??""}:{label:e(o.label),description:e(o.description)}}he();var S1=ve(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(lQ,{prompt:s,isResponding:n.includes(s.requestId),answers:o,questionIndex:r,onToggleOption:a,onAdvance:i},s.requestId):null}),lQ=ve(function({prompt:t,isResponding:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){let{t:s}=ye(),l=jt(),d=b1(t.questions,o,r),c=d.activeQuestion,f=N(null),p=N(i),[m,g]=Q(null),[h,v]=Q(null),y=h!==null&&h===c?.id;W(()=>{p.current=i},[i]),W(()=>{if(!(!c||c.multiSelect||!m)){if(m.questionId!==c.id){g(null);return}d.customAnswer.trim().length===0&&d.selectedOptionLabels.includes(m.optionLabel)&&g(null)}},[c,m,d.customAnswer,d.selectedOptionLabels]),W(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);let x=R((w,T)=>{if(c?.multiSelect){a(w,T);return}g({questionId:w,optionLabel:T}),a(w,T),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||y||w.metaKey||w.ctrlKey||w.altKey||w.isComposing||w.keyCode===229||ki(w.target))return;let T=qh(w.key,c.options.length);if(T===null)return;let S=c.options[T];S&&(w.preventDefault(),x(c.id,Td(S)))},{target:"document"}),!c)return null;let C=d.customAnswer.trim().length>0;return b(TS,{className:"py-2",open:!y,onOpenChange:w=>{v(w?null:c.id)},children:[u("div",{className:"flex items-center gap-1 px-1 sm:px-2",children:b(LS,{title:s(y?"pendingUserInput.showQuestion":"pendingUserInput.hideQuestion"),"data-pending-user-input-toggle":y?"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,y?u("span",{className:"min-w-0 flex-1 truncate text-secondary-label text-xs",children:c.question}):null,u(rn,{"aria-hidden":"true",className:K("ml-auto size-icon-2 shrink-0 text-secondary-label transition-transform duration-(--control-duration) group-hover:text-foreground",y&&"rotate-180")})]})}),u(kS,{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(lr,{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,T)=>{let S=Td(w),L=w1(s,c,w),I=m?.questionId===c.id&&m.optionLabel===S||!C&&d.selectedOptionLabels.includes(S),P=T<9?T+1:null,E=K("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"),_=b(ke,{children:[b("div",{className:"min-w-0 flex-1 flex flex-col gap-0.5",children:[u("span",{className:"text-sm font-medium",children:L.label}),L.description&&L.description!==L.label?u("span",{className:"text-secondary-label text-[11px]",children:L.description}):null]}),I?u(ro,{className:"size-icon-2 shrink-0 text-primary"}):P!==null?u("kbd",{className:K("flex size-5 shrink-0 items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums"),children:P}):null]});return u("button",{type:"button","aria-pressed":I,disabled:n,onClick:()=>{x(c.id,S)},className:E,children:_},`${c.id}:${S}`)})})]})})]})});he();var I1=ve(function({planTitle:t}){let{t:n}=ye();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 T1(e){if(e.occupant.kind!=="approval")return null;let{approval:t}=e.occupant;return u(BD,{requestId:t.requestId,isResponding:e.respondingRequestIds.includes(t.requestId),options:t.options,keybindings:e.keybindings,declineReasonRelay:t.declineReasonRelay,onRespondToApproval:e.onRespondToApproval})}function k1(e){return e.occupant.kind!=="user-input"?null:u(S1,{pendingUserInputs:[e.occupant.userInput],respondingRequestIds:e.respondingRequestIds,answers:e.activePendingDraftAnswers,questionIndex:e.activePendingQuestionIndex,onToggleOption:e.onSelectActivePendingUserInputOption,onAdvance:e.onAdvanceActivePendingUserInput})}var L1={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(Bb,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-0.5",children:T1(e)})]}),collapsed:e=>e.occupant.kind!=="approval"?null:b("div",{"data-chat-composer-collapsed-controls":"true",children:[u(Bb,{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:T1(e)})]})},decision:{expanded:e=>e.occupant.kind!=="decision"?null:u(zb,{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(zb,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision,className:"pt-2 pb-3"})})},"user-input":{expanded:k1,collapsed:e=>b("div",{"data-chat-composer-collapsed-controls":"true",children:[k1(e),e.collapsedPendingRow]})},"plan-follow-up":{expanded:e=>e.activeProposedPlan===null?null:u(I1,{planTitle:FD(e.activeProposedPlan.planMarkdown)??null},e.activeProposedPlan.id),collapsed:null}};function P1(e,t){let n=L1[e.occupant.kind],o=t?n.collapsed:n.expanded;return o===null?null:o(e)}var Eye=Object.keys(L1);he();function A1(e){let{threadId:t,isLocalDraftThread:n,selection:o,selectionsEqual:r,onChosen:a}=e,i=N(null);W(()=>{let s=i.current;i.current={threadId:t,selection:o},!(s===null||s.threadId!==t||n)&&(r(s.selection,o)||a?.(o))},[t,n,o,r,a])}function dQ(e){return typeof e!="string"?null:e.trim()||null}function cQ(e){return e.type==="select"?{...e,options:[...e.options],...e.promptInjectedValues?{promptInjectedValues:[...e.promptInjectedValues]}:{}}:{...e}}function uQ(e,t){return e?.find(o=>o.id===t)?.value}function E1(e,t){let n=dQ(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 fQ(e,t){if(e.type==="boolean")return typeof t=="boolean"?{...e,currentValue:t}:e;let n=typeof t=="string"?E1(e,t):E1(e,e.currentValue);if(!n){let{currentValue:o,...r}=e;return r}return{...e,currentValue:n}}function lf(e){let{caps:t,selections:n}=e;return(t.optionDescriptors??[]).map(cQ).map(r=>fQ(r,uQ(n,r.id)??r.currentValue))}function Ji(e){if(e)return e.type==="boolean"||e.currentValue?e.currentValue:e.options.find(t=>t.isDefault)?.id}function rh(e){if(!e)return;let t=Ji(e);if(typeof t=="string")return e.options.find(n=>n.id===t)?.label}function pQ(e){if(!e||e.length===0)return;let t=[];for(let n of e){let o=Ji(n);(typeof o=="string"||typeof o=="boolean")&&t.push({id:n.id,value:o})}return t.length>0?t:void 0}function ah(e,t){if(!t||t.length===0)return;let n=new Set(t.map(r=>r.id)),o=pQ(e)?.filter(r=>n.has(r.id));return o&&o.length>0?o:void 0}function Hb(e){return typeof e=="string"&&/\bultrathink\b/i.test(e)}function R1(e,t){let n=e.trim();return!n||t!=="ultrathink"||/^\/[^\s/]+(?:\s|$)/u.test(n)||n.startsWith("Ultrathink:")?n:`Ultrathink:
3868
+ `)[0]}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-1 pt-0.5",children:s.options.map(f=>u(ie,{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 rQ(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Ub(e,t){let n=rQ(t?.customAnswer);if(e.allowFreeform!==!1&&n)return n;let o=IC(e,t?.selectedOptionLabels);return e.multiSelect?o.length>0?o:null:o[0]??null}function aQ(e,t){let n={};for(let o of e){let r=Ub(o,t[o.id]);if(!r)return null;n[o.id]=r}return n}function iQ(e,t){return e.reduce((n,o)=>Ub(o,t[o.id])?n+1:n,0)}function b1(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?Ub(r,a):null,s=r?.allowFreeform===!1?"":a?.customAnswer??"",l=iQ(e,t),d=e.length===0?!0:o>=e.length-1;return{questionIndex:o,activeQuestion:r,activeDraft:a,selectedOptionLabels:r?IC(r,a?.selectedOptionLabels):[],customAnswer:s,resolvedAnswer:i,usingCustomAnswer:s.trim().length>0,answeredQuestionCount:l,isLastQuestion:d,isComplete:aQ(e,t)!==null,canAdvance:!!i}}var sQ={approve:{label:"pendingUserInput.planApprove",description:"pendingUserInput.planApproveHint"},revise:{label:"pendingUserInput.planRevise",description:"pendingUserInput.planReviseHint"},stop:{label:"pendingUserInput.planStop",description:"pendingUserInput.planStopHint"}};function w1(e,t,n){let o=t.kind==="plan"&&n.planAction!==void 0?sQ[n.planAction]:void 0;return o===void 0?{label:n.label,description:n.description??""}:{label:e(o.label),description:e(o.description)}}he();var S1=ve(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(lQ,{prompt:s,isResponding:n.includes(s.requestId),answers:o,questionIndex:r,onToggleOption:a,onAdvance:i},s.requestId):null}),lQ=ve(function({prompt:t,isResponding:n,answers:o,questionIndex:r,onToggleOption:a,onAdvance:i}){let{t:s}=ye(),l=jt(),d=b1(t.questions,o,r),c=d.activeQuestion,f=N(null),p=N(i),[m,g]=Q(null),[h,v]=Q(null),y=h!==null&&h===c?.id;W(()=>{p.current=i},[i]),W(()=>{if(!(!c||c.multiSelect||!m)){if(m.questionId!==c.id){g(null);return}d.customAnswer.trim().length===0&&d.selectedOptionLabels.includes(m.optionLabel)&&g(null)}},[c,m,d.customAnswer,d.selectedOptionLabels]),W(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);let x=R((w,T)=>{if(c?.multiSelect){a(w,T);return}g({questionId:w,optionLabel:T}),a(w,T),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||y||w.metaKey||w.ctrlKey||w.altKey||w.isComposing||w.keyCode===229||ki(w.target))return;let T=qh(w.key,c.options.length);if(T===null)return;let S=c.options[T];S&&(w.preventDefault(),x(c.id,Td(S)))},{target:"document"}),!c)return null;let C=d.customAnswer.trim().length>0;return b(TS,{className:"py-2",open:!y,onOpenChange:w=>{v(w?null:c.id)},children:[u("div",{className:"flex items-center gap-1 px-1 sm:px-2",children:b(LS,{title:s(y?"pendingUserInput.showQuestion":"pendingUserInput.hideQuestion"),"data-pending-user-input-toggle":y?"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,y?u("span",{className:"min-w-0 flex-1 truncate text-secondary-label text-xs",children:c.question}):null,u(rn,{"aria-hidden":"true",className:K("ml-auto size-icon-2 shrink-0 text-secondary-label transition-transform duration-(--control-duration) group-hover:text-foreground",y&&"rotate-180")})]})}),u(kS,{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(sr,{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,T)=>{let S=Td(w),L=w1(s,c,w),I=m?.questionId===c.id&&m.optionLabel===S||!C&&d.selectedOptionLabels.includes(S),P=T<9?T+1:null,E=K("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"),_=b(ke,{children:[b("div",{className:"min-w-0 flex-1 flex flex-col gap-0.5",children:[u("span",{className:"text-sm font-medium",children:L.label}),L.description&&L.description!==L.label?u("span",{className:"text-secondary-label text-[11px]",children:L.description}):null]}),I?u(ro,{className:"size-icon-2 shrink-0 text-primary"}):P!==null?u("kbd",{className:K("flex size-5 shrink-0 items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums"),children:P}):null]});return u("button",{type:"button","aria-pressed":I,disabled:n,onClick:()=>{x(c.id,S)},className:E,children:_},`${c.id}:${S}`)})})]})})]})});he();var I1=ve(function({planTitle:t}){let{t:n}=ye();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 T1(e){if(e.occupant.kind!=="approval")return null;let{approval:t}=e.occupant;return u(BD,{requestId:t.requestId,isResponding:e.respondingRequestIds.includes(t.requestId),options:t.options,keybindings:e.keybindings,declineReasonRelay:t.declineReasonRelay,onRespondToApproval:e.onRespondToApproval})}function k1(e){return e.occupant.kind!=="user-input"?null:u(S1,{pendingUserInputs:[e.occupant.userInput],respondingRequestIds:e.respondingRequestIds,answers:e.activePendingDraftAnswers,questionIndex:e.activePendingQuestionIndex,onToggleOption:e.onSelectActivePendingUserInputOption,onAdvance:e.onAdvanceActivePendingUserInput})}var L1={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(Bb,{approval:e.occupant.approval,pendingCount:e.occupant.pendingCount}),u("div",{className:"flex min-w-0 flex-wrap items-center gap-0.5",children:T1(e)})]}),collapsed:e=>e.occupant.kind!=="approval"?null:b("div",{"data-chat-composer-collapsed-controls":"true",children:[u(Bb,{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:T1(e)})]})},decision:{expanded:e=>e.occupant.kind!=="decision"?null:u(zb,{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(zb,{decision:e.occupant.decision.card,onRespond:e.onRespondToDecision,className:"pt-2 pb-3"})})},"user-input":{expanded:k1,collapsed:e=>b("div",{"data-chat-composer-collapsed-controls":"true",children:[k1(e),e.collapsedPendingRow]})},"plan-follow-up":{expanded:e=>e.activeProposedPlan===null?null:u(I1,{planTitle:FD(e.activeProposedPlan.planMarkdown)??null},e.activeProposedPlan.id),collapsed:null}};function P1(e,t){let n=L1[e.occupant.kind],o=t?n.collapsed:n.expanded;return o===null?null:o(e)}var Eye=Object.keys(L1);he();function A1(e){let{threadId:t,isLocalDraftThread:n,selection:o,selectionsEqual:r,onChosen:a}=e,i=N(null);W(()=>{let s=i.current;i.current={threadId:t,selection:o},!(s===null||s.threadId!==t||n)&&(r(s.selection,o)||a?.(o))},[t,n,o,r,a])}function dQ(e){return typeof e!="string"?null:e.trim()||null}function cQ(e){return e.type==="select"?{...e,options:[...e.options],...e.promptInjectedValues?{promptInjectedValues:[...e.promptInjectedValues]}:{}}:{...e}}function uQ(e,t){return e?.find(o=>o.id===t)?.value}function E1(e,t){let n=dQ(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 fQ(e,t){if(e.type==="boolean")return typeof t=="boolean"?{...e,currentValue:t}:e;let n=typeof t=="string"?E1(e,t):E1(e,e.currentValue);if(!n){let{currentValue:o,...r}=e;return r}return{...e,currentValue:n}}function lf(e){let{caps:t,selections:n}=e;return(t.optionDescriptors??[]).map(cQ).map(r=>fQ(r,uQ(n,r.id)??r.currentValue))}function Ji(e){if(e)return e.type==="boolean"||e.currentValue?e.currentValue:e.options.find(t=>t.isDefault)?.id}function rh(e){if(!e)return;let t=Ji(e);if(typeof t=="string")return e.options.find(n=>n.id===t)?.label}function pQ(e){if(!e||e.length===0)return;let t=[];for(let n of e){let o=Ji(n);(typeof o=="string"||typeof o=="boolean")&&t.push({id:n.id,value:o})}return t.length>0?t:void 0}function ah(e,t){if(!t||t.length===0)return;let n=new Set(t.map(r=>r.id)),o=pQ(e)?.filter(r=>n.has(r.id));return o&&o.length>0?o:void 0}function Hb(e){return typeof e=="string"&&/\bultrathink\b/i.test(e)}function R1(e,t){let n=e.trim();return!n||t!=="ultrathink"||/^\/[^\s/]+(?:\s|$)/u.test(n)||n.startsWith("Ultrathink:")?n:`Ultrathink:
3869
3869
  ${n}`}he();function ih(e,t,n){if(e!=="opencode"||t.length===0)return!1;let o=n?.trim();return o?!t.some(r=>r.slug===o):!1}function sh(e,t){if(e)return t?e:e.filter(n=>n.id!=="agent"||n.value!=="plan")}var M1={agent:"traits.savedOption.agent",effort:"traits.savedOption.effort",reasoningEffort:"traits.savedOption.reasoningEffort",variant:"traits.savedOption.variant"};function mQ(e){let t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function N1(e,t){return Object.hasOwn(M1,t)?e(M1[t]):mQ(t)}function _1(e,t){return(e??[]).map(n=>typeof n.value=="boolean"?{id:n.id,label:t(n.id),type:"boolean",currentValue:n.value}:{id:n.id,label:t(n.id),type:"select",options:[{id:n.value,label:n.value}],currentValue:n.value})}var gQ=`Ultrathink:
3870
- `;function hQ(){let{t:e}=ye();return u(ra,{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 vQ(e,t,n){return ah(e,[...t??[],{id:n}])}function D1(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 lh(e){if(!e)return null;let t=Ji(e);return typeof t=="string"?t:null}function O1(){let{t:e}=ye();return t=>N1(e,t)}var yQ=e=>e;function xQ(e,t,n,o,r,a,i,s,l){let d=e.getModelCapabilities(n,o,s),c=ih(t,n,o),f=c?_1(sh(a,s),l):lf({caps:d,selections:a}),p=f.filter(P=>P.type==="select"),m=f.filter(P=>P.type==="boolean"),g=p[0]??null,h=p.find(P=>P.id==="contextWindow")??null,v=p.find(P=>P.id==="agent")??null,y=m.find(P=>P.id==="fastMode")??null,x=m.find(P=>P.id==="thinking")??null,C=i&&(g?.promptInjectedValues?.length??0)>0&&r!=="none",w=C&&r==="ultrathink-in-body",T=(C?"ultrathink":lh(g))??null,S=typeof x?.currentValue=="boolean"?x.currentValue:null,L=lh(h),k=lh(v),I=v?rh(v):null;return{caps:d,descriptors:f,selectDescriptors:p,booleanDescriptors:m,primarySelectDescriptor:g,contextWindowDescriptor:h,agentDescriptor:v,fastModeDescriptor:y,thinkingDescriptor:x,effort:T,thinkingEnabled:S,contextWindow:L,ultrathinkPromptControlled:C,ultrathinkInBodyText:w,selectedAgent:k,selectedAgentLabel:I,modelIsUnavailable:c}}function $b(e){let t=xQ(e.modelApi,e.provider,e.models,e.model,e.promptInjection,e.modelOptions,e.allowPromptInjectedEffort??!0,e.planModeEnabled,e.labelOf??yQ),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||t.modelIsUnavailable&&t.descriptors.length>0}}function Kb(e){return $b(e).hasAnyControls}var qb=ve(function({provider:t,instanceId:n,models:o,model:r,promptInjection:a,onPromptUpdate:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,...c}){let{t:f}=ye(),p=O1(),m=jt(),g=m.draft.useStore(P=>P.setProviderModelOptions),h=R(P=>{if("onModelOptionsChange"in c){c.onModelOptionsChange(P);return}let E=c.threadRef??c.draftId;E&&g(E,t,P,{...n?{instanceId:n}:{},model:r,persistSticky:!0})},[n,r,c,t,g]),{descriptors:v,selectDescriptors:y,booleanDescriptors:x,primarySelectDescriptor:C,ultrathinkPromptControlled:w,ultrathinkInBodyText:T,hasAnyControls:S,modelIsUnavailable:L}=$b({modelApi:m.model,provider:t,models:o,model:r,promptInjection:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,labelOf:p}),k=(P,E)=>{h(vQ(P,s,E))},I=(P,E)=>{if(E){if(P.promptInjectedValues?.includes(E)){i(_=>_.trim().length===0?gQ:R1(_,"ultrathink"));return}T&&P.id===C?.id||(w&&P.id===C?.id&&i(_=>_.replace(/^Ultrathink:\s*/i,"")),k(D1(v,P.id,E),P.id))}};return S?L?u(ke,{children:v.map((P,E)=>{let _=P.type==="boolean"?f(P.currentValue===!0?"traits.on":"traits.off"):rh(P);return _?b("div",{children:[E>0?u(_a,{}):null,b(Ll,{children:[u(bS,{children:P.label}),u("div",{className:"px-2 pb-1.5 text-ui-sm text-muted-foreground",children:_})]})]},P.id):null})}):b(ke,{children:[y.map((P,E)=>{let _=w&&P.id===C?.id?"ultrathink":lh(P)??"";return b("div",{children:[E>0?u(_a,{}):null,b(Ll,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:P.label}),T&&P.id===C?.id?u("div",{className:"px-2 pb-1.5 text-muted-foreground/80 text-xs",children:f("traits.ultrathinkInBodyNotice")}):null,u(Ir,{value:_,onValueChange:A=>I(P,A),children:P.options.map(A=>u(Vo,{value:A.id,hideIndicator:!0,closeOnClick:!0,disabled:T&&P.id===C?.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(ke,{children:[" ",u(hQ,{})]}):null]})}),A.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:A.description}):null]})},A.id))})]})]},P.id)}),x.map((P,E)=>{let _=P.currentValue===!0?"on":"off";return b("div",{children:[E>0||y.length>0?u(_a,{}):null,b(Ll,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:P.label}),u(Ir,{value:_,onValueChange:A=>{k(D1(v,P.id,A==="on"),P.id)},children:["on","off"].map(A=>u(Vo,{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))})]})]},P.id)})]}):null});function CQ(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=Ji(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")}):rh(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 F1=ve(function({provider:t,instanceId:n,models:o,model:r,promptInjection:a,onPromptUpdate:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,triggerVariant:c,triggerClassName:f,...p}){let[m,g]=Q(!1),{t:h}=ye(),v=O1(),y=jt().model,{descriptors:x,primarySelectDescriptor:C,ultrathinkPromptControlled:w}=$b({modelApi:y,provider:t,models:o,model:r,promptInjection:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,labelOf:v});if(!Kb({modelApi:y,provider:t,models:o,model:r,promptInjection:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}))return null;let{label:T,showFastModeIcon:S}=CQ(h,{provider:t,descriptors:x,primarySelectDescriptorId:C?.id??null,ultrathinkPromptControlled:w}),L=S?b(ke,{children:[u(Jo,{icon:Cs,className:K("fill-current opacity-80",t==="claudeAgent"?"text-[#d97757]":"text-foreground")}),u("span",{className:"sr-only",children:h("traits.fastModeOn")})]}):null,k=t==="codex";return b(_o,{open:m,onOpenChange:I=>{g(I)},children:[u(Oo,{render:u(Yo,{variant:c??"ghost",className:K(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:[L,u("span",{className:"min-w-0 truncate",children:T}),u(ga,{})]}):b(ke,{children:[L,u("span",{children:T}),u(ga,{})]})}),u(Do,{align:"start",children:u(qb,{provider:t,...n?{instanceId:n}:{},models:o,model:r,promptInjection:a,onPromptUpdate:i,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,...p})})]})});function B1(e){return Hb(e)?Hb(e.replace(/^Ultrathink:\s*/i,""))?"ultrathink-in-body":"ultrathink":"none"}function z1(e,t){let{provider:n,model:o,models:r,modelOptions:a,promptInjectionState:i="none",planModeEnabled:s}=e;if(ih(n,r,o)){let g=sh(a,s);return{provider:n,promptEffort:null,modelOptionsForDispatch:g&&g.length>0?[...g]:void 0}}let l=t.getModelCapabilities(r,o,s),d=lf({caps:l,selections:a}),c=d.find(g=>g.type==="select"),f=Ji(c??null),p=typeof f=="string"?f:null,m=(c?.promptInjectedValues?.length??0)>0&&i!=="none";return{provider:n,promptEffort:p,modelOptionsForDispatch:ah(d,[...a??[],...s?[]:bQ(r,o,t)]),...m?{composerFrameClassName:"ultrathink-frame",composerSurfaceClassName:"shadow-[0_0_0_1px_rgba(255,255,255,0.07)_inset]",modelPickerIconClassName:"ultrathink-chroma"}:{}}}function bQ(e,t,n){let o=lf({caps:n.getModelCapabilities(e,t,!0),selections:void 0}).find(r=>r.type==="select"&&r.id==="agent");return o&&Ji(o)==="plan"?[{id:o.id}]:[]}function U1(e,t){let{provider:n,instanceId:o,threadRef:r,draftId:a,model:i,models:s,modelOptions:l,promptInjection:d,onPromptUpdate:c,planModeEnabled:f}=t;return!(r!==void 0||a!==void 0)||!Kb({modelApi:t.modelApi,provider:n,models:s,model:i,modelOptions:l,promptInjection:d,planModeEnabled:f})?null:u(e,{provider:n,...o?{instanceId:o}:{},models:s,...r?{threadRef:r}:{},...a?{draftId:a}:{},model:i,modelOptions:l,promptInjection:d,onPromptUpdate:c,planModeEnabled:f})}function H1(e){return U1(qb,e)}function $1(e){return U1(F1,e)}he();var K1=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},q1=(e=>e?K1(e):K1);he();var wQ=e=>e;function SQ(e,t=wQ){let n=Tn.useSyncExternalStore(e.subscribe,Tn.useCallback(()=>t(e.getState()),[e,t]),Tn.useCallback(()=>t(e.getInitialState()),[e,t]));return Tn.useDebugValue(n),n}var V1=e=>{let t=q1(e),n=o=>SQ(t,o);return Object.assign(n,t),n},W1=(e=>e?V1(e):V1);var Vb=W1(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 G1(e){return Vb(t=>e===null?null:t.presetIdByDraftId[e]??null)}function Wb(e,t){return t==null?void 0:e.find(n=>n.presetId===t)}var Gb="__none__",j1=ve(function({environmentId:t,draftId:n,threadPresetId:o,compact:r}){let{t:a}=ye(),i=jt().presets.useThreadPresets(t),s=G1(n),l=Vb(c=>c.setDraftPresetId);if(n===null){let f=Wb(i,o)?.displayName??o;return f===null?null:b(Yo,{variant:"ghost",disabled:!0,"aria-label":a("preset.appliedLabel",{name:f}),className:"shrink-0 whitespace-nowrap",children:[u(Jo,{icon:Ma}),u("span",{className:"min-w-0 truncate",children:f})]})}if(i.length===0)return null;let d=Wb(i,s);return b(_o,{children:[u(Oo,{render:u(Yo,{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(Jo,{icon:Ma}),r?null:u("span",{className:"min-w-0 truncate",children:d?.displayName??a("preset.none")}),u(ga,{})]})}),u(Do,{align:"start",children:b(Ll,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:a("preset.menuTitle")}),b(Ir,{value:s??Gb,onValueChange:c=>{l(n,c===Gb?null:c)},children:[u(Vo,{value:Gb,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"min-w-0 truncate",children:a("preset.none")})}),i.map(c=>u(Vo,{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))]})]})})]})});he();function Q1(e){let t=e.credentialIdentity;return[e.queryKey,t===null?"":t.id,t===null?"":String(t.revision)].join("\0")}function IQ(e,t){let n=t.credentialIdentity;return n===null?!1:e.environmentId===t.environmentId&&e.instanceId===t.instanceId&&e.credentialIdentity.id===n.id&&e.credentialIdentity.revision===n.revision}function X1(e){return e.capability.status!=="unsupported"&&e.credentialIdentity!==null}function jb(e,t){return e===null||!Number.isFinite(e)?null:t.kind==="money"?e.toFixed(t.precision):(Number.isInteger(e),String(e))}function dh(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 Qb(e,t){return e.freshness==="stale"||e.status==="error"||e.errorReason!==null||t!==null}function Y1(e){if(e.unlimited===!0)return{kind:"unlimited"};let t=e.kind==="spend-cap"?e.used??e.remaining:e.remaining??e.used,n=jb(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 J1(e,t){let n=[];for(let o of e){let r=Y1(o);r!==null&&n.push({metricId:o.metricId,kind:o.kind,display:r,nativeLabel:o.nativeLabel,durationMs:o.windowMs,resetsAt:o.resetsAt,fetchedAt:o.fetchedAt,stale:Qb(o,t)})}return n}function Z1(e){return e.filter(t=>t.kind==="rate-limit"&&Y1(t)===null).map(t=>({metricId:t.metricId,kind:t.kind,nativeLabel:t.nativeLabel,durationMs:t.windowMs,resetsAt:t.resetsAt}))}function eO(e){return e.snapshot===null||e.credentialIdentity===null?null:IQ(e.snapshot,e)?e.snapshot:null}function tO(e){for(let t of e)if(t.resetsAt!==null)return t.resetsAt;return null}function nO(e){let t=null;for(let n of e)n.fetchedAt!==null&&(t===null||n.fetchedAt<t)&&(t=n.fetchedAt);return t}he();function oO(e,t){let n=N(e),o=N(0),r=N(!1),[a,i]=Q(e),[s,l]=Q(null),[d,c]=Q(!1);a!==e&&(i(e),n.current=e,o.current+=1,r.current=!1,l(null),c(!1));let f=R(async()=>{if(r.current)return;let p=o.current+1;o.current=p;let m=e;r.current=!0,c(!0);try{let g=await t();if(o.current!==p||n.current!==m)return;l(g)}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 Yb(e,t){switch(e.unit){case"days":return t("accountUsage.windowDays",{count:e.count});case"hours":return t("accountUsage.windowHours",{count:e.count});case"minutes":return t("accountUsage.windowMinutes",{count:e.count});case"seconds":return t("accountUsage.windowSeconds",{count:e.count})}}function Jb(e,t){let n=e.nativeLabel?.trim()??"";if(n.length>0)return n;let o=dh(e.durationMs);return o!==null?Yb(o,t):PQ(e.kind,t)}function TQ(e,t){switch(e.kind){case"unlimited":return t("accountUsage.unlimited");case"money":return`${e.currency} ${e.amount}`;case"quantity":return`${e.amount} ${e.nativeUnit}`;case"percent":return e.direction==="used"?t("accountUsage.percentUsed",{value:e.amount}):t("accountUsage.percentRemaining",{value:e.amount})}}function kQ(e,t){let n=TQ(e.display,t);if(e.kind==="quota-window")return`${Jb(e,t)} ${n}`;let o=e.nativeLabel?.trim()??"";return o.length>0?`${o} ${n}`:n}function LQ(e,t){let n=Jb({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:e.durationMs},t),o=dh(e.durationMs);return o!==null?`${n} \xB7 ${Yb(o,t)}`:e.resetsAt!==null?`${n} \xB7 ${t("accountUsage.resetsAt",{time:Dd(e.resetsAt)})}`:n}function PQ(e,t){switch(e){case"balance":return t("accountUsage.kindBalance");case"credits":return t("accountUsage.kindCredits");case"quota-window":return t("accountUsage.kindQuotaWindow");case"spend-cap":return t("accountUsage.kindSpendCap");case"rate-limit":return t("accountUsage.kindRateLimit")}}function AQ(e,t){switch(e){case"account":return t("accountUsage.scopeAccount");case"org":return t("accountUsage.scopeOrg")}}function Dd(e){return aa(e,"locale")||e}function EQ(e,t){switch(e.outcome){case"fresh":return t("accountUsage.outcomeFresh");case"partial":return t("accountUsage.outcomePartial");case"joined-inflight":return t("accountUsage.outcomeJoinedInflight");case"rate-limited":return e.retryAt===null?t("accountUsage.outcomeRateLimited"):t("accountUsage.outcomeRateLimitedUntil",{time:Dd(e.retryAt)});case"offline":return t("accountUsage.outcomeOffline");case"unsupported":return t("accountUsage.outcomeUnsupported");case"error":return t("accountUsage.outcomeError")}}function RQ(e,t){switch(e){case"credential-unavailable":return t("accountUsage.unsupportedSignedOut");case"instance-disabled":return t("accountUsage.unsupportedDisabled");case"unsupported-driver":return t("accountUsage.unsupportedNoChannel");default:return t("accountUsage.unsupported")}}function MQ(e,t){switch(e){case"rate-limited":return t("accountUsage.outcomeRateLimited");case"auth-rejected":return t("accountUsage.errorAuthRejected");case"unreachable":return t("accountUsage.errorUnreachable");case"response-invalid":return t("accountUsage.errorResponseInvalid");case"reader-unloaded":return t("accountUsage.errorReaderUnloaded");default:return t("accountUsage.outcomeError")}}function NQ(e,t,n){return e.capability.status==="unsupported"?RQ(e.error,n):t.length>0?null:e.loading?n("accountUsage.loading"):e.error!==null?MQ(e.error,n):e.credentialIdentity===null||e.capability.status==="unknown"?n("accountUsage.unknown"):n("accountUsage.noData")}function Xb(e,t){let n=jb(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 rO(e){let[t,n]=Q(!1);return u(_Q,{...e,expanded:t,onToggleExpanded:()=>n(o=>!o)})}function _Q(e){let{expanded:t,onToggleExpanded:n,onRefresh:o,...r}=e,{t:a}=ye(),i=Q1(r),{feedback:s,refreshing:l,refresh:d}=oO(i,o),c=r.capability.status==="supported"&&r.credentialIdentity!==null?eO(r):null,f=c?.metrics??[],p=J1(f,r.error),m=p.some(S=>S.stale)||r.error!==null&&c!==null,g=tO(p),h=nO(f),v=l,y=NQ(r,p,a),x=X1(r),w=`${Jr()}-account-usage-details`,T=[...p.map(S=>({key:S.metricId,text:kQ(S,a)})),...Z1(f).map(S=>({key:`${S.metricId}\0status`,text:LQ(S,a)})),...g===null?[]:[{key:"resets-at",text:a("accountUsage.resetsAt",{time:Dd(g)})}]];return b("div",{className:"min-w-0 px-3 pt-1 sm:px-4","data-composer-account-usage":"true","data-refresh-outcome":s?.outcome??"",children:[b("div",{className:"flex min-w-0 items-start gap-1.5",children:[u(ie,{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?"accountUsage.hideDetails":"accountUsage.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.instanceLabel}),m?u("span",{className:"text-[11px] text-muted-foreground","data-composer-account-usage-stale":"true",children:a("accountUsage.stale")}):null,u(rn,{"aria-hidden":"true",className:K("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:T.length>0?T.map((S,L)=>b("span",{children:[L>0?u("span",{"aria-hidden":"true",children:" \xB7 "}):null,S.text]},S.key)):y})]})}),x?u(ie,{type:"button",size:"xs",variant:"ghost",className:"mt-0.5 shrink-0 text-secondary-label","aria-label":a("accountUsage.refreshAria",{instance:r.instanceLabel}),disabled:v,onClick:()=>{d()},children:a(v?"accountUsage.refreshing":"accountUsage.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-account-usage-details":"true",children:[f.length===0?u("p",{className:"text-[11px] text-secondary-label",children:y??a("accountUsage.noData")}):f.map(S=>u(DQ,{metric:S,queryError:r.error,t:a},S.metricId)),h!==null?u("p",{className:"text-[11px] text-secondary-label",children:a("accountUsage.collectedAt",{time:Dd(h)})}):null]}):null,s!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:EQ(s,a)}):r.error!==null&&c!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:a("accountUsage.errorKeepLast")}):null]})}function DQ({metric:e,queryError:t,t:n}){let o=Xb(e,e.used),r=e.unlimited===!0?n("accountUsage.unlimited"):Xb(e,e.remaining),a=Xb(e,e.limit),i=n("accountUsage.sharedScope",{scope:AQ(e.scope,n)}),s=Qb(e,t),l=e.windowMs,d=dh(l),c=Jb({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:l},n);return b("div",{className:"text-[11px] text-secondary-label","data-metric-id":e.metricId,"data-metric-kind":e.kind,"data-window-ms":l===null?void 0:String(l),children:[b("div",{className:"font-medium text-foreground",children:[c,s?u("span",{className:"ms-2 font-normal text-muted-foreground",children:n("accountUsage.stale")}):null]}),b("div",{className:"mt-0.5 flex flex-wrap gap-x-2 tabular-nums",children:[o!==null?b("span",{children:[o," ",n("accountUsage.used")]}):null,r!==null?b("span",{children:[r," ",e.unlimited===!0?null:n("accountUsage.remaining")]}):null,a!==null?b("span",{children:[a," ",n("accountUsage.limit")]}):null]}),u("div",{className:"mt-0.5",children:i}),e.fetchedAt!==null?u("div",{children:n("accountUsage.collectedAt",{time:Dd(e.fetchedAt)})}):null,e.resetsAt!==null?u("div",{children:n("accountUsage.resetsAt",{time:Dd(e.resetsAt)})}):null,d!==null?u("div",{children:Yb(d,n)}):null]})}function ai(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 aO(e,t){if(!e)return null;let n=t.get(e.instanceId)?.find(o=>o.slug===e.model);return n?Md(n):e.model}function iO(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 OQ(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function sO(e){let{t}=ye(),{usage:n,breakdown:o,modelDisplayName:r,onCompact:a,compactDisabled:i,compactDisabledReason:s}=e,l=OQ(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,g=m!==null&&m>0,v=d>90?"var(--color-error)":"color-mix(in oklab, var(--color-muted-foreground) 72%, transparent)";return b(wi,{children:[u(Ii,{openOnHover:!0,delay:150,closeDelay:a?150:0,render:u(ie,{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?t("contextWindow.usedPercentAria",{percentage:l}):t("contextWindow.usedTokensAria",{tokens:ai(n.usedTokens)}),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(Si,{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:[ai(n.usedTokens),"/",ai(n.maxTokens??null)]})]}):u("div",{className:"text-secondary-label text-[11px] tabular-nums",children:ai(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:ai(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:ai(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:ai(o.messageTokens)})]})]}):null,g?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:ai(m)})]}):null,n.compactsAutomatically?u("div",{className:"mt-1 text-pretty text-secondary-label text-[11px] font-medium",children:iO(t,r,n.autoCompactThreshold)}):null,a?b(ke,{children:[b(ie,{size:"xs",variant:"outline",className:"mt-1 w-full justify-center",disabled:i,onClick:a,children:[u(cc,{"aria-hidden":"true"}),t("contextWindow.compactContext")]}),i&&s?u("div",{className:"text-pretty text-secondary-label text-[11px]",children:s}):null]}):null]})})]})}he();var lO=bt(null);function dO({children:e}){let{data:t,target:n,threadKey:o}=ia(),r=t.useComposerStatus({target:n,threadKey:o});return u(lO.Provider,{value:r,children:e})}function cO(){let e=Ut(lO);if(e===null)throw new Error("Composer status has not been provided.");return e}function uO(e){return e.startsWith("!")}function fO(e){return e.slice(1).trim()}function pO(e){return e.length===0?"empty":/[\r\n]/.test(e)?"multiline":null}function FQ(){return null}function mO(){let{data:e,target:t,threadKey:n}=ia();return(e.useShellCommand??FQ)({target:t,threadKey:n})}function Zb(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 gO({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 hO(e,t){let n=Kr.indexOf(e);if(n===-1)return Kr[0];let o=(n+t+Kr.length)%Kr.length;return Kr[o]??Kr[0]}var BQ=['[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(",");function zQ(e){return e.closest(BQ)!==null}var UQ=[];function HQ(e,t){return{images:e.images,terminalContexts:e.terminalContexts,elementContexts:e.elementContexts,previewAnnotations:e.previewAnnotations,reviewComments:e.reviewComments,nonPersistedImageIds:e.nonPersistedImageIds,activeProvider:e.activeProvider,nativeModeByProvider:e.nativeModeByProvider,selectedPluginActionKey:e.selectedPluginActionKey,promptHasText:e.prompt.trim().length>0,promptInjection:B1(e.prompt),hasSendableContent:t({prompt:e.prompt,imageCount:e.images.length,terminalContexts:e.terminalContexts,elementContextCount:e.elementContexts.length+e.previewAnnotations.length+e.reviewComments.length}).hasSendableContent}}var $Q=e=>e.prompt.trim();function KQ(e){let{t}=ye(),n=e.api.draft.useThreadDraftSelector(e.composerDraftTarget,$Q),o=e.pendingCustomAnswer!==null;return u("button",{type:"button",className:K("min-w-0 flex-1 truncate bg-transparent p-0 text-left text-[14px]",(o?e.pendingCustomAnswer:n)?"text-foreground":"text-placeholder"),onPointerDown:r=>r.preventDefault(),onClick:e.onExpand,"aria-label":t("composer.expandComposer"),children:o?e.pendingCustomAnswer||t("composer.typeOwnAnswer"):n||(e.noProviderAvailable?t("composer.enableProviderSettings"):t("composer.askAnything"))})}var qQ=ve(function(t){let{data:n,target:o}=ia(),r=nS(),a=n.useAccountUsage({target:o,active:r&&!t.hidden});return t.hidden||a===void 0?null:u(rO,{...a},a.queryKey)}),VQ=ve(function(t){let{data:n,target:o}=ia(),r=n.useContextUsage(o);return r?.window==null?null:u(sO,{usage:r.window,breakdown:r.breakdown,modelDisplayName:t.modelDisplayName,onCompact:t.onCompact,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason})}),WQ=ve(function(t){let{t:n}=ye();return b(ke,{children:[u(VQ,{modelDisplayName:t.activeThreadModelDisplayName,onCompact:t.onCompactContext,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason}),t.isPreparingWorktree?u("span",{className:"text-secondary-label text-xs",children:n("composer.preparingWorktree")}):null,u(sf,{compact:t.compact,pendingAction:t.pendingAction,isRunning:t.isRunning,showPlanFollowUpPrompt:t.showPlanFollowUpPrompt,promptHasText:t.promptHasText,isSendBusy:t.isSendBusy,sendDisabledReason:t.sendDisabledReason,isEnvironmentUnavailable:t.isEnvironmentUnavailable,isPreparingWorktree:t.isPreparingWorktree,hasSendableContent:t.hasSendableContent,preserveComposerFocusOnPointerDown:t.preserveComposerFocusOnPointerDown??!1,showSendWhileRunning:t.showSendWhileRunning??!1,onPreviousPendingQuestion:t.onPreviousPendingQuestion,onInterrupt:t.onInterrupt,interruptArmed:t.interruptArmed,onImplementPlanInNewThread:t.onImplementPlanInNewThread,shellCommandMode:t.shellCommandMode,shellCommandUnavailableReason:t.shellCommandUnavailableReason})]})}),vO=ve(function(t){let n=BM(),{data:o,target:r,threadKey:a}=ia(),{activePendingApproval:i,pendingUserInputs:s,activePendingProgress:l,activePendingResolvedAnswers:d,activePendingIsResponding:c,activePendingDraftAnswers:f,activePendingQuestionIndex:p,respondingRequestIds:m,occupants:g,respondToApproval:h,respondToDecision:v,selectUserInputOption:y,changeUserInputCustomAnswer:x,advanceUserInput:C,previousUserInputQuestion:w}=o.useComposerPending({target:r,threadKey:a}),{runtimeMode:T,interactionMode:S,lockedProvider:L,providerStatuses:k,activeProjectDefaultModelSelection:I,projectId:P,activeThreadModelSelection:E}=o.useComposerModelContext(r),{activeThreadId:_,activeThread:A,isLocalDraftThread:H,projectSelectionRequired:V,phase:J,isSendBusy:D,sendDisabledReason:ne,unavailableAgentInstanceId:B=null,noAgentChosen:U=!1,isPreparingWorktree:ee,environmentUnavailable:j,compactDisabled:Z,compactDisabledReason:de}=cO(),{t:F}=ye(),{composerDraftTarget:X,environmentId:pe,attachmentUploadsCapabilityKnown:le,supportsAttachmentUploads:re,routeKind:we,routeThreadRef:Xe,draftId:ot,forceExpandedOnMobile:at,slots:je,resolvedTheme:oe,settings:Te,keybindings:Y,terminalOpen:me,gitCwd:ge,promptRef:G,composerRef:Ye,composerImagesRef:vt,composerTerminalContextsRef:Mt,composerElementContextsRef:Dt,sendContextRef:Nt,onSend:Ot,onInterrupt:At,interruptArmed:xt=!1,recentSlashCommandIds:_t=UQ,onSlashCommandUsed:Xt,onCompactContext:mn,onImplementPlanInNewThread:Hn,onProviderModelSelect:yt,onProviderInstanceSelect:qt,onModelSelectionChosen:an,onSelectPluginAction:kn,onManagePlugins:sn,getModelDisabledReason:Cn,getModelContinuationLabel:$n,onContinueInModel:$,toggleInteractionMode:ae,handleRuntimeModeChange:ce,handleInteractionModeChange:Le,handleNativeModeChange:ze,focusComposer:ft,scheduleComposerFocus:gn,setThreadError:lt,onExpandImage:hn}=t,Ft=o.useComposerPlan(r),rt=Ft.proposedPlan,Zt=Ft.tasksProgress,ln=Ft.taskSteps,Se=s.length===0&&S==="plan"&&rt!==null,Re=N(null),qe=R((O,Ie)=>{y(O,Ie),G.current="",Re.current?.resetCursorState({cursor:0})},[G,y]),pt=R(async(O,Ie,_e)=>{try{await h(O,Ie,_e)}catch(Pt){lt(r.threadId,Pt instanceof Error?Pt.message:F("approval.respondFailed"))}},[r.threadId,h,lt,F]),st=R((O,Ie)=>{v(O,Ie).then(_e=>{_e!==null&&lt(r.threadId,_e)})},[r.threadId,v,lt]),it=R(()=>{C().then(O=>{O!==null&&lt(r.threadId,O)})},[C,r.threadId,lt]),kt=xN({machineUnavailable:j!==null,sessionStarted:A?.session!=null,sessionDisconnected:J==="disconnected"}),Vt=CN(kt),Pe=t.api,{limits:Et}=t.attachments,mt=Pe.draft.useThreadDraftSelector(X,O=>HQ(O,Pe.chat.deriveComposerSendState)),on=mt.images,Nn=q(()=>on.filter(O=>LC(O)==="image"),[on]),xe=mt.terminalContexts,Ve=mt.elementContexts,Ct=mt.previewAnnotations,ct=mt.reviewComments,vn=mt.nonPersistedImageIds,bn=Pe.uploads.useStore(O=>O.uploadsByImageId),yn=re?qM({imageIds:on.map(O=>O.id),uploadsByImageId:bn,environmentId:pe},F):null,Lt=Pe.draft.useStore,xn=Lt(O=>O.setPrompt),Wt=Lt(O=>O.setNativeMode),An=Lt(O=>O.addImage),eo=Lt(O=>O.addImages),va=Lt(O=>O.removeImage),ya=Lt(O=>O.insertTerminalContext),He=Lt(O=>O.removeElementContext),xa=Lt(O=>O.removePreviewAnnotation),Cr=Lt(O=>O.removeReviewComment),qr=Lt(O=>O.clearComposerPromptAndImages);W(()=>{if(le){if(!re){for(let O of on)Pe.uploads.release(O.id);return}Pe.draft.restoreAttachments();for(let O of on)Pe.uploads.start({environmentId:pe,image:O})}},[le,on,pe,re]);let _n=q(()=>mN(Pe.model.applyInstanceSettings(Pe.model.deriveInstanceEntries(k),Te)),[Pe.model,k,Te]),tr=mt.activeProvider??null,Ro=A?.session?.providerInstanceId??E?.instanceId??I?.instanceId??null,ul=hN(_n,tr??Ro)??Pe.model.makeDriverKind("unconfigured"),Zi=L??ul,to=q(()=>{if(!L||!A)return null;let O=A.session?.providerInstanceId??E?.instanceId;return O?_n.find(Ie=>Ie.instanceId===O)?.continuationGroupKey??null:null},[A,E?.instanceId,L,_n]),gt=q(()=>{if(B!==null)return B;let O=[mt.activeProvider,A?.session?.providerInstanceId,E?.instanceId,I?.instanceId];for(let Ie of O){if(!Ie)continue;let _e=_n.find(Pt=>Pt.instanceId===Ie&&gN(Pt));if(_e){if(L&&_e.driverKind!==L||to&&_e.continuationGroupKey!==to)continue;return _e.instanceId}}return Pe.model.noProviderSelection.instanceId},[I?.instanceId,A?.session?.providerInstanceId,E?.instanceId,mt.activeProvider,to,L,_n,B]),xo=B!==null,zo=q(()=>xo||U?void 0:_n.find(O=>O.instanceId===gt),[U,xo,_n,gt]),Ae=zo===void 0&&!xo&&!U,Uo=xo&&OC(_n,{lockedProvider:L,lockedContinuationGroupKey:to}).length===0,es=de??(Ae?F("composer.compactingUnavailable"):null),Dn=zo?.driverKind??Zi,{modelOptions:Vr,selectedModel:co,selectedModelStatus:Wr}=Pe.draft.useEffectiveModelState({threadRef:X,providers:k,selectedProvider:Dn,selectedInstanceId:gt,threadModelSelection:E,projectModelSelection:I,settings:Te}),uo=q(()=>zo?.snapshot??null,[zo]),Ho=q(()=>zo?.models??[],[zo]),Kn=mt.promptInjection,Co=q(()=>z1({provider:Dn,model:co,models:Ho,promptInjectionState:Kn,modelOptions:Vr?.[gt],planModeEnabled:Te.planModeEnabled},Pe.model),[Vr,Kn,gt,co,Dn,Ho,Te.planModeEnabled]),si=Co.promptEffort,li=Co.modelOptionsForDispatch,di=Te.planModeEnabled,nr=q(()=>({showInteractionModeToggle:di&&Pe.model.getInteractionModeToggle(k,Dn),runtimeModeSwitch:uo?.runtimeModeSwitch??"next-turn"}),[di,k,Dn,uo]),wn=uo?.supportsNativeModeSwitch===!0,Gr=H&&wn?mt.nativeModeByProvider?.[gt]??null:null,Mo=q(()=>Pe.model.resolveNativeMode(uo,{runtimeMode:T,nativeModeId:H?Gr:A?.nativeModeId??null}),[Pe.model,A?.nativeModeId,uo,T,H,Gr]),Ca=Gr&&Mo?.current.id===Gr?Gr:void 0,ba=R(O=>{H&&Wt(X,gt,O),ze(O)},[H,Wt,X,gt,ze]),qn=q(()=>Pe.model.createSelection(gt,co,li),[Pe.model,gt,co,li]);A1({threadId:A?.id??null,isLocalDraftThread:H,selection:qn,selectionsEqual:Pe.model.selectionsEqual,onChosen:xo||U?void 0:an});let wa=R(O=>qt(O,qn),[qt,qn]),no=co,Ke=q(()=>{let O=new Map;for(let Ie of _n)O.set(Ie.instanceId,Pe.model.getAppModelOptionsForInstance(Te,Ie,Ie.instanceId===gt?no:null));return O},[Pe.model,_n,gt,no,Te]),Bt=q(()=>(Ke.get(gt)??[]).some(Ie=>Ie.slug===no)?no:Pe.model.normalizeSlug(no)??no,[Pe.model,Ke,gt,no,Dn]),dn=H&&L===null,Ln=Pe.pluginComposer.useOptions(dn?pe:null,P),Sa=Ln.options,Ia=dn?mt.selectedPluginActionKey:null,Ta=q(()=>Ia===null?null:Sa.find(O=>O.id===Ia)??null,[Ia,Sa]),ka=Ia!==null,jr=ka&&Ta===null?F(Ln.isKnown?"composer.pluginUnavailable":"composer.pluginLoading"):null,ts=ne??jr??(l?null:yn),ci=ts!==null,[ch,df]=Q(!1);W(()=>{df(!1)},[gt]);let uh=th(Wr),cf=ID({status:Wr,submissionTarget:l?"pending-user-input":"provider-turn"}),Fd=ch&&cf?uh:null,fh=q(()=>aO(E,Ke),[E,Ke]),or=`${String(pe)}\0${String(X)}`,[uf,z]=Q(!1),[Ee,tt]=Q(!1),[Yt,On]=Q(null),[ui,ph]=Q(null),[mh,fi]=Q(!1),[Bd,fl]=Q(!1),[wO,tw]=Q(null),[pl,gh]=Q({key:0,active:!1}),nw=N(or);Ce(()=>{nw.current!==or&&(nw.current=or,z(!1),On(null),fi(!1),fl(!1),tw(null),gh({key:pl.key,active:!1}))},[or,pl.key]);let br=Bp("max-sm"),fo=br&&!at&&!Ee,ml=N(null),ow=N(null),hh=N(null),rw=N(null),vh=N(!1),bo=N(null),gl=N(null),hl=N(null),ff=N(!1),aw=N(0),vl=N(null),yh=N(new Set),ns=N(new Map),SO=R(()=>{z(!0)},[]),IO=R(O=>{Le(O)},[Le]),TO=q(()=>new Set(vn),[vn]),Vn=i!==null,iw=l?.activeQuestion?.allowFreeform===!1,pi=mO(),kO=Pe.draft.useThreadDraftSelector(X,O=>uO(O.prompt)),yl=pi!==null&&kO&&!Vn&&l===null,zd=g[0]??null,{showTopDrawer:pf,showCollapsedPromptRow:LO,hasBlocking:Ud}=UM(zd?.kind??null,fo),PO=Se||l!==null,{isComposerFooterCompact:os,isComposerPrimaryActionsCompact:sw}=YM(hh,PO),lw=l!==null,dw=R(O=>{let Ie=Re.current?.readDraftPrompt()??G.current,_e=O(Ie);if(_e===Ie){gn();return}lw?xn(X,_e):(G.current=_e,xn(X,_e),Re.current?.syncCursor(Po(_e,_e.length),Ao(_e,_e.length))),gn()},[lw,X,G,gn,xn]),AO=H1({modelApi:Pe.model,provider:Dn,instanceId:gt,...we==="server"?{threadRef:Xe}:{},...we==="draft"&&ot?{draftId:ot}:{},model:co,models:Ho,modelOptions:Vr?.[gt],promptInjection:Kn,onPromptUpdate:dw,planModeEnabled:Te.planModeEnabled}),cw=$1({modelApi:Pe.model,provider:Dn,instanceId:gt,...we==="server"?{threadRef:Xe}:{},...we==="draft"&&ot?{draftId:ot}:{},model:co,models:Ho,modelOptions:Vr?.[gt],promptInjection:Kn,onPromptUpdate:dw,planModeEnabled:Te.planModeEnabled}),mf=q(()=>l?{questionIndex:l.questionIndex,isLastQuestion:l.isLastQuestion,canAdvance:l.canAdvance,isResponding:c,isComplete:!!d}:null,[c,l,d]),EO=J==="running"||D||ci||Ae||V||j!==null||!mt.hasSendableContent,RO=F("composer.sendMessage"),Hd=br&&!fo&&mf!==null,MO=R(O=>{An(X,O)},[X,An]),NO=R(O=>{eo(X,O)},[X,eo]),_O=R(O=>{Pe.uploads.release(O),va(X,O)},[Pe.uploads,X,va]);W(()=>{On(null)},[Ve,Ct,ct,xe,co,si,Dn]),Ce(()=>{vt.current=on},[on,vt]),Ce(()=>{Mt.current=xe},[xe,Mt]),Ce(()=>{Dt.current=Ve},[Ve,Dt]);let DO=R(()=>{if(!br)return;bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null);let O=document.activeElement;O instanceof HTMLElement&&O.blur(),tt(!1)},[br]),OO=R(()=>!br||D||ci||Ae||j!==null||J==="running"?!1:l?l.isLastQuestion&&!!d:Se||mt.hasSendableContent,[l,d,mt.hasSendableContent,j,br,D,ci,Ae,J,Se]),{composerSubmissionError:FO,setComposerSubmissionError:gf,revalidatePromptLength:uw,submitComposer:fw}=DD({promptRef:G,maxInputChars:Et.maxInputChars,noProviderAvailable:Ae,isSendDisabled:ci,sendDisabledReason:ts,isModelSendBlocked:cf,onModelSendBlocked:()=>{df(!0)},activeThreadId:_,activePendingProgress:l,composerDocumentKey:or,pendingImageCompressionsRef:ns,onSend:Ot,onProviderInputRejectedReset:()=>{vh.current=!1},wasProviderInputRejected:()=>vh.current,onStillCompressing:()=>{Pe.notify.info(F("composer.stillCompressing"),F("composer.sendAgainThumbnail"))},shouldBlurMobileComposerOnSubmit:OO,blurMobileComposerAfterSend:DO}),xh=N(!1),pw=R(O=>{if(O?.preventDefault(),pi===null||xh.current)return;if(pi.unavailableReason!==null){gf(pi.unavailableReason);return}let Ie=G.current,_e=fO(Ie),Pt=pO(_e);if(Pt==="empty")return;if(Pt==="multiline"){gf(F("composer.shellCommand.singleLine"));return}gf(null),xh.current=!0;let Sn=X;pi.run(_e).then(cn=>{!cn||G.current!==Ie||(G.current="",xn(Sn,""),Re.current?.syncCursor(0,null))}).finally(()=>{xh.current=!1})},[X,pi,G,xn,gf,F]),hf=R((O,Ie)=>{if(yl){pw(O);return}fw(O,Ie)},[pw,yl,fw]),mw=R(()=>{if(!yl)return!1;let O=G.current.slice(1);return G.current=O,xn(X,O),Re.current?.resetCursorState({prompt:O,cursor:O.length}),!0},[X,G,xn,yl]),BO=R(()=>{if(!(Z||Ae||mt.hasSendableContent||i!==null||s.length>0||J==="running"||D||!_)){if((ns.current.get(or)??0)>0){Pe.notify.info(F("composer.stillCompressing"),F("composer.compactAgainThumbnail"));return}mn()}},[i,_,Z,or,mt.hasSendableContent,D,Ae,mn,s.length,J]),vf=R(()=>{bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null),gl.current!==null&&window.cancelAnimationFrame(gl.current),hl.current!==null&&window.cancelAnimationFrame(hl.current),ff.current=!0,tt(!0),gl.current=window.requestAnimationFrame(()=>{gl.current=null,ml.current?.focusAtEnd(),hl.current=window.requestAnimationFrame(()=>{hl.current=null,ff.current=!1})})},[]),yf=Pe.stash.useStore,xl=yf(O=>O.entries),gw=yf(O=>O.stashEntry),xf=yf(O=>O.takeEntry),hw=yf(O=>O.finalizeEntryImages);W(()=>()=>{vl.current!==null&&window.clearTimeout(vl.current)},[]);let vw=R(()=>{aw.current+=1,gh({key:aw.current,active:!0}),vl.current!==null&&window.clearTimeout(vl.current),vl.current=window.setTimeout(()=>{vl.current=null,gh(O=>({...O,active:!1}))},1200)},[]),zO=R(O=>{let{entry:Ie,durable:_e}=xf(O.id);if(!Ie)return;_e||Pe.notify.warning(F("composer.stashReappear"),F("composer.storageRejectedKeep")),fi(!1);let Pt=G.current,Sn=O.prompt.length===0?Pt:Pt.trim().length?`${Pt.replace(/\s+$/,"")}
3870
+ `;function hQ(){let{t:e}=ye();return u(ra,{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 vQ(e,t,n){return ah(e,[...t??[],{id:n}])}function D1(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 lh(e){if(!e)return null;let t=Ji(e);return typeof t=="string"?t:null}function O1(){let{t:e}=ye();return t=>N1(e,t)}var yQ=e=>e;function xQ(e,t,n,o,r,a,i,s,l){let d=e.getModelCapabilities(n,o,s),c=ih(t,n,o),f=c?_1(sh(a,s),l):lf({caps:d,selections:a}),p=f.filter(P=>P.type==="select"),m=f.filter(P=>P.type==="boolean"),g=p[0]??null,h=p.find(P=>P.id==="contextWindow")??null,v=p.find(P=>P.id==="agent")??null,y=m.find(P=>P.id==="fastMode")??null,x=m.find(P=>P.id==="thinking")??null,C=i&&(g?.promptInjectedValues?.length??0)>0&&r!=="none",w=C&&r==="ultrathink-in-body",T=(C?"ultrathink":lh(g))??null,S=typeof x?.currentValue=="boolean"?x.currentValue:null,L=lh(h),k=lh(v),I=v?rh(v):null;return{caps:d,descriptors:f,selectDescriptors:p,booleanDescriptors:m,primarySelectDescriptor:g,contextWindowDescriptor:h,agentDescriptor:v,fastModeDescriptor:y,thinkingDescriptor:x,effort:T,thinkingEnabled:S,contextWindow:L,ultrathinkPromptControlled:C,ultrathinkInBodyText:w,selectedAgent:k,selectedAgentLabel:I,modelIsUnavailable:c}}function $b(e){let t=xQ(e.modelApi,e.provider,e.models,e.model,e.promptInjection,e.modelOptions,e.allowPromptInjectedEffort??!0,e.planModeEnabled,e.labelOf??yQ),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||t.modelIsUnavailable&&t.descriptors.length>0}}function Kb(e){return $b(e).hasAnyControls}var qb=ve(function({provider:t,instanceId:n,models:o,model:r,promptInjection:a,onPromptUpdate:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,...c}){let{t:f}=ye(),p=O1(),m=jt(),g=m.draft.useStore(P=>P.setProviderModelOptions),h=R(P=>{if("onModelOptionsChange"in c){c.onModelOptionsChange(P);return}let E=c.threadRef??c.draftId;E&&g(E,t,P,{...n?{instanceId:n}:{},model:r,persistSticky:!0})},[n,r,c,t,g]),{descriptors:v,selectDescriptors:y,booleanDescriptors:x,primarySelectDescriptor:C,ultrathinkPromptControlled:w,ultrathinkInBodyText:T,hasAnyControls:S,modelIsUnavailable:L}=$b({modelApi:m.model,provider:t,models:o,model:r,promptInjection:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,labelOf:p}),k=(P,E)=>{h(vQ(P,s,E))},I=(P,E)=>{if(E){if(P.promptInjectedValues?.includes(E)){i(_=>_.trim().length===0?gQ:R1(_,"ultrathink"));return}T&&P.id===C?.id||(w&&P.id===C?.id&&i(_=>_.replace(/^Ultrathink:\s*/i,"")),k(D1(v,P.id,E),P.id))}};return S?L?u(ke,{children:v.map((P,E)=>{let _=P.type==="boolean"?f(P.currentValue===!0?"traits.on":"traits.off"):rh(P);return _?b("div",{children:[E>0?u(_a,{}):null,b(Ll,{children:[u(bS,{children:P.label}),u("div",{className:"px-2 pb-1.5 text-ui-sm text-muted-foreground",children:_})]})]},P.id):null})}):b(ke,{children:[y.map((P,E)=>{let _=w&&P.id===C?.id?"ultrathink":lh(P)??"";return b("div",{children:[E>0?u(_a,{}):null,b(Ll,{children:[u("div",{className:"px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs",children:P.label}),T&&P.id===C?.id?u("div",{className:"px-2 pb-1.5 text-muted-foreground/80 text-xs",children:f("traits.ultrathinkInBodyNotice")}):null,u(Sr,{value:_,onValueChange:A=>I(P,A),children:P.options.map(A=>u(Vo,{value:A.id,hideIndicator:!0,closeOnClick:!0,disabled:T&&P.id===C?.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(ke,{children:[" ",u(hQ,{})]}):null]})}),A.description?u("span",{className:"max-w-56 text-pretty text-muted-foreground/80 text-xs",children:A.description}):null]})},A.id))})]})]},P.id)}),x.map((P,E)=>{let _=P.currentValue===!0?"on":"off";return b("div",{children:[E>0||y.length>0?u(_a,{}):null,b(Ll,{children:[u("div",{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs",children:P.label}),u(Sr,{value:_,onValueChange:A=>{k(D1(v,P.id,A==="on"),P.id)},children:["on","off"].map(A=>u(Vo,{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))})]})]},P.id)})]}):null});function CQ(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=Ji(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")}):rh(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 F1=ve(function({provider:t,instanceId:n,models:o,model:r,promptInjection:a,onPromptUpdate:i,modelOptions:s,allowPromptInjectedEffort:l=!0,planModeEnabled:d,triggerVariant:c,triggerClassName:f,...p}){let[m,g]=Q(!1),{t:h}=ye(),v=O1(),y=jt().model,{descriptors:x,primarySelectDescriptor:C,ultrathinkPromptControlled:w}=$b({modelApi:y,provider:t,models:o,model:r,promptInjection:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,labelOf:v});if(!Kb({modelApi:y,provider:t,models:o,model:r,promptInjection:a,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d}))return null;let{label:T,showFastModeIcon:S}=CQ(h,{provider:t,descriptors:x,primarySelectDescriptorId:C?.id??null,ultrathinkPromptControlled:w}),L=S?b(ke,{children:[u(Jo,{icon:xs,className:K("fill-current opacity-80",t==="claudeAgent"?"text-[#d97757]":"text-foreground")}),u("span",{className:"sr-only",children:h("traits.fastModeOn")})]}):null,k=t==="codex";return b(_o,{open:m,onOpenChange:I=>{g(I)},children:[u(Oo,{render:u(Yo,{variant:c??"ghost",className:K(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:[L,u("span",{className:"min-w-0 truncate",children:T}),u(ga,{})]}):b(ke,{children:[L,u("span",{children:T}),u(ga,{})]})}),u(Do,{align:"start",children:u(qb,{provider:t,...n?{instanceId:n}:{},models:o,model:r,promptInjection:a,onPromptUpdate:i,modelOptions:s,allowPromptInjectedEffort:l,planModeEnabled:d,...p})})]})});function B1(e){return Hb(e)?Hb(e.replace(/^Ultrathink:\s*/i,""))?"ultrathink-in-body":"ultrathink":"none"}function z1(e,t){let{provider:n,model:o,models:r,modelOptions:a,promptInjectionState:i="none",planModeEnabled:s}=e;if(ih(n,r,o)){let g=sh(a,s);return{provider:n,promptEffort:null,modelOptionsForDispatch:g&&g.length>0?[...g]:void 0}}let l=t.getModelCapabilities(r,o,s),d=lf({caps:l,selections:a}),c=d.find(g=>g.type==="select"),f=Ji(c??null),p=typeof f=="string"?f:null,m=(c?.promptInjectedValues?.length??0)>0&&i!=="none";return{provider:n,promptEffort:p,modelOptionsForDispatch:ah(d,[...a??[],...s?[]:bQ(r,o,t)]),...m?{composerFrameClassName:"ultrathink-frame",composerSurfaceClassName:"shadow-[0_0_0_1px_rgba(255,255,255,0.07)_inset]",modelPickerIconClassName:"ultrathink-chroma"}:{}}}function bQ(e,t,n){let o=lf({caps:n.getModelCapabilities(e,t,!0),selections:void 0}).find(r=>r.type==="select"&&r.id==="agent");return o&&Ji(o)==="plan"?[{id:o.id}]:[]}function U1(e,t){let{provider:n,instanceId:o,threadRef:r,draftId:a,model:i,models:s,modelOptions:l,promptInjection:d,onPromptUpdate:c,planModeEnabled:f}=t;return!(r!==void 0||a!==void 0)||!Kb({modelApi:t.modelApi,provider:n,models:s,model:i,modelOptions:l,promptInjection:d,planModeEnabled:f})?null:u(e,{provider:n,...o?{instanceId:o}:{},models:s,...r?{threadRef:r}:{},...a?{draftId:a}:{},model:i,modelOptions:l,promptInjection:d,onPromptUpdate:c,planModeEnabled:f})}function H1(e){return U1(qb,e)}function $1(e){return U1(F1,e)}he();var K1=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},q1=(e=>e?K1(e):K1);he();var wQ=e=>e;function SQ(e,t=wQ){let n=Tn.useSyncExternalStore(e.subscribe,Tn.useCallback(()=>t(e.getState()),[e,t]),Tn.useCallback(()=>t(e.getInitialState()),[e,t]));return Tn.useDebugValue(n),n}var V1=e=>{let t=q1(e),n=o=>SQ(t,o);return Object.assign(n,t),n},W1=(e=>e?V1(e):V1);var Vb=W1(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 G1(e){return Vb(t=>e===null?null:t.presetIdByDraftId[e]??null)}function Wb(e,t){return t==null?void 0:e.find(n=>n.presetId===t)}var Gb="__none__",j1=ve(function({environmentId:t,draftId:n,threadPresetId:o,compact:r}){let{t:a}=ye(),i=jt().presets.useThreadPresets(t),s=G1(n),l=Vb(c=>c.setDraftPresetId);if(n===null){let f=Wb(i,o)?.displayName??o;return f===null?null:b(Yo,{variant:"ghost",disabled:!0,"aria-label":a("preset.appliedLabel",{name:f}),className:"shrink-0 whitespace-nowrap",children:[u(Jo,{icon:Ma}),u("span",{className:"min-w-0 truncate",children:f})]})}if(i.length===0)return null;let d=Wb(i,s);return b(_o,{children:[u(Oo,{render:u(Yo,{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(Jo,{icon:Ma}),r?null:u("span",{className:"min-w-0 truncate",children:d?.displayName??a("preset.none")}),u(ga,{})]})}),u(Do,{align:"start",children:b(Ll,{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??Gb,onValueChange:c=>{l(n,c===Gb?null:c)},children:[u(Vo,{value:Gb,hideIndicator:!0,closeOnClick:!0,children:u("span",{className:"min-w-0 truncate",children:a("preset.none")})}),i.map(c=>u(Vo,{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))]})]})})]})});he();function Q1(e){let t=e.credentialIdentity;return[e.queryKey,t===null?"":t.id,t===null?"":String(t.revision)].join("\0")}function IQ(e,t){let n=t.credentialIdentity;return n===null?!1:e.environmentId===t.environmentId&&e.instanceId===t.instanceId&&e.credentialIdentity.id===n.id&&e.credentialIdentity.revision===n.revision}function X1(e){return e.capability.status!=="unsupported"&&e.credentialIdentity!==null}function jb(e,t){return e===null||!Number.isFinite(e)?null:t.kind==="money"?e.toFixed(t.precision):(Number.isInteger(e),String(e))}function dh(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 Qb(e,t){return e.freshness==="stale"||e.status==="error"||e.errorReason!==null||t!==null}function Y1(e){if(e.unlimited===!0)return{kind:"unlimited"};let t=e.kind==="spend-cap"?e.used??e.remaining:e.remaining??e.used,n=jb(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 J1(e,t){let n=[];for(let o of e){let r=Y1(o);r!==null&&n.push({metricId:o.metricId,kind:o.kind,display:r,nativeLabel:o.nativeLabel,durationMs:o.windowMs,resetsAt:o.resetsAt,fetchedAt:o.fetchedAt,stale:Qb(o,t)})}return n}function Z1(e){return e.filter(t=>t.kind==="rate-limit"&&Y1(t)===null).map(t=>({metricId:t.metricId,kind:t.kind,nativeLabel:t.nativeLabel,durationMs:t.windowMs,resetsAt:t.resetsAt}))}function eO(e){return e.snapshot===null||e.credentialIdentity===null?null:IQ(e.snapshot,e)?e.snapshot:null}function tO(e){for(let t of e)if(t.resetsAt!==null)return t.resetsAt;return null}function nO(e){let t=null;for(let n of e)n.fetchedAt!==null&&(t===null||n.fetchedAt<t)&&(t=n.fetchedAt);return t}he();function oO(e,t){let n=N(e),o=N(0),r=N(!1),[a,i]=Q(e),[s,l]=Q(null),[d,c]=Q(!1);a!==e&&(i(e),n.current=e,o.current+=1,r.current=!1,l(null),c(!1));let f=R(async()=>{if(r.current)return;let p=o.current+1;o.current=p;let m=e;r.current=!0,c(!0);try{let g=await t();if(o.current!==p||n.current!==m)return;l(g)}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 Yb(e,t){switch(e.unit){case"days":return t("accountUsage.windowDays",{count:e.count});case"hours":return t("accountUsage.windowHours",{count:e.count});case"minutes":return t("accountUsage.windowMinutes",{count:e.count});case"seconds":return t("accountUsage.windowSeconds",{count:e.count})}}function Jb(e,t){let n=e.nativeLabel?.trim()??"";if(n.length>0)return n;let o=dh(e.durationMs);return o!==null?Yb(o,t):PQ(e.kind,t)}function TQ(e,t){switch(e.kind){case"unlimited":return t("accountUsage.unlimited");case"money":return`${e.currency} ${e.amount}`;case"quantity":return`${e.amount} ${e.nativeUnit}`;case"percent":return e.direction==="used"?t("accountUsage.percentUsed",{value:e.amount}):t("accountUsage.percentRemaining",{value:e.amount})}}function kQ(e,t){let n=TQ(e.display,t);if(e.kind==="quota-window")return`${Jb(e,t)} ${n}`;let o=e.nativeLabel?.trim()??"";return o.length>0?`${o} ${n}`:n}function LQ(e,t){let n=Jb({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:e.durationMs},t),o=dh(e.durationMs);return o!==null?`${n} \xB7 ${Yb(o,t)}`:e.resetsAt!==null?`${n} \xB7 ${t("accountUsage.resetsAt",{time:Dd(e.resetsAt)})}`:n}function PQ(e,t){switch(e){case"balance":return t("accountUsage.kindBalance");case"credits":return t("accountUsage.kindCredits");case"quota-window":return t("accountUsage.kindQuotaWindow");case"spend-cap":return t("accountUsage.kindSpendCap");case"rate-limit":return t("accountUsage.kindRateLimit")}}function AQ(e,t){switch(e){case"account":return t("accountUsage.scopeAccount");case"org":return t("accountUsage.scopeOrg")}}function Dd(e){return aa(e,"locale")||e}function EQ(e,t){switch(e.outcome){case"fresh":return t("accountUsage.outcomeFresh");case"partial":return t("accountUsage.outcomePartial");case"joined-inflight":return t("accountUsage.outcomeJoinedInflight");case"rate-limited":return e.retryAt===null?t("accountUsage.outcomeRateLimited"):t("accountUsage.outcomeRateLimitedUntil",{time:Dd(e.retryAt)});case"offline":return t("accountUsage.outcomeOffline");case"unsupported":return t("accountUsage.outcomeUnsupported");case"error":return t("accountUsage.outcomeError")}}function RQ(e,t){switch(e){case"credential-unavailable":return t("accountUsage.unsupportedSignedOut");case"instance-disabled":return t("accountUsage.unsupportedDisabled");case"unsupported-driver":return t("accountUsage.unsupportedNoChannel");default:return t("accountUsage.unsupported")}}function MQ(e,t){switch(e){case"rate-limited":return t("accountUsage.outcomeRateLimited");case"auth-rejected":return t("accountUsage.errorAuthRejected");case"unreachable":return t("accountUsage.errorUnreachable");case"response-invalid":return t("accountUsage.errorResponseInvalid");case"reader-unloaded":return t("accountUsage.errorReaderUnloaded");default:return t("accountUsage.outcomeError")}}function NQ(e,t,n){return e.capability.status==="unsupported"?RQ(e.error,n):t.length>0?null:e.loading?n("accountUsage.loading"):e.error!==null?MQ(e.error,n):e.credentialIdentity===null||e.capability.status==="unknown"?n("accountUsage.unknown"):n("accountUsage.noData")}function Xb(e,t){let n=jb(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 rO(e){let[t,n]=Q(!1);return u(_Q,{...e,expanded:t,onToggleExpanded:()=>n(o=>!o)})}function _Q(e){let{expanded:t,onToggleExpanded:n,onRefresh:o,...r}=e,{t:a}=ye(),i=Q1(r),{feedback:s,refreshing:l,refresh:d}=oO(i,o),c=r.capability.status==="supported"&&r.credentialIdentity!==null?eO(r):null,f=c?.metrics??[],p=J1(f,r.error),m=p.some(S=>S.stale)||r.error!==null&&c!==null,g=tO(p),h=nO(f),v=l,y=NQ(r,p,a),x=X1(r),w=`${Jr()}-account-usage-details`,T=[...p.map(S=>({key:S.metricId,text:kQ(S,a)})),...Z1(f).map(S=>({key:`${S.metricId}\0status`,text:LQ(S,a)})),...g===null?[]:[{key:"resets-at",text:a("accountUsage.resetsAt",{time:Dd(g)})}]];return b("div",{className:"min-w-0 px-3 pt-1 sm:px-4","data-composer-account-usage":"true","data-refresh-outcome":s?.outcome??"",children:[b("div",{className:"flex min-w-0 items-start gap-1.5",children:[u(ie,{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?"accountUsage.hideDetails":"accountUsage.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.instanceLabel}),m?u("span",{className:"text-[11px] text-muted-foreground","data-composer-account-usage-stale":"true",children:a("accountUsage.stale")}):null,u(rn,{"aria-hidden":"true",className:K("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:T.length>0?T.map((S,L)=>b("span",{children:[L>0?u("span",{"aria-hidden":"true",children:" \xB7 "}):null,S.text]},S.key)):y})]})}),x?u(ie,{type:"button",size:"xs",variant:"ghost",className:"mt-0.5 shrink-0 text-secondary-label","aria-label":a("accountUsage.refreshAria",{instance:r.instanceLabel}),disabled:v,onClick:()=>{d()},children:a(v?"accountUsage.refreshing":"accountUsage.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-account-usage-details":"true",children:[f.length===0?u("p",{className:"text-[11px] text-secondary-label",children:y??a("accountUsage.noData")}):f.map(S=>u(DQ,{metric:S,queryError:r.error,t:a},S.metricId)),h!==null?u("p",{className:"text-[11px] text-secondary-label",children:a("accountUsage.collectedAt",{time:Dd(h)})}):null]}):null,s!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:EQ(s,a)}):r.error!==null&&c!==null?u("p",{role:"status",className:"px-1 pb-1 text-[11px] text-muted-foreground",children:a("accountUsage.errorKeepLast")}):null]})}function DQ({metric:e,queryError:t,t:n}){let o=Xb(e,e.used),r=e.unlimited===!0?n("accountUsage.unlimited"):Xb(e,e.remaining),a=Xb(e,e.limit),i=n("accountUsage.sharedScope",{scope:AQ(e.scope,n)}),s=Qb(e,t),l=e.windowMs,d=dh(l),c=Jb({kind:e.kind,nativeLabel:e.nativeLabel,durationMs:l},n);return b("div",{className:"text-[11px] text-secondary-label","data-metric-id":e.metricId,"data-metric-kind":e.kind,"data-window-ms":l===null?void 0:String(l),children:[b("div",{className:"font-medium text-foreground",children:[c,s?u("span",{className:"ms-2 font-normal text-muted-foreground",children:n("accountUsage.stale")}):null]}),b("div",{className:"mt-0.5 flex flex-wrap gap-x-2 tabular-nums",children:[o!==null?b("span",{children:[o," ",n("accountUsage.used")]}):null,r!==null?b("span",{children:[r," ",e.unlimited===!0?null:n("accountUsage.remaining")]}):null,a!==null?b("span",{children:[a," ",n("accountUsage.limit")]}):null]}),u("div",{className:"mt-0.5",children:i}),e.fetchedAt!==null?u("div",{children:n("accountUsage.collectedAt",{time:Dd(e.fetchedAt)})}):null,e.resetsAt!==null?u("div",{children:n("accountUsage.resetsAt",{time:Dd(e.resetsAt)})}):null,d!==null?u("div",{children:Yb(d,n)}):null]})}function ai(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 aO(e,t){if(!e)return null;let n=t.get(e.instanceId)?.find(o=>o.slug===e.model);return n?Md(n):e.model}function iO(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 OQ(e){return e===null||!Number.isFinite(e)?null:e<10?`${e.toFixed(1).replace(/\.0$/,"")}%`:`${Math.round(e)}%`}function sO(e){let{t}=ye(),{usage:n,breakdown:o,modelDisplayName:r,onCompact:a,compactDisabled:i,compactDisabledReason:s}=e,l=OQ(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,g=m!==null&&m>0,v=d>90?"var(--color-error)":"color-mix(in oklab, var(--color-muted-foreground) 72%, transparent)";return b(wi,{children:[u(Ii,{openOnHover:!0,delay:150,closeDelay:a?150:0,render:u(ie,{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?t("contextWindow.usedPercentAria",{percentage:l}):t("contextWindow.usedTokensAria",{tokens:ai(n.usedTokens)}),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(Si,{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:[ai(n.usedTokens),"/",ai(n.maxTokens??null)]})]}):u("div",{className:"text-secondary-label text-[11px] tabular-nums",children:ai(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:ai(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:ai(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:ai(o.messageTokens)})]})]}):null,g?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:ai(m)})]}):null,n.compactsAutomatically?u("div",{className:"mt-1 text-pretty text-secondary-label text-[11px] font-medium",children:iO(t,r,n.autoCompactThreshold)}):null,a?b(ke,{children:[b(ie,{size:"xs",variant:"outline",className:"mt-1 w-full justify-center",disabled:i,onClick:a,children:[u(cc,{"aria-hidden":"true"}),t("contextWindow.compactContext")]}),i&&s?u("div",{className:"text-pretty text-secondary-label text-[11px]",children:s}):null]}):null]})})]})}he();var lO=bt(null);function dO({children:e}){let{data:t,target:n,threadKey:o}=ia(),r=t.useComposerStatus({target:n,threadKey:o});return u(lO.Provider,{value:r,children:e})}function cO(){let e=Ut(lO);if(e===null)throw new Error("Composer status has not been provided.");return e}function uO(e){return e.startsWith("!")}function fO(e){return e.slice(1).trim()}function pO(e){return e.length===0?"empty":/[\r\n]/.test(e)?"multiline":null}function FQ(){return null}function mO(){let{data:e,target:t,threadKey:n}=ia();return(e.useShellCommand??FQ)({target:t,threadKey:n})}function Zb(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 gO({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 hO(e,t){let n=$r.indexOf(e);if(n===-1)return $r[0];let o=(n+t+$r.length)%$r.length;return $r[o]??$r[0]}var BQ=['[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(",");function zQ(e){return e.closest(BQ)!==null}var UQ=[];function HQ(e,t){return{images:e.images,terminalContexts:e.terminalContexts,elementContexts:e.elementContexts,previewAnnotations:e.previewAnnotations,reviewComments:e.reviewComments,nonPersistedImageIds:e.nonPersistedImageIds,activeProvider:e.activeProvider,nativeModeByProvider:e.nativeModeByProvider,selectedPluginActionKey:e.selectedPluginActionKey,promptHasText:e.prompt.trim().length>0,promptInjection:B1(e.prompt),hasSendableContent:t({prompt:e.prompt,imageCount:e.images.length,terminalContexts:e.terminalContexts,elementContextCount:e.elementContexts.length+e.previewAnnotations.length+e.reviewComments.length}).hasSendableContent}}var $Q=e=>e.prompt.trim();function KQ(e){let{t}=ye(),n=e.api.draft.useThreadDraftSelector(e.composerDraftTarget,$Q),o=e.pendingCustomAnswer!==null;return u("button",{type:"button",className:K("min-w-0 flex-1 truncate bg-transparent p-0 text-left text-[14px]",(o?e.pendingCustomAnswer:n)?"text-foreground":"text-placeholder"),onPointerDown:r=>r.preventDefault(),onClick:e.onExpand,"aria-label":t("composer.expandComposer"),children:o?e.pendingCustomAnswer||t("composer.typeOwnAnswer"):n||(e.noProviderAvailable?t("composer.enableProviderSettings"):t("composer.askAnything"))})}var qQ=ve(function(t){let{data:n,target:o}=ia(),r=nS(),a=n.useAccountUsage({target:o,active:r&&!t.hidden});return t.hidden||a===void 0?null:u(rO,{...a},a.queryKey)}),VQ=ve(function(t){let{data:n,target:o}=ia(),r=n.useContextUsage(o);return r?.window==null?null:u(sO,{usage:r.window,breakdown:r.breakdown,modelDisplayName:t.modelDisplayName,onCompact:t.onCompact,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason})}),WQ=ve(function(t){let{t:n}=ye();return b(ke,{children:[u(VQ,{modelDisplayName:t.activeThreadModelDisplayName,onCompact:t.onCompactContext,compactDisabled:t.compactDisabled,compactDisabledReason:t.compactDisabledReason}),t.isPreparingWorktree?u("span",{className:"text-secondary-label text-xs",children:n("composer.preparingWorktree")}):null,u(sf,{compact:t.compact,pendingAction:t.pendingAction,isRunning:t.isRunning,showPlanFollowUpPrompt:t.showPlanFollowUpPrompt,promptHasText:t.promptHasText,isSendBusy:t.isSendBusy,sendDisabledReason:t.sendDisabledReason,isEnvironmentUnavailable:t.isEnvironmentUnavailable,isPreparingWorktree:t.isPreparingWorktree,hasSendableContent:t.hasSendableContent,preserveComposerFocusOnPointerDown:t.preserveComposerFocusOnPointerDown??!1,showSendWhileRunning:t.showSendWhileRunning??!1,onPreviousPendingQuestion:t.onPreviousPendingQuestion,onInterrupt:t.onInterrupt,interruptArmed:t.interruptArmed,onImplementPlanInNewThread:t.onImplementPlanInNewThread,shellCommandMode:t.shellCommandMode,shellCommandUnavailableReason:t.shellCommandUnavailableReason})]})}),vO=ve(function(t){let n=BM(),{data:o,target:r,threadKey:a}=ia(),{activePendingApproval:i,pendingUserInputs:s,activePendingProgress:l,activePendingResolvedAnswers:d,activePendingIsResponding:c,activePendingDraftAnswers:f,activePendingQuestionIndex:p,respondingRequestIds:m,occupants:g,respondToApproval:h,respondToDecision:v,selectUserInputOption:y,changeUserInputCustomAnswer:x,advanceUserInput:C,previousUserInputQuestion:w}=o.useComposerPending({target:r,threadKey:a}),{runtimeMode:T,interactionMode:S,lockedProvider:L,providerStatuses:k,activeProjectDefaultModelSelection:I,projectId:P,activeThreadModelSelection:E}=o.useComposerModelContext(r),{activeThreadId:_,activeThread:A,isLocalDraftThread:H,projectSelectionRequired:V,phase:J,isSendBusy:D,sendDisabledReason:ne,unavailableAgentInstanceId:F=null,noAgentChosen:U=!1,isPreparingWorktree:ee,environmentUnavailable:j,compactDisabled:Z,compactDisabledReason:de}=cO(),{t:B}=ye(),{composerDraftTarget:X,environmentId:pe,attachmentUploadsCapabilityKnown:le,supportsAttachmentUploads:re,routeKind:we,routeThreadRef:Xe,draftId:ot,forceExpandedOnMobile:at,slots:je,resolvedTheme:oe,settings:Te,keybindings:Y,terminalOpen:me,gitCwd:ge,promptRef:G,composerRef:Ye,composerImagesRef:ht,composerTerminalContextsRef:Mt,composerElementContextsRef:Dt,sendContextRef:Nt,onSend:Ot,onInterrupt:At,interruptArmed:xt=!1,recentSlashCommandIds:_t=UQ,onSlashCommandUsed:Xt,onCompactContext:mn,onImplementPlanInNewThread:Hn,onProviderModelSelect:vt,onProviderInstanceSelect:qt,onModelSelectionChosen:an,onSelectPluginAction:kn,onManagePlugins:sn,getModelDisabledReason:Cn,getModelContinuationLabel:$n,onContinueInModel:$,toggleInteractionMode:ae,handleRuntimeModeChange:ce,handleInteractionModeChange:Le,handleNativeModeChange:ze,focusComposer:ft,scheduleComposerFocus:gn,setThreadError:lt,onExpandImage:hn}=t,Ft=o.useComposerPlan(r),rt=Ft.proposedPlan,Zt=Ft.tasksProgress,ln=Ft.taskSteps,Se=s.length===0&&S==="plan"&&rt!==null,Re=N(null),qe=R((O,Ie)=>{y(O,Ie),G.current="",Re.current?.resetCursorState({cursor:0})},[G,y]),pt=R(async(O,Ie,_e)=>{try{await h(O,Ie,_e)}catch(Pt){lt(r.threadId,Pt instanceof Error?Pt.message:B("approval.respondFailed"))}},[r.threadId,h,lt,B]),st=R((O,Ie)=>{v(O,Ie).then(_e=>{_e!==null&&lt(r.threadId,_e)})},[r.threadId,v,lt]),it=R(()=>{C().then(O=>{O!==null&&lt(r.threadId,O)})},[C,r.threadId,lt]),kt=xN({machineUnavailable:j!==null,sessionStarted:A?.session!=null,sessionDisconnected:J==="disconnected"}),Vt=CN(kt),Pe=t.api,{limits:Et}=t.attachments,yt=Pe.draft.useThreadDraftSelector(X,O=>HQ(O,Pe.chat.deriveComposerSendState)),on=yt.images,Nn=q(()=>on.filter(O=>LC(O)==="image"),[on]),xe=yt.terminalContexts,Ve=yt.elementContexts,Ct=yt.previewAnnotations,ct=yt.reviewComments,vn=yt.nonPersistedImageIds,bn=Pe.uploads.useStore(O=>O.uploadsByImageId),yn=re?qM({imageIds:on.map(O=>O.id),uploadsByImageId:bn,environmentId:pe},B):null,Lt=Pe.draft.useStore,xn=Lt(O=>O.setPrompt),Wt=Lt(O=>O.setNativeMode),An=Lt(O=>O.addImage),eo=Lt(O=>O.addImages),va=Lt(O=>O.removeImage),ya=Lt(O=>O.insertTerminalContext),He=Lt(O=>O.removeElementContext),xa=Lt(O=>O.removePreviewAnnotation),xr=Lt(O=>O.removeReviewComment),Kr=Lt(O=>O.clearComposerPromptAndImages);W(()=>{if(le){if(!re){for(let O of on)Pe.uploads.release(O.id);return}Pe.draft.restoreAttachments();for(let O of on)Pe.uploads.start({environmentId:pe,image:O})}},[le,on,pe,re]);let _n=q(()=>mN(Pe.model.applyInstanceSettings(Pe.model.deriveInstanceEntries(k),Te)),[Pe.model,k,Te]),tr=yt.activeProvider??null,Ro=A?.session?.providerInstanceId??E?.instanceId??I?.instanceId??null,cl=hN(_n,tr??Ro)??Pe.model.makeDriverKind("unconfigured"),Zi=L??cl,to=q(()=>{if(!L||!A)return null;let O=A.session?.providerInstanceId??E?.instanceId;return O?_n.find(Ie=>Ie.instanceId===O)?.continuationGroupKey??null:null},[A,E?.instanceId,L,_n]),mt=q(()=>{if(F!==null)return F;let O=[yt.activeProvider,A?.session?.providerInstanceId,E?.instanceId,I?.instanceId];for(let Ie of O){if(!Ie)continue;let _e=_n.find(Pt=>Pt.instanceId===Ie&&gN(Pt));if(_e){if(L&&_e.driverKind!==L||to&&_e.continuationGroupKey!==to)continue;return _e.instanceId}}return Pe.model.noProviderSelection.instanceId},[I?.instanceId,A?.session?.providerInstanceId,E?.instanceId,yt.activeProvider,to,L,_n,F]),xo=F!==null,zo=q(()=>xo||U?void 0:_n.find(O=>O.instanceId===mt),[U,xo,_n,mt]),Ae=zo===void 0&&!xo&&!U,Uo=xo&&OC(_n,{lockedProvider:L,lockedContinuationGroupKey:to}).length===0,es=de??(Ae?B("composer.compactingUnavailable"):null),Dn=zo?.driverKind??Zi,{modelOptions:qr,selectedModel:co,selectedModelStatus:Vr}=Pe.draft.useEffectiveModelState({threadRef:X,providers:k,selectedProvider:Dn,selectedInstanceId:mt,threadModelSelection:E,projectModelSelection:I,settings:Te}),uo=q(()=>zo?.snapshot??null,[zo]),Ho=q(()=>zo?.models??[],[zo]),Kn=yt.promptInjection,Co=q(()=>z1({provider:Dn,model:co,models:Ho,promptInjectionState:Kn,modelOptions:qr?.[mt],planModeEnabled:Te.planModeEnabled},Pe.model),[qr,Kn,mt,co,Dn,Ho,Te.planModeEnabled]),si=Co.promptEffort,li=Co.modelOptionsForDispatch,di=Te.planModeEnabled,nr=q(()=>({showInteractionModeToggle:di&&Pe.model.getInteractionModeToggle(k,Dn),runtimeModeSwitch:uo?.runtimeModeSwitch??"next-turn"}),[di,k,Dn,uo]),wn=uo?.supportsNativeModeSwitch===!0,Wr=H&&wn?yt.nativeModeByProvider?.[mt]??null:null,Mo=q(()=>Pe.model.resolveNativeMode(uo,{runtimeMode:T,nativeModeId:H?Wr:A?.nativeModeId??null}),[Pe.model,A?.nativeModeId,uo,T,H,Wr]),Ca=Wr&&Mo?.current.id===Wr?Wr:void 0,ba=R(O=>{H&&Wt(X,mt,O),ze(O)},[H,Wt,X,mt,ze]),qn=q(()=>Pe.model.createSelection(mt,co,li),[Pe.model,mt,co,li]);A1({threadId:A?.id??null,isLocalDraftThread:H,selection:qn,selectionsEqual:Pe.model.selectionsEqual,onChosen:xo||U?void 0:an});let wa=R(O=>qt(O,qn),[qt,qn]),no=co,Ke=q(()=>{let O=new Map;for(let Ie of _n)O.set(Ie.instanceId,Pe.model.getAppModelOptionsForInstance(Te,Ie,Ie.instanceId===mt?no:null));return O},[Pe.model,_n,mt,no,Te]),Bt=q(()=>(Ke.get(mt)??[]).some(Ie=>Ie.slug===no)?no:Pe.model.normalizeSlug(no)??no,[Pe.model,Ke,mt,no,Dn]),dn=H&&L===null,Ln=Pe.pluginComposer.useOptions(dn?pe:null,P),Sa=Ln.options,Ia=dn?yt.selectedPluginActionKey:null,Ta=q(()=>Ia===null?null:Sa.find(O=>O.id===Ia)??null,[Ia,Sa]),ka=Ia!==null,Gr=ka&&Ta===null?B(Ln.isKnown?"composer.pluginUnavailable":"composer.pluginLoading"):null,ts=ne??Gr??(l?null:yn),ci=ts!==null,[ch,df]=Q(!1);W(()=>{df(!1)},[mt]);let uh=th(Vr),cf=ID({status:Vr,submissionTarget:l?"pending-user-input":"provider-turn"}),Fd=ch&&cf?uh:null,fh=q(()=>aO(E,Ke),[E,Ke]),jr=`${String(pe)}\0${String(X)}`,[uf,z]=Q(!1),[Ee,tt]=Q(!1),[Yt,On]=Q(null),[ui,ph]=Q(null),[mh,fi]=Q(!1),[Bd,ul]=Q(!1),[wO,tw]=Q(null),[fl,gh]=Q({key:0,active:!1}),nw=N(jr);Ce(()=>{nw.current!==jr&&(nw.current=jr,z(!1),On(null),fi(!1),ul(!1),tw(null),gh({key:fl.key,active:!1}))},[jr,fl.key]);let Cr=Bp("max-sm"),fo=Cr&&!at&&!Ee,pl=N(null),ow=N(null),hh=N(null),rw=N(null),vh=N(!1),bo=N(null),ml=N(null),gl=N(null),ff=N(!1),aw=N(0),hl=N(null),yh=N(new Set),vl=N(new Map),SO=R(()=>{z(!0)},[]),IO=R(O=>{Le(O)},[Le]),TO=q(()=>new Set(vn),[vn]),Vn=i!==null,iw=l?.activeQuestion?.allowFreeform===!1,pi=mO(),kO=Pe.draft.useThreadDraftSelector(X,O=>uO(O.prompt)),yl=pi!==null&&kO&&!Vn&&l===null,zd=g[0]??null,{showTopDrawer:pf,showCollapsedPromptRow:LO,hasBlocking:Ud}=UM(zd?.kind??null,fo),PO=Se||l!==null,{isComposerFooterCompact:ns,isComposerPrimaryActionsCompact:sw}=YM(hh,PO),lw=l!==null,dw=R(O=>{let Ie=Re.current?.readDraftPrompt()??G.current,_e=O(Ie);if(_e===Ie){gn();return}lw?xn(X,_e):(G.current=_e,xn(X,_e),Re.current?.syncCursor(Po(_e,_e.length),Ao(_e,_e.length))),gn()},[lw,X,G,gn,xn]),AO=H1({modelApi:Pe.model,provider:Dn,instanceId:mt,...we==="server"?{threadRef:Xe}:{},...we==="draft"&&ot?{draftId:ot}:{},model:co,models:Ho,modelOptions:qr?.[mt],promptInjection:Kn,onPromptUpdate:dw,planModeEnabled:Te.planModeEnabled}),cw=$1({modelApi:Pe.model,provider:Dn,instanceId:mt,...we==="server"?{threadRef:Xe}:{},...we==="draft"&&ot?{draftId:ot}:{},model:co,models:Ho,modelOptions:qr?.[mt],promptInjection:Kn,onPromptUpdate:dw,planModeEnabled:Te.planModeEnabled}),mf=q(()=>l?{questionIndex:l.questionIndex,isLastQuestion:l.isLastQuestion,canAdvance:l.canAdvance,isResponding:c,isComplete:!!d}:null,[c,l,d]),EO=J==="running"||D||ci||Ae||V||j!==null||!yt.hasSendableContent,RO=B("composer.sendMessage"),Hd=Cr&&!fo&&mf!==null,MO=R(O=>{An(X,O)},[X,An]),NO=R(O=>{eo(X,O)},[X,eo]),_O=R(O=>{Pe.uploads.release(O),va(X,O)},[Pe.uploads,X,va]);W(()=>{On(null)},[Ve,Ct,ct,xe,co,si,Dn]),Ce(()=>{ht.current=on},[on,ht]),Ce(()=>{Mt.current=xe},[xe,Mt]),Ce(()=>{Dt.current=Ve},[Ve,Dt]);let DO=R(()=>{if(!Cr)return;bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null);let O=document.activeElement;O instanceof HTMLElement&&O.blur(),tt(!1)},[Cr]),OO=R(()=>!Cr||D||ci||Ae||j!==null||J==="running"?!1:l?l.isLastQuestion&&!!d:Se||yt.hasSendableContent,[l,d,yt.hasSendableContent,j,Cr,D,ci,Ae,J,Se]),{composerSubmissionError:FO,setComposerSubmissionError:gf,revalidatePromptLength:uw,submitComposer:fw}=DD({promptRef:G,maxInputChars:Et.maxInputChars,noProviderAvailable:Ae,isSendDisabled:ci,sendDisabledReason:ts,isModelSendBlocked:cf,onModelSendBlocked:()=>{df(!0)},activeThreadId:_,activePendingProgress:l,composerDocumentKey:jr,pendingImageCompressionsRef:vl,onSend:Ot,onProviderInputRejectedReset:()=>{vh.current=!1},wasProviderInputRejected:()=>vh.current,onStillCompressing:()=>{Pe.notify.info(B("composer.stillCompressing"),B("composer.sendAgainThumbnail"))},shouldBlurMobileComposerOnSubmit:OO,blurMobileComposerAfterSend:DO}),xh=N(!1),pw=R(O=>{if(O?.preventDefault(),pi===null||xh.current)return;if(pi.unavailableReason!==null){gf(pi.unavailableReason);return}let Ie=G.current,_e=fO(Ie),Pt=pO(_e);if(Pt==="empty")return;if(Pt==="multiline"){gf(B("composer.shellCommand.singleLine"));return}gf(null),xh.current=!0;let Sn=X;pi.run(_e).then(cn=>{!cn||G.current!==Ie||(G.current="",xn(Sn,""),Re.current?.syncCursor(0,null))}).finally(()=>{xh.current=!1})},[X,pi,G,xn,gf,B]),hf=R((O,Ie)=>{if(yl){pw(O);return}fw(O,Ie)},[pw,yl,fw]),mw=R(()=>{if(!yl)return!1;let O=G.current.slice(1);return G.current=O,xn(X,O),Re.current?.resetCursorState({prompt:O,cursor:O.length}),!0},[X,G,xn,yl]),BO=R(()=>{Z||Ae||i!==null||s.length>0||J==="running"||D||!_||mn()},[i,_,Z,D,Ae,mn,s.length,J]),vf=R(()=>{bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null),ml.current!==null&&window.cancelAnimationFrame(ml.current),gl.current!==null&&window.cancelAnimationFrame(gl.current),ff.current=!0,tt(!0),ml.current=window.requestAnimationFrame(()=>{ml.current=null,pl.current?.focusAtEnd(),gl.current=window.requestAnimationFrame(()=>{gl.current=null,ff.current=!1})})},[]),yf=Pe.stash.useStore,xl=yf(O=>O.entries),gw=yf(O=>O.stashEntry),xf=yf(O=>O.takeEntry),hw=yf(O=>O.finalizeEntryImages);W(()=>()=>{hl.current!==null&&window.clearTimeout(hl.current)},[]);let vw=R(()=>{aw.current+=1,gh({key:aw.current,active:!0}),hl.current!==null&&window.clearTimeout(hl.current),hl.current=window.setTimeout(()=>{hl.current=null,gh(O=>({...O,active:!1}))},1200)},[]),zO=R(O=>{let{entry:Ie,durable:_e}=xf(O.id);if(!Ie)return;_e||Pe.notify.warning(B("composer.stashReappear"),B("composer.storageRejectedKeep")),fi(!1);let Pt=G.current,Sn=O.prompt.length===0?Pt:Pt.trim().length?`${Pt.replace(/\s+$/,"")}
3871
3871
 
3872
- ${O.prompt}`:O.prompt,cn=Sn!==Pt;cn&&(G.current=Sn,xn(X,Sn),Re.current?.syncCursor(Po(Sn,Sn.length),null));let wr=[];if(O.attachments.length>0){let Pa=new Set(vt.current.map(po=>po.id)),oo=new Set(vt.current.map(po=>`${po.mimeType}\0${po.sizeBytes}\0${po.name}`)),Cl=Math.max(0,Et.maxAttachments-vt.current.length),Xr=O.attachments.filter(po=>!Pa.has(po.id)&&!oo.has(`${po.mimeType}\0${po.sizeBytes}\0${po.name}`));wr=Xr.slice(Cl).map(po=>po.name);let Yr=Pe.draft.hydrateImagesFromPersisted(Xr.slice(0,Cl));Yr.length>0&&eo(X,Yr)}let In=[];O.droppedImageNames.length>0&&In.push(F("composer.stashImagesTooLarge",{names:O.droppedImageNames.join(", ")})),O.unreadableImageNames&&O.unreadableImageNames.length>0&&In.push(F("composer.stashImagesUnreadable",{names:O.unreadableImageNames.join(", ")})),wr.length>0&&In.push(F("composer.stashImagesOverLimit",{names:wr.join(", "),limit:Et.maxAttachments})),In.length>0&&Pe.notify.warning(F("composer.someImagesNotRestored"),In.join(" ")),cn&&window.requestAnimationFrame(()=>{ml.current?.focusAtEnd()})},[eo,X,vt,Et.maxAttachments,G,xn,F,xf]),UO=R(O=>{let{durable:Ie}=xf(O.id);Ie||Pe.notify.warning(F("composer.stashEntryMayReturn"),F("composer.storageRejectedDelete"))},[F,xf]),HO=R(async()=>{let O=G.current.split("\uFFFC").join("").trim(),Ie=[...vt.current];if(O.length===0&&Ie.length===0){fi(cn=>!cn);return}let _e=`${String(X)}\0${O}\0${Ie.map(cn=>cn.id).join(",")}`;if(yh.current.has(_e))return;yh.current.add(_e);let Pt=X,Sn=Nu();try{let{evicted:cn,written:wr,durable:In}=gw({id:Sn,createdAt:new Date().toISOString(),prompt:O,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:Ie.length});if(!wr){Pe.notify.error(F("composer.couldNotStash"),F("composer.storageRejectedWrite"));return}In||Pe.notify.warning(F("composer.stashNotSurvive"),F("composer.storageUnavailableMemory")),G.current="",qr(Pt);for(let bl of Ie)Pe.uploads.release(bl.id);Re.current?.syncCursor(0,null),vw(),cn&&Pe.notify.warning(F("composer.oldestStashDiscarded"),F("composer.oldestStashDiscardedDetail",{count:Pe.stash.maxEntries}));let Pa=[],oo=[],Cl=[];for(let bl of Ie){let Kd=await Pe.imageCompression.compressForStash(bl.file);if(!Kd.ok){(Kd.reason==="too-large"?oo:Cl).push(bl.name);continue}Pa.push({id:bl.id,name:bl.name,mimeType:Kd.image.mimeType,sizeBytes:Kd.image.sizeBytes,dataUrl:Kd.image.dataUrl})}let{kept:Xr,droppedNames:Yr}=Pe.stash.partitionAttachments(Pa),{attached:po,durable:If}=hw(Sn,{attachments:Xr,droppedImageNames:[...oo,...Yr],unreadableImageNames:Cl});po?!If&&In&&Ie.length>0&&Pe.notify.warning(F("composer.stashImagesNotSaved"),F("composer.stashImagesMissingOnReload")):Xr.length>0&&Pe.notify.warning(F("composer.stashImagesDidNotAttach"),F("composer.stashImagesDidNotAttachDetail",{count:Xr.length}))}finally{yh.current.delete(_e)}},[qr,X,vt,hw,G,vw,gw,F]),Ch=R(()=>{fi(O=>!O)},[]),$O=R(()=>{if(fo){vf(),fi(!0);return}Ch()},[vf,fo,Ch]),bh=R(()=>{fl(O=>!O)},[]),$d=A?.latestTurn?.turnId??null,yw=$d!==null&&wO===$d,Qr=yw?null:Zt,La=yw?null:ln,wh=R(()=>{$d!==null&&tw($d),fl(!1)},[$d]),Cf=xl.length>0&&!Vn&&(n||pf||Bd||fo)?u(EC,{count:xl.length,menuOpen:mh,placement:"inline",pulseKey:pl.key,pulsing:pl.active,onToggleMenu:$O}):null,bf=Qr!==null&&La!==null&&!Bd&&!Ud&&(n||pf||fo)?u(RC,{expanded:!1,onDismiss:wh,onToggle:bh,placement:"inline",progress:Qr,steps:La}):null,Sh=!n&&!pf&&!Bd&&!fo,KO=Sh&&(xl.length>0||Qr!==null&&La!==null&&Qr.totalSteps>0);W(()=>{(Qr===null||La===null)&&fl(!1)},[La,Qr]),W(()=>{Ud&&fl(!1)},[Ud]),W(()=>{fl(!1)},[_]);let qO=R(()=>{fi(!1)},[]),VO=R(O=>{On(null),uw(O),fi(!1)},[uw]);Pe.pane.useKeydown(O=>{if(Pe.keybindings.resolveShortcutCommand(O,Y,{context:{terminalFocus:Pe.terminalFocus.getOwner()!==null,terminalOpen:me,modelPickerOpen:uf}})==="composer.stash"&&(O.preventDefault(),O.stopPropagation(),!Pe.commandPalette.isOpen())){if(s.length>0&&!Vn){fi(_e=>!_e);return}Vn||V||l!==null||HO()}},{capture:!0});let wf=async O=>{if(!_||O.length===0)return;if(s.length>0){Pe.notify.error(F("attachments.answerQuestionsFirst"));return}let Ie=_,_e=or,Pt=ns.current.get(_e)??0,Sn=vt.current.length+Pt,cn=[],wr=null;for(let In of O){if(Sn>=Et.maxAttachments){wr=F("attachments.limitReached",{count:Et.maxAttachments});break}if(In.size<=0){wr=F("attachments.empty",{name:In.name});continue}cn.push(In),Sn+=1}if(lt(Ie,wr),cn.length!==0){ns.current.set(_e,Pt+cn.length);try{let In=[],Pa=null;for(let oo of cn){if(!(Pe.imageCompression.isHeicFile(oo)||kC(oo.type))){let If=re?Et.maxFileBytes:Et.maxImageBytes;if(oo.size>If){Pa=F("attachments.tooLarge",{name:oo.name,limit:PC(If)});continue}In.push({...AC({id:Nu(),name:oo.name||F("attachments.defaultFileName"),mimeType:oo.type||"application/octet-stream",sizeBytes:oo.size}),previewUrl:URL.createObjectURL(oo),file:oo});continue}let Xr=await Pe.imageCompression.prepareForAttachment(oo,Et.maxImageBytes);if(!Xr.ok){Pa=Xr.reason==="unreadable"?F("attachments.unreadableImage",{name:oo.name}):F("attachments.imageTooLarge",{name:oo.name});continue}let Yr=Xr.file,po=URL.createObjectURL(Yr);In.push({...AC({id:Nu(),name:Yr.name||F("attachments.defaultImageName"),mimeType:Yr.type,sizeBytes:Yr.size}),previewUrl:po,file:Yr})}In.length===1&&In[0]?MO(In[0]):In.length>1&&NO(In),Pa!==null&&lt(Ie,Pa)}finally{let In=(ns.current.get(_e)??0)-cn.length;In>0?ns.current.set(_e,In):ns.current.delete(_e)}}},WO=O=>{_O(O)},GO=O=>{let Ie=Array.from(O.target.files??[]);O.target.value="",Ie.length!==0&&wf(Ie)},xw=O=>{let Ie=Array.from(O.clipboardData.files);Ie.length!==0&&(O.preventDefault(),wf(Ie))},Cw=(O,Ie)=>{if(O.length===0||Vn||s.length>0||V)return!1;let _e=G.current,Pt=(Ie?.ensureLeadingBoundary??!1)&&_e.length>0&&!/\s$/.test(_e);return Re.current?.applyPromptReplacement(_e.length,_e.length,Pt?` ${O}`:O)??!1},jO=St(np,a,null);jO.current=O=>{if(Vn||s.length>0||V)return!1;let Ie=G.current,_e=Math.max(0,Math.min(Ie.length,Re.current?.readSnapshot().expandedCursor??Ie.length)),Pt=Ie.slice(0,_e),Sn=Ie.slice(_e),cn=`${Pt.length>0&&!/\s$/.test(Pt)?" ":""}${O}${/^\s/.test(Sn)?"":" "}`;return Re.current?.applyPromptReplacement(_e,_e,cn)??!1};let{isDragOverComposer:QO,composerMentionDragHandlers:Ih,onComposerMentionDragLeaveCapture:XO}=_D({documentKey:or,insertMentionAtEnd:O=>Cw(O,{ensureLeadingBoundary:!0}),onInsertRejected:()=>{Pe.notify.error(F("composer.unableToAddToChat"),F("composer.composerBusy"))}}),Th=R(()=>{At()},[At]),kh=R(()=>{Hn()},[Hn]),YO=R(()=>{br&&(ff.current||(bo.current!==null&&window.cancelAnimationFrame(bo.current),bo.current=window.requestAnimationFrame(()=>{if(bo.current=null,ff.current)return;let O=rw.current,Ie=hh.current,_e=document.activeElement;_e instanceof Element&&zQ(_e)||_e instanceof Node&&(O&&O.contains(_e)||Ie&&Ie.contains(_e))||tt(!1)})))},[br]);W(()=>()=>{bo.current!==null&&window.cancelAnimationFrame(bo.current),gl.current!==null&&window.cancelAnimationFrame(gl.current),hl.current!==null&&window.cancelAnimationFrame(hl.current)},[]);let Lh=R(()=>Re.current?.readSnapshot()??{value:G.current,cursor:Po(G.current,G.current.length),expandedCursor:G.current.length,terminalContextIds:Mt.current.map(O=>O.id)},[Mt,G]),Sf=N({onComposerPaste:xw,submitComposer:hf,exitShellCommandMode:mw});Sf.current={onComposerPaste:xw,submitComposer:hf,exitShellCommandMode:mw};let JO=R(O=>{Sf.current.onComposerPaste(O)},[]),ZO=R((O,Ie)=>{Sf.current.submitComposer(O,Ie)},[]),eF=R(()=>Sf.current.exitShellCommandMode(),[]),Ph=()=>({prompt:G.current,images:vt.current,terminalContexts:Mt.current,elementContexts:Dt.current,previewAnnotations:Ct,reviewComments:ct,selectedPromptEffort:si,selectedModelOptionsForDispatch:li,selectedModelSelection:qn,...Ca?{selectedNativeModeId:Ca}:{},providerAvailable:zo!==void 0,selectedProvider:Dn,selectedModel:co,selectedModelStatus:Wr,selectedProviderModels:Ho,selectedPluginAction:Ta});Nt.current=Ph,rr(Ye,()=>({focusAtEnd:()=>{ml.current?.focusAtEnd()},focusAt:Ie=>{ml.current?.focusAt(Ie)},addDroppedFiles:Ie=>{wf(Ie),ft()},insertTextAtEnd:Cw,toggleModelPicker:()=>{z(Ie=>!Ie)},cyclePermissionMode:Ie=>{if(Mo===null){ce(hO(T,Ie));return}let{modes:_e,current:Pt}=Mo;if(!wn||_e.length<2)return;let Sn=_e.findIndex(wr=>wr.id===Pt.id),cn=_e[(Sn+Ie+_e.length)%_e.length];cn!==void 0&&ba(cn.id)},readSnapshot:Lh,resetCursorState:Ie=>{Re.current?.resetCursorState(Ie)},addTerminalContext:Ie=>{if(!A)return;let _e=Lh(),Pt=Pe.terminalContext.insertInlinePlaceholder(_e.value,_e.expandedCursor),Sn=Po(Pt.prompt,Pt.cursor);ya(X,Pt.prompt,{id:Nu(),threadId:A.id,createdAt:new Date().toISOString(),...Ie},Pt.contextIndex)&&(G.current=Pt.prompt,Re.current?.syncCursor(Sn,Ao(Pt.prompt,Pt.cursor)),window.requestAnimationFrame(()=>{ml.current?.focusAt(Sn)}))},readSendIdentity:()=>({pluginActionId:Ta?.id??null,prompt:G.current}),getSendContext:Ph,validateProviderInput:Ie=>{let _e=jr??bC({prompt:G.current,providerInput:o.assistantQuotes.expandForProvider(Ie),submissionTarget:"provider-turn",maxInputChars:Et.maxInputChars,t:F});return vh.current=_e!==null,On(_e),_e===null}}),[A,wf,X,ya,G,vt,Mt,Dt,Ct,ct,ft,Vn,s.length,V,Lh,co,li,qn,Ca,Ae,si,Dn,Ho,Ta,jr,o,Ph,Nt,Et.maxInputChars,Mo,wn,ba,ce,T,F]);let tF=Vn?i?.detail??F("composer.resolveApprovalToContinue"):F(l?"composer.typeOwnAnswer":Se&&rt?"composer.addFeedbackRefinePlan":V?"composer.chooseProjectToStart":Ae?"composer.enableProviderToSend":Vt??"composer.askAnythingFull");return b("form",{ref:hh,onSubmit:hf,onFocusCapture:O=>{let Ie=O.target;fo&&Ie instanceof HTMLElement&&Ie.closest('[data-chat-composer-collapsed-controls="true"]')||(bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null),tt(!0))},onBlurCapture:()=>{YO()},onDragEnterCapture:Ih.onDragEnter,onDragOverCapture:Ih.onDragOver,onDragLeaveCapture:XO,onDropCapture:Ih.onDrop,className:K("mx-auto w-full min-w-0 max-w-3xl",KO&&"pt-7"),"data-chat-composer-form":"true",children:[pf&&(!Bd||Ud)?u("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-variant":zd?.kind==="approval"?"warning":"info","data-occupant":zd?.kind??"none",children:zd===null?null:P1({occupant:zd,respondingRequestIds:m,keybindings:Y,onRespondToApproval:pt,onRespondToDecision:st,activePendingDraftAnswers:f,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:qe,onAdvanceActivePendingUserInput:it,activeProposedPlan:rt,collapsedPendingRow:u(OD,{activePendingProgress:l,isPendingUserInputChoiceOnly:iw,expandMobileComposer:vf,inlineTasksBadge:bf,inlineStashBadge:Cf,pendingPrimaryAction:mf,isSendBusy:D,sendDisabledReason:ts,isEnvironmentUnavailable:j!==null||Ae||V,onPreviousActivePendingUserInputQuestion:w,handleInterruptPrimaryAction:Th,handleImplementPlanInNewThreadPrimaryAction:kh})},fo)}):null,Bd&&!Ud&&Qr&&La?u(KM,{onDismiss:wh,onCollapse:bh,progress:Qr,steps:La}):null,b("div",{className:"relative",children:[Sh&&Qr&&La?u(RC,{expanded:!1,hasTrailingShoulder:xl.length>0,onDismiss:wh,onToggle:bh,progress:Qr,steps:La}):null,Sh?u(EC,{count:xl.length,menuOpen:mh,pulseKey:pl.key,pulsing:pl.active,onToggleMenu:Ch}):null,u("div",{"data-chat-composer-main-surface":"true",className:K("group relative z-10 rounded-[22px] p-px transition-colors duration-200",Co.composerFrameClassName),children:b("div",{ref:rw,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":fo?"true":"false",className:K("rounded-[20px] transition-[background-color] duration-200",QO?"bg-accent/45 ring-1 ring-primary/70":null,V?"opacity-75":null,Co.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,u(qQ,{hidden:Vn}),LO?b("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[u(KQ,{api:Pe,composerDraftTarget:X,pendingCustomAnswer:l?l.customAnswer:null,noProviderAvailable:Ae,onExpand:vf}),bf,Cf,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:EO,"aria-label":RO,onPointerDown:O=>O.preventDefault(),onClick:O=>{O.stopPropagation(),hf()},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:ph,className:K("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",Vn&&"pb-3 sm:pb-4",fo&&"hidden"),children:[!fo&&!Vn&&s.length===0&&Ct.length>0&&u(jM,{annotations:Ct,images:on,...re?{uploadsByImageId:bn,onRetryUpload:O=>Pe.uploads.retry({environmentId:pe,image:O})}:{},onRemove:O=>{Pe.uploads.release(O),xa(X,O)},onExpandImage:O=>{let Ie=Zb(Nn,O);Ie&&hn(Ie)},className:"mb-3"}),!fo&&!Vn&&s.length===0&&ct.length>0&&u(GM,{comments:ct,onRemove:O=>Cr(X,O),className:"mb-3"}),!fo&&!Vn&&s.length===0&&Ve.length>0&&u(WM,{contexts:Ve,onRemove:O=>He(X,O),className:"mb-3"}),!fo&&!Vn&&s.length===0&&on.some(O=>!Ct.some(Ie=>Ie.id===O.id))&&u("div",{className:"mb-3 flex flex-wrap gap-2",children:on.filter(O=>!Ct.some(Ie=>Ie.id===O.id)).map(O=>{let Ie=re?bn[O.id]:void 0,_e=LC(O),Pt=VM(_e),Sn=_e==="image"&&!!O.previewUrl;return b("div",{className:K("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",Sn?"w-16":"w-44 max-w-full"),children:[Sn?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":F("attachments.preview",{name:O.name}),onClick:()=>{let cn=Zb(Nn,O.id);cn&&hn(cn)},children:u("img",{src:O.previewUrl,alt:O.name,className:"h-full w-full object-cover"})}):b("a",{href:O.previewUrl,target:"_blank",rel:"noreferrer",className:"flex h-full w-full items-center gap-2 px-2 pe-7 text-start","aria-label":F("attachments.open",{name:O.name}),children:[u(Pt,{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:O.name}),u("span",{className:"block text-[10px] text-secondary-label",children:PC(O.sizeBytes)})]})]}),TO.has(O.id)&&b(Je,{children:[u(et,{render:u("span",{role:"img","aria-label":F("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(Pn,{className:"size-3"})})}),u(Ze,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:F("attachments.draftMayNotPersistDetail")})]}),Ie?.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:Pg(Ie.progress)}),Ie?.status==="failed"&&b(Je,{children:[u(et,{render:u(ie,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>Pe.uploads.retry({environmentId:pe,image:O}),"aria-label":F("attachments.retryUpload",{name:O.name})}),children:u(vs,{})}),u(Ze,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:Lg(Ie,F)})]}),u(ie,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>WO(O.id),"aria-label":F("attachments.remove",{name:O.name}),children:u(en,{})})]},O.id)})}),yl?b("div",{"data-composer-shell-command-mode":"true",className:"flex min-w-0 items-center gap-1.5 px-1 pb-1 text-xs",children:[u(qo,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-primary"}),u("span",{className:"shrink-0 font-medium text-primary",children:F("composer.shellCommand.mode")}),u("span",{className:"min-w-0 truncate text-muted-foreground",children:pi?.unavailableReason??F("composer.shellCommand.hint")})]}):null,b("div",{className:"relative",children:[u(cN,{handleRef:Re,api:Pe,composerDraftTarget:X,composerDocumentKey:or,promptRef:G,editorRef:ml,menuAnchor:ui,resolvedTheme:oe,selectedProvider:Dn,selectedProviderStatus:uo,planModeUiEnabled:di,showSkillsInSlashMenu:Te.showSkillsInSlashMenu,recentSlashCommandIds:_t,environmentId:pe,gitCwd:ge,onSlashCommandUsed:Xt,onOpenModelPicker:SO,onInteractionModeChange:IO,onToggleInteractionMode:ae,activePendingProgress:l,activePendingRequestId:s[0]?.requestId??null,hasPendingUserInputs:s.length>0,changeUserInputCustomAnswer:x,terminalContexts:xe,showTerminalContexts:!Vn&&s.length===0,showEditor:!iw,isApprovalState:Vn,editorClassName:Hd?"max-sm:pb-11":void 0,placeholder:tF,disabled:Vn||V,onPaste:JO,onSubmit:ZO,isMobileViewport:br,isDraftRoute:we==="draft",stashMenuOpen:mh,stashEntries:xl,onRestoreStashEntry:zO,onDeleteStashEntry:UO,onCloseStashMenu:qO,onPromptEdited:VO,onUnclaimedEscape:eF}),Hd?b("div",{"data-chat-composer-mobile-pending-actions":"true",className:"absolute bottom-0 right-0 flex items-center justify-end gap-1",children:[bf,Cf,u(sf,{compact:!0,pendingAction:mf,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:D,sendDisabledReason:ts,isEnvironmentUnavailable:j!==null||Ae||V,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:w,onInterrupt:Th,interruptArmed:xt,onImplementPlanInNewThread:kh})]}):null]})]}),u(gO,{message:Yt??FO}),jr===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:jr}),U?u("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-agent-not-chosen":"true",children:F("composer.agentNotChosen")}):null,xo?u("p",{role:"status",className:"px-3 pb-2 text-xs text-warning sm:px-4","data-chat-composer-agent-unavailable":"true",children:F(Uo?"composer.agentUnavailableNoChoice":"composer.agentUnavailable")}):null,Fd===null?null:b("p",{role:"status",className:"flex flex-wrap items-center gap-2 px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-model-blocked":Wr,children:[F(Fd.blockKey),Fd.canChooseModel?u(ie,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-xs","data-chat-composer-choose-model":"true",onClick:()=>{z(!0)},children:F("modelPicker.chooseModel")}):null]}),fo||Vn?null:b("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":os?"true":"false",className:K("flex min-w-0 flex-nowrap items-center justify-between gap-2 overflow-visible px-3 pb-3 sm:px-4 sm:pb-4",s.length>0&&"pt-2",os?"gap-1.5":"gap-2 sm:gap-0",Hd&&"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:ow,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:GO}),b(Je,{children:[u(et,{render:u(ie,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:V||s.length>0,"aria-label":F("attachments.add"),onClick:()=>ow.current?.click()}),children:u(wo,{})}),u(Ze,{side:"top",children:F("attachments.add")})]}),Ae?b(ie,{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(Pn,{className:"size-4"}),F("composer.noProviderAvailable")]}):b(ke,{children:[u(af,{name:"conversation.input.agent",...je===void 0?{}:{slots:je},owner:{activeInstanceId:gt,unavailableInstanceId:B,notChosen:U,instanceEntries:_n,lockedProvider:L,lockedContinuationGroupKey:to,compact:os,onInstanceChange:wa},fallback:u(FC,{activeInstanceId:gt,unavailableInstanceId:B,notChosen:U,instanceEntries:_n,lockedProvider:L,lockedContinuationGroupKey:to,compact:os,onInstanceChange:wa})}),xo||U?null:u(TD,{...je===void 0?{}:{slots:je},compact:os,hideInstanceRail:!0,showInstanceOnTrigger:!1,activeInstanceId:gt,model:Bt,modelStatus:Wr,lockedProvider:L,lockedContinuationGroupKey:to,instanceEntries:_n,keybindings:Y,modelOptionsByInstance:Ke,terminalOpen:me,open:uf,...Co.modelPickerIconClassName?{activeProviderIconClassName:Co.modelPickerIconClassName}:{},onOpenChange:O=>{z(O)},getModelDisabledReason:Cn,getModelContinuationLabel:$n,onContinueInModel:$,onInstanceModelChange:yt,...dn?{pluginActions:Sa,selectedPluginActionKey:Ta?.id??null,onSelectPluginAction:kn,onManagePlugins:sn}:{}})]}),ka?null:b(ke,{children:[u(j1,{environmentId:pe,draftId:we==="draft"?ot:null,threadPresetId:A?.presetId??null,compact:os}),os?u(RD,{interactionMode:S,runtimeMode:T,runtimeModeSwitch:nr.runtimeModeSwitch,nativeMode:Mo,canSwitchNativeMode:wn,showInteractionModeToggle:nr.showInteractionModeToggle,traitsMenuContent:AO,onToggleInteractionMode:ae,onRuntimeModeChange:ce,onNativeModeChange:ba}):b(ke,{children:[cw?u(af,{name:"conversation.input.effort",...je===void 0?{}:{slots:je},fallback:cw}):null,Mo===null&&nr.showInteractionModeToggle?u(af,{name:"conversation.input.plan",...je===void 0?{}:{slots:je},owner:{interactionMode:S,showInteractionModeToggle:nr.showInteractionModeToggle,onToggleInteractionMode:ae},fallback:u(Pb,{interactionMode:S,showInteractionModeToggle:nr.showInteractionModeToggle,onToggleInteractionMode:ae})}):null,u(af,{name:"conversation.input.permission",...je===void 0?{}:{slots:je},owner:{runtimeMode:T,runtimeModeSwitch:nr.runtimeModeSwitch,nativeMode:Mo,canSwitchNativeMode:wn,onRuntimeModeChange:ce,onNativeModeChange:ba},fallback:u(Ab,{runtimeMode:T,runtimeModeSwitch:nr.runtimeModeSwitch,nativeMode:Mo,canSwitchNativeMode:wn,onRuntimeModeChange:ce,onNativeModeChange:ba})})]})]})]}),b("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":sw?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[Hd?null:bf,Hd?null:Cf,u(WQ,{compact:sw,activeThreadModelDisplayName:fh,pendingAction:mf,isRunning:J==="running",showPlanFollowUpPrompt:s.length===0&&Se,promptHasText:mt.promptHasText,isSendBusy:D,sendDisabledReason:ts,isEnvironmentUnavailable:j!==null||Ae||V,isPreparingWorktree:ee,hasSendableContent:mt.hasSendableContent,preserveComposerFocusOnPointerDown:br,showSendWhileRunning:br,onPreviousPendingQuestion:w,onInterrupt:Th,interruptArmed:xt,onImplementPlanInNewThread:kh,shellCommandMode:yl,shellCommandUnavailableReason:pi?.unavailableReason??null,compactDisabled:Z||Ae||D,compactDisabledReason:es,onCompactContext:BO})]})]})]})})]})]})});function yO(e){let{composerRef:t,...n}=e,o=n;return u(YR,{value:o.api,children:u(vO,{...o,composerRef:t})})}function Od({section:e,resetKey:t,children:n}){return u(Fl,{resetKey:t,fallback:o=>GQ(e,o),children:n})}function GQ(e,t){return u(jQ,{section:e,error:t})}function jQ({section:e,error:t}){let{t:n}=ut();return b("div",{role:"status","data-conversation-section-error":e,className:e==="composer"||e==="queue"?"pointer-events-auto mx-auto flex w-full max-w-3xl items-start gap-2 rounded-lg border border-destructive/30 bg-background px-3 py-2 text-sm":"flex min-h-0 flex-1 flex-col items-center justify-center gap-2 px-6 py-12 text-center text-sm",children:[u(Pn,{"aria-hidden":!0,className:"size-4 shrink-0 text-destructive"}),b("div",{className:"min-w-0",children:[u("p",{className:"font-medium text-foreground",children:n(`timeline.sectionUnavailable.${e}`)}),u("p",{className:"whitespace-pre-wrap break-words text-muted-foreground",children:n("timeline.sectionUnavailableHint",{reason:t.message})})]})]})}function xO({hostVersion:e,scopeClass:t}){let{t:n}=ut();return b("div",{role:"status","data-conversation-host-data-mismatch":!0,className:K("flex min-h-0 min-w-0 flex-1 flex-col items-center justify-center gap-2 px-6 py-12 text-center text-sm",t),children:[u(Pn,{"aria-hidden":!0,className:"size-5 text-destructive"}),u("p",{className:"font-medium text-foreground",children:n("timeline.hostDataMismatchTitle")}),u("p",{className:"max-w-md text-muted-foreground",children:n("timeline.hostDataMismatchDescription",{host:e??0,plugin:16})})]})}function CO(e){let{data:t}=e;return t?.version!==16?u(xO,{hostVersion:t?.version??null,scopeClass:e.scopeClass}):u(_f.Provider,{value:e.scope.active,children:u(YQ,{...e,data:t})})}var QQ=ve(function({threadKey:t,onModeChange:n}){let[o]=Ht("turn-navigator",t,null),r=R(a=>{n("chat"),o?.onSelect(a)},[n,o]);return o===null?null:u(US,{...o,placement:"inline",onSelect:r})});function XQ({slots:e,children:t}){let{data:n,target:o,threadKey:r}=ia(),a=n.useComposerPending({target:o,threadKey:r});return e?.renderSlotChain("conversation.composer",{occupants:a.occupants},t)??t}function YQ(e){let{scope:t,mode:n,timeline:o,trajectory:r,composer:a,data:i}=e,[,s]=Ht("turn-navigator",t.threadKey,null),l=a.draftHero.active,d=a.sessionActions,c=a.terminalControl,f=a.agentsControl,{mode:p,onModeChange:m}=n,g=q(()=>l?b(ke,{children:[d,u("div",{className:"min-w-0 flex-1"}),c]}):b(ke,{children:[d,u(OS,{mode:p,onModeChange:m}),u("div",{className:"min-w-0 flex-1"}),c,f,u(QQ,{threadKey:t.threadKey,onModeChange:m})]}),[l,d,c,f,p,m,t.threadKey]),{belowSlot:h,draftHero:v,onOverlayElementChange:y,sessionActions:x,terminalControl:C,agentsControl:w,contextStrip:T,...S}=a,L=u(yO,{...S,attachments:e.attachments,firstRow:g}),k=q(()=>({environmentId:t.environmentId,threadId:t.threadId}),[t.environmentId,t.threadId]),[I,P]=Ht("trajectory-reveal",t.threadKey,null),E=R(F=>{n.onModeChange("chat"),P(X=>({rowId:F,nonce:(X?.nonce??0)+1}))},[n,P]),_=R(()=>P(null),[P]),A=N(null),{t:H}=ye(),V=N(a.api);V.current=a.api;let J=R(F=>V.current.notify.warning(H(`timeline.quote.${F}`)),[H]),[D,ne]=Ht("timeline-quote-reveal",t.threadKey,null);W(()=>{let F=A.current;if(!F)return;let X=pe=>{let le=pe.detail?.quote;if(le){if(le.environmentId!==k.environmentId||le.threadId!==k.threadId){J("otherThread");return}n.onModeChange("chat"),ne({quote:le})}};return F.addEventListener(Nh,X),()=>F.removeEventListener(Nh,X)},[n,ne,k.environmentId,k.threadId,J]);let B=R(F=>{ne(null),F==="message-missing"&&J("messageMissing"),F==="passage-missing"&&J("passageMissing")},[ne,J]),U=q(()=>({data:i,target:k,threadKey:t.threadKey}),[i,k,t.threadKey]),{controlRef:ee,...j}=o,Z=i.useChatWindow({target:k,threadKey:t.threadKey,visible:t.visible&&n.mode==="chat"}),de=O0({inputKey:t.threadKey,visible:t.visible,endInset:o.contentInsetEndAdjustment,derive:e.derive,onReturnToLatest:Z.onReturnToLatest,controlRef:ee});return b("div",{ref:A,className:K("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[u(GS,{data:i,target:k,threadKey:t.threadKey,surfaceRef:A}),u(FS,{chat:b(Od,{section:"chat",resetKey:t.threadKey,children:[u(P0,{data:i,target:k,visible:t.visible,...j,paneActive:t.active,liveFollowEnabled:de.liveFollowEnabled,scrollerRef:de.bindTimelineHandle,onRowsChange:de.onRowsChange,onIsAtEndChange:de.onIsAtEndChange,onManualNavigation:de.onManualNavigation,onDisclosureNavigation:de.onDisclosureNavigation,loadEarlier:Z.loadEarlier,loadLater:Z.loadLater,pagingBlockedByInteraction:Z.pagingBlockedByInteraction,onVisibleTurnRangeChange:Z.onVisibleTurnRangeChange,onReturnToLatest:Z.loadLater===null?null:de.returnToEnd,onTurnNavigatorChange:s,revealMessageRequest:I,revealQuoteRequest:D,onRevealQuoteDone:B,onRevealMessageHandled:_}),u(M0,{data:i,target:k,bottomInset:o.contentInsetEndAdjustment,showScrollToEnd:de.showScrollToEnd,onScrollToEnd:de.returnToEnd})]},"chat"),mode:n.mode,trajectory:u(Od,{section:"trajectory",resetKey:t.threadKey,children:u(H0,{data:i,target:k,inputKey:t.threadKey,paneVisible:t.visible&&n.mode==="trajectory",timestampFormat:r.timestampFormat,onOpenInChat:E})},"trajectory"),visible:t.visible}),u(zM,{data:i,target:k,threadKey:t.threadKey,belowSlot:a.belowSlot,composer:u(Od,{section:"composer",resetKey:t.threadKey,children:u(Sp,{value:U,children:u(dO,{children:u(XQ,{slots:a.slots,children:L})})})}),draftHero:a.draftHero,onOverlayElementChange:a.onOverlayElementChange,questions:u(Od,{section:"composer",resetKey:t.threadKey,children:u(RM,{data:i,target:k})}),queue:u(Od,{section:"queue",resetKey:t.threadKey,children:u(EM,{data:i,target:k,inputKey:t.threadKey,attachments:e.attachments})})})]})}var JQ=".ycodium-conversation-ui";function ZQ(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function bO(e,t="conversation"){let n=ZQ(),o=e.replaceAll(JQ,`.${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 e7(e){let t=bO(Sw);return{views:{[_h]:t7(t,e)},viewCapabilities:{[_h]:[Ew,Aw]},slots:[{name:"conversation.input.agent",order:0,component:yN},{name:"conversation.input.model",order:0,component:kD},{name:"conversation.input.plan",order:0,component:LD},{name:"conversation.input.permission",order:0,component:ED}]}}function t7(e,t){return function(o){let a=o[Dh]??t,i={...o};return delete i[Dh],b(kw,{value:a,children:[u(n7,{retain:e.retain}),u(Pw,{value:e.scopeClass,children:u(CO,{...i,scopeClass:e.scopeClass})})]})}}function n7({retain:e}){return Vd(()=>e(),[e]),null}export{e7 as default};
3872
+ ${O.prompt}`:O.prompt,cn=Sn!==Pt;cn&&(G.current=Sn,xn(X,Sn),Re.current?.syncCursor(Po(Sn,Sn.length),null));let br=[];if(O.attachments.length>0){let Pa=new Set(ht.current.map(po=>po.id)),oo=new Set(ht.current.map(po=>`${po.mimeType}\0${po.sizeBytes}\0${po.name}`)),Cl=Math.max(0,Et.maxAttachments-ht.current.length),Xr=O.attachments.filter(po=>!Pa.has(po.id)&&!oo.has(`${po.mimeType}\0${po.sizeBytes}\0${po.name}`));br=Xr.slice(Cl).map(po=>po.name);let Yr=Pe.draft.hydrateImagesFromPersisted(Xr.slice(0,Cl));Yr.length>0&&eo(X,Yr)}let In=[];O.droppedImageNames.length>0&&In.push(B("composer.stashImagesTooLarge",{names:O.droppedImageNames.join(", ")})),O.unreadableImageNames&&O.unreadableImageNames.length>0&&In.push(B("composer.stashImagesUnreadable",{names:O.unreadableImageNames.join(", ")})),br.length>0&&In.push(B("composer.stashImagesOverLimit",{names:br.join(", "),limit:Et.maxAttachments})),In.length>0&&Pe.notify.warning(B("composer.someImagesNotRestored"),In.join(" ")),cn&&window.requestAnimationFrame(()=>{pl.current?.focusAtEnd()})},[eo,X,ht,Et.maxAttachments,G,xn,B,xf]),UO=R(O=>{let{durable:Ie}=xf(O.id);Ie||Pe.notify.warning(B("composer.stashEntryMayReturn"),B("composer.storageRejectedDelete"))},[B,xf]),HO=R(async()=>{let O=G.current.split("\uFFFC").join("").trim(),Ie=[...ht.current];if(O.length===0&&Ie.length===0){fi(cn=>!cn);return}let _e=`${String(X)}\0${O}\0${Ie.map(cn=>cn.id).join(",")}`;if(yh.current.has(_e))return;yh.current.add(_e);let Pt=X,Sn=Nu();try{let{evicted:cn,written:br,durable:In}=gw({id:Sn,createdAt:new Date().toISOString(),prompt:O,attachments:[],droppedImageNames:[],unreadableImageNames:[],pendingImageCount:Ie.length});if(!br){Pe.notify.error(B("composer.couldNotStash"),B("composer.storageRejectedWrite"));return}In||Pe.notify.warning(B("composer.stashNotSurvive"),B("composer.storageUnavailableMemory")),G.current="",Kr(Pt);for(let bl of Ie)Pe.uploads.release(bl.id);Re.current?.syncCursor(0,null),vw(),cn&&Pe.notify.warning(B("composer.oldestStashDiscarded"),B("composer.oldestStashDiscardedDetail",{count:Pe.stash.maxEntries}));let Pa=[],oo=[],Cl=[];for(let bl of Ie){let Kd=await Pe.imageCompression.compressForStash(bl.file);if(!Kd.ok){(Kd.reason==="too-large"?oo:Cl).push(bl.name);continue}Pa.push({id:bl.id,name:bl.name,mimeType:Kd.image.mimeType,sizeBytes:Kd.image.sizeBytes,dataUrl:Kd.image.dataUrl})}let{kept:Xr,droppedNames:Yr}=Pe.stash.partitionAttachments(Pa),{attached:po,durable:If}=hw(Sn,{attachments:Xr,droppedImageNames:[...oo,...Yr],unreadableImageNames:Cl});po?!If&&In&&Ie.length>0&&Pe.notify.warning(B("composer.stashImagesNotSaved"),B("composer.stashImagesMissingOnReload")):Xr.length>0&&Pe.notify.warning(B("composer.stashImagesDidNotAttach"),B("composer.stashImagesDidNotAttachDetail",{count:Xr.length}))}finally{yh.current.delete(_e)}},[Kr,X,ht,hw,G,vw,gw,B]),Ch=R(()=>{fi(O=>!O)},[]),$O=R(()=>{if(fo){vf(),fi(!0);return}Ch()},[vf,fo,Ch]),bh=R(()=>{ul(O=>!O)},[]),$d=A?.latestTurn?.turnId??null,yw=$d!==null&&wO===$d,Qr=yw?null:Zt,La=yw?null:ln,wh=R(()=>{$d!==null&&tw($d),ul(!1)},[$d]),Cf=xl.length>0&&!Vn&&(n||pf||Bd||fo)?u(EC,{count:xl.length,menuOpen:mh,placement:"inline",pulseKey:fl.key,pulsing:fl.active,onToggleMenu:$O}):null,bf=Qr!==null&&La!==null&&!Bd&&!Ud&&(n||pf||fo)?u(RC,{expanded:!1,onDismiss:wh,onToggle:bh,placement:"inline",progress:Qr,steps:La}):null,Sh=!n&&!pf&&!Bd&&!fo,KO=Sh&&(xl.length>0||Qr!==null&&La!==null&&Qr.totalSteps>0);W(()=>{(Qr===null||La===null)&&ul(!1)},[La,Qr]),W(()=>{Ud&&ul(!1)},[Ud]),W(()=>{ul(!1)},[_]);let qO=R(()=>{fi(!1)},[]),VO=R(O=>{On(null),uw(O),fi(!1)},[uw]);Pe.pane.useKeydown(O=>{if(Pe.keybindings.resolveShortcutCommand(O,Y,{context:{terminalFocus:Pe.terminalFocus.getOwner()!==null,terminalOpen:me,modelPickerOpen:uf}})==="composer.stash"&&(O.preventDefault(),O.stopPropagation(),!Pe.commandPalette.isOpen())){if(s.length>0&&!Vn){fi(_e=>!_e);return}Vn||V||l!==null||HO()}},{capture:!0});let wf=async O=>{if(!_||O.length===0)return;if(s.length>0){Pe.notify.error(B("attachments.answerQuestionsFirst"));return}let Ie=_,_e=jr,Pt=vl.current.get(_e)??0,Sn=ht.current.length+Pt,cn=[],br=null;for(let In of O){if(Sn>=Et.maxAttachments){br=B("attachments.limitReached",{count:Et.maxAttachments});break}if(In.size<=0){br=B("attachments.empty",{name:In.name});continue}cn.push(In),Sn+=1}if(lt(Ie,br),cn.length!==0){vl.current.set(_e,Pt+cn.length);try{let In=[],Pa=null;for(let oo of cn){if(!(Pe.imageCompression.isHeicFile(oo)||kC(oo.type))){let If=re?Et.maxFileBytes:Et.maxImageBytes;if(oo.size>If){Pa=B("attachments.tooLarge",{name:oo.name,limit:PC(If)});continue}In.push({...AC({id:Nu(),name:oo.name||B("attachments.defaultFileName"),mimeType:oo.type||"application/octet-stream",sizeBytes:oo.size}),previewUrl:URL.createObjectURL(oo),file:oo});continue}let Xr=await Pe.imageCompression.prepareForAttachment(oo,Et.maxImageBytes);if(!Xr.ok){Pa=Xr.reason==="unreadable"?B("attachments.unreadableImage",{name:oo.name}):B("attachments.imageTooLarge",{name:oo.name});continue}let Yr=Xr.file,po=URL.createObjectURL(Yr);In.push({...AC({id:Nu(),name:Yr.name||B("attachments.defaultImageName"),mimeType:Yr.type,sizeBytes:Yr.size}),previewUrl:po,file:Yr})}In.length===1&&In[0]?MO(In[0]):In.length>1&&NO(In),Pa!==null&&lt(Ie,Pa)}finally{let In=(vl.current.get(_e)??0)-cn.length;In>0?vl.current.set(_e,In):vl.current.delete(_e)}}},WO=O=>{_O(O)},GO=O=>{let Ie=Array.from(O.target.files??[]);O.target.value="",Ie.length!==0&&wf(Ie)},xw=O=>{let Ie=Array.from(O.clipboardData.files);Ie.length!==0&&(O.preventDefault(),wf(Ie))},Cw=(O,Ie)=>{if(O.length===0||Vn||s.length>0||V)return!1;let _e=G.current,Pt=(Ie?.ensureLeadingBoundary??!1)&&_e.length>0&&!/\s$/.test(_e);return Re.current?.applyPromptReplacement(_e.length,_e.length,Pt?` ${O}`:O)??!1},jO=St(np,a,null);jO.current=O=>{if(Vn||s.length>0||V)return!1;let Ie=G.current,_e=Math.max(0,Math.min(Ie.length,Re.current?.readSnapshot().expandedCursor??Ie.length)),Pt=Ie.slice(0,_e),Sn=Ie.slice(_e),cn=`${Pt.length>0&&!/\s$/.test(Pt)?" ":""}${O}${/^\s/.test(Sn)?"":" "}`;return Re.current?.applyPromptReplacement(_e,_e,cn)??!1};let{isDragOverComposer:QO,composerMentionDragHandlers:Ih,onComposerMentionDragLeaveCapture:XO}=_D({documentKey:jr,insertMentionAtEnd:O=>Cw(O,{ensureLeadingBoundary:!0}),onInsertRejected:()=>{Pe.notify.error(B("composer.unableToAddToChat"),B("composer.composerBusy"))}}),Th=R(()=>{At()},[At]),kh=R(()=>{Hn()},[Hn]),YO=R(()=>{Cr&&(ff.current||(bo.current!==null&&window.cancelAnimationFrame(bo.current),bo.current=window.requestAnimationFrame(()=>{if(bo.current=null,ff.current)return;let O=rw.current,Ie=hh.current,_e=document.activeElement;_e instanceof Element&&zQ(_e)||_e instanceof Node&&(O&&O.contains(_e)||Ie&&Ie.contains(_e))||tt(!1)})))},[Cr]);W(()=>()=>{bo.current!==null&&window.cancelAnimationFrame(bo.current),ml.current!==null&&window.cancelAnimationFrame(ml.current),gl.current!==null&&window.cancelAnimationFrame(gl.current)},[]);let Lh=R(()=>Re.current?.readSnapshot()??{value:G.current,cursor:Po(G.current,G.current.length),expandedCursor:G.current.length,terminalContextIds:Mt.current.map(O=>O.id)},[Mt,G]),Sf=N({onComposerPaste:xw,submitComposer:hf,exitShellCommandMode:mw});Sf.current={onComposerPaste:xw,submitComposer:hf,exitShellCommandMode:mw};let JO=R(O=>{Sf.current.onComposerPaste(O)},[]),ZO=R((O,Ie)=>{Sf.current.submitComposer(O,Ie)},[]),eF=R(()=>Sf.current.exitShellCommandMode(),[]),Ph=()=>({prompt:G.current,images:ht.current,terminalContexts:Mt.current,elementContexts:Dt.current,previewAnnotations:Ct,reviewComments:ct,selectedPromptEffort:si,selectedModelOptionsForDispatch:li,selectedModelSelection:qn,...Ca?{selectedNativeModeId:Ca}:{},providerAvailable:zo!==void 0,selectedProvider:Dn,selectedModel:co,selectedModelStatus:Vr,selectedProviderModels:Ho,selectedPluginAction:Ta});Nt.current=Ph,or(Ye,()=>({focusAtEnd:()=>{pl.current?.focusAtEnd()},focusAt:Ie=>{pl.current?.focusAt(Ie)},addDroppedFiles:Ie=>{wf(Ie),ft()},insertTextAtEnd:Cw,toggleModelPicker:()=>{z(Ie=>!Ie)},cyclePermissionMode:Ie=>{if(Mo===null){ce(hO(T,Ie));return}let{modes:_e,current:Pt}=Mo;if(!wn||_e.length<2)return;let Sn=_e.findIndex(br=>br.id===Pt.id),cn=_e[(Sn+Ie+_e.length)%_e.length];cn!==void 0&&ba(cn.id)},readSnapshot:Lh,resetCursorState:Ie=>{Re.current?.resetCursorState(Ie)},addTerminalContext:Ie=>{if(!A)return;let _e=Lh(),Pt=Pe.terminalContext.insertInlinePlaceholder(_e.value,_e.expandedCursor),Sn=Po(Pt.prompt,Pt.cursor);ya(X,Pt.prompt,{id:Nu(),threadId:A.id,createdAt:new Date().toISOString(),...Ie},Pt.contextIndex)&&(G.current=Pt.prompt,Re.current?.syncCursor(Sn,Ao(Pt.prompt,Pt.cursor)),window.requestAnimationFrame(()=>{pl.current?.focusAt(Sn)}))},readSendIdentity:()=>({pluginActionId:Ta?.id??null,prompt:G.current}),getSendContext:Ph,validateProviderInput:Ie=>{let _e=Gr??bC({prompt:G.current,providerInput:o.assistantQuotes.expandForProvider(Ie),submissionTarget:"provider-turn",maxInputChars:Et.maxInputChars,t:B});return vh.current=_e!==null,On(_e),_e===null}}),[A,wf,X,ya,G,ht,Mt,Dt,Ct,ct,ft,Vn,s.length,V,Lh,co,li,qn,Ca,Ae,si,Dn,Ho,Ta,Gr,o,Ph,Nt,Et.maxInputChars,Mo,wn,ba,ce,T,B]);let tF=Vn?i?.detail??B("composer.resolveApprovalToContinue"):B(l?"composer.typeOwnAnswer":Se&&rt?"composer.addFeedbackRefinePlan":V?"composer.chooseProjectToStart":Ae?"composer.enableProviderToSend":Vt??"composer.askAnythingFull");return b("form",{ref:hh,onSubmit:hf,onFocusCapture:O=>{let Ie=O.target;fo&&Ie instanceof HTMLElement&&Ie.closest('[data-chat-composer-collapsed-controls="true"]')||(bo.current!==null&&(window.cancelAnimationFrame(bo.current),bo.current=null),tt(!0))},onBlurCapture:()=>{YO()},onDragEnterCapture:Ih.onDragEnter,onDragOverCapture:Ih.onDragOver,onDragLeaveCapture:XO,onDropCapture:Ih.onDrop,className:K("mx-auto w-full min-w-0 max-w-3xl",KO&&"pt-7"),"data-chat-composer-form":"true",children:[pf&&(!Bd||Ud)?u("div",{className:"chat-composer-top-drawer","data-chat-composer-top-drawer":"true","data-variant":zd?.kind==="approval"?"warning":"info","data-occupant":zd?.kind??"none",children:zd===null?null:P1({occupant:zd,respondingRequestIds:m,keybindings:Y,onRespondToApproval:pt,onRespondToDecision:st,activePendingDraftAnswers:f,activePendingQuestionIndex:p,onSelectActivePendingUserInputOption:qe,onAdvanceActivePendingUserInput:it,activeProposedPlan:rt,collapsedPendingRow:u(OD,{activePendingProgress:l,isPendingUserInputChoiceOnly:iw,expandMobileComposer:vf,inlineTasksBadge:bf,inlineStashBadge:Cf,pendingPrimaryAction:mf,isSendBusy:D,sendDisabledReason:ts,isEnvironmentUnavailable:j!==null||Ae||V,onPreviousActivePendingUserInputQuestion:w,handleInterruptPrimaryAction:Th,handleImplementPlanInNewThreadPrimaryAction:kh})},fo)}):null,Bd&&!Ud&&Qr&&La?u(KM,{onDismiss:wh,onCollapse:bh,progress:Qr,steps:La}):null,b("div",{className:"relative",children:[Sh&&Qr&&La?u(RC,{expanded:!1,hasTrailingShoulder:xl.length>0,onDismiss:wh,onToggle:bh,progress:Qr,steps:La}):null,Sh?u(EC,{count:xl.length,menuOpen:mh,pulseKey:fl.key,pulsing:fl.active,onToggleMenu:Ch}):null,u("div",{"data-chat-composer-main-surface":"true",className:K("group relative z-10 rounded-[22px] p-px transition-colors duration-200",Co.composerFrameClassName),children:b("div",{ref:rw,"data-chat-composer-surface":"true","data-chat-composer-mobile-collapsed":fo?"true":"false",className:K("rounded-[20px] transition-[background-color] duration-200",QO?"bg-accent/45 ring-1 ring-primary/70":null,V?"opacity-75":null,Co.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,u(qQ,{hidden:Vn}),LO?b("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[u(KQ,{api:Pe,composerDraftTarget:X,pendingCustomAnswer:l?l.customAnswer:null,noProviderAvailable:Ae,onExpand:vf}),bf,Cf,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:EO,"aria-label":RO,onPointerDown:O=>O.preventDefault(),onClick:O=>{O.stopPropagation(),hf()},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:ph,className:K("relative px-3 pb-2 sm:px-4","pt-3.5 sm:pt-4",Vn&&"pb-3 sm:pb-4",fo&&"hidden"),children:[!fo&&!Vn&&s.length===0&&Ct.length>0&&u(jM,{annotations:Ct,images:on,...re?{uploadsByImageId:bn,onRetryUpload:O=>Pe.uploads.retry({environmentId:pe,image:O})}:{},onRemove:O=>{Pe.uploads.release(O),xa(X,O)},onExpandImage:O=>{let Ie=Zb(Nn,O);Ie&&hn(Ie)},className:"mb-3"}),!fo&&!Vn&&s.length===0&&ct.length>0&&u(GM,{comments:ct,onRemove:O=>xr(X,O),className:"mb-3"}),!fo&&!Vn&&s.length===0&&Ve.length>0&&u(WM,{contexts:Ve,onRemove:O=>He(X,O),className:"mb-3"}),!fo&&!Vn&&s.length===0&&on.some(O=>!Ct.some(Ie=>Ie.id===O.id))&&u("div",{className:"mb-3 flex flex-wrap gap-2",children:on.filter(O=>!Ct.some(Ie=>Ie.id===O.id)).map(O=>{let Ie=re?bn[O.id]:void 0,_e=LC(O),Pt=VM(_e),Sn=_e==="image"&&!!O.previewUrl;return b("div",{className:K("relative h-16 overflow-hidden rounded-lg border border-border/80 bg-background",Sn?"w-16":"w-44 max-w-full"),children:[Sn?u("button",{type:"button",className:"h-full w-full cursor-zoom-in","aria-label":B("attachments.preview",{name:O.name}),onClick:()=>{let cn=Zb(Nn,O.id);cn&&hn(cn)},children:u("img",{src:O.previewUrl,alt:O.name,className:"h-full w-full object-cover"})}):b("a",{href:O.previewUrl,target:"_blank",rel:"noreferrer",className:"flex h-full w-full items-center gap-2 px-2 pe-7 text-start","aria-label":B("attachments.open",{name:O.name}),children:[u(Pt,{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:O.name}),u("span",{className:"block text-[10px] text-secondary-label",children:PC(O.sizeBytes)})]})]}),TO.has(O.id)&&b(Je,{children:[u(et,{render:u("span",{role:"img","aria-label":B("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(Pn,{className:"size-3"})})}),u(Ze,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:B("attachments.draftMayNotPersistDetail")})]}),Ie?.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:Pg(Ie.progress)}),Ie?.status==="failed"&&b(Je,{children:[u(et,{render:u(ie,{variant:"ghost",size:"icon-xs",className:"absolute bottom-1 left-1 bg-background/85 hover:bg-background/90",onClick:()=>Pe.uploads.retry({environmentId:pe,image:O}),"aria-label":B("attachments.retryUpload",{name:O.name})}),children:u(hs,{})}),u(Ze,{side:"top",className:"max-w-64 whitespace-normal leading-tight",children:Lg(Ie,B)})]}),u(ie,{variant:"ghost",size:"icon-xs",className:"absolute right-1 top-1 bg-background/80 hover:bg-background/90",onClick:()=>WO(O.id),"aria-label":B("attachments.remove",{name:O.name}),children:u(en,{})})]},O.id)})}),yl?b("div",{"data-composer-shell-command-mode":"true",className:"flex min-w-0 items-center gap-1.5 px-1 pb-1 text-xs",children:[u(qo,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-primary"}),u("span",{className:"shrink-0 font-medium text-primary",children:B("composer.shellCommand.mode")}),u("span",{className:"min-w-0 truncate text-muted-foreground",children:pi?.unavailableReason??B("composer.shellCommand.hint")})]}):null,b("div",{className:"relative",children:[u(cN,{handleRef:Re,api:Pe,composerDraftTarget:X,composerDocumentKey:jr,promptRef:G,editorRef:pl,menuAnchor:ui,resolvedTheme:oe,selectedProvider:Dn,selectedProviderStatus:uo,planModeUiEnabled:di,showSkillsInSlashMenu:Te.showSkillsInSlashMenu,recentSlashCommandIds:_t,environmentId:pe,gitCwd:ge,onSlashCommandUsed:Xt,onOpenModelPicker:SO,onInteractionModeChange:IO,onToggleInteractionMode:ae,activePendingProgress:l,activePendingRequestId:s[0]?.requestId??null,hasPendingUserInputs:s.length>0,changeUserInputCustomAnswer:x,terminalContexts:xe,showTerminalContexts:!Vn&&s.length===0,showEditor:!iw,isApprovalState:Vn,editorClassName:Hd?"max-sm:pb-11":void 0,placeholder:tF,disabled:Vn||V,onPaste:JO,onSubmit:ZO,isMobileViewport:Cr,isDraftRoute:we==="draft",stashMenuOpen:mh,stashEntries:xl,onRestoreStashEntry:zO,onDeleteStashEntry:UO,onCloseStashMenu:qO,onPromptEdited:VO,onUnclaimedEscape:eF}),Hd?b("div",{"data-chat-composer-mobile-pending-actions":"true",className:"absolute bottom-0 right-0 flex items-center justify-end gap-1",children:[bf,Cf,u(sf,{compact:!0,pendingAction:mf,isRunning:!1,showPlanFollowUpPrompt:!1,promptHasText:!1,isSendBusy:D,sendDisabledReason:ts,isEnvironmentUnavailable:j!==null||Ae||V,isPreparingWorktree:!1,hasSendableContent:!1,preserveComposerFocusOnPointerDown:!0,onPreviousPendingQuestion:w,onInterrupt:Th,interruptArmed:xt,onImplementPlanInNewThread:kh})]}):null]})]}),u(gO,{message:Yt??FO}),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}),U?u("p",{role:"status",className:"px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-agent-not-chosen":"true",children:B("composer.agentNotChosen")}):null,xo?u("p",{role:"status",className:"px-3 pb-2 text-xs text-warning sm:px-4","data-chat-composer-agent-unavailable":"true",children:B(Uo?"composer.agentUnavailableNoChoice":"composer.agentUnavailable")}):null,Fd===null?null:b("p",{role:"status",className:"flex flex-wrap items-center gap-2 px-3 pb-2 text-xs text-muted-foreground sm:px-4","data-chat-composer-model-blocked":Vr,children:[B(Fd.blockKey),Fd.canChooseModel?u(ie,{type:"button",size:"sm",variant:"ghost",className:"h-6 px-2 text-xs","data-chat-composer-choose-model":"true",onClick:()=>{z(!0)},children:B("modelPicker.chooseModel")}):null]}),fo||Vn?null:b("div",{"data-chat-composer-footer":"true","data-chat-composer-footer-compact":ns?"true":"false",className:K("flex min-w-0 flex-nowrap items-center justify-between gap-2 overflow-visible px-3 pb-3 sm:px-4 sm:pb-4",s.length>0&&"pt-2",ns?"gap-1.5":"gap-2 sm:gap-0",Hd&&"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:ow,type:"file",multiple:!0,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:GO}),b(Je,{children:[u(et,{render:u(ie,{type:"button",variant:"ghost",size:"icon-sm","data-chat-composer-attach":"true",className:"shrink-0",disabled:V||s.length>0,"aria-label":B("attachments.add"),onClick:()=>ow.current?.click()}),children:u(wo,{})}),u(Ze,{side:"top",children:B("attachments.add")})]}),Ae?b(ie,{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(Pn,{className:"size-4"}),B("composer.noProviderAvailable")]}):b(ke,{children:[u(af,{name:"conversation.input.agent",...je===void 0?{}:{slots:je},owner:{activeInstanceId:mt,unavailableInstanceId:F,notChosen:U,instanceEntries:_n,lockedProvider:L,lockedContinuationGroupKey:to,compact:ns,onInstanceChange:wa},fallback:u(FC,{activeInstanceId:mt,unavailableInstanceId:F,notChosen:U,instanceEntries:_n,lockedProvider:L,lockedContinuationGroupKey:to,compact:ns,onInstanceChange:wa})}),xo||U?null:u(TD,{...je===void 0?{}:{slots:je},compact:ns,hideInstanceRail:!0,showInstanceOnTrigger:!1,activeInstanceId:mt,model:Bt,modelStatus:Vr,lockedProvider:L,lockedContinuationGroupKey:to,instanceEntries:_n,keybindings:Y,modelOptionsByInstance:Ke,terminalOpen:me,open:uf,...Co.modelPickerIconClassName?{activeProviderIconClassName:Co.modelPickerIconClassName}:{},onOpenChange:O=>{z(O)},getModelDisabledReason:Cn,getModelContinuationLabel:$n,onContinueInModel:$,onInstanceModelChange:vt,...dn?{pluginActions:Sa,selectedPluginActionKey:Ta?.id??null,onSelectPluginAction:kn,onManagePlugins:sn}:{}})]}),ka?null:b(ke,{children:[u(j1,{environmentId:pe,draftId:we==="draft"?ot:null,threadPresetId:A?.presetId??null,compact:ns}),ns?u(RD,{interactionMode:S,runtimeMode:T,runtimeModeSwitch:nr.runtimeModeSwitch,nativeMode:Mo,canSwitchNativeMode:wn,showInteractionModeToggle:nr.showInteractionModeToggle,traitsMenuContent:AO,onToggleInteractionMode:ae,onRuntimeModeChange:ce,onNativeModeChange:ba}):b(ke,{children:[cw?u(af,{name:"conversation.input.effort",...je===void 0?{}:{slots:je},fallback:cw}):null,Mo===null&&nr.showInteractionModeToggle?u(af,{name:"conversation.input.plan",...je===void 0?{}:{slots:je},owner:{interactionMode:S,showInteractionModeToggle:nr.showInteractionModeToggle,onToggleInteractionMode:ae},fallback:u(Pb,{interactionMode:S,showInteractionModeToggle:nr.showInteractionModeToggle,onToggleInteractionMode:ae})}):null,u(af,{name:"conversation.input.permission",...je===void 0?{}:{slots:je},owner:{runtimeMode:T,runtimeModeSwitch:nr.runtimeModeSwitch,nativeMode:Mo,canSwitchNativeMode:wn,onRuntimeModeChange:ce,onNativeModeChange:ba},fallback:u(Ab,{runtimeMode:T,runtimeModeSwitch:nr.runtimeModeSwitch,nativeMode:Mo,canSwitchNativeMode:wn,onRuntimeModeChange:ce,onNativeModeChange:ba})})]})]})]}),b("div",{"data-chat-composer-actions":"right","data-chat-composer-primary-actions-compact":sw?"true":"false",className:"flex shrink-0 flex-nowrap items-center justify-end gap-2",children:[Hd?null:bf,Hd?null:Cf,u(WQ,{compact:sw,activeThreadModelDisplayName:fh,pendingAction:mf,isRunning:J==="running",showPlanFollowUpPrompt:s.length===0&&Se,promptHasText:yt.promptHasText,isSendBusy:D,sendDisabledReason:ts,isEnvironmentUnavailable:j!==null||Ae||V,isPreparingWorktree:ee,hasSendableContent:yt.hasSendableContent,preserveComposerFocusOnPointerDown:Cr,showSendWhileRunning:Cr,onPreviousPendingQuestion:w,onInterrupt:Th,interruptArmed:xt,onImplementPlanInNewThread:kh,shellCommandMode:yl,shellCommandUnavailableReason:pi?.unavailableReason??null,compactDisabled:Z||Ae||D,compactDisabledReason:es,onCompactContext:BO})]})]})]})})]})]})});function yO(e){let{composerRef:t,...n}=e,o=n;return u(YR,{value:o.api,children:u(vO,{...o,composerRef:t})})}function Od({section:e,resetKey:t,children:n}){return u(Fl,{resetKey:t,fallback:o=>GQ(e,o),children:n})}function GQ(e,t){return u(jQ,{section:e,error:t})}function jQ({section:e,error:t}){let{t:n}=ut();return b("div",{role:"status","data-conversation-section-error":e,className:e==="composer"||e==="queue"?"pointer-events-auto mx-auto flex w-full max-w-3xl items-start gap-2 rounded-lg border border-destructive/30 bg-background px-3 py-2 text-sm":"flex min-h-0 flex-1 flex-col items-center justify-center gap-2 px-6 py-12 text-center text-sm",children:[u(Pn,{"aria-hidden":!0,className:"size-4 shrink-0 text-destructive"}),b("div",{className:"min-w-0",children:[u("p",{className:"font-medium text-foreground",children:n(`timeline.sectionUnavailable.${e}`)}),u("p",{className:"whitespace-pre-wrap break-words text-muted-foreground",children:n("timeline.sectionUnavailableHint",{reason:t.message})})]})]})}function xO({hostVersion:e,scopeClass:t}){let{t:n}=ut();return b("div",{role:"status","data-conversation-host-data-mismatch":!0,className:K("flex min-h-0 min-w-0 flex-1 flex-col items-center justify-center gap-2 px-6 py-12 text-center text-sm",t),children:[u(Pn,{"aria-hidden":!0,className:"size-5 text-destructive"}),u("p",{className:"font-medium text-foreground",children:n("timeline.hostDataMismatchTitle")}),u("p",{className:"max-w-md text-muted-foreground",children:n("timeline.hostDataMismatchDescription",{host:e??0,plugin:16})})]})}function CO(e){let{data:t}=e;return t?.version!==16?u(xO,{hostVersion:t?.version??null,scopeClass:e.scopeClass}):u(_f.Provider,{value:e.scope.active,children:u(YQ,{...e,data:t})})}var QQ=ve(function({threadKey:t,onModeChange:n}){let[o]=Ht("turn-navigator",t,null),r=R(a=>{n("chat"),o?.onSelect(a)},[n,o]);return o===null?null:u(US,{...o,placement:"inline",onSelect:r})});function XQ({slots:e,children:t}){let{data:n,target:o,threadKey:r}=ia(),a=n.useComposerPending({target:o,threadKey:r});return e?.renderSlotChain("conversation.composer",{occupants:a.occupants},t)??t}function YQ(e){let{scope:t,mode:n,timeline:o,trajectory:r,composer:a,data:i}=e,[,s]=Ht("turn-navigator",t.threadKey,null),l=a.draftHero.active,d=a.sessionActions,c=a.terminalControl,f=a.agentsControl,{mode:p,onModeChange:m}=n,g=q(()=>l?b(ke,{children:[d,u("div",{className:"min-w-0 flex-1"}),c]}):b(ke,{children:[d,u(OS,{mode:p,onModeChange:m}),u("div",{className:"min-w-0 flex-1"}),c,f,u(QQ,{threadKey:t.threadKey,onModeChange:m})]}),[l,d,c,f,p,m,t.threadKey]),{belowSlot:h,draftHero:v,onOverlayElementChange:y,sessionActions:x,terminalControl:C,agentsControl:w,contextStrip:T,...S}=a,L=u(yO,{...S,attachments:e.attachments,firstRow:g}),k=q(()=>({environmentId:t.environmentId,threadId:t.threadId}),[t.environmentId,t.threadId]),[I,P]=Ht("trajectory-reveal",t.threadKey,null),E=R(B=>{n.onModeChange("chat"),P(X=>({rowId:B,nonce:(X?.nonce??0)+1}))},[n,P]),_=R(()=>P(null),[P]),A=N(null),{t:H}=ye(),V=N(a.api);V.current=a.api;let J=R(B=>V.current.notify.warning(H(`timeline.quote.${B}`)),[H]),[D,ne]=Ht("timeline-quote-reveal",t.threadKey,null);W(()=>{let B=A.current;if(!B)return;let X=pe=>{let le=pe.detail?.quote;if(le){if(le.environmentId!==k.environmentId||le.threadId!==k.threadId){J("otherThread");return}n.onModeChange("chat"),ne({quote:le})}};return B.addEventListener(Nh,X),()=>B.removeEventListener(Nh,X)},[n,ne,k.environmentId,k.threadId,J]);let F=R(B=>{ne(null),B==="message-missing"&&J("messageMissing"),B==="passage-missing"&&J("passageMissing")},[ne,J]),U=q(()=>({data:i,target:k,threadKey:t.threadKey}),[i,k,t.threadKey]),{controlRef:ee,...j}=o,Z=i.useChatWindow({target:k,threadKey:t.threadKey,visible:t.visible&&n.mode==="chat"}),de=O0({inputKey:t.threadKey,visible:t.visible,endInset:o.contentInsetEndAdjustment,derive:e.derive,onReturnToLatest:Z.onReturnToLatest,controlRef:ee});return b("div",{ref:A,className:K("relative flex min-h-0 min-w-0 flex-1 flex-col",e.scopeClass),"data-conversation-surface":!0,children:[u(GS,{data:i,target:k,threadKey:t.threadKey,surfaceRef:A}),u(FS,{chat:b(Od,{section:"chat",resetKey:t.threadKey,children:[u(P0,{data:i,target:k,visible:t.visible,...j,paneActive:t.active,liveFollowEnabled:de.liveFollowEnabled,scrollerRef:de.bindTimelineHandle,onRowsChange:de.onRowsChange,onIsAtEndChange:de.onIsAtEndChange,onManualNavigation:de.onManualNavigation,onDisclosureNavigation:de.onDisclosureNavigation,loadEarlier:Z.loadEarlier,loadLater:Z.loadLater,pagingBlockedByInteraction:Z.pagingBlockedByInteraction,onVisibleTurnRangeChange:Z.onVisibleTurnRangeChange,onReturnToLatest:Z.loadLater===null?null:de.returnToEnd,onTurnNavigatorChange:s,revealMessageRequest:I,revealQuoteRequest:D,onRevealQuoteDone:F,onRevealMessageHandled:_}),u(M0,{data:i,target:k,bottomInset:o.contentInsetEndAdjustment,showScrollToEnd:de.showScrollToEnd,onScrollToEnd:de.returnToEnd})]},"chat"),mode:n.mode,trajectory:u(Od,{section:"trajectory",resetKey:t.threadKey,children:u(H0,{data:i,target:k,inputKey:t.threadKey,paneVisible:t.visible&&n.mode==="trajectory",timestampFormat:r.timestampFormat,onOpenInChat:E})},"trajectory"),visible:t.visible}),u(zM,{data:i,target:k,threadKey:t.threadKey,belowSlot:a.belowSlot,composer:u(Od,{section:"composer",resetKey:t.threadKey,children:u(Sp,{value:U,children:u(dO,{children:u(XQ,{slots:a.slots,children:L})})})}),draftHero:a.draftHero,onOverlayElementChange:a.onOverlayElementChange,questions:u(Od,{section:"composer",resetKey:t.threadKey,children:u(RM,{data:i,target:k})}),queue:u(Od,{section:"queue",resetKey:t.threadKey,children:u(EM,{data:i,target:k,inputKey:t.threadKey,attachments:e.attachments})})})]})}var JQ=".ycodium-conversation-ui";function ZQ(){let e=globalThis,t=(e.__ycodiumConversationScope??0)+1;return e.__ycodiumConversationScope=t,`ycodium-conversation-ui-${t}`}function bO(e,t="conversation"){let n=ZQ(),o=e.replaceAll(JQ,`.${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 e7(e){let t=bO(Sw);return{views:{[_h]:t7(t,e)},viewCapabilities:{[_h]:[Ew,Aw]},slots:[{name:"conversation.input.agent",order:0,component:yN},{name:"conversation.input.model",order:0,component:kD},{name:"conversation.input.plan",order:0,component:LD},{name:"conversation.input.permission",order:0,component:ED}]}}function t7(e,t){return function(o){let a=o[Dh]??t,i={...o};return delete i[Dh],b(kw,{value:a,children:[u(n7,{retain:e.retain}),u(Pw,{value:e.scopeClass,children:u(CO,{...i,scopeClass:e.scopeClass})})]})}}function n7({retain:e}){return Vd(()=>e(),[e]),null}export{e7 as default};